Search in sources :

Example 6 with AutoTargeting

use of main.elements.targeting.AutoTargeting in project Eidolons by IDemiurge.

the class ZoneEffect method initTargeting.

public void initTargeting() {
    Conditions conditions = new Conditions();
    int spell_radius = radius.getInt(ref);
    // if (spell_radius == 0) {
    // spell_radius = ref.getObj(KEYS.ACTIVE.name()).getIntParam(G_PARAMS.RADIUS);
    // }
    NumericCondition condition = ConditionMaster.getDistanceFilterCondition(KEYS.TARGET.name(), spell_radius);
    conditions.add(condition);
    if (// just on same cell
    spell_radius == 0)
        condition.setStrict(false);
    // TODO really???
    conditions.add(ConditionMaster.getNotDeadCondition());
    if (notSelf) {
        conditions.add(new NotCondition(ConditionMaster.getSelfFilterCondition()));
    }
    if (// TODO target filtering - targeting
    allyOrEnemyOnly != null) // modifiers?
    {
        conditions.add(allyOrEnemyOnly ? ConditionMaster.getAllyCondition() : ConditionMaster.getEnemyCondition());
    }
    // legacy?
    // if (allyOrEnemyOnly==null)
    // conditions.add(ConditionMaster.getEnemyCondition());
    // else if (!allyOrEnemyOnly) {
    // conditions.add(allyOrEnemyOnly? ConditionMaster.getAllyCondition() :
    // ConditionMaster.getEnemyCondition());
    // }
    // if (effects.getSpell() != null)
    // if (effects.getSpell().checkBool(STD_BOOLS.APPLY_THRU))
    this.targeting = new AutoTargeting(conditions, C_OBJ_TYPE.BF);
    if (targeting == null) {
        this.targeting = new AutoTargeting(conditions, C_OBJ_TYPE.BF_OBJ);
    }
    setFilteringConditions(conditions);
}
Also used : AutoTargeting(main.elements.targeting.AutoTargeting) NotCondition(main.elements.conditions.NotCondition) NumericCondition(main.elements.conditions.NumericCondition) Conditions(main.elements.conditions.Conditions)

Example 7 with AutoTargeting

use of main.elements.targeting.AutoTargeting in project Eidolons by IDemiurge.

the class HeroObjectModifyingEffect method getObjectsToModify.

protected List<Obj> getObjectsToModify() {
    if (objName != null) {
        return getObjectsByName(objName);
    } else {
        // TODO simple condition format - prop,
        Ref REF = ref.getCopy();
        // value"
        initFilterConditions();
        Unit hero = (Unit) ref.getSourceObj();
        if (type != null) {
            List<Integer> list;
            try {
                list = getIdList(hero);
            } catch (Exception e) {
                LogMaster.log(1, "Group obj effect failed to getOrCreate targets: " + this);
                return new ArrayList<>();
            }
            List<Obj> objList = new ArrayList<>();
            for (Integer id : list) {
                objList.add(game.getObjectById(id));
            }
            return objList;
        }
        new AutoTargeting(conditions).select(REF);
        return REF.getGroup().getObjects();
    }
}
Also used : AutoTargeting(main.elements.targeting.AutoTargeting) Ref(main.entity.Ref) Obj(main.entity.obj.Obj) ArrayList(java.util.ArrayList) Unit(eidolons.entity.obj.unit.Unit)

Example 8 with AutoTargeting

use of main.elements.targeting.AutoTargeting in project Eidolons by IDemiurge.

the class AuraEffect method applyThis.

/*
     *
     * so what really happens?
     *
     * maybe it's OK if it's not Spirit?
     *
     * There aren't really non-ValueMod effect variants, are there?
     * "Damage Aura"? Property Aura, e.g. demonic! :)
     */
