public class Earthquake extends RandomEvent
Modifier and Type | Field and Description |
---|---|
private GameEngine |
gameEngine |
private int |
playerAffected |
private int |
tileDamageValue |
private java.util.ArrayList<Tile> |
tilesDamaged |
duration, randomiser
Constructor and Description |
---|
Earthquake(GameEngine engine,
GameScreen gameScreen) |
Modifier and Type | Method and Description |
---|---|
private java.util.ArrayList<Tile> |
chooseAffectedTiles()
A method which chooses the tiles to be damaged by the earthquake.
|
void |
eventEffect(boolean doOrUndo)
Overridden eventEffect() method initially found in the RandomEvent abstract class.
|
java.lang.String |
eventMessage(boolean doOrUndo)
Overridden eventMessage() method initially found in the RandomEvent abstract class.
|
private int |
getNumberGreaterThanX(int limit,
int x)
A method which returns an integer i where x is smaller or equal to i which is smaller than the limit.
|
int |
getTileDamageValue()
A method which returns the value which production will be divided by on the damaged tiles.
|
java.util.ArrayList<Tile> |
getTilesDamaged()
A method which returns the tiles chosen to be damaged by the earthquake.
|
java.lang.String |
toString()
Returns a string representation of an Earthquake instance.
|
decDuration, eventHappen, getDuration, getEventCooldown
private int playerAffected
private GameEngine gameEngine
private java.util.ArrayList<Tile> tilesDamaged
private int tileDamageValue
public Earthquake(GameEngine engine, GameScreen gameScreen)
public java.util.ArrayList<Tile> getTilesDamaged()
public int getTileDamageValue()
public void eventEffect(boolean doOrUndo)
eventEffect
in class RandomEvent
doOrUndo:
- boolean determining whether to cause the event effect, or
reverse it. True - Cause, False - Reverse.public java.lang.String eventMessage(boolean doOrUndo)
eventMessage
in class RandomEvent
doOrUndo:
- boolean determining whether to cause the event effect, or
reverse it. True - Cause, False - Reverse.private java.util.ArrayList<Tile> chooseAffectedTiles()
private int getNumberGreaterThanX(int limit, int x)
limit
- sets the limitx
- which increments the number generatedpublic java.lang.String toString()
toString
in class java.lang.Object