AllConditionInterpreter.kt

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

import io.github.lishangbu.avalon.game.battle.engine.core.dsl.ConditionNode
import io.github.lishangbu.avalon.game.battle.engine.core.dsl.condition.AllConditionNode
import io.github.lishangbu.avalon.game.battle.engine.core.event.EventContext
import io.github.lishangbu.avalon.game.battle.engine.core.runtime.ConditionInterpreter
import io.github.lishangbu.avalon.game.battle.engine.core.type.ConditionTypeId
import io.github.lishangbu.avalon.game.battle.engine.core.type.StandardConditionTypeIds

/**
 * `all` 条件解释器。
 */
class AllConditionInterpreter : ConditionInterpreter {
    override val type: ConditionTypeId = StandardConditionTypeIds.ALL

    override fun evaluate(
        condition: ConditionNode,
        context: EventContext,
    ): Boolean {
        require(condition is AllConditionNode) { "Condition must be AllConditionNode." }
        error("AllConditionInterpreter requires HookRuleProcessor-level recursion support.")
    }
}