Search in sources :

Example 31 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class DC_MovementManager method getMoves.

public static List<DC_ActiveObj> getMoves(Unit unit) {
    List<DC_ActiveObj> moveActions = new ArrayList<>();
    DequeImpl<DC_UnitAction> actions = unit.getActionMap().get(ActionEnums.ACTION_TYPE.SPECIAL_MOVE);
    if (actions != null) {
        moveActions = new ArrayList<>(Arrays.asList(actions.toArray(new DC_ActiveObj[actions.size()])));
    }
    if (moveActions.isEmpty()) {
        moveActions.addAll(unit.getActionMap().get(ActionEnums.ACTION_TYPE.ADDITIONAL_MOVE));
    } else {
        for (DC_UnitAction a : unit.getActionMap().get(ActionEnums.ACTION_TYPE.ADDITIONAL_MOVE)) {
            String name = a.getName();
            switch(// have a switch to turn off all default moves!
            name) {
                case "Clumsy Leap":
                    if (!DataManager.toStringList(moveActions).contains("Leap")) {
                        moveActions.add(a);
                    }
                    continue;
                case "Move Right":
                case "Move Left":
                    if (!DataManager.toStringList(moveActions).contains("Sidestep Right")) {
                        moveActions.add(a);
                    }
                    continue;
            }
            moveActions.add(a);
        }
    }
    moveActions.addAll(AiUnitActionMaster.getSpells(AiEnums.AI_LOGIC.MOVE, unit));
    moveActions = DC_ActionManager.filterActionsByCanBePaid(moveActions);
    return moveActions;
}
Also used : DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Example 32 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class TargetingMaster method selectTargetForAction.

public static Integer selectTargetForAction(DC_ActiveObj a) {
    /*
         * getOrCreate possible targets init goal type prioritize
		 */
    GOAL_TYPE type = GoalManager.getGoalFromAction(a);
    Obj target = null;
    int max_priority = Integer.MIN_VALUE;
    Set<Obj> objects = null;
    a.getTargeting().getFilter().setRef(a.getRef());
    try {
        objects = a.getTargeting().getFilter().getObjects();
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    for (Obj obj : objects) {
        ActionSequence sequence = new ActionSequence(type, new Action(a, obj));
        sequence.setAi(a.getOwnerObj().getUnitAI());
        sequence.setType(type);
        int priority = DC_PriorityManager.getPriority(sequence);
        if (priority > max_priority) {
            target = obj;
            max_priority = priority;
        }
    }
    if (target == null) {
        return null;
    }
    return target.getId();
}
Also used : Action(eidolons.game.battlecraft.ai.elements.actions.Action) ActionSequence(eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence) ActiveObj(main.entity.obj.ActiveObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) GOAL_TYPE(main.content.enums.system.AiEnums.GOAL_TYPE)

Example 33 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class DC_GameManager method select.

@Override
public Integer select(Set<Obj> selectingSet, Ref ref) {
    Pair<Set<Obj>, TargetRunnable> p = new ImmutablePair<>(selectingSet, (t) -> {
        if (ref.getActive() instanceof DC_ActiveObj) {
            // TODO CLICK ON ANY OTHER OBJ MUST RESULT IN SELECTION STOP!
            // ((DC_ActiveObj) ref.getActive()).activateOn(t);
            // WaitMaster.receiveInput(WAIT_OPERATIONS.SELECT_BF_OBJ, t.getId());
            t.invokeClicked();
        }
    });
    GuiEventManager.trigger(SELECT_MULTI_OBJECTS, p);
    for (Obj obj : new ArrayList<>(selectingSet)) {
        if (obj instanceof DC_Obj) {
            DC_Obj unit = (DC_Obj) obj;
            if (getActiveObj() != null) {
                if (getActiveObj().getZ() != unit.getZ()) {
                    selectingSet.remove(unit);
                }
            }
        }
    }
    this.selectingSet = selectingSet;
    if (selectingSet.isEmpty()) {
        // getGame().getToolTipMaster().addTooltip(SCREEN_POSITION.ACTIVE_UNIT_BOTTOM,
        // "No targets available!");
        DC_SoundMaster.playStandardSound(STD_SOUNDS.ACTION_CANCELLED);
        return null;
    }
    setSelecting(true);
    for (Obj obj : selectingSet) {
        DrawMasterStatic.getObjImageCache().remove(obj);
    }
    Integer id = selectAwait();
    if (id == null) {
        if (ref.getTarget() != null) {
            return ref.getTarget();
        }
    }
    return id;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Set(java.util.Set) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) MicroObj(main.entity.obj.MicroObj) ActiveObj(main.entity.obj.ActiveObj) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) PassiveAbilityObj(main.ability.PassiveAbilityObj) ArrayList(java.util.ArrayList) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) TargetRunnable(eidolons.libgdx.bf.TargetRunnable)

