Search in sources :

Example 1 with Party

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;
}
Also used : Party(eidolons.client.cc.logic.party.Party) ObjType(main.entity.type.ObjType) UnitData(eidolons.game.battlecraft.logic.dungeon.universal.UnitData)

Example 2 with 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;
}
Also used : Party(eidolons.client.cc.logic.party.Party) Unit(eidolons.entity.obj.unit.Unit)

Example 3 with Party

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);
    }
}
Also used : Party(eidolons.client.cc.logic.party.Party) ObjType(main.entity.type.ObjType)

Example 4 with Party

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;
}
Also used : Party(eidolons.client.cc.logic.party.Party) Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit)

Example 5 with Party

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;
// }
}
Also used : Party(eidolons.client.cc.logic.party.Party) DC_Player(eidolons.game.battlecraft.logic.battle.universal.DC_Player)

Aggregations

Party (eidolons.client.cc.logic.party.Party)10 Unit (eidolons.entity.obj.unit.Unit)3 ObjType (main.entity.type.ObjType)3 UnitData (eidolons.game.battlecraft.logic.dungeon.universal.UnitData)2 Coordinates (main.game.bf.Coordinates)2 DC_Player (eidolons.game.battlecraft.logic.battle.universal.DC_Player)1 MacroParty (eidolons.game.module.adventure.entity.MacroParty)1 Faction (eidolons.game.module.adventure.faction.Faction)1 ArrayList (java.util.ArrayList)1 Obj (main.entity.obj.Obj)1