Search in sources :

Example 1 with CustomTargetEffect

use of main.ability.effects.continuous.CustomTargetEffect in project Eidolons by IDemiurge.

the class BindingDamageEffect method applyThis.

@Override
public boolean applyThis() {
    // Can be initialized() just once
    GroupImpl group = ref.getGroup();
    Effects effects = new Effects();
    STANDARD_EVENT_TYPE event_type;
    if (shareOrRedirect) {
        // TODO splitMode!
        event_type = STANDARD_EVENT_TYPE.UNIT_IS_DEALT_TOUGHNESS_DAMAGE;
        if (spellDmgOnly != null) {
            if (spellDmgOnly) {
                event_type = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_DEALT_SPELL_DAMAGE;
            }
        }
        if (physicalDmgOnly != null) {
            if (physicalDmgOnly) {
                event_type = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_DEALT_PHYSICAL_DAMAGE;
            }
        }
    } else {
        effects.add(new AlteringEffect(false, formula.getNegative().toString()));
        event_type = Event.STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_DAMAGE;
        if (spellDmgOnly != null) {
            if (spellDmgOnly) {
                event_type = STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_SPELL_DAMAGE;
            }
        }
        if (physicalDmgOnly != null) {
            if (physicalDmgOnly) {
                event_type = STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_PHYSICAL_DAMAGE;
            }
        }
    }
    Targeting targeting_other_units = new AutoTargeting(new Conditions(new GroupCondition(Ref.KEYS.MATCH.name(), group), // negative
    new RefCondition(KEYS.EVENT_TARGET, KEYS.MATCH, true)));
    effects.add(new CustomTargetEffect(targeting_other_units, new DealDamageEffect(getDamageFormula(), GenericEnums.DAMAGE_TYPE.PURE)));
    /*
         * ensure there is no deadlock
		 */
    conditions = new Conditions();
    conditions.add(new NonTriggeredEventCondition());
    KEYS OBJ_REF = Ref.KEYS.EVENT_TARGET;
    conditions.add(new GroupCondition(OBJ_REF, group));
    // has the group...
    Ref REF = Ref.getCopy(ref);
    // REF.setTarget(null); // ???
    new AddTriggerEffect(event_type, conditions, OBJ_REF, effects).apply(REF);
    return true;
}
Also used : AutoTargeting(main.elements.targeting.AutoTargeting) Targeting(main.elements.targeting.Targeting) AutoTargeting(main.elements.targeting.AutoTargeting) NonTriggeredEventCondition(main.elements.conditions.standard.NonTriggeredEventCondition) STANDARD_EVENT_TYPE(main.game.logic.event.Event.STANDARD_EVENT_TYPE) RefCondition(main.elements.conditions.RefCondition) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) DealDamageEffect(eidolons.ability.effects.oneshot.DealDamageEffect) Effects(main.ability.effects.Effects) Conditions(main.elements.conditions.Conditions) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect) Ref(main.entity.Ref) GroupImpl(main.entity.group.GroupImpl) KEYS(main.entity.Ref.KEYS) AlteringEffect(eidolons.ability.effects.oneshot.misc.AlteringEffect) GroupCondition(main.elements.conditions.standard.GroupCondition)

Example 2 with CustomTargetEffect

use of main.ability.effects.continuous.CustomTargetEffect 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 3 with CustomTargetEffect

use of main.ability.effects.continuous.CustomTargetEffect in project Eidolons by IDemiurge.

the class BindingSpellEffect method applyThis.

