Search in sources :

Example 21 with EnumMaster

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

the class UnitViewTooltipFactory method supplier.

@Override
protected Supplier<List<ValueContainer>> supplier(BattleFieldObject hero) {
    return () -> {
        List<ValueContainer> values = new ArrayList<>();
        if (hero.checkSelectHighlighted()) {
            String actionTargetingTooltip = "";
            DC_ActiveObj action = (DC_ActiveObj) hero.getGame().getManager().getActivatingAction();
            try {
                actionTargetingTooltip = ToolTipMaster.getActionTargetingTooltip(hero, action);
            } catch (Exception e) {
                if (!action.isBroken()) {
                    main.system.ExceptionMaster.printStackTrace(e);
                } else {
                    action.setBroken(true);
                }
            }
            if (!StringMaster.isEmpty(actionTargetingTooltip)) {
                final ValueContainer activationTooltip = new ValueContainer(actionTargetingTooltip, "");
                activationTooltip.setNameAlignment(Align.left);
                values.add(activationTooltip);
            }
        }
        if (!hero.isMine())
            if (!hero.getGame().isDebugMode())
                if (hero.getVisibilityLevelForPlayer() != VISIBILITY_LEVEL.CLEAR_SIGHT) {
                    final ValueContainer nameContainer = new ValueContainer(hero.getToolTip(), "");
                    nameContainer.setNameAlignment(Align.left);
                    values.add(nameContainer);
                    if (hero.getGame().isStarted())
                        if (hero.getUnitVisionStatus() != null) {
                            final ValueContainer valueContainer = new ValueContainer(StringMaster.getWellFormattedString(hero.getUnitVisionStatus().name()), "");
                            valueContainer.setNameAlignment(Align.left);
                            values.add(valueContainer);
                        }
                    String text = hero.getGame().getVisionMaster().getHintMaster().getHintsString(hero);
                    TextureRegion texture = TextureCache.getOrCreateR(VISUALS.QUESTION.getImgPath());
                    final ValueContainer hintsContainer = new ValueContainer(texture, text);
                    hintsContainer.setNameAlignment(Align.left);
                    hintsContainer.setValueAlignment(Align.right);
                    values.add(hintsContainer);
                    return values;
                }
        final ValueContainer nameContainer = new ValueContainer(hero.getToolTip(), "");
        nameContainer.setNameAlignment(Align.left);
        values.add(nameContainer);
        INFO_LEVEL info_level = new EnumMaster<INFO_LEVEL>().retrieveEnumConst(INFO_LEVEL.class, OptionsMaster.getGameplayOptions().getValue(GAMEPLAY_OPTION.INFO_DETAIL_LEVEL));
        values.add(getValueContainer(hero, PARAMS.C_TOUGHNESS, PARAMS.TOUGHNESS));
        values.add(getValueContainer(hero, PARAMS.C_ENDURANCE, PARAMS.ENDURANCE));
        if (info_level != null)
            switch(info_level) {
                case VERBOSE:
                    values.add(getValueContainer(hero, PARAMS.C_STAMINA, PARAMS.STAMINA));
                    values.add(getValueContainer(hero, PARAMS.C_FOCUS, PARAMS.FOCUS));
                    values.add(getValueContainer(hero, PARAMS.C_MORALE, PARAMS.MORALE));
                    values.add(getValueContainer(hero, PARAMS.C_ESSENCE, PARAMS.ESSENCE));
                case NORMAL:
                    addParamStringToValues(hero, values, PARAMS.ARMOR);
                    addParamStringToValues(hero, values, PARAMS.RESISTANCE);
                case BASIC:
                    addParamStringToValues(hero, values, PARAMS.DAMAGE);
                    addParamStringToValues(hero, values, PARAMS.ATTACK);
                    addParamStringToValues(hero, values, PARAMS.DEFENSE);
            }
        if (hero.getIntParam(PARAMS.N_OF_ACTIONS) > 0) {
            values.add(getValueContainer(hero, PARAMS.C_N_OF_ACTIONS, PARAMS.N_OF_ACTIONS));
        }
        if (hero.getIntParam(PARAMS.N_OF_COUNTERS) > 0) {
            values.add(getValueContainer(hero, PARAMS.C_N_OF_COUNTERS, PARAMS.N_OF_COUNTERS));
        }
        if (hero.getGame().isDebugMode()) {
            ValueContainer valueContainer = new ValueContainer("coord:", hero.getCoordinates().toString());
            valueContainer.setNameAlignment(Align.left);
            valueContainer.setValueAlignment(Align.right);
            values.add(valueContainer);
            if (hero.getFacing() != null || hero.getDirection() != null) {
                final String name = "direction: " + (hero.getFacing() != null ? hero.getFacing().getDirection() : hero.getDirection());
                valueContainer = new ValueContainer(name, hero.getCoordinates().toString());
                valueContainer.setNameAlignment(Align.left);
                valueContainer.setValueAlignment(Align.right);
                values.add(valueContainer);
            }
        }
        if (hero instanceof Unit) {
            addPropStringToValues(hero, values, G_PROPS.MODE);
            addPropStringToValues(hero, values, G_PROPS.STATUS);
        }
        if (hero.getCustomParamMap() != null) {
            hero.getCustomParamMap().keySet().forEach(counter -> {
                final String name = StringMaster.getWellFormattedString(counter);
                String img = CounterMaster.getImagePath(counter);
                if (img != null) {
                    TextureRegion texture = TextureCache.getOrCreateR(img);
                    final ValueContainer valueContainer = (texture == null) ? new ValueContainer(name, hero.getCustomParamMap().get(counter)) : new ValueContainer(texture, name, hero.getCustomParamMap().get(counter));
                    valueContainer.setNameAlignment(Align.left);
                    valueContainer.setValueAlignment(Align.right);
                    values.add(valueContainer);
                }
            });
        }
        // if (VisionManager.isVisibilityOn()){
        if (RuleMaster.isRuleOn(RULE.VISIBILITY) || Eidolons.game.isDebugMode()) {
            addParamStringToValues(hero, values, PARAMS.LIGHT_EMISSION);
            addParamStringToValues(hero, values, PARAMS.ILLUMINATION);
            addParamStringToValues(hero, values, PARAMS.CONCEALMENT);
        // addKeyAndValue("Gamma", ""+hero.getGame().getVisionMaster().
        // getGammaMaster().
        // getGamma(false, hero.getGame().getManager().getActiveObj(), hero), values);
        }
        if (hero.getGame().isDebugMode()) {
            final ValueContainer outlineContainer = new ValueContainer(StringMaster.getWellFormattedString(hero.getOutlineTypeForPlayer() + ""), "");
            outlineContainer.setNameAlignment(Align.left);
            values.add(outlineContainer);
            final ValueContainer outlineContainer2 = new ValueContainer(StringMaster.getWellFormattedString(hero.getVisibilityLevel() + ""), "");
            outlineContainer.setNameAlignment(Align.left);
            values.add(outlineContainer);
        }
        return values;
    };
}
Also used : Arrays(java.util.Arrays) ToolTipMaster(eidolons.system.text.ToolTipMaster) PARAMS(eidolons.content.PARAMS) Supplier(java.util.function.Supplier) StringMaster(main.system.auxiliary.StringMaster) CounterMaster(main.system.entity.CounterMaster) ArrayList(java.util.ArrayList) RULE(eidolons.game.battlecraft.rules.RuleMaster.RULE) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) OptionsMaster(eidolons.system.options.OptionsMaster) G_PROPS(main.content.values.properties.G_PROPS) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) Align(com.badlogic.gdx.utils.Align) VISIBILITY_LEVEL(main.content.enums.rules.VisionEnums.VISIBILITY_LEVEL) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) List(java.util.List) TextureCache(eidolons.libgdx.texture.TextureCache) Eidolons(eidolons.game.core.Eidolons) GAMEPLAY_OPTION(eidolons.system.options.GameplayOptions.GAMEPLAY_OPTION) BaseView(eidolons.libgdx.bf.grid.BaseView) RuleMaster(eidolons.game.battlecraft.rules.RuleMaster) VISUALS(main.swing.generic.components.G_Panel.VISUALS) Unit(eidolons.entity.obj.unit.Unit) EnumMaster(main.system.auxiliary.EnumMaster) INFO_LEVEL(main.content.enums.rules.VisionEnums.INFO_LEVEL) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) EnumMaster(main.system.auxiliary.EnumMaster) INFO_LEVEL(main.content.enums.rules.VisionEnums.INFO_LEVEL) ArrayList(java.util.ArrayList) List(java.util.List) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Unit(eidolons.entity.obj.unit.Unit)

