Package model.facility
Class Forest
java.lang.Object
model.facility.Facility
model.facility.EffectualFacility
model.facility.Forest
- All Implemented Interfaces:
Serializable
,Buildable
,SideEffect
- See Also:
-
Field Summary
Fields inherited from class model.facility.EffectualFacility
influenceRadius
Fields inherited from class model.facility.Facility
coordinate, dimension, maintenanceFee, oneTimeCost
-
Constructor Summary
ConstructorsConstructorDescriptionForest
(int oneTimeCost, int maintenanceFee, Coordinate coordinate, Dimension dimension, float influenceRadius, Date birthday) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Evaluates the condition for the facility to have effect on a given zonevoid
Applies special effect of the facility on a given zone.int
getAge()
getBadEffectIndustrial
(Zone zone, GameModel gm) Filter out industrial zones lies between a given zone and the forest.A type can be:void
grewEffect
(Zone zone, GameModel gm) The appending effect along the growth of the forest.boolean
hasDirectView
(Zone zone, Buildable[][] map) Checks if a zone can see the forest directlyvoid
Increments forests age by one, if one year passed.boolean
Checks if the buildable is under constructionvoid
reverseEffect
(Zone zone, GameModel gm) Reverse special effect of the facility on a given zone.void
void
Methods inherited from class model.facility.EffectualFacility
toString
Methods inherited from class model.facility.Facility
getCoordinate, getDimension, getMaintenanceFee, getOneTimeCost, isConnected, resetConnected, setConnected
-
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
Increments forests age by one, if one year passed.- Parameters:
now
- the current time
-
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
Filter out industrial zones lies between a given zone and the forest.- Parameters:
zone
- given zonegm
- gme model- Returns:
- the list of bad zones
-
grewEffect
The appending effect along the growth of the forest.- Parameters:
zone
- the zone be further effectedgm
- game model
-
effect
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
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
Description copied from interface:SideEffect
Evaluates the condition for the facility to have effect on a given zone- Specified by:
condition
in interfaceSideEffect
- Specified by:
condition
in classEffectualFacility
- Parameters:
zone
- the zone to check- Returns:
- true if condition is satisfied, otherwise, false
-
hasDirectView
Checks if a zone can see the forest directly- Parameters:
zone
- zone to be checkedmap
- map of city- Returns:
- true if can
-