@Override
public boolean applyThis() {
    // TODO Auto-generated method stub
    Effects effects = null;
    if (!shareOrRedirect) {
        effects = new Effects(new CustomTargetEffect(new FixedTargeting(KEYS.TARGET2), new DuplicateEffect(true)), new CustomTargetEffect(new FixedTargeting(KEYS.TARGET), new InterruptEffect()));
    }
    Effect EFFECT = new DuplicateSpellEffect(KEYS.TARGET.name(), false, true);
    EFFECT.setTargetGroup(ref.getGroup());
    effects = new Effects(EFFECT);
    Event.STANDARD_EVENT_TYPE event_type = Event.STANDARD_EVENT_TYPE.SPELL_RESOLVED;
    conditions.add(ConditionMaster.getPropCondition("EVENT_SPELL", G_PROPS.SPELL_TAGS, SpellEnums.SPELL_TAGS.MIND_AFFECTING.name()));
    return false;
}
Also used : InterruptEffect(main.ability.effects.triggered.InterruptEffect) FixedTargeting(main.elements.targeting.FixedTargeting) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) DuplicateEffect(eidolons.ability.effects.continuous.triggered.DuplicateEffect) DuplicateSpellEffect(eidolons.ability.effects.continuous.triggered.DuplicateSpellEffect) Event(main.game.logic.event.Event) DC_Effect(eidolons.ability.effects.DC_Effect) DuplicateSpellEffect(eidolons.ability.effects.continuous.triggered.DuplicateSpellEffect) DuplicateEffect(eidolons.ability.effects.continuous.triggered.DuplicateEffect) Effect(main.ability.effects.Effect) InterruptEffect(main.ability.effects.triggered.InterruptEffect) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) Effects(main.ability.effects.Effects)

Example 4 with CustomTargetEffect

use of main.ability.effects.continuous.CustomTargetEffect in project Eidolons by IDemiurge.

the class DC_CounterRule method check.

public boolean check(Unit unit) {
    if (!checkApplies(unit)) {
        return false;
    }
    this.unit = unit;
    if (getNumberOfCounters(unit) <= 0) {
        if (!isAppliedAlways()) {
            // if (checkAlreadyApplied(unit)) TODO that's bullshit!
            // log(getLiftedLogString());
            // removeBuff(unit); // may not be needed now
            removeEffects(unit);
            return false;
        }
    }
    if (ImmunityRule.checkImmune(unit, getCounterName())) {
        return false;
    }
    // if (!checkAlreadyApplied(unit))
    // log(getAppliedLogString());
    Ref ref = unit.getRef().getCopy();
    ref.setTarget(unit.getId());
    initEffects();
    addBuff(unit);
    if (getSpread() != null) {
        new CustomTargetEffect(new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ADJACENT), new ModifyCounterEffect(getCounterName(), MOD.MODIFY_BY_CONST, getSpread())).apply(Ref.getSelfTargetingRefCopy(unit));
    }
    // it only once!
    return true;
// effects.apply(ref);
}
Also used : Ref(main.entity.Ref) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting)

Aggregations

CustomTargetEffect (main.ability.effects.continuous.CustomTargetEffect)4 Effects (main.ability.effects.Effects)3 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)2 Effect (main.ability.effects.Effect)2 AutoTargeting (main.elements.targeting.AutoTargeting)2 Ref (main.entity.Ref)2 DC_Effect (eidolons.ability.effects.DC_Effect)1 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ZoneEffect (eidolons.ability.effects.containers.customtarget.ZoneEffect)1 DuplicateEffect (eidolons.ability.effects.continuous.triggered.DuplicateEffect)1 DuplicateSpellEffect (eidolons.ability.effects.continuous.triggered.DuplicateSpellEffect)1 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)1 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)1 AlteringEffect (eidolons.ability.effects.oneshot.misc.AlteringEffect)1 TemplateAutoTargeting (eidolons.ability.targeting.TemplateAutoTargeting)1 AttachmentEffect (main.ability.effects.AttachmentEffect)1 MicroEffect (main.ability.effects.MicroEffect)1 ConditionalEffect (main.ability.effects.container.ConditionalEffect)1 InterruptEffect (main.ability.effects.triggered.InterruptEffect)1 Conditions (main.elements.conditions.Conditions)1