public boolean applyThis() {
    if (!on) {
        return true;
    }
    if (game.isSimulation()) {
        return false;
    }
    if (continuous) {
        AutoTargeting targeting = new AutoTargeting(new DistanceCondition(radius.toString()));
        targeting.getConditions().add(ConditionMaster.getAliveCondition(KEYS.MATCH));
        if (onlyEnemiesOrAllies != null) {
            if (onlyEnemiesOrAllies) {
                targeting.getConditions().add(ConditionMaster.getEnemyCondition());
            } else {
                targeting.getConditions().add(ConditionMaster.getAllyCondition());
            }
        }
        // remove aura-bearer from targets list
        targeting.getConditions().add(new NotCondition(new RefCondition(KEYS.MATCH, KEYS.SOURCE)));
        AddBuffEffect buffEffect = new AddBuffEffect(getBuffType(), effect, true);
        Effects auraEffects = new Effects(new ConditionalEffect(ConditionMaster.getAliveCondition(KEYS.SOURCE), new CustomTargetEffect(targeting, buffEffect)));
        auraEffect = new AddBuffEffect(auraEffects);
        // auraEffect.setTransient(false);
        boolean results = auraEffect.apply(ref);
        if (results) {
            if (!notSelf) {
                Effect copy = effect.getCopy();
                copy.apply(Ref.getSelfTargetingRefCopy(ref.getSourceObj()));
            }
        }
        return results;
    }
    // preCheck?
    if (!initialized) {
        init();
    }
    return trigger.apply(ref);
}
Also used : ConditionalEffect(main.ability.effects.container.ConditionalEffect) AutoTargeting(main.elements.targeting.AutoTargeting) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) ZoneEffect(eidolons.ability.effects.containers.customtarget.ZoneEffect) AttachmentEffect(main.ability.effects.AttachmentEffect) ConditionalEffect(main.ability.effects.container.ConditionalEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Effect(main.ability.effects.Effect) MicroEffect(main.ability.effects.MicroEffect) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) Effects(main.ability.effects.Effects)

Example 9 with AutoTargeting

use of main.elements.targeting.AutoTargeting in project Eidolons by IDemiurge.

the class DualAttackMaster method createDual.

private static DC_UnitAction createDual(DC_UnitAction main, DC_UnitAction offhand) {
    Costs costs = getDualCosts(main, offhand);
    // cooldown!
    ActiveAbility activateAttacks = new ActiveAbility(main.getTargeting(), new Effects(new ActivateEffect(main.getName(), true), new ActivateEffect(offhand.getName(), true)));
    Ability setCooldown = new ActiveAbility(new AutoTargeting(new PropCondition(G_PROPS.ACTION_TAGS, "Dual", false)), new ModifyValueEffect(PARAMS.C_COOLDOWN, MOD.SET, getCooldown(main.getOwnerObj())));
    Abilities abilities = new Abilities();
    abilities.add(activateAttacks);
    abilities.add(setCooldown);
    ObjType newType = new ObjType("Dual: " + main.getName() + " and " + offhand.getName(), DataManager.getType("Dual Attack", DC_TYPE.ACTIONS));
    for (Cost cost : costs.getCosts()) {
        PARAMETER p = cost.getCostParam();
        if (p == null)
            continue;
        newType.setParam(p, cost.getPayment().getAmountFormula().toString());
    }
    DC_UnitAction dual = new DC_UnitAction(newType, main.getOwner(), main.getGame(), new Ref(main.getOwnerObj()));
    dual.setAbilities(abilities);
    dual.setCosts(costs);
    dual.setTargeting(main.getTargeting());
    dual.getTargeter().setTargetingInitialized(true);
    dual.setConstructed(true);
    return dual;
}
Also used : ActiveAbility(main.ability.ActiveAbility) ActiveAbility(main.ability.ActiveAbility) Ability(main.ability.Ability) AutoTargeting(main.elements.targeting.AutoTargeting) Costs(main.elements.costs.Costs) Abilities(main.ability.Abilities) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects) PropCondition(main.elements.conditions.PropCondition) Cost(main.elements.costs.Cost) DC_UnitAction(eidolons.entity.active.DC_UnitAction) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) ActivateEffect(eidolons.ability.effects.oneshot.activation.ActivateEffect) PARAMETER(main.content.values.parameters.PARAMETER)

Aggregations

AutoTargeting (main.elements.targeting.AutoTargeting)9 Conditions (main.elements.conditions.Conditions)4 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)3 Effects (main.ability.effects.Effects)3 Ref (main.entity.Ref)3 Ability (main.ability.Ability)2 ActiveAbility (main.ability.ActiveAbility)2 CustomTargetEffect (main.ability.effects.continuous.CustomTargetEffect)2 GroupImpl (main.entity.group.GroupImpl)2 Obj (main.entity.obj.Obj)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 ZoneEffect (eidolons.ability.effects.containers.customtarget.ZoneEffect)1 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)1 ActivateEffect (eidolons.ability.effects.oneshot.activation.ActivateEffect)1 AlteringEffect (eidolons.ability.effects.oneshot.misc.AlteringEffect)1 DC_UnitAction (eidolons.entity.active.DC_UnitAction)1 Unit (eidolons.entity.obj.unit.Unit)1 ArrayList (java.util.ArrayList)1 Abilities (main.ability.Abilities)1