Search in sources :

Example 11 with Context

use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.

the class ExplorationAiMaster method tryMoveAiTurnBased.

private boolean tryMoveAiTurnBased(UnitAI ai, float timePercentage) {
    if (ai.getStandingOrders() == null) {
        try {
            ai.setStandingOrders(getOrders(ai));
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
            return false;
        }
    }
    if (ai.getStandingOrders() == null) {
        return false;
    }
    Double cost = ai.getStandingOrders().getCurrentAction().getActive().getParamDouble(PARAMS.AP_COST) / ai.getUnit().getIntParam(PARAMS.N_OF_ACTIONS);
    if (timePercentage >= cost) {
        ActionInput input = new ActionInput(ai.getStandingOrders().getCurrentAction().getActive(), new Context(ai.getStandingOrders().getCurrentAction().getRef()));
        master.getGame().getGameLoop().actionInput(input);
        return true;
    }
    return false;
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput)

Example 12 with Context

use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.

the class UnitHandler method initChannelingSpellData.

public void initChannelingSpellData(DC_SpellObj spell) {
    Context context = new Context(spell.getOwnerObj().getRef());
    if (ChannelingRule.isPreTargetingNeeded(spell)) {
        spell.getTargeter().initTarget();
        // context.setTarget(target); // group?
        if (spell.getTargetGroup() != null)
            context.setGroup(spell.getTargetGroup());
        else
            context.setTarget(spell.getTargetObj().getId());
    }
    channelingSpellData = new ActionInput(spell, context);
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput)

Example 13 with Context

use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.

the class DefaultActionHandler method turnToMotion.

private static boolean turnToMotion(Unit source, Coordinates coordinates) {
    DC_ActiveObj action = getTurnToAction(source, coordinates);
    Context context = new Context(source, null);
    return activate(context, action);
}
Also used : Context(main.game.logic.action.context.Context)

Example 14 with Context

use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.

the class DefaultActionHandler method leftClickUnit.

public static boolean leftClickUnit(boolean shift, boolean control, BattleFieldObject target) {
    if (shift) {
        return leftClickCell(true, false, target.getX(), target.getY());
    }
    if (control) {
        return leftClickCell(false, true, target.getX(), target.getY());
    }
    if (!OptionsMaster.getGameplayOptions().getBooleanValue(GAMEPLAY_OPTION.DEFAULT_ACTIONS))
        return false;
    Unit source = Eidolons.getGame().getManager().getActiveObj();
    if (source.getGame().isDebugMode()) {
        return doDebugStuff(source, target);
    }
    if (target.isMine())
        return false;
    DC_ActiveObj action = null;
    if (target instanceof DungeonObj)
        action = getDungeonObjAction(source, (DungeonObj) target);
    else
        action = getPreferredAttackAction(source, target);
    if (action == null)
        return false;
    Context context = new Context(source, target);
    return activate(context, action);
}
Also used : Context(main.game.logic.action.context.Context) DungeonObj(eidolons.game.module.dungeoncrawl.objects.DungeonObj) Unit(eidolons.entity.obj.unit.Unit)

Aggregations

Context (main.game.logic.action.context.Context)14 ActionInput (eidolons.game.core.ActionInput)9 Unit (eidolons.entity.obj.unit.Unit)4 DC_UnitAction (eidolons.entity.active.DC_UnitAction)3 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)2 Action (eidolons.game.battlecraft.ai.elements.actions.Action)2 DungeonObj (eidolons.game.module.dungeoncrawl.objects.DungeonObj)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 DC_QuickItemAction (eidolons.entity.active.DC_QuickItemAction)1 DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 AiQuickItemAction (eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction)1 ActionPath (eidolons.game.battlecraft.ai.tools.path.ActionPath)1 AnimContext (eidolons.libgdx.anims.AnimContext)1 GearCluster (eidolons.libgdx.gui.generic.GearCluster)1 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)1 Obj (main.entity.obj.Obj)1 Coordinates (main.game.bf.Coordinates)1