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.
 
 

25 lines
732 B

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))
}
}
}