Search in sources :

Example 6 with ActiveObj

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

the class RadialManager method createNodes.

public static List<RadialValueContainer> createNodes(Unit sourceUnit, DC_Obj target, List<? extends ActiveObj> actives, boolean groupedAttacks) {
    List<RadialValueContainer> list = new ArrayList<>();
    if (checkExamineNode(target))
        list.add(getExamineNode(target));
    List<RadialValueContainer> moves = new ArrayList<>();
    List<RadialValueContainer> turns = new ArrayList<>();
    List<RadialValueContainer> attacks = new ArrayList<>();
    List<RadialValueContainer> offhandAttacks = new ArrayList<>();
    List<RadialValueContainer> specialActions = new ArrayList<>();
    List<RadialValueContainer> modes = new ArrayList<>();
    List<RadialValueContainer> orders = new ArrayList<>();
    List<RadialValueContainer> quickItems = new ArrayList<>();
    List<RadialValueContainer> dualAttacks = new ArrayList<>();
    List<DC_ActiveObj> topActions = new ArrayList<>();
    List<DC_ActiveObj> shortcuts = new ArrayList<>();
    // top actions = last? recommended?
    processingShortcuts = false;
    for (ActiveObj action : actives) {
        if (!isActionShown(action, target))
            continue;
        if (action == SHORTCUT) {
            processingShortcuts = true;
            continue;
        }
        DC_ActiveObj el = (DC_ActiveObj) action;
        if (processingShortcuts)
            shortcuts.add(el);
        else if (el.getActionGroup() == ACTION_TYPE_GROUPS.DUNGEON) {
            topActions.add(el);
        } else if (el.isMove()) {
            final RadialValueContainer valueContainer = configureMoveNode(target, el);
            addCostTooltip(el, valueContainer);
            moves.add(valueContainer);
        } else if (el.isTurn()) {
            final RadialValueContainer valueContainer = configureActionNode(target, el);
            addCostTooltip(el, valueContainer);
            turns.add(valueContainer);
        } else if (el.getChecker().isDualAttack()) {
            dualAttacks.add(getAttackActionNode(el, target));
        } else if (el.isStandardAttack() || (el.getActionGroup() == ACTION_TYPE_GROUPS.SPECIAL && el.getActionType() == ACTION_TYPE.SPECIAL_ATTACK)) {
            if (el.isOffhand())
                offhandAttacks.add(getAttackActionNode(el, target));
            else
                attacks.add(getAttackActionNode(el, target));
        } else // if (el.getActionType()==ACTION_TYPE.SPECIAL_ATTACK){
        // attacks.add(getAttackActionNode(el, target));
        // offhandAttacks.add(getAttackActionNode(el, target));
        // }
        {
            final RadialValueContainer valueContainer = configureActionNode(target, el);
            // if (el.isSpell()) { DONE VIA SpellRadialManager
            // spells.add(valueContainer);
            // } else
            addCostTooltip(el, valueContainer);
            if (el instanceof DC_QuickItemAction) {
                quickItems.add(valueContainer);
            } else if (el.getActionGroup() == ACTION_TYPE_GROUPS.ORDER) {
                orders.add(valueContainer);
            } else if (el.getActionType() == ACTION_TYPE.MODE) {
                modes.add(valueContainer);
            } else {
                if (!el.isAttackAny()) {
                    if (el.getActionType() != ACTION_TYPE.HIDDEN) {
                        specialActions.add(valueContainer);
                    }
                }
            }
        }
    }
    if (!attacks.isEmpty()) {
        if (groupedAttacks)
            list.add(configureAttackParentNode(attacks, RADIAL_PARENT_NODE.MAIN_HAND_ATTACKS, target, sourceUnit.getAttackAction(false)));
        else {
            for (RadialValueContainer sub : attacks) {
                list.add(sub);
            }
        }
    }
    list.add(getParentNode(RADIAL_PARENT_NODE.TURN_ACTIONS, turns));
    list.add(getParentNode(RADIAL_PARENT_NODE.MOVES, moves));
    if (!offhandAttacks.isEmpty()) {
        if (groupedAttacks)
            list.add(configureAttackParentNode(offhandAttacks, RADIAL_PARENT_NODE.OFFHAND_ATTACKS, target, sourceUnit.getAttackAction(true)));
        else {
            for (RadialValueContainer sub : offhandAttacks) {
                list.add(sub);
            }
        }
    }
    list.add(getParentNode(RADIAL_PARENT_NODE.QUICK_ITEMS, quickItems));
    list.add(getParentNode(RADIAL_PARENT_NODE.MODES, modes));
    list.add(getParentNode(RADIAL_PARENT_NODE.ORDERS, orders));
    list.add(getParentNode(RADIAL_PARENT_NODE.DUAL_ATTACKS, dualAttacks));
    list.add(getParentNode(RADIAL_PARENT_NODE.SPECIAL, specialActions));
    if (!sourceUnit.getSpells().isEmpty()) {
        final List<RadialValueContainer> spellNodes = SpellRadialManager.getSpellNodes(sourceUnit, target);
        list.add(getParentNode(RADIAL_PARENT_NODE.SPELLS, spellNodes));
    }
    topActions.forEach(activeObj -> {
        list.add(configureActionNode(target, activeObj));
    });
    shortcuts.forEach(activeObj -> {
        list.add(configureShortcutActionNode(target, activeObj));
    });
    // REMOVE IF NO NODES IN PARENT!
    list.removeIf(i -> i == null);
    return list;
}
Also used : ActiveObj(main.entity.obj.ActiveObj)

