package evolution; import java.util.Map; /** * The creation power of the player. * This is an indication for the number of humans that the player can * create. */ public class CreationPower implements Evolver { /** * Constructor of creation power. */ public CreationPower() { creationAmount = EvolutionKnowledgeCatalog.getInst() .getInitCreationPower(); humanCreationDecrease = EvolutionKnowledgeCatalog.getInst() .getHumanCreationDecrease(); creationIncrease = EvolutionKnowledgeCatalog.getInst() .getCreationIncrease(); max = EvolutionKnowledgeCatalog.getInst() .getMaxCreationPower(); Evolution.getInst().register(this); } /** * Decrease the CreationPower of the player. */ public void decreasePowerHuman() throws CreationPowerInsufficientException { if((creationAmount - humanCreationDecrease) < 0) throw new CreationPowerInsufficientException("You don't have enough magic in the sjakosj"); creationAmount -= humanCreationDecrease; } /** * Return the amount of CreationPower of the player. */ public double getAmount() { return creationAmount; } /** * Adjust the amount of CreationPower on every clocktick. */ public void evolve(double value) { if(creationAmount + creationIncrease > max) creationAmount = max; else creationAmount += creationIncrease; } /** * Return the priority of this evolver. */ public double getPriority() { return 0; } /** * Check whether this evolver produces energy. */ public boolean producesEnergy() { return false; } /** * Return the maximum energy production of this evolver. */ public double maxEnergyProduction(Map m1, Map m2) { return 0; } /** * The amount of creation power left to create humans. */ private double creationAmount; /** * The decrease of the creation power when a human is created. */ private double humanCreationDecrease; /** * The amount by which the CreationPower of the player increases every clocktick. */ private double creationIncrease; /** * The maximum amount of CreationPower of the player. */ private double max; }