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;
}
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));
}
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;
}
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);
}
}
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);
}
}
Aggregations