public abstract class RandomEvent
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
duration |
private int |
eventCooldown |
private GameScreen |
gameScreen |
(package private) java.util.Random |
randomiser |
Constructor and Description |
---|
RandomEvent(GameScreen gameScreen) |
Modifier and Type | Method and Description |
---|---|
protected void |
decDuration()
Method which decrements the duration of the event by 1.
|
abstract void |
eventEffect(boolean doOrUndo)
Abstract method which implements the back-end effects of a random event.
|
void |
eventHappen(boolean doOrUndo)
Method which calls eventEffect() and eventMessage() in sequence, and displays the message
in the GUI.
|
abstract java.lang.String |
eventMessage(boolean doOrUndo)
Abstract method which generates a string to display in the random event message
overlay during gameplay.
|
protected int |
getDuration()
Method which gets the duration remaining of the current random event.
|
protected int |
getEventCooldown()
Method which returns the value that the duration of an event must decrement to in
order for it to be removed from the game.
|
java.util.Random randomiser
private GameScreen gameScreen
private int eventCooldown
protected int duration
RandomEvent(GameScreen gameScreen)
public abstract void eventEffect(boolean doOrUndo)
doOrUndo:
- boolean determining whether to cause the event effect, or
reverse it. True = Cause, False = Reverse.public abstract java.lang.String eventMessage(boolean doOrUndo)
doOrUndo:
- boolean determining whether to cause the event effect, or
reverse it. True = Cause, False = Reverse.protected int getEventCooldown()
public void eventHappen(boolean doOrUndo)
doOrUndo:
- boolean determining whether to cause the event effect, or
reverse it. True = Cause, False = Reverse.protected int getDuration()
protected void decDuration()