Skip to content

Commit

Permalink
close #114
Browse files Browse the repository at this point in the history
  • Loading branch information
gamma-delta committed Jun 12, 2022
1 parent 608fd0e commit bf46822
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ import kotlin.math.abs
import kotlin.math.roundToInt

object OpFisherman : Operator {
override fun operate(continuation: SpellContinuation, stack: MutableList<SpellDatum<*>>, local: SpellDatum<*>, ctx: CastingContext): OperationResult {
if (stack.isEmpty())
throw MishapNotEnoughArgs(1, 0)
override fun operate(
continuation: SpellContinuation,
stack: MutableList<SpellDatum<*>>,
local: SpellDatum<*>,
ctx: CastingContext
): OperationResult {
if (stack.size < 2)
throw MishapNotEnoughArgs(2, 0)
val arg = stack.getChecked<Double>(stack.lastIndex)
val datum = stack[stack.lastIndex]
val distance = stack.size - (arg + 1) // because getChecked<Int> just gives me a double for some reason
Expand Down

0 comments on commit bf46822

Please sign in to comment.