Search in sources :

Example 1 with Event

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;
}
Also used : Ref(main.entity.Ref) Event(main.game.logic.event.Event)

Example 2 with Event

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();
}
Also used : Ref(main.entity.Ref) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) Event(main.game.logic.event.Event)

Example 3 with Event

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));
}
Also used : Ref(main.entity.Ref) Event(main.game.logic.event.Event)

Example 4 with Event

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));
}
Also used : Ref(main.entity.Ref) Event(main.game.logic.event.Event)

Example 5 with Event

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));
}
Also used : Event(main.game.logic.event.Event)

Aggregations

Event (main.game.logic.event.Event)34 Ref (main.entity.Ref)17 Unit (eidolons.entity.obj.unit.Unit)10 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)6 Coordinates (main.game.bf.Coordinates)4 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)3 Gdx (com.badlogic.gdx.Gdx)2 Keys (com.badlogic.gdx.Input.Keys)2 Batch (com.badlogic.gdx.graphics.g2d.Batch)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)2 Vector2 (com.badlogic.gdx.math.Vector2)2 Group (com.badlogic.gdx.scenes.scene2d.Group)2 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)2 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)2 Align (com.badlogic.gdx.utils.Align)2 DC_Obj (eidolons.entity.obj.DC_Obj)2 DC_Engine (eidolons.game.battlecraft.DC_Engine)2 LastSeenMaster (eidolons.game.battlecraft.logic.battlefield.vision.LastSeenMaster)2 OutlineMaster (eidolons.game.battlecraft.logic.battlefield.vision.OutlineMaster)2