Search in sources :

Example 1 with GameLauncher

use of eidolons.game.core.launch.GameLauncher in project Eidolons by IDemiurge.

the class Crawler method main.

public static void main(String[] args) {
    FAST_DC.FAST_MODE = false;
    ExplorationMaster.setTestMode(true);
    DC_Engine.jarInit();
    FontMaster.init();
    GuiManager.init();
    int index = DialogMaster.optionChoice(launch_options, "Choose the type of Eidolons game you want to launch...");
    List<String> parts = null;
    if (index == 0) {
        String data = FileManager.readFile(launchDataPath);
        parts = StringMaster.openContainer(data);
        index = 1;
    }
    if (index == 2) {
    // random  = true;
    // parts = Collections.nCopies(2, "");
    } else if (index == 3) {
        FAST_DC.main(new String[] { "" + (Arrays.asList(PresetLauncher.LAUNCH_OPTIONS)).indexOf(StringMaster.getWellFormattedString(LAUNCH.EXPLORATION.toString())) });
        return;
    } else if (index == 4) {
        FAST_DC.main(new String[] { "" + (Arrays.asList(PresetLauncher.LAUNCH_OPTIONS)).indexOf(StringMaster.getWellFormattedString(LAUNCH.EXPLORATION_TEST.toString())) });
        return;
    }
    DemoLauncher.main(null);
    DC_Engine.mainMenuInit();
    String dungeon = parts == null ? "crawl" + new FileChooser(PathFinder.getDungeonLevelFolder() + "crawl").launch("", "") : parts.get(0);
    launchData += dungeon;
    dungeon = StringMaster.removePreviousPathSegments(dungeon, PathFinder.getDungeonLevelFolder());
    ScreenData data = new ScreenData(ScreenType.BATTLE, dungeon);
    GameLauncher launcher = new GameLauncher(GAME_SUBCLASS.TEST);
    Ref ref = new Ref();
    Condition conditions = new Conditions();
    launcher.PLAYER_PARTY = parts == null ? ListChooser.chooseType(DC_TYPE.CHARS, ref, conditions) : parts.get(1);
    launchData += StringMaster.SEPARATOR + launcher.PLAYER_PARTY;
    launcher.setDungeon(dungeon);
    launcher.PARTY_CODE = CODE.PRESET;
    launcher.ENEMY_CODE = CODE.NONE;
    GuiEventManager.trigger(GuiEventType.SWITCH_SCREEN, data);
    DC_Engine.gameStartInit();
    DC_Game game = launcher.initDC_Game();
    game.start(true);
    if (!StringMaster.isEmpty(launchData)) {
        FileManager.write(launchData, launchDataPath);
    }
}
Also used : Condition(main.elements.conditions.Condition) Ref(main.entity.Ref) FileChooser(main.swing.generic.components.editors.FileChooser) GameLauncher(eidolons.game.core.launch.GameLauncher) DC_Game(eidolons.game.core.game.DC_Game) Conditions(main.elements.conditions.Conditions) ScreenData(eidolons.libgdx.screens.ScreenData)

Example 2 with GameLauncher

use of eidolons.game.core.launch.GameLauncher in project Eidolons by IDemiurge.

the class AiTrainer method runAiScenario.

private AiTrainingResult runAiScenario(String presetPath) {
    if (!AiTrainingRunner.evolutionTestMode) {
        RandomWizard.setAveraged(parameters.deterministic);
        if (parameters.getEnvironmentType() == TRAINING_ENVIRONMENT.PRESET) {
            new GameLauncher(GAME_SUBCLASS.TEST).launchPreset(presetPath);
        } else if (parameters.getEnvironmentType() == TRAINING_ENVIRONMENT.SAVE) {
            Loader.setPendingLoadPath(presetPath);
            DC_Game game = new GameLauncher(GAME_SUBCLASS.TEST).initDC_Game();
            game.start(true);
        } else if (parameters.getEnvironmentType() == TRAINING_ENVIRONMENT.DUNGEON_LEVEL) {
            GameLauncher a = new GameLauncher(GAME_SUBCLASS.SCENARIO);
            if (StringMaster.isEmpty(parameters.getPartyData())) {
                parameters.setPartyData(getDefaultPartyData());
            }
            a.PLAYER_PARTY = parameters.getPartyData();
            if (StringMaster.isEmpty(parameters.getDungeonData())) {
                parameters.setDungeonData(getDefaultDungeonData());
            }
            a.setDungeon(parameters.getDungeonData());
            DC_Game game = a.initGame();
            game.start(true);
        }
    }
    DC_Game.game.getAiManager().getPriorityProfileManager().setPriorityProfile(trainee, profile);
    boolean result = (boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.GAME_FINISHED);
    if (!result) {
        throw new RuntimeException();
    }
    return evaluateResult(profile, parameters, criteria);
}
Also used : GameLauncher(eidolons.game.core.launch.GameLauncher) DC_Game(eidolons.game.core.game.DC_Game)

Aggregations

DC_Game (eidolons.game.core.game.DC_Game)2 GameLauncher (eidolons.game.core.launch.GameLauncher)2 ScreenData (eidolons.libgdx.screens.ScreenData)1 Condition (main.elements.conditions.Condition)1 Conditions (main.elements.conditions.Conditions)1 Ref (main.entity.Ref)1 FileChooser (main.swing.generic.components.editors.FileChooser)1