Search in sources :

Example 6 with Character

use of de.gg.game.model.entities.Character in project ProjektGG by eskalon.

the class CharacterBehaviour method getImpeachmentVoteOption.

private static int getImpeachmentVoteOption(short characterId, ImpeachmentBallot matter, GameSession session) {
    int tmp = -20;
    short characterToImpeachId = matter.getPos().getCurrentHolder();
    Character character = session.getWorld().getCharacter(characterId);
    NPCCharacterTrait trait = character.getNPCTrait();
    if (characterId == characterToImpeachId) {
        tmp = 150;
    } else {
        int opinion = getOpinionOfAnotherCharacter(characterToImpeachId, characterId, session);
        tmp += opinion;
        int posLevel = matter.getType().getLevel();
        if (trait != null) {
            // Ambition
            if (character.getPosition().getLevel() + 1 == posLevel)
                tmp += trait.getAmbitionDecisionModifier() - 15;
            // Loyalty
            if (opinion >= 55)
                tmp += trait.getGeneralLoyaltyDecisionModifier();
        }
    }
    return tmp < 0 ? characterToImpeachId : -1;
}
Also used : NPCCharacterTrait(de.gg.game.model.types.NPCCharacterTrait) Character(de.gg.game.model.entities.Character)

Example 7 with Character

use of de.gg.game.model.entities.Character in project ProjektGG by eskalon.

the class ElectionBallot method processVoteResult.

@Override
public void processVoteResult(BallotResults result, World world) {
    // Reputation & opinion effects
    for (Entry<Short, Integer> e : result.getIndividualVotes().entrySet()) {
        Character voter = world.getCharacter(e.getKey());
        for (BallotOption option : this.getOptions()) {
            if (option.getValue() == e.getValue()) {
                voter.addOpinionModifier((short) option.getValue(), 12);
            } else {
                voter.addOpinionModifier((short) option.getValue(), -8);
            }
        }
    }
    // Actual effect
    pos.setCurrentHolder(pos.getApplicants().get(result.getOverallResult()));
    pos.getApplicants().clear();
}
Also used : Character(de.gg.game.model.entities.Character)

Example 8 with Character

use of de.gg.game.model.entities.Character in project ProjektGG by eskalon.

the class ImpeachmentBallot method getInfoText.

@Override
public String getInfoText() {
    Character voteCallerC = world.getCharacter(voteCaller);
    Character currentHolderC = world.getCharacter(currentHolder);
    return Lang.get("vote.impeachment.info", voteCallerC.getPosition(), voteCallerC, voteCallerC.isMale(), currentHolderC.getPosition(), currentHolderC, currentHolderC.isMale());
}
Also used : Character(de.gg.game.model.entities.Character)

Example 9 with Character

use of de.gg.game.model.entities.Character in project ProjektGG by eskalon.

the class AuthoritativeSession method init.

/**
 * {@inheritDoc}
 */
@Override
public void init(HashMap<Short, LobbyPlayer> players, @Nullable SavedGame savedGame) {
    for (LobbyPlayer player : players.values()) {
        player.setReady(false);
    }
    super.init(players, savedGame);
    // FIXME wenn man ein zweites mal ein spiel hostet, kann es passieren,
    // dass während dem obigen init() der GameLoadingScreen fertig wird.
    // Während dann die Modelle gesetzt werden, werden im init nochmals die
    // Buildings verändert. -> zusammenlegen
    // Setup the server processing systems
    ServerProcessingSystem<Character> s;
    s = new FirstCharacterEventWaveServerSystem(clientResultListeners);
    s.init(world, sessionSetup.getSeed());
    this.characterSystems.add(s);
    s = new NpcActionSystem(clientResultListeners);
    s.init(world, sessionSetup.getSeed());
    this.characterSystems.add(s);
    s = new NpcActionSystem2(clientResultListeners);
    s.init(world, sessionSetup.getSeed());
    this.characterSystems.add(s);
    ServerProcessingSystem<Player> s2;
    s2 = new FirstPlayerEventWaveServerSystem(clientResultListeners);
    s2.init(world, sessionSetup.getSeed());
    this.playerSystems.add(s2);
    s2 = new IllnessDamageSystem(clientResultListeners);
    s2.init(world, sessionSetup.getSeed());
    this.playerSystems.add(s2);
    // Load the systems states
    if (savedGame != null) {
        for (ProcessingSystem<Character> c : characterSystems) {
            ((ServerProcessingSystem<Character>) c).loadSavedState(savedGame.processingSystemStates.get(c.getClass().getSimpleName()));
        }
        for (ProcessingSystem<Player> p : playerSystems) {
            ((ServerProcessingSystem<Player>) p).loadSavedState(savedGame.processingSystemStates.get(p.getClass().getSimpleName()));
        }
    }
}
Also used : NpcActionSystem(de.gg.game.systems.server.NpcActionSystem) LobbyPlayer(de.gg.game.network.LobbyPlayer) Player(de.gg.game.model.entities.Player) Character(de.gg.game.model.entities.Character) NpcActionSystem2(de.gg.game.systems.server.NpcActionSystem2) FirstPlayerEventWaveServerSystem(de.gg.game.systems.server.FirstPlayerEventWaveServerSystem) ServerProcessingSystem(de.gg.game.systems.server.ServerProcessingSystem) LobbyPlayer(de.gg.game.network.LobbyPlayer) FirstCharacterEventWaveServerSystem(de.gg.game.systems.server.FirstCharacterEventWaveServerSystem) IllnessDamageSystem(de.gg.game.systems.server.IllnessDamageSystem)

