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;
}
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();
}
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());
}
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()));
}
}
}
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++;
}
}
Aggregations