use of de.gg.game.model.types.PositionType in project ProjektGG by eskalon.
the class RoundEndSystem method processCharacter.
public void processCharacter(short id, Character c) {
// AGE
c.setAge(c.getAge() + 1);
// AGE DAMAGE
if (c.getAge() > 18) {
if (c.getAge() > 45) {
if (c.getAge() > 65) {
// > 65
c.setHp(c.getHp() - 3);
} else {
// 45-65
c.setHp(c.getHp() - 2);
}
} else {
// 19 - 45
c.setHp(c.getHp() - 1);
}
}
// SALARY
// TODO statt am Rundenende am Rundenstart berechnen
PositionType position = c.getPosition();
if (position != null) {
c.setGold(c.getGold() + position.getSalary());
}
// TEMPORARY OPINION MODIFIERS
for (Entry<Short, Integer> opinionEntry : c.getOpinionModifiers().entrySet()) {
if (opinionEntry.getValue() > 0) {
opinionEntry.setValue(opinionEntry.getValue() - 4);
if (opinionEntry.getValue() < 0)
c.getOpinionModifiers().remove(opinionEntry.getKey());
}
if (opinionEntry.getValue() < 0) {
opinionEntry.setValue(opinionEntry.getValue() + 3);
if (opinionEntry.getValue() > 0)
c.getOpinionModifiers().remove(opinionEntry.getKey());
}
}
// REPUTATION MODIFIERS
if (c.getReputationModifiers() > 0)
c.setReputationModifiers(c.getReputationModifiers() - 1);
if (c.getReputationModifiers() < 0)
c.setReputationModifiers(c.getReputationModifiers() + 1);
}
use of de.gg.game.model.types.PositionType in project ProjektGG by eskalon.
the class ServersideActionHandler method onImpeachmentVoteArranged.
@Override
public boolean onImpeachmentVoteArranged(short targetCharacterId, short clientId) {
PositionType t = world.getCharacters().get(targetCharacterId).getPosition();
if (t != null) {
// TODO überprüfen, ob nicht bereits ein anderer einen Vote
// initiiert hat
world.getMattersToHoldVoteOn().add(new ImpeachmentBallot(world, t, world.getPlayer(clientId).getCurrentlyPlayedCharacterId()));
clientResultListeners.onImpeachmentVoteArranged(targetCharacterId, world.getPlayer(clientId).getCurrentlyPlayedCharacterId());
return true;
}
return false;
}
use of de.gg.game.model.types.PositionType in project ProjektGG by eskalon.
the class FirstEventWaveClientSystem method process.
@Override
public void process(short id, Player p) {
if (id == localPlayerId) {
Character c = p.getCurrentlyPlayedCharacter(world);
// Inform about open positions
for (Entry<PositionType, Position> e : world.getPositions().entrySet()) {
if (!e.getValue().isHeld()) {
if (e.getKey().getLevel() - 1 <= c.getHighestPositionLevel()) {
if (e.getKey().getStatusRequirement() == null || e.getKey().getStatusRequirement().getLevel() <= c.getStatus().getLevel()) {
NotificationData not = new NotificationData(Lang.get("notification.pos_available.title"), Lang.get("notification.pos_available.text", e.getKey()), null);
eventBus.post(new NotificationCreationEvent(not));
}
}
}
}
if (c.getStatus() == SocialStatus.NON_CITIZEN) {
if (p.getFortune(world) >= SocialStatus.NON_CITIZEN.getFortuneRequirement()) {
// TODO inform about possibility to buy citizen status
}
}
}
}
use of de.gg.game.model.types.PositionType in project ProjektGG by eskalon.
the class WorldGenerator method generateCharacters.
private void generateCharacters() {
// Add characters that have a position
for (PositionType posType : PositionType.values()) {
world.characters.put(world.characterIndex, CharacterFactory.createCharacterForPosition(random, posType));
world.positions.put(posType, new Position(world.characterIndex));
world.characterIndex++;
}
// Add the other characters
for (short i = (short) (29 + players.size()); i <= 100; i++) {
world.characters.put(world.characterIndex, CharacterFactory.createRandomCharacter(random));
world.characterIndex++;
}
}
Aggregations