Class Forest

All Implemented Interfaces:
Serializable, Buildable, SideEffect

public class Forest extends EffectualFacility
See Also:
  • Constructor Details

    • Forest

      public Forest(int oneTimeCost, int maintenanceFee, Coordinate coordinate, Dimension dimension, float influenceRadius, Date birthday)
  • Method Details

    • getAge

      public int getAge()
    • setAgeToTen

      public void setAgeToTen()
    • setTotalEffectCntToTenYears

      public void setTotalEffectCntToTenYears()
    • incAge

      public void incAge(Date now)
      Increments forests age by one, if one year passed.
      Parameters:
      now - the current time
    • getBuildableType

      public BuildableType getBuildableType()
      Description copied from interface: Buildable
      A type can be:
      Returns:
      the type of the buildable
    • isUnderConstruction

      public boolean isUnderConstruction()
      Description copied from interface: Buildable
      Checks if the buildable is under construction
      Returns:
      boolean
    • getBadEffectIndustrial

      public LinkedList<IndustrialZone> getBadEffectIndustrial(Zone zone, GameModel gm)
      Filter out industrial zones lies between a given zone and the forest.
      Parameters:
      zone - given zone
      gm - gme model
      Returns:
      the list of bad zones
    • grewEffect

      public void grewEffect(Zone zone, GameModel gm)
      The appending effect along the growth of the forest.
      Parameters:
      zone - the zone be further effected
      gm - game model
    • effect

      public void effect(Zone zone, GameModel gm)
      Description copied from interface: SideEffect
      Applies special effect of the facility on a given zone. if condition is satisfied.
      Parameters:
      zone - the zone to effect.
    • reverseEffect

      public void reverseEffect(Zone zone, GameModel gm)
      Description copied from interface: SideEffect
      Reverse special effect of the facility on a given zone. if condition is satisfied.
      Parameters:
      zone - the zone to effect.
    • condition

      public boolean condition(Zone zone, GameModel gm)
      Description copied from interface: SideEffect
      Evaluates the condition for the facility to have effect on a given zone
      Specified by:
      condition in interface SideEffect
      Specified by:
      condition in class EffectualFacility
      Parameters:
      zone - the zone to check
      Returns:
      true if condition is satisfied, otherwise, false
    • hasDirectView

      public boolean hasDirectView(Zone zone, Buildable[][] map)
      Checks if a zone can see the forest directly
      Parameters:
      zone - zone to be checked
      map - map of city
      Returns:
      true if can