-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd9b7d2
commit eedd256
Showing
4 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
common/src/main/java/miyucomics/hexical/casting/patterns/operators/eval/OpDiver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package miyucomics.hexical.casting.patterns.operators.eval | ||
|
||
import at.petrak.hexcasting.api.spell.* | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs | ||
|
||
object OpDiver : Action { | ||
override fun operate(continuation: SpellContinuation, stack: MutableList<Iota>, ravenmind: Iota?, ctx: CastingContext): OperationResult { | ||
if (stack.size < 2) | ||
throw MishapNotEnoughArgs(2, stack.size) | ||
val instructions = stack.getList(stack.lastIndex - 1) | ||
val diveAmount = stack.getPositiveIntUnderInclusive(0, stack.size - 1) | ||
stack.removeLastOrNull() | ||
stack.removeLastOrNull() | ||
|
||
val output = mutableListOf<Iota>() | ||
output.addAll(stack.takeLast(diveAmount)) | ||
for (i in 0 until diveAmount) | ||
stack.removeLast() | ||
|
||
// cast pattern list?? | ||
|
||
output.reverse() | ||
for (iota in output) | ||
stack.add(iota) | ||
|
||
return OperationResult(continuation, stack, ravenmind, listOf()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
common/src/main/java/miyucomics/hexical/registry/HexicalPatterns.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters