Search in sources :

Example 1 with StringMaster

use of main.system.auxiliary.StringMaster in project Eidolons by IDemiurge.

the class AutoTestFactory method createTest.

public AutoTest createTest(ObjType type) {
    List<String> list = new ArrayList<>();
    list.add(TEST_ARGS.NAME + ":" + type.getName());
    initArgList(list, type);
    String args = new StringMaster().constructContainer(list);
    AUTO_TEST_TYPE t = new EnumMaster<AUTO_TEST_TYPE>().retrieveEnumConst(AUTO_TEST_TYPE.class, type.getProperty(PROPS.AUTO_TEST_TYPE));
    if (t == null) {
        t = getType(type);
    }
    AutoTest test = new AutoTest(type, args, t, master);
    return test;
}
Also used : AUTO_TEST_TYPE(main.content.CONTENT_CONSTS2.AUTO_TEST_TYPE) StringMaster(main.system.auxiliary.StringMaster) ArrayList(java.util.ArrayList)

Example 2 with StringMaster

use of main.system.auxiliary.StringMaster in project Eidolons by IDemiurge.

the class DC_ActionManager method resetActions.

@Override
public void resetActions(Entity entity) {
    if (!(entity instanceof Unit)) {
        return;
    }
    Unit unit = (Unit) entity;
    DequeImpl<ActiveObj> actives;
    // #1: reset prop with ids if nothing is changed
    // if (ListMaster.isNotEmpty(actives) && entity.isActivesReady()) {
    // entity.setProperty(ACTIVES, StringMaster
    // .constructContainer(StringMaster.convertToIdList(actives)));
    // return;
    // }
    actives = new DequeImpl<>();
    // #2: reset the list if prop has been modified (via Add/Remove effects
    // ++ items). They should set ActivesReady to false for that.
    // or upon init
    unit.setActionMap(new HashMap<>());
    // if (!unit.isStandardActionsAdded())
    if (!unit.isBfObj()) {
        actives.addAll(getStandardActions(unit));
    }
    String activesProp = entity.getProperty(ACTIVES);
    for (String typeName : StringMaster.open(activesProp)) {
        ObjType type = DataManager.getType(typeName, DC_TYPE.ACTIONS);
        DC_UnitAction action;
        if (type == null) {
            try {
                action = (DC_UnitAction) game.getObjectById(Integer.valueOf(typeName));
            } catch (Exception e) {
                continue;
            }
        } else {
            action = getOrCreateAction(typeName, entity);
        }
        // idList.add(action.getId() + "");
        actives.add(action);
    }
    // list = new DequeImpl<>(items);
    actives.removeIf(activeObj -> !isActionAvailable(activeObj, ExplorationMaster.isExplorationOn()));
    try {
        addSpecialActions(unit, actives);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    if (ExplorationMaster.isExplorationOn())
        try {
            actives.removeIf(activeObj -> unit.getGame().getDungeonMaster().getExplorationMaster().getActionHandler().isActivationDisabledByExploration((DC_ActiveObj) activeObj));
            List<DC_ActiveObj> actions = unit.getGame().getDungeonMaster().getExplorationMaster().getActionHandler().getExplorationActions(unit);
            actives.addAll(actions);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    unit.setActives(new ArrayList<>(actives));
    if (!unit.isBfObj()) {
        addHiddenActions(unit, unit.getActives());
    }
    try {
        constructActionMaps(unit);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    // entity.setProperty(ACTIVES, StringMaster
    // .constructContainer(StringMaster.convertToIdList(actives)));
    entity.setActivesReady(true);
    for (ActiveObj a : actives) {
        if (activesProp.contains(a.getName())) {
            activesProp += a.getName() + ";";
        }
    }
    entity.setProperty(ACTIVES, activesProp);
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Active(main.entity.obj.Active) Trap(eidolons.game.module.dungeoncrawl.objects.Trap) ActionManager(main.game.logic.generic.ActionManager) Entrance(eidolons.game.module.dungeoncrawl.dungeon.Entrance) ActionEnums(main.content.enums.entity.ActionEnums) Ref(main.entity.Ref) VariableManager(main.data.ability.construct.VariableManager) ExtraAttacksRule(eidolons.game.battlecraft.rules.combat.attack.extra_attack.ExtraAttacksRule) ACTION_TYPE(main.content.enums.entity.ActionEnums.ACTION_TYPE) Player(main.game.logic.battle.player.Player) Weaver(main.system.threading.Weaver) DC_TYPE(main.content.DC_TYPE) GenericEnums(main.content.enums.GenericEnums) DungeonLevelMaster(eidolons.game.module.dungeoncrawl.dungeon.DungeonLevelMaster) ItemEnums(main.content.enums.entity.ItemEnums) ContentManager(main.content.ContentManager) DC_Game(eidolons.game.core.game.DC_Game) ExplorationMaster(eidolons.game.module.dungeoncrawl.explore.ExplorationMaster) ActionType(main.entity.type.ActionType) PARAMETER(main.content.values.parameters.PARAMETER) UnitAnalyzer(eidolons.game.battlecraft.rules.UnitAnalyzer) DualAttackMaster(eidolons.game.battlecraft.rules.combat.attack.dual.DualAttackMaster) java.util(java.util) ActiveObj(main.entity.obj.ActiveObj) MicroGame(main.game.core.game.MicroGame) DequeImpl(main.system.datatypes.DequeImpl) PARAMS(eidolons.content.PARAMS) StringMaster(main.system.auxiliary.StringMaster) DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj) STD_ACTION_MODES(main.content.CONTENT_CONSTS2.STD_ACTION_MODES) FleeRule(eidolons.game.battlecraft.rules.mechanics.FleeRule) FEATURE(eidolons.game.battlecraft.rules.RuleMaster.FEATURE) G_PROPS(main.content.values.properties.G_PROPS) ActionGenerator(eidolons.ability.ActionGenerator) LogMaster(main.system.auxiliary.log.LogMaster) ObjType(main.entity.type.ObjType) ListMaster(main.system.auxiliary.data.ListMaster) PROPS(eidolons.content.PROPS) Obj(main.entity.obj.Obj) KEYS(main.entity.Ref.KEYS) TrapMaster(eidolons.game.module.dungeoncrawl.objects.TrapMaster) Entity(main.entity.Entity) ACTION_TYPE_GROUPS(main.content.enums.entity.ActionEnums.ACTION_TYPE_GROUPS) DataManager(main.data.DataManager) RuleMaster(eidolons.game.battlecraft.rules.RuleMaster) Unit(eidolons.entity.obj.unit.Unit) UnitEnums(main.content.enums.entity.UnitEnums) EnumMaster(main.system.auxiliary.EnumMaster) ActiveObj(main.entity.obj.ActiveObj) ObjType(main.entity.type.ObjType) Unit(eidolons.entity.obj.unit.Unit)

Aggregations

ActionGenerator (eidolons.ability.ActionGenerator)1 PARAMS (eidolons.content.PARAMS)1 PROPS (eidolons.content.PROPS)1 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)1 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)1 DC_FeatObj (eidolons.entity.obj.attach.DC_FeatObj)1 Unit (eidolons.entity.obj.unit.Unit)1 RuleMaster (eidolons.game.battlecraft.rules.RuleMaster)1 FEATURE (eidolons.game.battlecraft.rules.RuleMaster.FEATURE)1 UnitAnalyzer (eidolons.game.battlecraft.rules.UnitAnalyzer)1 DualAttackMaster (eidolons.game.battlecraft.rules.combat.attack.dual.DualAttackMaster)1 ExtraAttacksRule (eidolons.game.battlecraft.rules.combat.attack.extra_attack.ExtraAttacksRule)1 FleeRule (eidolons.game.battlecraft.rules.mechanics.FleeRule)1 DC_Game (eidolons.game.core.game.DC_Game)1 DungeonLevelMaster (eidolons.game.module.dungeoncrawl.dungeon.DungeonLevelMaster)1 Entrance (eidolons.game.module.dungeoncrawl.dungeon.Entrance)1 ExplorationMaster (eidolons.game.module.dungeoncrawl.explore.ExplorationMaster)1 Trap (eidolons.game.module.dungeoncrawl.objects.Trap)1 TrapMaster (eidolons.game.module.dungeoncrawl.objects.TrapMaster)1 java.util (java.util)1