Search in sources :

Example 41 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class Executor method activate.

public boolean activate() {
    reset();
    syncActionRefWithSource();
    getTargeter().initTarget();
    if ((isCancelled()) != null) {
        cancelled();
        return false;
    }
    if (isInterrupted()) {
        return interrupted();
    }
    Obj target = getAction().getTargetObj();
    AnimContext animContext = new AnimContext(getAction());
    animContext.setTarget(target);
    boolean gameLog = getAction().getLogger().isActivationLogged();
    String targets = " ";
    if (getAction().getLogger().isTargetLogged())
        if (target != null) {
            if (game.isDebugMode())
                targets = getAction().getTargetObj().getNameAndCoordinate();
            else
                targets = getAction().getTargetObj().getNameIfKnown();
        } else if (getAction().getTargetGroup() != null) {
            targets = getAction().getTargetGroup().toString();
        }
    log(getAction().getOwnerObj().getNameAndCoordinate() + " activates " + getAction().getName() + " " + targets, false);
    if (gameLog)
        log(getAction().getOwnerObj().getNameIfKnown() + " activates " + getAction().getNameIfKnown() + " " + targets, true);
    beingActivated();
    if (isInterrupted()) {
        return interrupted();
    }
    initActivation();
    if (isInterrupted()) {
        return interrupted();
    }
    resolve();
    if (!BooleanMaster.isTrue(cancelled)) {
        payCosts();
    }
    if (AnimMaster.isOn())
        if (!AnimMaster.getInstance().getConstructor().isReconstruct())
            AnimMaster.getInstance().getConstructor().preconstruct(getAction());
    GuiEventManager.trigger(GuiEventType.ACTION_RESOLVES, new ActionInput(getAction(), animContext));
    actionComplete();
    return isResult();
}
Also used : ActionInput(eidolons.game.core.ActionInput) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) AnimContext(eidolons.libgdx.anims.AnimContext)

Example 42 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class DefaultActionHandler method leftClickCell.

public static boolean leftClickCell(boolean turn, boolean moveTo, int gridX, int gridY) {
    Unit source = null;
    try {
        source = Eidolons.getGame().getManager().getActiveObj();
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    if (source == null)
        return false;
    if (source.isAiControlled())
        return false;
    Coordinates c = new Coordinates(gridX, gridY);
    if (turn) {
        return turnToMotion(source, c);
    }
    if (moveTo) {
        return moveToMotion(source, c);
    }
    if (source.getGame().isDebugMode()) {
        return doDebugStuffCell(source, c);
    }
    if (c.x - source.getX() > 1) {
        return false;
    }
    if (c.y - source.getY() > 1) {
        return false;
    }
    DC_UnitAction action = getMoveToCellAction(source, c);
    if (action == null) {
        return false;
    }
    Obj target = action.getTargeting() instanceof SelectiveTargeting ? Eidolons.getGame().getCellByCoordinate(c) : null;
    Context context = new Context(source, target);
    return activate(context, action);
}
Also used : SelectiveTargeting(main.elements.targeting.SelectiveTargeting) Context(main.game.logic.action.context.Context) DungeonObj(eidolons.game.module.dungeoncrawl.objects.DungeonObj) DC_Obj(eidolons.entity.obj.DC_Obj) Obj(main.entity.obj.Obj) Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit)

Example 43 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class MiniObjComp method clicked.

public void clicked(Point point) {
    if (getObjects().size() < 2) {
        obj.getGame().getManager().objClicked(obj);
        return;
    }
    if (point.x < getWidth() / 3) {
        if (point.y < getHeight() / 3) {
            // CYCLE THRU OBJs
            Obj choice = DialogMaster.objChoice("Which object?", getObjects().toArray(new Obj[getObjects().size()]));
            if (choice != null) {
                obj = (DC_Obj) choice;
                obj.getGame().getManager().objClicked(obj);
            }
            return;
        }
    }
    obj.getGame().getManager().objClicked(obj);
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Obj(main.entity.obj.Obj)

Example 44 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class PatrolMaster method getBlockingUnit.

private static Unit getBlockingUnit(Patrol patrol, UnitAI ai) {
    Unit unit = ai.getUnit();
    DIRECTION direction = DirectionMaster.getRelativeDirection(unit.getCoordinates(), patrol.getDestination());
    // paths.getOrCreate(unit);
    Coordinates coordinates = unit.getCoordinates().getAdjacentCoordinate(direction);
    // TODO more than 1 coordinate?
    // unit.getGame().getUnitByCoordinate(coordinates);
    Unit unitByCoordinate = null;
    // preCheck leader?
    Collection<Unit> units = unit.getGame().getUnitsForCoordinates(coordinates);
    for (Obj u : units) {
        // sort?
        Unit blocker = (Unit) u;
        // if (u == leader)
        if (!blocker.isOwnedBy(ai.getUnit().getOwner())) {
            continue;
        }
        if (!blocker.canMove()) {
            continue;
        }
        unitByCoordinate = blocker;
    }
    return unitByCoordinate;
}
Also used : Obj(main.entity.obj.Obj) DIRECTION(main.game.bf.Coordinates.DIRECTION) Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit)

Example 45 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class OwnershipChangeEffect method applyThis.

@Override
public boolean applyThis() {
    if (!new Event(STANDARD_EVENT_TYPE.UNIT_OWNERSHIP_CHANGED, ref).fire()) {
        return false;
    }
    // + trigger rule flip image when ownership changes ;)
    Obj obj = ref.getTargetObj();
    Player newOwner = obj.getOriginalOwner();
    if (!neutral) {
        newOwner = // ref.getSourceObj().getOwner();
        ((MicroGame) ref.getGame()).getPlayer(!obj.getOwner().isMe());
    }
    obj.setOwner(newOwner);
    if (permanent) {
        obj.setOriginalOwner(newOwner);
    // obj.addProperty(G_PROPS.STATUS, STATUS.CHARMED.name());
    }
    if (berserker) {
    }
    LogMaster.log(LogMaster.CORE_DEBUG_1, ref.getTargetObj().getName() + "'s new owner: " + obj.getOwner());
    return true;
}
Also used : Player(main.game.logic.battle.player.Player) Obj(main.entity.obj.Obj) Event(main.game.logic.event.Event)

Aggregations

Obj (main.entity.obj.Obj)127 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)34 DC_Obj (eidolons.entity.obj.DC_Obj)30 Coordinates (main.game.bf.Coordinates)27 Unit (eidolons.entity.obj.unit.Unit)24 ArrayList (java.util.ArrayList)19 Ref (main.entity.Ref)15 DC_SpellObj (eidolons.entity.active.DC_SpellObj)14 BuffObj (main.entity.obj.BuffObj)13 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)12 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)11 ActiveObj (main.entity.obj.ActiveObj)10 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)9 PassiveAbilityObj (main.ability.PassiveAbilityObj)9 ObjType (main.entity.type.ObjType)8 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)7 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)7 PARAMETER (main.content.values.parameters.PARAMETER)7 Conditions (main.elements.conditions.Conditions)6 MicroObj (main.entity.obj.MicroObj)6