Example 22 with EnumMaster

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

the class DebugMaster method promptFunctionToExecute.

public void promptFunctionToExecute() {
    DC_SoundMaster.playStandardSound(RandomWizard.random() ? STD_SOUNDS.DIS__OPEN_MENU : STD_SOUNDS.SLING);
    String message = "Input function name";
    String funcName = JOptionPane.showInputDialog(null, message, lastFunction);
    if (funcName == null) {
        if (AutoTestMaster.isRunning()) {
            funcName = DEBUG_FUNCTIONS.AUTO_TEST_INPUT.name();
        } else {
            reset();
            return;
        }
    }
    if (AutoTestMaster.isRunning()) {
        if (funcName.equalsIgnoreCase("re")) {
            new Thread(new Runnable() {

                public void run() {
                    AutoTestMaster.runTests();
                }
            }, " thread").start();
            return;
        }
    }
    if (funcName.contains(" ")) {
        if (funcName.trim().equals("")) {
            int length = funcName.length();
            if (executedFunctions.size() >= length) {
                for (int i = 0; i < length; i++) {
                    funcName = executedFunctions.pop();
                }
            }
        }
    }
    if (StringMaster.isInteger(funcName)) {
        try {
            Integer integer = StringMaster.getInteger(funcName);
            if (integer >= DEBUG_FUNCTIONS.values().length) {
                executeDebugFunctionNewThread(HIDDEN_DEBUG_FUNCTIONS.values()[integer - DEBUG_FUNCTIONS.values().length]);
                playFuncExecuteSound();
                return;
            }
            {
                executeDebugFunctionNewThread(DEBUG_FUNCTIONS.values()[integer]);
                playFuncExecuteSound();
                return;
            }
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
    DEBUG_FUNCTIONS function = new EnumMaster<DEBUG_FUNCTIONS>().retrieveEnumConst(DEBUG_FUNCTIONS.class, funcName);
    if (function != null) {
        executeDebugFunctionNewThread(function);
        playFuncExecuteSound();
        return;
    }
    HIDDEN_DEBUG_FUNCTIONS function2 = new EnumMaster<HIDDEN_DEBUG_FUNCTIONS>().retrieveEnumConst(HIDDEN_DEBUG_FUNCTIONS.class, funcName);
    if (function2 != null) {
        executeDebugFunctionNewThread(function2);
    } else {
        function = new EnumMaster<DEBUG_FUNCTIONS>().retrieveEnumConst(DEBUG_FUNCTIONS.class, funcName, true);
        function2 = new EnumMaster<HIDDEN_DEBUG_FUNCTIONS>().retrieveEnumConst(HIDDEN_DEBUG_FUNCTIONS.class, funcName, true);
        if (StringMaster.compareSimilar(funcName, function.toString()) > StringMaster.compareSimilar(funcName, function2.toString())) {
            executeDebugFunctionNewThread(function);
        } else {
            executeDebugFunctionNewThread(function2);
        }
    }
    playFuncExecuteSound();
}
Also used : EnumMaster(main.system.auxiliary.EnumMaster) DEBUG_FUNCTIONS(eidolons.test.debug.DebugMaster.DEBUG_FUNCTIONS)

Example 23 with EnumMaster

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

the class DebugMaster method executeDebugFunction.

public Object executeDebugFunction(DEBUG_FUNCTIONS func) {
    executedFunctions.push(func.toString());
    boolean transmitted = false;
    if (game.isOnline()) {
        if (func.transmitted) {
            transmitted = true;
        }
    }
    if (target != null) {
        arg = target;
    }
    Unit infoObj = target instanceof Unit ? (Unit) target : null;
    Ref ref = null;
    if (infoObj == null) {
        try {
            infoObj = (Unit) getObj();
        } catch (Exception e) {
        }
    }
    if (infoObj == null) {
        infoObj = game.getManager().getActiveObj();
    }
    if (game.getManager().getActiveObj() != null) {
        ref = new Ref(game, game.getManager().getActiveObj().getId());
    } else {
        ref = new Ref(game);
    }
    ref.setDebug(true);
    Coordinates coordinate = null;
    String data = null;
    DC_TYPE TYPE;
    debugFunctionRunning = true;
    try {
        switch(func) {
            case SET_GLOBAL_ILLUMINATION:
                game.getVisionMaster().getIlluminationMaster().setGlobalIllumination(DialogMaster.inputInt("SET_GLOBAL_ILLUMINATION", game.getVisionMaster().getIlluminationMaster().getGlobalIllumination()));
                break;
            case SET_GLOBAL_CONCEALMENT:
                game.getVisionMaster().getIlluminationMaster().setGlobalConcealment(DialogMaster.inputInt("SET_GLOBAL_CONCEALMENT", game.getVisionMaster().getIlluminationMaster().getGlobalConcealment()));
                break;
            case TEST_CLONE_STATE:
                StateCloner.test();
                break;
            case TEST_LOAD_STATE:
                StatesKeeper.testLoad();
                return null;
            case RUN_AUTO_TESTS:
                AutoTestMaster.runTests();
                break;
            case AUTO_TEST_INPUT:
                WaitMaster.receiveInput(WAIT_OPERATIONS.AUTO_TEST_INPUT, true);
                break;
            case SET_OPTION:
                OptionsMaster.promptSetOption();
                break;
            case ADD_GROUP:
                File groupFile = ListChooser.chooseFile(PathFinder.getUnitGroupPath());
                if (groupFile == null) {
                    break;
                }
                if (arg instanceof DC_Cell) {
                    coordinate = arg.getCoordinates();
                } else {
                    coordinate = getGame().getBattleFieldManager().pickCoordinate();
                }
                if (coordinate == null) {
                    break;
                }
                data = FileManager.readFile(groupFile);
                UnitGroupMaster.setCurrentGroupHeight(MathMaster.getMaxY(data));
                UnitGroupMaster.setCurrentGroupWidth(MathMaster.getMaxX(data));
                UnitGroupMaster.setMirror(isAltMode());
                // UnitGroupMaster.setFlip(null);
                try {
                    DC_ObjInitializer.createUnits(game.getPlayer(isAltMode()), data, coordinate);
                } catch (Exception e) {
                    main.system.ExceptionMaster.printStackTrace(e);
                } finally {
                    UnitGroupMaster.setMirror(false);
                }
                break;
            case TOGGLE_DUMMY:
                game.setDummyMode(!game.isDummyMode());
                TestMasterContent.setForceFree(game.isDummyMode());
                break;
            case TOGGLE_DUMMY_PLUS:
                game.setDummyPlus(!game.isDummyPlus());
                TestMasterContent.setForceFree(game.isDummyMode());
                break;
            case PRESET:
                PresetMaster.handlePreset(isAltMode());
                break;
            case TOGGLE_DUNGEON_DEBUG:
                {
                    mapDebugOn = !mapDebugOn;
                    break;
                }
            case HIDDEN_FUNCTION:
                {
                    int i = DialogMaster.optionChoice(HIDDEN_DEBUG_FUNCTIONS.values(), "...");
                    if (i != -1) {
                        executeHiddenDebugFunction(HIDDEN_DEBUG_FUNCTIONS.values()[i]);
                    }
                    break;
                }
            case TOGGLE_AUTO_UNIT:
                if (!infoObj.isOwnedBy(game.getPlayer(true))) {
                    infoObj.setOriginalOwner(game.getPlayer(true));
                    infoObj.setOwner(game.getPlayer(true));
                } else {
                    infoObj.setAiControlled(!infoObj.isAiControlled());
                }
                WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_COMPLETE, true);
                break;
            case EDIT_AI:
                break;
            case SAVE:
                Saver.save("test");
                break;
            case LOAD:
                Loader.loadGame("test.xml");
                break;
            case PAUSE:
                DC_Game.game.getLoop().setPaused(!DC_Game.game.getLoop().isPaused());
                break;
            case TOGGLE_OMNIVISION:
                omnivision = !omnivision;
                break;
            case AUTO_COMBAT:
                game.getPlayer(true).setAi(!game.getPlayer(true).isAi());
                WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_COMPLETE, true);
                break;
            case ADD_TEST_SPELLS:
                TestMasterContent.addTestActives(false, infoObj.getType(), true);
                break;
            case ADD_ALL_SPELLS:
                TestMasterContent.addTestActives(true, infoObj.getType(), true);
                break;
            case TOGGLE_GRAPHICS_TEST:
                DrawMasterStatic.GRAPHICS_TEST_MODE = !DrawMasterStatic.GRAPHICS_TEST_MODE;
                if (DrawMasterStatic.GRAPHICS_TEST_MODE) {
                    DrawMasterStatic.FULL_GRAPHICS_TEST_MODE = DialogMaster.confirm("Full test on?");
                } else {
                    DrawMasterStatic.FULL_GRAPHICS_TEST_MODE = false;
                }
                break;
            case TOGGLE_LOG:
                {
                    String e = ListChooser.chooseEnum(LOG_CHANNEL.class);
                    LogMaster.toggle(e);
                    break;
                }
            case TOGGLE_QUIET:
                quiet = !quiet;
                break;
            case TOGGLE_FREE_ACTIONS:
                TestMasterContent.toggleFree();
                break;
            case GOD_MODE:
                TestMasterContent.toggleImmortal();
                // game.getManager().refreshAll();
                break;
            case RESTART:
                // if (!altMode) {
                // if (DialogMaster.confirm("Select anew?")) {
                // FAST_DC.getLauncher().selectiveInit();
                // }
                // }
                game.getManager().getDeathMaster().killAllUnits(true, false, quiet);
                game.getBattleMaster().getSpawner().spawnCustomParty(true);
                game.getBattleMaster().getSpawner().spawnCustomParty(false);
                game.getManager().refreshAll();
                WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_COMPLETE, true);
                return func;
            case CLEAR:
                boolean respawn = isAltMode();
                game.getManager().getDeathMaster().killAllUnits(!isAltMode());
                if (respawn) {
                    // /respawn!
                    game.getBattleMaster().getSpawner().spawnCustomParty(true);
                    game.getBattleMaster().getSpawner().spawnCustomParty(false);
                }
                game.getManager().refreshAll();
                break;
            case KILL_ALL_UNITS:
                game.getManager().getDeathMaster().killAll(isAltMode());
                break;
            case ACTIVATE_UNIT:
                if (isAltMode()) {
                    getObj().modifyParameter(PARAMS.C_N_OF_ACTIONS, 100);
                }
                if (getObj().isMine()) {
                    game.getManager().setActivatingAction(null);
                    game.getManager().activeSelect(getObj());
                } else {
                    WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_COMPLETE, true);
                    WaitMaster.WAIT(1234);
                    getObj().modifyParameter(PARAMS.C_N_OF_ACTIONS, 100);
                }
                game.getVisionMaster().refresh();
                break;
            case ADD_ITEM:
                if (isAltMode()) {
                    TYPE = DC_TYPE.WEAPONS;
                } else {
                    TYPE = (DC_TYPE) DialogMaster.getChosenOption("Choose item type...", DC_TYPE.WEAPONS, DC_TYPE.ARMOR, DC_TYPE.ITEMS, DC_TYPE.JEWELRY);
                }
                if (isAltMode()) {
                    if (!selectWeaponType()) {
                        break;
                    }
                } else if (!selectType(TYPE)) {
                    break;
                }
                if (!selectTarget(ref)) {
                    selectedTarget = infoObj;
                }
                if (selectedTarget == null) {
                    break;
                }
                boolean quick = false;
                if (isAltMode()) {
                    quick = false;
                } else if (TYPE == DC_TYPE.ITEMS) {
                    quick = true;
                } else if (TYPE == DC_TYPE.WEAPONS) {
                    quick = DialogMaster.confirm("quick slot item?");
                }
                DC_HeroItemObj item = ItemFactory.createItemObj(selectedType, selectedTarget.getOwner(), game, ref, quick);
                if (!quick) {
                    if (TYPE != DC_TYPE.JEWELRY) {
                        selectedTarget.equip(item, TYPE == DC_TYPE.ARMOR ? ItemEnums.ITEM_SLOT.ARMOR : ItemEnums.ITEM_SLOT.MAIN_HAND);
                    }
                } else {
                    selectedTarget.addQuickItem((DC_QuickItemObj) item);
                }
                // selectedTarget.addItemToInventory(item);
                game.getManager().refreshGUI();
                break;
            case ADD_SPELL:
                if (!selectType(DC_TYPE.SPELLS)) {
                    break;
                }
                if (!selectTarget(ref)) {
                    selectedTarget = infoObj;
                }
                if (selectedTarget == null) {
                    break;
                }
                TestMasterContent.setTEST_LIST(TestMasterContent.getTEST_LIST() + selectedType.getName() + ";");
                selectedTarget.getSpells().add(new DC_SpellObj(selectedType, selectedTarget.getOwner(), game, selectedTarget.getRef()));
                game.getManager().refreshGUI();
                break;
            case ADD_SKILL:
            case ADD_ACTIVE:
                PROPERTY prop = G_PROPS.ACTIVES;
                DC_TYPE T = DC_TYPE.ACTIONS;
                if (func == DEBUG_FUNCTIONS.ADD_SKILL) {
                    prop = PROPS.SKILLS;
                    T = DC_TYPE.SKILLS;
                }
                String type = ListChooser.chooseType(T);
                if (type == null) {
                    break;
                }
                if (!new SelectiveTargeting(new Conditions(ConditionMaster.getTYPECondition(C_OBJ_TYPE.BF_OBJ))).select(ref)) {
                    break;
                }
                lastType = type;
                new AddBuffEffect(type + " hack", new ModifyPropertyEffect(prop, MOD_PROP_TYPE.ADD, type), new Formula("1")).apply(ref);
                if (func == DEBUG_FUNCTIONS.ADD_ACTIVE) {
                    infoObj.getActives().add(game.getActionManager().getAction(type, infoObj));
                    game.getActionManager().constructActionMaps(infoObj);
                }
                // instead of toBase()
                break;
            case ADD_PASSIVE:
                // same method
                infoObj.getPassives().add(AbilityConstructor.getPassive(ListChooser.chooseType(DC_TYPE.ABILS), infoObj));
                infoObj.activatePassives();
                break;
            case CHANGE_OWNER:
                // if already has, make permanent
                new AddBuffEffect("ownership hack", new OwnershipChangeEffect(), new Formula("1")).apply(ref);
                break;
            case END_TURN:
                game.getManager().setActivatingAction(null);
                WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_INPUT, null);
                return func;
            case KILL_UNIT:
                if (arg != null) {
                    arg.kill(infoObj, !isAltMode(), isAltMode());
                } else {
                    infoObj.kill(infoObj, !isAltMode(), isAltMode());
                }
                // .getInfoObj());
                break;
            case ADD_CHAR:
                summon(true, DC_TYPE.CHARS, ref);
                break;
            case ADD_OBJ:
                summon(null, DC_TYPE.BF_OBJ, new Ref(game));
                break;
            case ADD_UNIT:
                summon(true, DC_TYPE.UNITS, ref);
                break;
            case SET_WAVE_POWER:
                Integer forcedPower;
                forcedPower = DialogMaster.inputInt();
                if (forcedPower < 0) {
                    forcedPower = null;
                }
                ArenaBattleMaster a = (ArenaBattleMaster) game.getBattleMaster();
                a.getWaveAssembler().setForcedPower(forcedPower);
                break;
            case SPAWN_CUSTOM_WAVE:
                coordinate = getGame().getBattleFieldManager().pickCoordinate();
                ObjType waveType = ListChooser.chooseType_(DC_TYPE.ENCOUNTERS);
                Wave wave = new Wave(coordinate, waveType, game, ref, game.getPlayer(!isAltMode()));
                String value = new ListChooser(SELECTION_MODE.MULTIPLE, StringMaster.openContainer(wave.getProperty(PROPS.UNIT_TYPES)), DC_TYPE.UNITS).choose();
                wave.setProperty(PROPS.UNIT_TYPES, value);
                // PROPS.EXTENDED_PRESET_GROUP
                break;
            case SPAWN_PARTY:
                coordinate = getGame().getBattleFieldManager().pickCoordinate();
                ObjType party = ListChooser.chooseType_(DC_TYPE.PARTY);
                game.getBattleMaster().getSpawner().spawnCustomParty(coordinate, null, party);
                break;
            case SPAWN_WAVE:
                if (!isAltMode()) {
                    coordinate = getGame().getBattleFieldManager().pickCoordinate();
                } else {
                // FACING_DIRECTION side = new EnumChooser<FACING_DIRECTION>()
                // .choose(FACING_DIRECTION.class);
                // if (side== FACING_DIRECTION.NONE)
                // game.getBattleMaster().getSpawner().getPositioner().setForcedSide(side);
                }
                String typeName = ListChooser.chooseType(DC_TYPE.ENCOUNTERS);
                if (typeName == null) {
                    return func;
                }
                try {
                    game.getBattleMaster().getSpawner().spawnWave(typeName, game.getPlayer(ALT_AI_PLAYER), coordinate);
                } catch (Exception e) {
                    main.system.ExceptionMaster.printStackTrace(e);
                } finally {
                // game.getBattleMaster().getSpawner().getPositioner().setForcedSide(null);
                }
                game.getManager().refreshAll();
                break;
            case ADD_ENEMY_UNIT:
                summon(false, DC_TYPE.UNITS, new Ref(game));
                // game.getManager().refreshAll();
                break;
            case TOGGLE_ALT_AI:
                {
                    game.getPlayer(true).setAi(!game.getPlayer(true).isAi());
                    ALT_AI_PLAYER = !ALT_AI_PLAYER;
                    break;
                }
            case TOGGLE_DEBUG:
                {
                    game.setDebugMode(!game.isDebugMode());
                    Launcher.setDEBUG_MODE(!Launcher.isDEBUG_MODE_DEFAULT());
                    break;
                }
            case WAITER_INPUT:
                {
                    String input = DialogMaster.inputText("operation");
                    WAIT_OPERATIONS operation = new EnumMaster<WAIT_OPERATIONS>().retrieveEnumConst(WAIT_OPERATIONS.class, input);
                    if (operation == null) {
                        operation = new EnumMaster<WAIT_OPERATIONS>().retrieveEnumConst(WAIT_OPERATIONS.class, input, true);
                    }
                    if (operation == null) {
                        DialogMaster.error("no such operation");
                        return func;
                    }
                    input = DialogMaster.inputText("input");
                    WaitMaster.receiveInput(operation, input);
                }
            case REMOVE_HACKS:
                break;
            // break;
            case TOGGLE_LIGHTING:
                break;
            case TOGGLE_FOG:
                break;
            case GUI_EVENT:
                EmitterController.getInstance();
                String string = ListChooser.chooseEnum(GuiEventType.class);
                GuiEventManager.trigger(new EnumMaster<GuiEventType>().retrieveEnumConst(GuiEventType.class, string), null);
                break;
            case SFX_PLAY_LAST:
                EmitterController.getInstance();
                GuiEventManager.trigger(GuiEventType.SFX_PLAY_LAST, null);
                break;
            case SFX_ADD:
                EmitterController.getInstance();
                GuiEventManager.trigger(GuiEventType.CREATE_EMITTER, null);
                break;
            case SFX_ADD_RANDOM:
                EmitterController.getInstance().getInstance();
                GuiEventManager.trigger(GuiEventType.CREATE_EMITTER, true);
                break;
            case SFX_MODIFY:
                EmitterController.getInstance().modify();
                break;
            case SFX_SET:
                EmitterController.getInstance().setForActive();
                break;
            case SFX_SAVE:
                EmitterController.getInstance().save();
                break;
        }
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    } finally {
        debugFunctionRunning = false;
    }
    if (isResetRequired(func))
        reset();
    if (transmitted) {
    // String transmittedData = lastType + StringMaster.NET_DATA_SEPARATOR + infoObj
    // + StringMaster.NET_DATA_SEPARATOR + data + StringMaster.NET_DATA_SEPARATOR
    // + ref;
    // game.getCommunicator().transmitDebugFunction(func, transmittedData);
    }
    return func;
}
Also used : DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) ListChooser(main.swing.generic.components.editors.lists.ListChooser) Unit(eidolons.entity.obj.unit.Unit) Conditions(main.elements.conditions.Conditions) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Formula(main.system.math.Formula) DC_Cell(eidolons.entity.obj.DC_Cell) DC_SpellObj(eidolons.entity.active.DC_SpellObj) ArenaBattleMaster(eidolons.game.battlecraft.logic.battle.arena.ArenaBattleMaster) ModifyPropertyEffect(eidolons.ability.effects.common.ModifyPropertyEffect) GuiEventType(main.system.GuiEventType) DC_TYPE(main.content.DC_TYPE) PROPERTY(main.content.values.properties.PROPERTY) WAIT_OPERATIONS(main.system.threading.WaitMaster.WAIT_OPERATIONS) Coordinates(main.game.bf.Coordinates) SelectiveTargeting(main.elements.targeting.SelectiveTargeting) Wave(eidolons.game.battlecraft.logic.battle.arena.Wave) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) EnumMaster(main.system.auxiliary.EnumMaster) LOG_CHANNEL(main.system.auxiliary.log.LogMaster.LOG_CHANNEL) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) File(java.io.File)

