Search in sources :

Example 11 with Character

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

the class CharacterFactory method createPlayerCharacter.

/**
 * Creates a character for a player.
 *
 * @param random
 *            The random generator for this session.
 * @param profession
 *            The player's profession.
 * @param difficulty
 *            The game's difficulty level.
 * @return the character.
 */
public static Character createPlayerCharacter(Random random, ProfessionType profession, GameDifficulty difficulty, boolean isMale, Religion religion, String name, String surname) {
    Character c = new Character();
    c.setAge(RandomUtils.getInt(random, 17, 23));
    c.setGold(profession.getStartingGold() + difficulty.getAdditionalStartingGold());
    c.setHighestPositionLevel(0);
    c.setHp(RandomUtils.getInt(random, 96, 104));
    c.setMale(isMale);
    c.setMarried(false);
    c.setName(name);
    c.setReligion(religion);
    c.setStatus(SocialStatus.NON_CITIZEN);
    c.setSurname(surname);
    c.setNPCTrait(null);
    return c;
}
Also used : Character(de.gg.game.model.entities.Character)

Example 12 with Character

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

the class RoundEndSystem method processPlayer.

public void processPlayer(short id, Player p) {
    Character c = p.getCurrentlyPlayedCharacter(world);
    // INHERITANCE TAX
    if (p.getPreviouslyInheritedValue() > 0) {
        c.setGold(c.getGold() - Math.round(p.getPreviouslyInheritedValue() * ((Integer) world.getLaws().get(LawType.INHERITANCE_TAX) / 100F)));
        p.setPreviouslyInheritedValue(0);
    }
    // SOCIAL STATUS
    if (c.getStatus().getLevel() < 3) {
        // Patrician & Cavalier
        SocialStatus superiorStatus = SocialStatus.values()[c.getStatus().getLevel() + 1];
        if (p.getFortune(world) >= superiorStatus.getFortuneRequirement() && c.getHighestPositionLevel() >= superiorStatus.getPositionLevelRequirement()) {
            // 
            c.setStatus(superiorStatus);
            if (localPlayerId == id) {
            // TODO notification!
            }
        }
    }
    // AP
    p.setAvailableAp(p.getAvailableAp() + 4 + p.getSkills().getAgilitySkill());
}
Also used : Character(de.gg.game.model.entities.Character) SocialStatus(de.gg.game.model.types.SocialStatus)

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