use of main.game.logic.event.Event in project Eidolons by IDemiurge.
the class DC_QuickItemObj method activate.
public boolean activate() {
if (!isConstructed() || wrapped) {
construct();
}
if (wrapped) {
activatePassives();
}
if (canBeActivated()) {
setRef(ref.getSourceObj().getRef());
ref.getSourceObj().getRef().setID(KEYS.ITEM, getId());
if (getActive().isForcePresetTarget()) {
if (getActive().getRef().getTargetObj() != null) {
ref.setTarget(getActive().getRef().getTarget());
}
} else {
getActive().setRef(ref);
}
ref.setID(KEYS.ACTIVE, getActive().getId());
getActive().activate();
if (getActive().isCancelled() != null) {
if (getActive().isCancelled()) {
return false;
}
}
// if (!game.isDebugMode())
removeCharge();
getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_HAS_USED_QUICK_ITEM, ref));
} else {
}
return true;
}
use of main.game.logic.event.Event in project Eidolons by IDemiurge.
the class DC_UnitModel method newRound.
@Override
public void newRound() {
if (!new Event(STANDARD_EVENT_TYPE.UNIT_NEW_ROUND_BEING_STARTED, ref).fire()) {
return;
}
// setMode(STD_MODES.NORMAL); just don't.
if (game.getState().getRound() > 0)
getResetter().regenerateToughness();
if (!DC_Engine.isAtbMode())
getResetter().resetActions();
regen();
new Event(STANDARD_EVENT_TYPE.UNIT_NEW_ROUND_STARTED, ref).fire();
}
use of main.game.logic.event.Event in project Eidolons by IDemiurge.
the class DoorMaster method actionActivated.
@Override
protected boolean actionActivated(DOOR_ACTION sub, Unit unit, DungeonObj obj) {
Door door = (Door) obj;
if (sub == DOOR_ACTION.UNLOCK) {
if (!tryPickLock(door))
return true;
}
switch(sub) {
case OPEN:
open(door, unit.getRef().getTargetingRef(obj));
return true;
case CLOSE:
obj.getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.DOOR_CLOSES, unit.getRef().getTargetingRef(obj)));
break;
}
DOOR_STATE state = getState(sub);
door.setState(state);
return true;
}
use of main.game.logic.event.Event in project Eidolons by IDemiurge.
the class DC_HeroItemObj method reduceDurability.
public int reduceDurability(int amount, boolean simulation) {
if (amount <= 0) {
return 0;
}
amount = Math.min(amount, getIntParam(PARAMS.C_DURABILITY));
if (simulation) {
return amount;
}
modifyParameter(PARAMS.C_DURABILITY, -amount, 0);
getRef().setAmount(amount);
getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.DURABILITY_LOST, getRef()));
if (getIntParam(PARAMS.C_DURABILITY) <= 0) {
broken();
} else {
game.getLogManager().log(StringMaster.MESSAGE_PREFIX_INFO + getName() + " loses " + amount + " durability, " + getIntParam(PARAMS.C_DURABILITY) + " left");
}
return amount;
}
Aggregations