Example 24 with EnumMaster

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

the class CharacterCreator method saveAs.

public static void saveAs(ObjType type, boolean preset) {
    // choose new name
    boolean newVersion = false;
    // if (DataManager.isTypeName(name)) {
    new Thread(new Runnable() {

        public void run() {
            // This name has already been
            DialogMaster.ask(// This name has already been
            "Save as...", // do?
            true, "Overwrite", "New Hero", "New Version");
        }
    }).start();
    Boolean result = (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.OPTION_DIALOG);
    String name = type.getName();
    if (result == null) {
        name = NameMaster.appendVersionToName(name);
        newVersion = true;
    } else if (!result) {
        // TODO what if it's not the one?
        name = getHeroName(getHero());
        if (name == null) {
            return;
        }
        // saveAs(type, preset);
        return;
    }
    // }
    ObjType newType = new ObjType(type);
    newType.setProperty(G_PROPS.NAME, name);
    Simulation.getGame().initType(newType);
    if (!partyMode) {
        addHero(newType);
    }
    if (preset && !newVersion) {
        newType.setGroup(StringMaster.PRESET, false);
        String value = ListChooser.chooseEnum(CUSTOM_HERO_GROUP.class);
        if (value != null) {
            newType.setProperty(G_PROPS.CUSTOM_HERO_GROUP, value);
        }
        WORKSPACE_GROUP ws = getDefaultWorkspaceGroup();
        String string = ListChooser.chooseEnum(WORKSPACE_GROUP.class);
        if (string != null) {
            ws = new EnumMaster<WORKSPACE_GROUP>().retrieveEnumConst(WORKSPACE_GROUP.class, string);
        }
        newType.setWorkspaceGroup(ws);
    } else {
        newType.setGroup(getFilterGroup(), false);
        newType.setProperty(G_PROPS.CUSTOM_HERO_GROUP, StringMaster.getWellFormattedString(getDefaultSpecGroup().name()));
        newType.setWorkspaceGroup(getDoneWorkspaceGroup());
    // automatic ?
    }
    save(newType);
    DataManager.addType(newType);
    if (newVersion) {
        heroManager.applyChangedType(heroManager.getHero(type), newType);
    }
}
Also used : WORKSPACE_GROUP(main.content.enums.system.MetaEnums.WORKSPACE_GROUP) ObjType(main.entity.type.ObjType) EnumMaster(main.system.auxiliary.EnumMaster)

