package model import korlibs.time.* import kotlinx.serialization.Serializable @Serializable /** A [BattleAction] represents some kind of input from a player. */ sealed class BattleAction: TimedEvent() @Serializable data class MultiHitAction( override val timestamp: TimeSpan, val target: Battler.Id, val hits: Int, val firstHitDelay: TimeSpan, val subsequentHitDelay: TimeSpan, val damage: Double, ): BattleAction() { override fun Battle.EventAPI.execute() { injectEffect(DamageEffect(timestamp + firstHitDelay, target, damage)) for (hit in 2..hits) { injectEffect(DamageEffect(timestamp + firstHitDelay + subsequentHitDelay * (hit - 1), target, damage)) } } }