RestorePpActionExecutor.kt

package io.github.lishangbu.avalon.game.battle.engine.core.runtime.action

import io.github.lishangbu.avalon.game.battle.engine.core.dsl.ActionNode
import io.github.lishangbu.avalon.game.battle.engine.core.dsl.action.RestorePpActionNode
import io.github.lishangbu.avalon.game.battle.engine.core.event.EventContext
import io.github.lishangbu.avalon.game.battle.engine.core.mutation.RestorePpMutation
import io.github.lishangbu.avalon.game.battle.engine.core.runtime.ActionExecutor
import io.github.lishangbu.avalon.game.battle.engine.core.runtime.ActionResult
import io.github.lishangbu.avalon.game.battle.engine.core.type.ActionTypeId
import io.github.lishangbu.avalon.game.battle.engine.core.type.StandardActionTypeIds

/**
 * `restore_pp` 动作执行器。
 */
class RestorePpActionExecutor : ActionExecutor {
    override val type: ActionTypeId = StandardActionTypeIds.RESTORE_PP

    override fun execute(
        action: ActionNode,
        context: EventContext,
    ): ActionResult {
        require(action is RestorePpActionNode) { "Action must be RestorePpActionNode." }
        return ActionResult(
            mutations = listOf(RestorePpMutation(action.target, action.moveId, action.value)),
        )
    }
}