Example 25 with EnumMaster

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

the class AddSpecialEffects method applyThis.

@Override
public boolean applyThis() {
    if (case_type == null) {
        case_type = new EnumMaster<SPECIAL_EFFECTS_CASE>().retrieveEnumConst(SPECIAL_EFFECTS_CASE.class, caseName);
    }
    if (effects == null) {
        effects = new AbilityEffect(abilName).getEffects();
    }
    if (!(ref.getTargetObj() instanceof DC_Obj)) {
        return false;
    }
    DC_Obj targetObj = (DC_Obj) ref.getTargetObj();
    targetObj.addSpecialEffect(case_type, effects);
    if (triggerEffect == null) {
        triggerEffect = getTriggerEffect();
        if (triggerEffect != null) {
            triggerEffect.apply(ref);
        }
    }
    return true;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) EnumMaster(main.system.auxiliary.EnumMaster) AbilityEffect(eidolons.ability.effects.containers.AbilityEffect)

Aggregations

EnumMaster (main.system.auxiliary.EnumMaster)28 ObjType (main.entity.type.ObjType)10 Unit (eidolons.entity.obj.unit.Unit)4 LINK_VARIANT (eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT)3 ArrayList (java.util.ArrayList)3 PROPERTY (main.content.values.properties.PROPERTY)3 ListChooser (main.swing.generic.components.editors.lists.ListChooser)3 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)2 RULE_SCOPE (eidolons.game.battlecraft.rules.RuleMaster.RULE_SCOPE)2 GAMEPLAY_OPTION (eidolons.system.options.GameplayOptions.GAMEPLAY_OPTION)2 MATERIAL (main.content.enums.entity.ItemEnums.MATERIAL)2 QUALITY_LEVEL (main.content.enums.entity.ItemEnums.QUALITY_LEVEL)2 Coordinates (main.game.bf.Coordinates)2 Color (com.badlogic.gdx.graphics.Color)1 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Align (com.badlogic.gdx.utils.Align)1 DC_Effect (eidolons.ability.effects.DC_Effect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 AbilityEffect (eidolons.ability.effects.containers.AbilityEffect)1 RayEffect (eidolons.ability.effects.containers.customtarget.RayEffect)1