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.
 
 

46 lines
1.3 KiB

package model
import korlibs.time.*
import kotlinx.serialization.*
sealed interface HistoryEntry: Comparable<HistoryEntry> {
val timestamp: TimeSpan
val pendingEffects: List<BattleEffect>
val battlers: List<Battler.Saved>
override fun compareTo(other: HistoryEntry): Int {
return timestamp.compareTo(other.timestamp)
}
@Serializable
@SerialName("load")
data class Load(
override val timestamp: TimeSpan,
override val pendingEffects: List<BattleEffect>,
override val battlers: List<Battler.Saved>,
): HistoryEntry {
companion object{
val ZERO = Load(timestamp = TimeSpan.ZERO, battlers = listOf(), pendingEffects = listOf())
}
}
@Serializable
@SerialName("histAction")
data class Action(
val action: BattleAction,
override val pendingEffects: List<BattleEffect>,
override val battlers: List<Battler.Saved>,
): HistoryEntry {
override val timestamp: TimeSpan get() = action.timestamp
}
@Serializable
@SerialName("histFX")
data class Effect(
val effect: BattleEffect,
override val pendingEffects: List<BattleEffect>,
override val battlers: List<Battler.Saved>,
): HistoryEntry {
override val timestamp: TimeSpan get() = effect.timestamp
}
}