use of eidolons.client.cc.logic.party.Party in project Eidolons by IDemiurge.
the class ScenarioPartyManager method initPlayerParty.
@Override
public Party initPlayerParty() {
if (!getMaster().getMetaGame().isPartyRespawn()) {
party = Eidolons.getParty();
return party;
}
// preset
// choice
// already as Unit?
ObjType type = getMetaGame().getScenario().getPartyType();
randomOneHero = OptionsMaster.getGameplayOptions().getBooleanValue(GAMEPLAY_OPTION.RANDOM_HERO);
chooseOneHero = !randomOneHero;
if (type == null) {
String string = getMetaGame().getScenario().getProperty(PROPS.SCENARIO_PARTY);
type = new ObjType("dummy", DC_TYPE.PARTY);
type.setProperty(PROPS.MEMBERS, string);
} else
type = new ObjType(type);
if (getGame().getMetaMaster().getPartyManager().isRandomOneHero() || getGame().getMetaMaster().getPartyManager().isChooseOneHero()) {
List<String> members = StringMaster.openContainer(type.getProperty(PROPS.MEMBERS));
if (getGame().getMetaMaster().getPartyManager().isRandomOneHero() || members.size() == 1) {
String hero = new RandomWizard<String>().getRandomListItem(members);
type.setProperty(PROPS.MEMBERS, hero);
} else {
// for restart
String hero = selectedHero;
if (hero == null)
hero = chooseHero(members);
if (hero == null) {
// aborted
return null;
}
type.setProperty(PROPS.MEMBERS, hero);
}
}
party = new Party(type);
// if (party.getNextMission().isEmpty()) {
// String missions = StringMaster.joinList(getMetaGame().getScenario().getAvailableMissions());
// party.setProperty(PROPS.PARTY_MISSIONS_NEXT,
// missions
// StringMaster.openContainer(getMetaGame().getScenario().
// getProperty(PROPS.SCENARIO_MISSIONS)).get(0)
// , true);
// }
getGame().getState().addObject(party);
getGame().getDataKeeper().addUnitData(new UnitData(party));
party.setProperty(PROPS.PARTY_MISSION, StringMaster.openContainer(getMetaGame().getScenario().getProperty(PROPS.SCENARIO_MISSIONS)).get(0), true);
return party;
}
use of eidolons.client.cc.logic.party.Party in project Eidolons by IDemiurge.
the class PartyHelper method addCreepParty.
public static Party addCreepParty(Unit leader, String name, List<Unit> units, ObjType newType) {
newType.setName(name);
Party p = createParty(newType, leader);
for (Unit unit : units) {
p.addMember(unit);
}
parties.add(p);
return p;
}
use of eidolons.client.cc.logic.party.Party in project Eidolons by IDemiurge.
the class PartyHelper method savePartyAs.
/**
* @param arcade true for New Branch in arcade mode, false for Export Party
* from anywhere
*/
public static void savePartyAs(boolean arcade, boolean auto) {
String newName = party.getName();
if (!arcade) {
newName = DialogMaster.inputText(PARTY_NAME_TIP, party.getName());
}
if (newName == null) {
return;
}
if (auto) {
if (!newName.contains(StringMaster.ARCADE)) {
newName = newName + " " + StringMaster.ARCADE;
}
}
if (!auto) {
if (DataManager.isTypeName(newName) && !party.getName().equals(newName)) {
if (!newName.contains(StringMaster.ARCADE)) {
newName = newName + " " + StringMaster.ARCADE;
}
Loop.startLoop(97);
int i = 2;
while (!Loop.loopEnded()) {
if (DataManager.isTypeName(newName + "-" + i)) {
continue;
}
newName = newName + "-" + i;
break;
}
if (!checkPartyName(newName)) {
DialogMaster.error("Invalid name!");
return;
}
}
}
// save old party
saveParty();
ObjType newType = new ObjType(party.getType());
Simulation.getGame().initType(newType);
if (arcade) {
party.setType(newType);
party.setProperty(G_PROPS.GROUP, StringMaster.ARCADE, true);
getParty().setName(newName);
saveParty();
} else {
Party exportedParty = newParty(newType);
exportedParty.setProperty(G_PROPS.GROUP, StringMaster.PRESET, true);
exportedParty.setName(newName);
saveParty(exportedParty, true);
}
}
use of eidolons.client.cc.logic.party.Party in project Eidolons by IDemiurge.
the class LocationSpawner method spawn.
@Override
public List<Unit> spawn(UnitData data, DC_Player player, SPAWN_MODE mode) {
if (data.getValue(PARTY_VALUE.MEMBERS) != null) {
String units = data.getValue(PARTY_VALUE.MEMBERS).replace(DataUnitFactory.getContainerSeparator(UnitData.FORMAT), "");
if (FileManager.isFile(units))
return spawnUnitGroup(player.isMe(), units);
}
if (player.isMe() && PresetMaster.getPreset() == null && getGame().getMetaMaster() != null) {
Party party = getGame().getMetaMaster().getPartyManager().getParty();
if (party == null) {
return new LinkedList<>();
}
List<String> list = ListMaster.toNameList(party.getMembers());
getPositioner().setMaxSpacePercentageTaken(50);
List<Coordinates> coords = getPositioner().getPlayerPartyCoordinates(list);
Iterator<Coordinates> iterator = coords.iterator();
for (Unit member : party.getMembers()) {
if (!iterator.hasNext()) {
main.system.auxiliary.log.LogMaster.log(1, "Spawn failed: Coordinates: " + coords + "; Units" + list);
break;
}
member.setCoordinates(iterator.next());
member.setConstructed(false);
getGame().getState().addObject(member);
member.setOriginalOwner(player);
member.setOwner(player);
member.setFacing(getFacingAdjuster().getPartyMemberFacing(member));
applyStartBonuses(member);
// what else should be done to *spawn*?
}
} else {
super.spawn(data, player, mode);
}
return null;
}
use of eidolons.client.cc.logic.party.Party in project Eidolons by IDemiurge.
the class Spawner method spawnCustomParty.
public void spawnCustomParty(boolean me, String partyData) {
DC_Player player = game.getPlayer(me);
if (BooleanMaster.isTrue(me)) {
Party party = PartyHelper.getParty();
if (party != null) {
DC_SoundMaster.playEffectSound(SOUNDS.READY, party.getLeader());
spawnPlayerParty(party, partyData);
return;
}
}
if (!partyData.contains(DC_ObjInitializer.COORDINATES_OBJ_SEPARATOR)) {
partyData = DC_ObjInitializer.convertVarStringToObjCoordinates(partyData);
}
UnitData data = generateData(partyData, player, null);
spawn(data, player, SPAWN_MODE.PARTY);
// List<MicroObj> list = DC_ObjInitializer.processUnitDataString(player, partyData, game);
// if (!ListMaster.isNotEmpty(list)) {
// return;
// }
}
Aggregations