Search in sources :

Example 16 with Event

use of main.game.logic.event.Event in project Eidolons by IDemiurge.

the class Costs method pay.

@Override
public boolean pay(Ref ref) {
    setRef(ref);
    boolean result = true;
    for (Cost cost : costs) {
        if (cost != null) {
            result &= cost.pay(this.ref);
        }
    }
    game.fireEvent(new Event(STANDARD_EVENT_TYPE.COSTS_HAVE_BEEN_PAID, ref));
    return result;
}
Also used : Event(main.game.logic.event.Event)

Example 17 with Event

use of main.game.logic.event.Event in project Eidolons by IDemiurge.

the class DataModel method fireParamEvent.

public boolean fireParamEvent(PARAMETER param, String amount, CONSTRUCTED_EVENT_TYPE event_type) {
    if (!isValueEventsOn(param.getName())) {
        return true;
    }
    if (param.isMastery()) {
        // TODO [PERFORMANCE] DEMANDS...
        return true;
    }
    if (ref == null || !getGame().isStarted() || getGame().isSimulation() || this instanceof ObjType) {
        return true;
    }
    Ref REF = Ref.getCopy(ref);
    REF.setAmount(amount);
    REF.setTarget(id);
    return getGame().fireEvent(new Event(event_type, "" + param, REF));
}
Also used : ObjType(main.entity.type.ObjType) Event(main.game.logic.event.Event)

Example 18 with Event

use of main.game.logic.event.Event in project Eidolons by IDemiurge.

the class ChangeFacingEffect method applyThis.

@Override
public boolean applyThis() {
    if (!(ref.getTargetObj() instanceof Unit)) {
        return false;
    }
    Unit obj = (Unit) ref.getTargetObj();
    FACING_DIRECTION oldDirection = obj.getFacing();
    FACING_DIRECTION newDirection = null;
    if (isClockwise() == null) {
        for (FACING_DIRECTION f : FACING_DIRECTION.values()) {
            Obj active = ref.getObj(KEYS.ACTIVE);
            if (active == null) {
                return false;
            }
            if (FacingMaster.getSingleFacing(f, obj, (BfObj) active.getRef().getTargetObj()) == UnitEnums.FACING_SINGLE.IN_FRONT) {
                newDirection = f;
                break;
            }
        }
    } else {
        newDirection = FacingMaster.rotate(oldDirection, isClockwise());
    }
    obj.setFacing(newDirection);
    game.fireEvent(new Event(getEventTypeDone(), ref));
    return true;
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) BfObj(main.entity.obj.BfObj) Obj(main.entity.obj.Obj) BfObj(main.entity.obj.BfObj) Event(main.game.logic.event.Event) Unit(eidolons.entity.obj.unit.Unit)

Example 19 with Event

use of main.game.logic.event.Event in project Eidolons by IDemiurge.

the class WaitEffect method applyThis.

@Override
public boolean applyThis() {
    if (ref.getTargetObj() == ref.getSourceObj()) {
        ref.getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_WAITS, game));
        return true;
    }
    Ref REF = Ref.getCopy(ref);
    REF.setValue(KEYS.TARGET2, ref.getTarget() + "");
    REF.setTarget(ref.getSource());
    boolean result = new AddBuffEffect(getRetainConditions(), getBuffName(), getEffects(REF)).apply(REF);
    if (!result) {
        return false;
    }
    try {
        WaitRule.addWaitingUnit((Unit) ref.getSourceObj(), (Unit) ref.getTargetObj());
    } catch (Exception e) {
        return false;
    }
    return result;
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Ref(main.entity.Ref) Event(main.game.logic.event.Event)

Example 20 with Event

use of main.game.logic.event.Event in project Eidolons by IDemiurge.

the class SummonEffect method applyThis.

@Override
public boolean applyThis() {
    // TODO XP -> LEVEL!
    Ref REF = Ref.getCopy(ref);
    REF.setValue(KEYS.STRING, typeName);
    ObjType type = DataManager.getType(typeName, getTYPE());
    game.fireEvent(new Event(getEventType(), REF));
    Coordinates c = ref.getTargetObj().getCoordinates();
    if (type == null) {
        String str = new Property(typeName, true).getStr(ref);
        type = DataManager.getType(str);
    }
    if (type.getOBJ_TYPE_ENUM() != DC_TYPE.CHARS) {
        type = addXp(type);
    }
    if (owner == null) {
        owner = ref.getSourceObj().getOwner();
    }
    setUnit((BattleFieldObject) game.createUnit(type, c.x, c.y, owner, ref.getCopy()));
    if (unit instanceof Unit) {
        if (!((Unit) unit).isHero()) {
            UnitTrainingMaster.train((Unit) unit);
        }
    }
    getUnit().getRef().setID(KEYS.SUMMONER, ref.getSource());
    REF.setID(KEYS.SUMMONED, getUnit().getId());
    ref.setID(KEYS.SUMMONED, getUnit().getId());
    game.fireEvent(new Event(getEventTypeDone(), REF));
    unit.getRef().setID(KEYS.ACTIVE, ref.getId(KEYS.ACTIVE));
    UpkeepRule.addUpkeep(unit);
    if (unit instanceof Unit) {
        SummoningSicknessRule.apply((Unit) unit);
    }
    if (effects != null) {
        REF.setTarget(getUnit().getId());
        return effects.apply(REF);
    }
    DC_SoundMaster.playEffectSound(SOUNDS.READY, unit);
    return true;
}
Also used : Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) Coordinates(main.game.bf.Coordinates) Event(main.game.logic.event.Event) Unit(eidolons.entity.obj.unit.Unit) Property(main.system.math.Property)

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