Example 7 with ActiveObj

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

the class DC_ActionManager method constructActionMaps.

public void constructActionMaps(Unit unit) {
    for (ACTION_TYPE sub : unit.getActionMap().keySet()) {
        unit.getActionMap().put(sub, new DequeImpl<>());
    }
    for (ActiveObj active : unit.getActives()) {
        DC_UnitAction action = (DC_UnitAction) active;
        ACTION_TYPE type = action.getActionType();
        if (type == null) {
            type = action.getActionType();
        }
        DequeImpl<DC_UnitAction> list = unit.getActionMap().get(type);
        if (!hiddenActions.contains(action.getType())) {
            list.add(action);
        }
    }
}
Also used : ActiveObj(main.entity.obj.ActiveObj) ACTION_TYPE(main.content.enums.entity.ActionEnums.ACTION_TYPE)

Example 8 with ActiveObj

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

the class AbilityImpl method activatedOn.

@Override
public boolean activatedOn(Ref ref) {
    setRef(ref);
    // preCheck if targeting is overridden
    if (!(targeting instanceof AutoTargeting)) {
        if (!(targeting instanceof FixedTargeting)) {
            if (isForcePresetTargeting() || targeting == null) {
                if (ref.getTarget() != null || ref.getGroup() != null) {
                    // without targeting.select()
                    return resolve();
                } else {
                    // inconsistent data
                    return false;
                }
            }
        }
    }
    boolean selectResult = targeting.select(ref);
    ActiveObj a = ref.getActive();
    if (selectResult) {
        if (a != null) {
            a.setCancelled(null);
        }
        return resolve();
    } else {
        if (a != null) {
            if (a.isCancelled() != null) {
                a.setCancelled(true);
            }
        }
        return false;
    }
}
Also used : AutoTargeting(main.elements.targeting.AutoTargeting) ActiveObj(main.entity.obj.ActiveObj) FixedTargeting(main.elements.targeting.FixedTargeting)

Example 9 with ActiveObj

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

the class DebugMaster method executeHiddenDebugFunction.

