Search in sources :

Example 11 with DC_UnitAction

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

the class DC_GameManager method previewMyAction.

public void previewMyAction(int index, ACTION_TYPE group) {
    if (ExplorationMaster.isExplorationOn())
        return;
    DC_UnitAction action = getActiveObj().getActionMap().get(group).get(index);
    GuiEventManager.trigger(GuiEventType.ACTION_HOVERED, action);
}
Also used : DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Example 12 with DC_UnitAction

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

the class EnsnaredRule method checkCutAway.

private boolean checkCutAway(boolean offhand) {
    int amount = 0;
    DC_WeaponObj weapon = unit.getWeapon(offhand);
    if (weapon == null) {
        weapon = unit.getNaturalWeapon(offhand);
    }
    DC_UnitAction attack_action = unit.getAction(offhand ? "Offhand Attack" : "Attack");
    if (// unit.getRef(),
    !attack_action.canBeActivated(unit.getRef(), true)) // true
    {
        // TODO log " has no strength left to cut the bonds"
        return false;
    }
    // }
    if (weapon.getDamageType() != GenericEnums.DAMAGE_TYPE.BLUDGEONING) {
        amount += unit.calculateDamage(offhand);
    }
    amount = MathMaster.applyMod(amount, unit.getIntParam(offhand ? PARAMS.OFF_HAND_ATTACK : PARAMS.ATTACK));
    amount = MathMaster.applyMod(amount, CUT_AWAY_MOD);
    amount = Math.min(getNumberOfCounters(unit), amount);
    unit.modifyCounter(getCounterName(), -amount);
    attack_action.payCosts();
    // unit.modifyParameter(PARAMS.C_STAMINA, -sta_cost);
    // unit.modifyParameter(PARAMS.C_N_OF_ACTIONS, -1);
    String string = ((offhand) ? "...Then " : unit.getName()) + " cuts away " + ((offhand) ? " another " + amount : amount + " Ensnare counters") + " with " + weapon.getName();
    if (getNumberOfCounters(unit) <= 0) {
        string += " and breaks free!";
        game.getLogManager().log(string);
        return true;
    } else {
        game.getLogManager().log(string);
    }
    return false;
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Example 13 with DC_UnitAction

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

the class PanelActionsDataSource method getQuickSlotActions.

@Override
public List<ActionValueContainer> getQuickSlotActions() {
    final DequeImpl<DC_QuickItemObj> items = unit.getQuickItems();
    if (items == null)
        return (List<ActionValueContainer>) ListMaster.fillWithNullElements(new ArrayList<ActionValueContainer>(), unit.getRemainingQuickSlots());
    List<ActionValueContainer> list = items.stream().map((DC_QuickItemObj key) -> {
        boolean valid = key.getActive().canBeManuallyActivated();
        final ActionValueContainer valueContainer = new ActionValueContainer(valid, getOrCreateR(key.getImagePath()), key::invokeClicked);
        ActionCostTooltip tooltip = new ActionCostTooltip(key.getActive());
        tooltip.setUserObject(new ActionCostSourceImpl(key.getActive()));
        valueContainer.addListener(tooltip.getController());
        return valueContainer;
    }).collect(Collectors.toList());
    ObjType type = DataManager.getType(StringMaster.getWellFormattedString(STD_SPEC_ACTIONS.Use_Inventory.name()), DC_TYPE.ACTIONS);
    TextureRegion invTexture = TextureCache.getOrCreateR(type.getImagePath());
    DC_UnitAction action = unit.getAction(StringMaster.getWellFormattedString(STD_SPEC_ACTIONS.Use_Inventory.name()));
    if (action == null)
        return list;
    boolean valid = action.canBeManuallyActivated();
    ActionValueContainer invButton = new ActionValueContainer(valid, invTexture, () -> {
        action.clicked();
    });
    list.add(invButton);
    for (int i = 0; i < unit.getRemainingQuickSlots() - 1; i++) {
        list.add(null);
    }
    return list;
}
Also used : ActionCostTooltip(eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ActionValueContainer(eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer) ObjType(main.entity.type.ObjType) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Example 14 with DC_UnitAction

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

the class PayCostEffect method applyThis.

@Override
public boolean applyThis() {
    Unit hero = (Unit) ref.getTargetObj();
    DC_UnitAction action = hero.getAction(actionName);
    if (action == null) {
        return false;
    }
    if (!force) {
    // preCheck
    }
    action.payCosts();
    return true;
}
Also used : Unit(eidolons.entity.obj.unit.Unit) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Example 15 with DC_UnitAction

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

the class InstantAttackRule method getInstantAttacks.

// could be a spell?..
public static List<DC_ActiveObj> getInstantAttacks(Unit unit) {
    List<DC_ActiveObj> list = new ArrayList<>();
    List<DC_UnitAction> attacks = new ArrayList<>(unit.getActionMap().get(ActionEnums.ACTION_TYPE.STANDARD_ATTACK));
    if (unit.getActionMap().get(ActionEnums.ACTION_TYPE.SPECIAL_ATTACK) != null) {
        attacks.addAll(unit.getActionMap().get(ActionEnums.ACTION_TYPE.SPECIAL_ATTACK));
    }
    for (DC_UnitAction attack : attacks) {
        if (checkAttackCanBeInstant(attack)) // if (attack
        // .checkProperty(G_PROPS.ACTION_TAGS,
        // ACTION_TAGS.INSTANT_ATTACK.toString()))
        {
            list.add(attack);
        }
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Aggregations

DC_UnitAction (eidolons.entity.active.DC_UnitAction)22 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)10 ArrayList (java.util.ArrayList)10 Unit (eidolons.entity.obj.unit.Unit)4 Obj (main.entity.obj.Obj)3 PARAMS (eidolons.content.PARAMS)2 DC_SpellObj (eidolons.entity.active.DC_SpellObj)2 DC_Obj (eidolons.entity.obj.DC_Obj)2 Action (eidolons.game.battlecraft.ai.elements.actions.Action)2 ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)2 Ref (main.entity.Ref)2 ObjType (main.entity.type.ObjType)2 Coordinates (main.game.bf.Coordinates)2 Context (main.game.logic.action.context.Context)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 FacingCondition (eidolons.ability.conditions.FacingCondition)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 ActivateEffect (eidolons.ability.effects.oneshot.activation.ActivateEffect)1 UNIT_INFO_PARAMS (eidolons.content.UNIT_INFO_PARAMS)1 DC_ActionManager (eidolons.entity.active.DC_ActionManager)1