use of eidolons.game.core.game.DC_Game in project Eidolons by IDemiurge.
the class Simulation method init.
public static void init(boolean testmode) {
game = new DC_Game(true);
game.init();
if (testmode) {
return;
}
CharacterCreator.setGame(getGame());
CharacterCreator.init();
}
use of eidolons.game.core.game.DC_Game in project Eidolons by IDemiurge.
the class CombatScriptExecutor method doUnitOperation.
private boolean doUnitOperation(COMBAT_SCRIPT_FUNCTION function, Ref ref, String[] args) {
int i = 0;
Unit unit = (Unit) ref.getObj(args[0]);
if (unit == null) {
String name = args[i];
if (DataManager.isTypeName(name))
i++;
else
name = null;
if (unit == null) {
Boolean power = null;
Boolean distance = null;
Boolean ownership = null;
unit = ((DC_Game) ref.getGame()).getMaster().getUnitByName(name, ref, ownership, distance, power);
}
}
// options - annihilate, ...
switch(function) {
case COMMENT:
return doComment(unit, args[i]);
case REMOVE:
return doRemove(unit);
case KILL:
return doKill(unit);
}
return false;
}
use of eidolons.game.core.game.DC_Game in project Eidolons by IDemiurge.
the class Loader method loadNewGame.
public static DC_Game loadNewGame(String savePath) {
String data = FileManager.readFile(savePath);
DC_Game game = GameFactory.createGame(GAME_SUBCLASS.TEST);
Node dungeonNode = XML_Converter.findNode(data, Saver.DUNGEON_NODE);
initDungeon(dungeonNode);
game.init();
// initFlags(); dungeon is not set!
game.battleInit();
loadGame(data);
game.start(true);
return game;
}
use of eidolons.game.core.game.DC_Game in project Eidolons by IDemiurge.
the class Loader method createObjects.
private static List<Obj> createObjects(List<String> objectNodes) {
DC_Game game = DC_Game.game;
List<Obj> objects = new ArrayList<>();
// TODO ID ORDER MUST BE PRESERVED! put in parameter?
for (String typesNode : objectNodes) {
Document node = XML_Converter.getDoc(typesNode);
DC_TYPE TYPE = DC_TYPE.getType(node.getNodeName());
for (Node subNode : XML_Converter.getNodeList(node)) {
String sub = XML_Converter.getStringFromXML(subNode);
game.setIdManager(new DC_IdManager(game));
Map<PROPERTY, String> props = getPropsFromNode(sub);
Map<PARAMETER, String> params = getParamsFromNode(sub);
ObjType type = DataManager.getType(subNode.getNodeName(), TYPE);
// preset ID?! init containers by id... including buffs; but first create them
Ref ref = new Ref(game);
Node refNode = XML_Converter.findNode(sub, Saver.OBJ_NODE);
if (refNode != null)
for (String substring : StringMaster.open(refNode.getTextContent())) {
ref.setValue(KEYS.valueOf(substring.split("=")[0].toUpperCase()), substring.split("=")[1]);
}
String ownerName = null;
DC_Player owner = game.getBattleMaster().getPlayerManager().getPlayer(// property?
ownerName);
if (owner == null) {
owner = DC_Player.NEUTRAL;
}
Coordinates c = new Coordinates(params.get(G_PARAMS.POS_X) + "-" + params.get(G_PARAMS.POS_Y));
Obj object = createObj(type, c.x, c.y, owner, game, ref);
object.getPropMap().putAll(props);
object.getParamMap().putAll(params);
object.setId(StringMaster.getInteger(props.get(G_PROPS.ID)));
objects.add(object);
init(object);
}
}
return objects;
}
use of eidolons.game.core.game.DC_Game in project Eidolons by IDemiurge.
the class XlsMaster method main.
public static void main(String[] args) {
String types = "units;";
for (DC_TYPE type : TYPES) {
types += type.getName() + ";";
}
CoreEngine.setSelectivelyReadTypes(types);
// args[0];
String path = "Y:\\Google Drive\\Project Eidolons\\content\\";
String filename = path + "content.xls";
DC_Engine.mainMenuInit();
int i = 0;
HSSFWorkbook workbook = new HSSFWorkbook();
new DC_Game();
for (DC_TYPE TYPE : TYPES) {
PARAMS[] params = PARAM_ARRAYS[i];
String[] formulas = FORMULA_ARRAYS[i];
createSheet(workbook, TYPE, GROUPS_ARRAYS[i], params, formulas);
i++;
}
try {
FileOutputStream fileOut = new FileOutputStream(filename);
workbook.write(fileOut);
fileOut.close();
} catch (IOException e) {
main.system.ExceptionMaster.printStackTrace(e);
}
System.out.println("Content excel file has been generated!");
}
Aggregations