public Object executeHiddenDebugFunction(HIDDEN_DEBUG_FUNCTIONS func) {
    executedFunctions.push(func.toString());
    Unit infoObj;
    try {
        infoObj = (Unit) getObj();
    } catch (Exception e) {
        infoObj = game.getManager().getActiveObj();
    }
    switch(func) {
        case WRITE_GROUP:
            Entity entity = DC_Game.game.getValueHelper().getEntity();
            if (entity == null) {
                break;
            }
            XML_Writer.writeXML_ForTypeGroup(entity.getOBJ_TYPE_ENUM(), entity.getGroupingKey());
        case WRITE:
            if (!(DC_Game.game.getValueHelper().getEntity() instanceof ObjType)) {
                break;
            }
            XML_Writer.writeXML_ForTypeGroup(DC_Game.game.getValueHelper().getEntity().getOBJ_TYPE_ENUM());
            break;
        case WRITE_TYPE:
            if (!(DC_Game.game.getValueHelper().getEntity() instanceof ObjType)) {
                break;
            }
            XML_Writer.writeXML_ForType((ObjType) DC_Game.game.getValueHelper().getEntity());
            break;
        case TOGGLE_AV_MODE:
            CoreEngine.setArcaneVault(!CoreEngine.isArcaneVault());
            CoreEngine.setArcaneVaultMode(true);
            break;
        case RECONSTRUCT:
            {
                for (ActiveObj obj : infoObj.getPassives()) {
                    obj.setConstructed(false);
                }
                for (ActiveObj obj : infoObj.getActives()) {
                    obj.setConstructed(false);
                }
                break;
            }
        case RELOAD_TYPES:
            {
                XML_Reader.readTypes(false, true);
                game.initObjTypes();
                break;
            }
        case RESTART_GAME:
            // TODO     executeDebugFunction(KILL_ALL_UNITS);
            // DC_ObjInitializer.processUnitDataString(game.getPlayer(true),
            // game.getPlayerParty(), game);
            game.getManager().unitActionCompleted(null, false);
            break;
        case BF_RESURRECT_ALL:
            break;
        case DISPLAY_EVENT_LOG:
            break;
        case DISPLAY_REF:
            display(game.getManager().getInfoObj().getName() + "'s REF:", game.getManager().getInfoObj().getRef() + "");
            break;
        case DISPLAY_TRIGGERS:
            // display("Triggers: ", game.getState().getAttachedTriggers());
            displayList("Triggers: ", game.getState().getTriggers(), 1);
            break;
        case DISPLAY_STATE:
            display("State: ", game.getState());
            break;
        case DISPLAY_EFFECTS:
            displayList("Effects ", game.getState().getEffects(), 1);
            break;
        case DISPLAY_OBJECTS:
            for (OBJ_TYPE sub : game.getState().getGame().getState().getObjMaps().keySet()) {
                displayList(sub + ": ", game.getState().getGame().getState().getObjMaps().get(sub).keySet(), 1);
            }
        case DISPLAY_UNITS:
            displayList("Units ", game.getState().getGame().getUnits(), 1);
            break;
        case DISPLAY_UNIT_INFO:
            display("INFO OBJ: ", getUnitInfo(game.getManager().getInfoObj()));
            break;
        case HERO_ADD_ALL_SPELLS:
            for (ObjType type : DataManager.getTypes(DC_TYPE.SPELLS)) {
                Unit hero = (Unit) game.getManager().getInfoObj();
                if (LibraryManager.checkHeroHasSpell(hero, type)) {
                    continue;
                }
                LibraryManager.addVerbatimSpell(hero, type);
                DC_SpellObj spell = new DC_SpellObj(type, hero.getOriginalOwner(), hero.getGame(), hero.getRef());
                hero.getSpells().add(spell);
            }
            break;
        default:
            break;
    }
    return null;
}
Also used : Entity(main.entity.Entity) OBJ_TYPE(main.content.OBJ_TYPE) C_OBJ_TYPE(main.content.C_OBJ_TYPE) ActiveObj(main.entity.obj.ActiveObj) ObjType(main.entity.type.ObjType) DC_SpellObj(eidolons.entity.active.DC_SpellObj) Unit(eidolons.entity.obj.unit.Unit)

Example 10 with ActiveObj

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

the class AbilityConstructor method getAbilitiesList.

private static List<ActiveObj> getAbilitiesList(G_PROPS prop, Entity entity, boolean passive) {
    if (entity.getProperty(prop) == "") {
        return null;
    }
    List<ActiveObj> list = new ArrayList<>();
    for (String abilTypeName : StringMaster.open(entity.getProperty(prop))) {
        if (abilTypeName.isEmpty())
            continue;
        ActiveObj ability;
        ability = newAbility(abilTypeName, entity, passive);
        if (ability != null) {
            list.add(ability);
        }
    }
    return list;
}
Also used : ActiveObj(main.entity.obj.ActiveObj) ArrayList(java.util.ArrayList)

Aggregations

ActiveObj (main.entity.obj.ActiveObj)18 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)7 ArrayList (java.util.ArrayList)4 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)4 Unit (eidolons.entity.obj.unit.Unit)3 Targeting (main.elements.targeting.Targeting)3 Ref (main.entity.Ref)3 Active (main.entity.obj.Active)3 DC_Effect (eidolons.ability.effects.DC_Effect)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)2 RayEffect (eidolons.ability.effects.containers.customtarget.RayEffect)2 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)2 ZoneEffect (eidolons.ability.effects.containers.customtarget.ZoneEffect)2 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)2 TemplateAutoTargeting (eidolons.ability.targeting.TemplateAutoTargeting)2 TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)2 STD_ACTION_MODES (main.content.CONTENT_CONSTS2.STD_ACTION_MODES)2 FixedTargeting (main.elements.targeting.FixedTargeting)2 ActionType (main.entity.type.ActionType)2 ActionGenerator (eidolons.ability.ActionGenerator)1