Class ReputationCalculator


  • @Lazy
    @Component
    public class ReputationCalculator
    extends java.lang.Object
    Calculator for a players reputation
    Author:
    Andi Hotz, (c) Sahits GmbH, 2012 Created on Jul 23, 2012
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ch.sahits.game.openpatrician.model.personal.ICareer calculateCareer​(ch.sahits.game.openpatrician.model.city.ICity city, ch.sahits.game.openpatrician.model.IPlayer player)
      Calculate the current career level of the player.
      int calculateWareReputation​(ch.sahits.game.openpatrician.model.city.ICity city, ch.sahits.game.openpatrician.model.IPlayer player)
      Check each ware if the player contributes and what amount.
      double remapReputation​(ch.sahits.game.openpatrician.model.city.ICity city, ch.sahits.game.openpatrician.model.IPlayer player)
      Remap the linear reputation stored in a city to value that are used in ranks.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReputationCalculator

        public ReputationCalculator()
    • Method Detail

      • calculateWareReputation

        public int calculateWareReputation​(ch.sahits.game.openpatrician.model.city.ICity city,
                                           ch.sahits.game.openpatrician.model.IPlayer player)
        Check each ware if the player contributes and what amount. If the city contributes enough to cover the needs, this ware is irrelevant for the computation If the player contributes enough to cover all the need he gets 100 points for the ware. If he contributes less he gets a fraction according to what he contributes.
        Parameters:
        city - for which the ware based reputation should be checked
        player - for whom the reputation is calculated
        Returns:
        value between 0 and 100
      • remapReputation

        public double remapReputation​(ch.sahits.game.openpatrician.model.city.ICity city,
                                      ch.sahits.game.openpatrician.model.IPlayer player)
        Remap the linear reputation stored in a city to value that are used in ranks.
        Parameters:
        city - for which the reputation is remaped
        player - for which the reputation is remapped
        Returns:
        reputation of the player in the city
      • calculateCareer

        public ch.sahits.game.openpatrician.model.personal.ICareer calculateCareer​(ch.sahits.game.openpatrician.model.city.ICity city,
                                                                                   ch.sahits.game.openpatrician.model.IPlayer player)
        Calculate the current career level of the player.
        Parameters:
        city - in which to calculate hte career level
        player - for whom to calculate the career level
        Returns:
        career level of the player.