Search in sources :

Example 1 with ActionInput

use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.

the class AnimMaster method bindEvents.

public void bindEvents() {
    DC_SoundMaster.bindEvents();
    GuiEventManager.bind(GuiEventType.ADD_FLOATING_TEXT, p -> {
        FloatingText floatingText = (FloatingText) p.get();
        // if (!floatingText.isInitialized())
        floatingText.init();
        addActor(floatingText);
    });
    GuiEventManager.bind(GuiEventType.MOUSE_HOVER, p -> {
        if (!isOn()) {
            return;
        }
        if (!(p.get() instanceof Unit)) {
            return;
        }
        if (showBuffAnimsOnHoverLength == null) {
            return;
        }
        try {
            mouseHover((Unit) p.get());
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    });
    GuiEventManager.bind(GuiEventType.ACTION_INTERRUPTED, p -> {
        if (!isOn()) {
            return;
        }
        leadAnimation.interrupt();
    });
    GuiEventManager.bind(GuiEventType.ACTION_BEING_RESOLVED, p -> {
    // CompositeAnim animation = constructor.getOrCreate((DC_ActiveObj) portrait.get());
    });
    GuiEventManager.bind(GuiEventType.ACTION_RESOLVES, p -> {
        if (!isOn()) {
            return;
        }
        ActionInput input = (ActionInput) p.get();
        try {
            initActionAnimation(input.getAction(), (AnimContext) input.getContext());
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    });
    // GuiEventManager.bind(GuiEventType.UPDATE_BUFFS, p -> {
    // updateContinuousAnims();
    // });
    // GuiEventManager.bind(GuiEventType.ABILITY_RESOLVES, p -> {
    // if (!isOn()) {
    // return;
    // }
    // Ability ability = (Ability) p.get();
    // what about triggers?
    // getParentAnim(ability.getRef().getActive()).addAbilityAnims(ability);
    // });
    GuiEventManager.bind(GuiEventType.INGAME_EVENT_TRIGGERED, p -> {
        if (!isOn()) {
            return;
        }
        try {
            initEventAnimation((Event) p.get());
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    });
    GuiEventManager.bind(GuiEventType.EFFECT_APPLIED, p -> {
        if (!isOn()) {
            return;
        }
        try {
            initEffectAnimation((Effect) p.get());
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    });
}
Also used : FloatingText(eidolons.libgdx.anims.text.FloatingText) ActionInput(eidolons.game.core.ActionInput) Unit(eidolons.entity.obj.unit.Unit)

Example 2 with ActionInput

use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.

the class RadialManager method configureSelectiveTargetedNode.

protected static RadialValueContainer configureSelectiveTargetedNode(DC_ActiveObj active, DC_Obj target) {
    boolean wasValid;
    // if (target == null|| target.equals(active.getOwnerObj())){
    // Set<Obj> objSet = CoreEngine.isActionTargetingFiltersOff() ?
    // DC_Game.game.getUnits().parallelStream().distinct().collect(Collectors.toSet())
    // : getFilter(active).getObjects();
    // wasValid = objSet.size() > 0 &&
    // active.canBeManuallyActivated();
    // } else
    wasValid = active.canBeManuallyActivated();
    final boolean valid = wasValid;
    TextureRegion textureRegion = getOrCreateR(active.getImagePath());
    // valid ? now via Shader!
    // getOrCreateR(active.getImagePath()) :
    // getOrCreateGrayscaleR(active.getImagePath());
    Runnable runnable = () -> {
        if (valid) {
            Context context = new Context(active.getOwnerObj().getRef());
            if (target != null)
                if (!target.equals(active.getOwnerObj())) {
                    context.setTarget(target.getId());
                }
            Eidolons.getGame().getGameLoop().actionInput(new ActionInput(active, context));
        } else {
            FloatingTextMaster.getInstance().createFloatingText(TEXT_CASES.CANNOT_ACTIVATE, "", active);
        }
    };
    return new RadialValueContainer(textureRegion, runnable, valid, active, target);
}
Also used : Context(main.game.logic.action.context.Context) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ActionInput(eidolons.game.core.ActionInput)

Example 3 with ActionInput

use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.

the class Executor method activateOn.

public void activateOn(Ref ref) {
    targeter.setForcePresetTarget(true);
    Eidolons.getGame().getGameLoop().actionInput(new ActionInput(getAction(), new Context(ref)));
}
Also used : Context(main.game.logic.action.context.Context) AnimContext(eidolons.libgdx.anims.AnimContext) ActionInput(eidolons.game.core.ActionInput)

Example 4 with ActionInput

use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.

the class Executor method activateOn.

public void activateOn(DC_Obj t) {
    if (Thread.currentThread() == getGame().getGameLoopThread()) {
        // for triggered activation, e.g. Extra Attacks
        targeter.presetTarget = t;
        activate();
        return;
    }
    Eidolons.getGame().getGameLoop().actionInput(new ActionInput(getAction(), t));
}
Also used : ActionInput(eidolons.game.core.ActionInput)

Example 5 with ActionInput

use of eidolons.game.core.ActionInput 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)

Aggregations

ActionInput (eidolons.game.core.ActionInput)14 Context (main.game.logic.action.context.Context)9 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)2 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 Unit (eidolons.entity.obj.unit.Unit)2 AnimContext (eidolons.libgdx.anims.AnimContext)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)1 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 Action (eidolons.game.battlecraft.ai.elements.actions.Action)1 ActionPath (eidolons.game.battlecraft.ai.tools.path.ActionPath)1 FloatingText (eidolons.libgdx.anims.text.FloatingText)1 GearCluster (eidolons.libgdx.gui.generic.GearCluster)1 Obj (main.entity.obj.Obj)1 Test (org.junit.Test)1