Example 34 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class AttackDamageTest method testDamageCalc.

@Test
public void testDamageCalc() {
    DC_ActiveObj action = entity.getAttack().getSubActions().get(0);
    // setAveraged(true);
    action.activateOn(entity2);
    Attack attack = DC_AttackMaster.getAttackFromAction(action);
    int precalc = DamageCalculator.precalculateDamage(attack);
    // DamageFactory.getDamageFromAttack(attack);
    printingAsserts.assertEqualAndLog(action.getDamageDealt().getAmount(), precalc, action + " dmg precalc", action + " Damage Dealt");
}
Also used : Attack(eidolons.game.battlecraft.rules.combat.attack.Attack) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) TwoUnitsTest(tests.entity.TwoUnitsTest) Test(org.junit.Test)

Example 35 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class ModeEffect method addEndTurnEffect.

private void addEndTurnEffect() {
    Condition condition = new StringComparison(prop, mode.toString(), true);
    if (mode == STD_MODES.DIVINATION) {
        Effect effect = new DivinationEffect();
        addBuffEffect.addEffect(new DelayedEffect(effect, condition));
        return;
    }
    String formula = mode.getFormula();
    if (ref.getActive() instanceof DC_ActiveObj) {
        DC_ActiveObj activeObj = (DC_ActiveObj) ref.getActive();
        if (activeObj.getParam(PARAMS.FORMULA).contains(StringMaster.MOD)) {
            formula = StringMaster.wrapInParenthesis(formula) + "*" + activeObj.getParam(PARAMS.FORMULA) + "/100";
        } else if (activeObj.getIntParam(PARAMS.FORMULA) != 0) {
            formula += "+" + activeObj.getIntParam(PARAMS.FORMULA);
        }
    }
    ModifyValueEffect effect = new ModifyValueEffect(mode.getParameter(), MOD.MODIFY_BY_CONST, new Formula("min(0, " + formula + ")"));
    PARAMETER param = ContentManager.getPARAM(mode.getParameter());
    effect.setParam(param);
    effect.setMaxParam(ContentManager.getBaseParameterFromCurrent(param));
    Formula appendedByModifier = new Formula(formula).getAppendedByModifier(timeModifier);
    effect.setFormula(appendedByModifier);
    addBuffEffect.addEffect(new DelayedEffect(effect, condition));
// new DelayedEffect(effect, condition).apply(ref);
}
Also used : Condition(main.elements.conditions.Condition) RefCondition(main.elements.conditions.RefCondition) Formula(main.system.math.Formula) StringComparison(main.elements.conditions.StringComparison) DivinationEffect(eidolons.ability.effects.oneshot.spell.DivinationEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) DivinationEffect(eidolons.ability.effects.oneshot.spell.DivinationEffect) SetCustomModeEffect(eidolons.ability.effects.continuous.SetCustomModeEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) ModifyPropertyEffect(eidolons.ability.effects.common.ModifyPropertyEffect) PeriodicEffect(main.ability.effects.periodic.PeriodicEffect) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) ImmobilizeEffect(eidolons.ability.effects.oneshot.status.ImmobilizeEffect) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) PARAMETER(main.content.values.parameters.PARAMETER)

Aggregations

DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)73 Unit (eidolons.entity.obj.unit.Unit)22 ArrayList (java.util.ArrayList)17 Obj (main.entity.obj.Obj)15 DC_UnitAction (eidolons.entity.active.DC_UnitAction)12 DC_Obj (eidolons.entity.obj.DC_Obj)12 Ref (main.entity.Ref)9 Action (eidolons.game.battlecraft.ai.elements.actions.Action)8 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)7 ActiveObj (main.entity.obj.ActiveObj)7 Effect (main.ability.effects.Effect)5 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)5 Targeting (main.elements.targeting.Targeting)5 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)4 DC_SpellObj (eidolons.entity.active.DC_SpellObj)4 ActionPath (eidolons.game.battlecraft.ai.tools.path.ActionPath)4 FixedTargeting (main.elements.targeting.FixedTargeting)4 Coordinates (main.game.bf.Coordinates)4 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)3 ActionSequence (eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence)3