You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
939 B
31 lines
939 B
package model
|
|
|
|
import korlibs.time.*
|
|
|
|
sealed interface TimedEvent: Comparable<TimedEvent> {
|
|
val timestamp: TimeSpan
|
|
fun Battle.execute()
|
|
|
|
override fun compareTo(other: TimedEvent): Int {
|
|
return timestamp.compareTo(other.timestamp)
|
|
}
|
|
}
|
|
|
|
/** A [BattleEffect] represents some kind of timed impact on the game as a result of a [BattleAction]. */
|
|
sealed interface BattleEffect: TimedEvent
|
|
|
|
/** A [BattleAction] represents some kind of input from a player. */
|
|
sealed interface BattleAction: TimedEvent
|
|
|
|
data class LoadAction(
|
|
override val timestamp: TimeSpan,
|
|
val battlers: List<Battler.Saved>,
|
|
val pendingEffects: List<BattleEffect>) : BattleAction {
|
|
override fun Battle.execute() {
|
|
throw AssertionError("LoadActions should never be executed normally.")
|
|
}
|
|
|
|
companion object{
|
|
val ZERO = LoadAction(timestamp = TimeSpan.ZERO, battlers = listOf(), pendingEffects = listOf())
|
|
}
|
|
}
|
|
|