Class ServerEurope

    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
    • Constructor Detail

      • ServerEurope

        public ServerEurope​(Game game,
                            java.lang.String id)
        Trivial constructor for Game.newInstance.
        Parameters:
        game - The Game this object belongs to.
        id - The object identifier.
      • ServerEurope

        public ServerEurope​(Game game,
                            Player owner)
        Creates a new ServerEurope.
        Parameters:
        game - The Game in which this object belongs.
        owner - The Player that will be using this object of Europe.
    • Method Detail

      • equipForRole

        public boolean equipForRole​(Unit unit,
                                    Role role,
                                    int roleCount)
        Equip a unit for a role using resources at this location.
        Overrides:
        equipForRole in class Europe
        Parameters:
        unit - The Unit to equip.
        role - The Role to build for.
        roleCount - The role count.
        Returns:
        True if the equipping succeeded.
      • initializeMigration

        public void initializeMigration​(java.util.Random random)
        Generates the initial recruits for this player. Recruits may be determined by the difficulty level, or generated randomly.
        Parameters:
        random - A pseudo-random number source.
      • fillRecruitables

        private void fillRecruitables​(java.util.Random random)
        Fill out to the full amount of recruits.
        Parameters:
        random - A pseudo-random number source.
      • increaseRecruitmentDifficulty

        public void increaseRecruitmentDifficulty()
        Increases the base price and lower cap for recruits.
      • extractRecruitable

        public AbstractUnit extractRecruitable​(int slot,
                                               java.util.Random random)
        Extract the recruitable at a given slot, and replace it with the given new recruitable type. Note that we shift the old units down, because the AI always recruits from the lowest slot.
        Parameters:
        slot - The slot to recruit with.
        random - A pseudo-random number source.
        Returns:
        The recruited AbstractUnit.
      • generateRecruitablesList

        private java.util.List<RandomChoice<UnitType>> generateRecruitablesList()
        Generate a weighted list of unit types recruitable by this player.
        Returns:
        A weighted list of recruitable unit types.
      • replaceRecruits

        public boolean replaceRecruits​(java.util.Random random)
        Replace any non-recruitable recruits.
        Parameters:
        random - A pseudo-random number source.
        Returns:
        True if any recruit was replaced.
      • generateFountainRecruits

        public java.util.List<Unit> generateFountainRecruits​(int n,
                                                             java.util.Random random)
        Generate new recruits following a Fountain of Youth discovery. FIXME: Get rid of this, it is only used because the AI is stupid.
        Parameters:
        n - The number of new units.
        random - A pseudo-random number source.
        Returns:
        The generated units.
      • increasePrice

        public void increasePrice​(UnitType unitType,
                                  int price)
        Increases the price for a unit.
        Parameters:
        unitType - The UnitType, trained or purchased
        price - The current price of the unit
      • csEquipForRole

        public boolean csEquipForRole​(Unit unit,
                                      Role role,
                                      int roleCount,
                                      java.util.Random random,
                                      ChangeSet cs)
        Equip a unit for a specific role.
        Parameters:
        unit - The Unit to equip.
        role - The Role to equip for.
        roleCount - The role count.
        random - A pseudo-random number source.
        cs - A ChangeSet to update.
        Returns:
        True if the equipping succeeds.
      • csNewTurn

        public void csNewTurn​(java.util.Random random,
                              LogBuilder lb,
                              ChangeSet cs)
        New turn for this colony tile. FIXME: give Europe a shipyard and remove this?
        Specified by:
        csNewTurn in interface TurnTaker
        Parameters:
        random - A Random number source.
        lb - A LogBuilder to log to.
        cs - A ChangeSet to update.