Class EventEngineState
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.event.EventEngineState
-
public class EventEngineState extends java.lang.ObjectState for the event engine holing serializable information used by the EventEngine. Created by andi on 29.03.17.
-
-
Constructor Summary
Constructors Constructor Description EventEngineState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFire(ch.sahits.game.openpatrician.model.city.ICity city, java.time.LocalDateTime date)Add or override the date of the last fire in the cityvoidaddPlague(ch.sahits.game.openpatrician.model.city.ICity city, java.time.LocalDateTime date)Add or override the date of the last plague in the cityjava.util.Optional<java.time.LocalDateTime>getLastFire(ch.sahits.game.openpatrician.model.city.ICity city)Retrieve the Date of the last fire.java.util.Optional<java.time.LocalDateTime>getLastPlague(ch.sahits.game.openpatrician.model.city.ICity city)Retrieve the Date of the last plague.java.util.Optional<EEventState>getMarriageState(ch.sahits.game.openpatrician.model.IPlayer player)Retrieve the current marriage state of the player.voidresetMarriedState(ch.sahits.game.openpatrician.model.IPlayer player)Remove the player form the marriage state map.voidsetMarriageState(ch.sahits.game.openpatrician.model.IPlayer player, EEventState state)Set or update the marriage state of a player.
-
-
-
Method Detail
-
addFire
public void addFire(ch.sahits.game.openpatrician.model.city.ICity city, java.time.LocalDateTime date)Add or override the date of the last fire in the city- Parameters:
city- where the fire happeneddate- when the fire happened
-
getLastFire
public java.util.Optional<java.time.LocalDateTime> getLastFire(ch.sahits.game.openpatrician.model.city.ICity city)
Retrieve the Date of the last fire. There might not have been a fire yet.- Parameters:
city- which should be checked- Returns:
- date of the last fire or empty
-
addPlague
public void addPlague(ch.sahits.game.openpatrician.model.city.ICity city, java.time.LocalDateTime date)Add or override the date of the last plague in the city- Parameters:
city- where the plague happeneddate- when the plague happened
-
getLastPlague
public java.util.Optional<java.time.LocalDateTime> getLastPlague(ch.sahits.game.openpatrician.model.city.ICity city)
Retrieve the Date of the last plague. There might not have been a plague yet.- Parameters:
city- which should be checked- Returns:
- date of the last plague or empty
-
setMarriageState
public void setMarriageState(ch.sahits.game.openpatrician.model.IPlayer player, EEventState state)Set or update the marriage state of a player.- Parameters:
player- to be updatedstate- marriage state
-
getMarriageState
public java.util.Optional<EEventState> getMarriageState(ch.sahits.game.openpatrician.model.IPlayer player)
Retrieve the current marriage state of the player.- Parameters:
player- to be checked.- Returns:
- marriage state or empty
-
resetMarriedState
public void resetMarriedState(ch.sahits.game.openpatrician.model.IPlayer player)
Remove the player form the marriage state map.- Parameters:
player- that gets married.
-
-