package model import korlibs.time.* sealed interface TimedEvent: Comparable { 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, val pendingEffects: List) : 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()) } }