use of eidolons.ability.effects.oneshot.misc.AlteringEffect 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;
}
Aggregations