Example 10 with Character

use of de.gg.game.model.entities.Character in project ProjektGG by eskalon.

the class WorldGenerator method generatePlayers.

private void generatePlayers() {
    for (Entry<Short, LobbyPlayer> entry : players.entrySet()) {
        LobbyPlayer lp = entry.getValue();
        Profession profession = new Profession(ProfessionType.values()[lp.getProfessionTypeIndex()]);
        Character character = CharacterFactory.createPlayerCharacter(random, profession.getProfession(), setup.getDifficulty(), lp.isMale(), lp.getReligion(), lp.getName(), lp.getSurname());
        world.characters.put(world.characterIndex, character);
        // TODO 1. Skill-Werte aus LobbyPlayer hinzufügen (Reihenfolge:
        // agility, bargain, combat, crafting, rhetorical, stealth)
        // TODO 2. House-IDS setzen
        Player player = PlayerFactory.createPlayerCharacter(world.characterIndex, lp.getIcon(), profession, (short) 0, (short) 0, 1, 1, 1, 1, 1, 1);
        world.players.put(entry.getKey(), player);
        world.characterIndex++;
    }
}
Also used : Profession(de.gg.game.model.entities.Profession) LobbyPlayer(de.gg.game.network.LobbyPlayer) Player(de.gg.game.model.entities.Player) Character(de.gg.game.model.entities.Character) LobbyPlayer(de.gg.game.network.LobbyPlayer)

Aggregations

Character (de.gg.game.model.entities.Character)12 Player (de.gg.game.model.entities.Player)3 SocialStatus (de.gg.game.model.types.SocialStatus)2 LobbyPlayer (de.gg.game.network.LobbyPlayer)2 FailedHandshakeResponse (de.gg.engine.network.message.FailedHandshakeResponse)1 SuccessfulHandshakeResponse (de.gg.engine.network.message.SuccessfulHandshakeResponse)1 NotificationCreationEvent (de.gg.game.events.NotificationCreationEvent)1 Position (de.gg.game.model.entities.Position)1 Profession (de.gg.game.model.entities.Profession)1 NPCCharacterTrait (de.gg.game.model.types.NPCCharacterTrait)1 PositionType (de.gg.game.model.types.PositionType)1 FirstCharacterEventWaveServerSystem (de.gg.game.systems.server.FirstCharacterEventWaveServerSystem)1 FirstPlayerEventWaveServerSystem (de.gg.game.systems.server.FirstPlayerEventWaveServerSystem)1 IllnessDamageSystem (de.gg.game.systems.server.IllnessDamageSystem)1 NpcActionSystem (de.gg.game.systems.server.NpcActionSystem)1 NpcActionSystem2 (de.gg.game.systems.server.NpcActionSystem2)1 ServerProcessingSystem (de.gg.game.systems.server.ServerProcessingSystem)1 NotificationData (de.gg.game.ui.data.NotificationData)1 Random (java.util.Random)1