use of main.game.logic.event.Event.STANDARD_EVENT_TYPE in project Eidolons by IDemiurge.
the class ModeEffect method addDispelOnHitTrigger.
private void addDispelOnHitTrigger() {
Effects effects = new Effects(new RemoveBuffEffect(addBuffEffect.getBuffTypeName()));
if (!mode.equals(STD_MODES.ALERT)) {
effects.add(InterruptRule.getEffect());
} else {
effects.add(AlertRule.getInterruptEffect());
}
if (mode.equals(STD_MODES.CHANNELING)) {
effects.add(new EffectImpl() {
@Override
public boolean applyThis() {
ChannelingRule.channelingInterrupted((Unit) getRef().getSourceObj());
return true;
}
});
}
// TODO
STANDARD_EVENT_TYPE event_type = STANDARD_EVENT_TYPE.UNIT_IS_DEALT_TOUGHNESS_DAMAGE;
Condition conditions = (mode.equals(STD_MODES.ALERT)) ? InterruptRule.getConditionsAlert() : InterruptRule.getConditions();
addBuffEffect.addEffect(new DelayedEffect(event_type, effects, conditions));
}
use of main.game.logic.event.Event.STANDARD_EVENT_TYPE in project Eidolons by IDemiurge.
the class BattleStatManager method eventBeingHandled.
@Override
public void eventBeingHandled(Event event) {
if (!(event.getRef().getSourceObj() instanceof Unit))
return;
Unit source = (Unit) event.getRef().getSourceObj();
Unit target = null;
if ((event.getRef().getTargetObj() instanceof Unit))
target = (Unit) event.getRef().getTargetObj();
if (event.getType() instanceof STANDARD_EVENT_TYPE) {
switch((STANDARD_EVENT_TYPE) event.getType()) {
case UNIT_FALLS_UNCONSCIOUS:
modifyUnitStat(COMBAT_STATS.DIED, source, 1);
break;
case UNIT_HAS_BEEN_DEALT_PURE_DAMAGE:
{
unitDealtDamage(source, target, event.getRef().getAmount());
break;
}
case UNIT_HAS_BEEN_KILLED:
{
unitKilled(source, target);
break;
}
}
} else if (AiTrainingRunner.running)
if (event.getRef().getAmount() != null) {
if (event.getType() instanceof EventType) {
modifyUnitModStat(target.isEnemyTo(source.getOwner()), (event.getType()).getArg(), source, event.getRef().getAmount());
}
}
}
use of main.game.logic.event.Event.STANDARD_EVENT_TYPE 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;
}
use of main.game.logic.event.Event.STANDARD_EVENT_TYPE in project Eidolons by IDemiurge.
the class ObjectiveMaster method initObjectiveTrigger.
public static void initObjectiveTrigger(OBJECTIVE_TYPE type, String data, Location mission) {
Dungeon dungeon = mission.getBossLevel();
objectiveData = data;
STANDARD_EVENT_TYPE eventType = null;
Conditions conditions = new Conditions();
Abilities abilities = new Abilities();
abilities.add(new ActiveAbility(new FixedTargeting(), new EndGameEffect(true)));
Ref ref = new Ref();
Integer id = null;
String name;
switch(type) {
case BOSS:
eventType = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_KILLED;
Coordinates c = DC_ObjInitializer.getCoordinatesFromObjString(objectiveData);
// new Coordinates(s);
name = DC_ObjInitializer.getNameFromObjString(objectiveData);
// conditions.add(new ObjComparison(KEY, KEYS.TARGET.toString()));
break;
case CAPTURE_HOLD:
// "As long as
break;
case SURVIVE_TIME:
break;
case ESCAPE:
// eventType = STANDARD_EVENT_TYPE.UNIT_GONE_THRU_ENTRANCE;
break;
case ITEM:
break;
}
// some objectives will be initialized on a condition, e.g. capture-hold
addTrigger(eventType, conditions, abilities);
}
use of main.game.logic.event.Event.STANDARD_EVENT_TYPE in project Eidolons by IDemiurge.
the class ObjectiveMaster method addTrigger.
private static void addTrigger(EVENT_TEMPLATE ET, String eventData, SCRIPT_CONDITION_TEMPLATE CT, String conditionData, ACTION_TEMPLATE AT, String actionData) {
STANDARD_EVENT_TYPE eventType = null;
Conditions conditions = null;
Abilities abilities = null;
addTrigger(eventType, conditions, abilities);
}
Aggregations