HexCasting/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt
2023-04-24 21:45:36 -05:00

24 lines
1,014 B
Kotlin

package at.petrak.hexcasting.common.casting.operators.circles
import at.petrak.hexcasting.api.casting.asActionResult
import at.petrak.hexcasting.api.casting.castables.ConstMediaAction
import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
import at.petrak.hexcasting.api.casting.eval.env.CircleCastEnv
import at.petrak.hexcasting.api.casting.iota.Iota
import at.petrak.hexcasting.api.casting.mishaps.MishapNoSpellCircle
// TODO: we now have the interesting potential to add *other* spell circle getters, like the current position
// of the eval. Hmm hm hm.
// Reminded of "targeted position" in Psi -- we could have a "cast location" refl that gets the player pos
// or the current eval pos on a circle
object OpImpetusDir : ConstMediaAction {
override val argc = 0
override fun execute(args: List<Iota>, ctx: CastingEnvironment): List<Iota> {
if (ctx !is CircleCastEnv)
throw MishapNoSpellCircle()
return ctx.circleState().impetusDir.step().asActionResult
}
}