Search in sources :

Example 31 with Event

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

Example 32 with Event

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

Example 33 with Event

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

Example 34 with Event

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;
}
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