use of main.game.logic.event.Event in project Eidolons by IDemiurge.
the class BattleFieldObject method kill.
@Override
public boolean kill(Entity killer, boolean leaveCorpse, Boolean quietly) {
if (isDead()) {
return false;
}
boolean ignoreInterrupt = false;
if (quietly == null) {
ignoreInterrupt = true;
quietly = false;
}
if ((game.isDebugMode() && isMine()) || (!ignoreInterrupt && !quietly)) {
if ((game.isDebugMode() && isMine()) || checkPassive(UnitEnums.STANDARD_PASSIVES.INDESTRUCTIBLE)) {
preventDeath();
return false;
}
}
ref.setID(KEYS.KILLER, killer.getId());
Ref REF = Ref.getCopy(killer.getRef());
REF.setTarget(id);
REF.setSource(killer.getId());
if (!quietly) {
if (!getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_IS_BEING_KILLED, REF))) {
if (!ignoreInterrupt) {
return false;
}
}
((BattleFieldObject) killer).applySpecialEffects(SPECIAL_EFFECTS_CASE.ON_KILL, this, REF);
applySpecialEffects(SPECIAL_EFFECTS_CASE.ON_DEATH, ((BattleFieldObject) killer), REF);
if (!ignoreInterrupt) {
if (ref.checkInterrupted()) {
return false;
}
}
}
getGame().getManager().unitDies(this, (Obj) killer, leaveCorpse, quietly);
return true;
}
use of main.game.logic.event.Event in project Eidolons by IDemiurge.
the class ModifyCounterEffect method applyThis.
@Override
public boolean applyThis() {
Ref REF = Ref.getCopy(ref);
Integer amount = formula.getInt(ref);
// MODIFY_BY_CONST Counter: {ACTIVE_PARAMS.BLEEDING_MOD}/100*(20-({TARGET_C_TOUGHNESS}*100/{TARGET_TOUGHNESS})*10/100)
if (getResistanceMod() != null) {
amount = MathMaster.applyMod(amount, getResistanceMod());
}
int mod = 0;
if (ref.getTargetObj() instanceof DC_HeroItemObj) {
try {
mod = ref.getSourceObj().getIntParam(DC_ContentManager.getCoatingAppliedModParam(CounterMaster.findCounterConst(counterName)));
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
Integer modValue = MathMaster.addFactor(amount, mod);
REF.setAmount(modValue);
REF.setValue(KEYS.STRING, counterName);
new Event(STANDARD_EVENT_TYPE.COUNTER_BEING_MODIFIED, REF).fire();
boolean result = false;
switch(modtype) {
case MODIFY_BY_CONST:
result = ref.getTargetObj().modifyCounter(counterName, modValue);
break;
case MODIFY_BY_PERCENT:
result = ref.getTargetObj().modifyCounter(counterName, modValue);
break;
case SET:
result = ref.getTargetObj().setCounter(counterName, modValue);
break;
default:
break;
}
if (CoreEngine.isPhaseAnimsOn())
if (result) {
try {
getAnimation().addPhaseArgs(PHASE_TYPE.COUNTER, counterName, modtype, modValue);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
} else {
return false;
}
REF.setAmount(ref.getTargetObj().getCounter(counterName));
return new Event(STANDARD_EVENT_TYPE.COUNTER_MODIFIED, REF).fire();
}
use of main.game.logic.event.Event in project Eidolons by IDemiurge.
the class DialogueHandler method lineSpoken.
public void lineSpoken(DialogScenario actorObject) {
Ref ref = new Ref(game);
ref.setAmount(map.get(actorObject).getId());
game.fireEvent(new Event(STANDARD_EVENT_TYPE.DIALOGUE_LINE_SPOKEN, ref));
}
use of main.game.logic.event.Event in project Eidolons by IDemiurge.
the class DialogueHandler method dialogueDone.
public void dialogueDone() {
Ref ref = new Ref(game);
ref.setValue(KEYS.STRING, dialogue.getName());
game.fireEvent(new Event(STANDARD_EVENT_TYPE.DIALOGUE_FINISHED, ref));
}
use of main.game.logic.event.Event in project Eidolons by IDemiurge.
the class DataModel method firePropEvent.
protected boolean firePropEvent(CONSTRUCTED_EVENT_TYPE EVENT_TYPE, String val) {
if (!isValueEventsOn(val)) {
return true;
}
Ref REF = Ref.getCopy(ref);
REF.setTarget(id);
return getGame().fireEvent(new Event(EVENT_TYPE, "" + val, REF));
}
Aggregations