Search in sources :

Example 1 with DC_Game

use of eidolons.game.core.game.DC_Game in project Eidolons by IDemiurge.

the class FearsomeEffect method applyThis.

@Override
public boolean applyThis() {
    super.applyThis();
    Formula buffer = new Formula(formula.toString());
    formula = formula.getAppendedByFactor(-0.5);
    try {
        for (Unit unit : ((DC_Game) game).getUnits()) {
            if (!friendlyFire) {
                if (unit.getOwner().equals(ref.getSourceObj().getOwner())) {
                    continue;
                }
            }
            if (!unit.checkInSightForUnit((Unit) ref.getSourceObj())) {
                continue;
            }
            ref.setTarget(unit.getId());
            super.applyThis();
        }
    } catch (Exception ignored) {
    } finally {
        formula = buffer;
    }
    return true;
}
Also used : Formula(main.system.math.Formula) DC_Game(eidolons.game.core.game.DC_Game) Unit(eidolons.entity.obj.unit.Unit)

Example 2 with DC_Game

use of eidolons.game.core.game.DC_Game in project Eidolons by IDemiurge.

the class PartyHelper method addCreepParty.

public static void addCreepParty(Wave wave) {
    DC_Game game = wave.getGame();
    Unit leader = wave.getLeader();
    String name = wave.getName();
    List<Unit> units = wave.getUnits();
    ObjType newType = new ObjType(game);
    wave.setParty(addCreepParty(leader, name, units, newType));
}
Also used : ObjType(main.entity.type.ObjType) DC_Game(eidolons.game.core.game.DC_Game) Unit(eidolons.entity.obj.unit.Unit)

Example 3 with DC_Game

use of eidolons.game.core.game.DC_Game in project Eidolons by IDemiurge.

the class VisibilityCondition method check.

@Override
public boolean check(Ref ref) {
    if (!(ref.getObj(KEYS.MATCH) instanceof BfObj)) {
        return false;
    }
    DC_Obj match = (DC_Obj) ref.getObj(KEYS.MATCH);
    boolean result = false;
    if (this.match == null && this.source == null) {
        if (p_vision != null) {
            PLAYER_VISION playerVision = match.getActivePlayerVisionStatus();
            if (game.getManager().getActiveObj().isMine() != ref.getSourceObj().isMine()) {
                if (ref.getSourceObj().isMine()) {
                    playerVision = match.getPlayerVisionStatus(false);
                } else {
                // TODO for enemy unit on player's unit...
                }
            }
            if (playerVision == p_vision) {
                return true;
            }
        }
        UNIT_VISION visionStatus = match.getUnitVisionStatus();
        if (!ref.getSourceObj().isActiveSelected()) {
            visionStatus = match.getGame().getVisionMaster().getSightMaster().getUnitVisibilityStatus(match, (Unit) ref.getSourceObj());
        }
        return visionStatus.isSufficient(u_vision);
    }
    if (p_vision != null) {
        Unit unit = (Unit) ref.getObj(source);
        result = unit.getActivePlayerVisionStatus() == p_vision;
    } else if (u_vision != null) {
        match = (DC_Obj) ref.getObj(this.match);
        // if (((DC_Game) game).getManager().isAI_Turn()) { what's the idea?
        Unit activeObj = (Unit) ref.getObj(source);
        result = ((DC_Game) game).getVisionMaster().getUnitVisibilityStatus(match, activeObj).isSufficient(u_vision);
    // }
    }
    return result;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) PLAYER_VISION(main.content.enums.rules.VisionEnums.PLAYER_VISION) UNIT_VISION(main.content.enums.rules.VisionEnums.UNIT_VISION) BfObj(main.entity.obj.BfObj) DC_Game(eidolons.game.core.game.DC_Game) Unit(eidolons.entity.obj.unit.Unit)

Example 4 with DC_Game

use of eidolons.game.core.game.DC_Game 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 5 with DC_Game

use of eidolons.game.core.game.DC_Game in project Eidolons by IDemiurge.

the class Launcher method launchDC.

public static void launchDC(String partyName, boolean forceBattleInit) {
    // initSave(Launcher.getLoadPath());
    /*
         * initObjectString buffs and dynamic params non-bf objects - items,
		 */
    DC_Game game = Eidolons.game;
    try {
        initFullData();
        boolean first = false;
        if (game == null) {
            first = true;
            DC_Engine.gameInit();
        }
        DemoLauncher.main(new String[] {});
        ScreenData data = new ScreenData(ScreenType.BATTLE, "Loading...");
        GuiEventManager.trigger(GuiEventType.SWITCH_SCREEN, data);
        Eidolons.initScenario(new ScenarioMetaMaster(ScenarioLauncher.CRAWL));
        try {
            Eidolons.mainGame.getMetaMaster().getGame().dungeonInit();
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
        // GdxLauncher.main(new String[]{});
        game = Simulation.getGame();
        if (game == null) {
            game = new DC_Game(false);
        }
        game.init();
        game.setSimulation(true);
        CharacterCreator.getHeroManager().prebattleCleanSave();
        game.setSimulation(false);
        game.setDebugMode(isDEBUG_MODE_DEFAULT());
        if (CharacterCreator.isArcadeMode()) {
            PartyHelper.initArcade();
        }
        PartyHelper.getParty().setGame(game);
        if (forceBattleInit || !game.isBattleInit()) {
            game.battleInit();
        }
        game.start(first);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
        game.setSimulation(true);
    }
    // setView(VIEWS.DC);
    try {
        createGame();
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
}
Also used : ScenarioMetaMaster(eidolons.game.battlecraft.logic.meta.scenario.ScenarioMetaMaster) DC_Game(eidolons.game.core.game.DC_Game) ScreenData(eidolons.libgdx.screens.ScreenData)

Aggregations

DC_Game (eidolons.game.core.game.DC_Game)14 Unit (eidolons.entity.obj.unit.Unit)5 Ref (main.entity.Ref)3 DC_SpellObj (eidolons.entity.active.DC_SpellObj)2 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)2 DC_JewelryObj (eidolons.entity.item.DC_JewelryObj)2 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)2 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)2 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)2 DC_FeatObj (eidolons.entity.obj.attach.DC_FeatObj)2 GameLauncher (eidolons.game.core.launch.GameLauncher)2 ScreenData (eidolons.libgdx.screens.ScreenData)2 DC_TYPE (main.content.DC_TYPE)2 Obj (main.entity.obj.Obj)2 ObjType (main.entity.type.ObjType)2 Node (org.w3c.dom.Node)2 PARAMS (eidolons.content.PARAMS)1 DC_IdManager (eidolons.entity.DC_IdManager)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 DC_Player (eidolons.game.battlecraft.logic.battle.universal.DC_Player)1