use of eidolons.game.module.adventure.MacroRef in project Eidolons by IDemiurge.
the class EditorManager method create.
private static <E extends MapActor> MacroObj create(ObjType type) {
MacroRef ref = new MacroRef(MacroGame.game);
ref.setPlayer(MacroGame.game.getPlayerFaction().getOwner());
ref.setPlayer(MacroGame.game.getFactions().get(0).getOwner());
if (type.getOBJ_TYPE_ENUM() == MACRO_OBJ_TYPES.PLACE)
return new Place(MacroGame.game, type, ref);
if (type.getOBJ_TYPE_ENUM() == DC_TYPE.PARTY)
try {
MacroParty party = new MacroParty(type, MacroGame.game, ref);
party.getParty().initMembers();
return party;
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
return null;
}
use of eidolons.game.module.adventure.MacroRef in project Eidolons by IDemiurge.
the class MacroAction method activate.
@Override
public boolean activate() {
MacroRef ref = new MacroRef(MacroManager.getSelectedPartyMember());
ref.setParty(MacroManager.getActiveParty());
return activatedOn(ref);
}
use of eidolons.game.module.adventure.MacroRef in project Eidolons by IDemiurge.
the class MacroActionManager method getAction.
private static MacroAction getAction(String actionName, Obj obj) {
MacroAction action = actionMap.get(actionName);
if (action != null) {
return action;
}
MacroRef ref = new MacroRef(obj);
// objType.initType(); aut0
// TODO DataManager.getType(actionName, MACRO_OBJ_TYPES.MAP_ACTIONS);
ObjType objType = null;
if (objType == null)
objType = getBaseType();
action = new MacroAction(objType, ref);
actionMap.put(actionName, action);
return action;
}
use of eidolons.game.module.adventure.MacroRef in project Eidolons by IDemiurge.
the class MacroActionManager method generateMacroActions.
public static void generateMacroActions() {
// different entities
for (MACRO_MODES m : MACRO_MODES.values()) {
MacroAction action = new MacroAction(getBaseType(), new MacroRef(), m);
actionMap.put((m.toString()), action);
}
for (MACRO_PARTY_ACTIONS m : MACRO_PARTY_ACTIONS.values()) {
MacroAction action = new MacroAction(getBaseType(), new MacroRef(), m);
actionMap.put((m.toString()), action);
}
// can this work for real setting with many parties active?
}
use of eidolons.game.module.adventure.MacroRef in project Eidolons by IDemiurge.
the class TownInitializer method initShops.
public static void initShops(Town town) {
MacroRef ref = MacroGame.getGame().getRef().getCopy();
int i = 0;
int max = town.getLevel();
if (max == 0) {
max = default_shop_limit;
}
int min = town.getLevel() / 2;
if (min == 0) {
min = default_shop_min;
}
for (String shopTypeName : StringMaster.open(town.getProperty(MACRO_PROPS.SHOPS))) {
i++;
if (i > max) {
break;
}
ObjType type = new ObjType(DataManager.getType(shopTypeName, MACRO_OBJ_TYPES.SHOP));
type.initType();
if (type == null) {
type = getGenericShopType(shopTypeName);
}
addShop(town, ref, type);
}
if (i < min) {
// generate by preferred type/level/mod
Map<SHOP_TYPE, Integer> typeMap = new RandomWizard<SHOP_TYPE>().constructWeightMap(town.getProperty(MACRO_PROPS.SHOP_TYPE), SHOP_TYPE.class, MACRO_OBJ_TYPES.SHOP);
Map<SHOP_MODIFIER, Integer> modMap = new RandomWizard<SHOP_MODIFIER>().constructWeightMap(town.getProperty(MACRO_PROPS.SHOP_MODIFIER), SHOP_MODIFIER.class, MACRO_OBJ_TYPES.SHOP);
while (true) {
SHOP_TYPE shopType = new RandomWizard<SHOP_TYPE>().getObjectByWeight(typeMap);
SHOP_MODIFIER shopMode = new RandomWizard<SHOP_MODIFIER>().getObjectByWeight(modMap);
ObjType type = getGenericShopType(shopType.toString());
type.setProperty(MACRO_PROPS.SHOP_MODIFIER, shopMode.toString());
addShop(town, ref, type);
}
}
}
Aggregations