Added some entry points for RS.
Tweaked some dice name/structure so it makes more sense from the caller side
This commit is contained in:
parent
483e67bb16
commit
9c3d3f2d70
@ -4,5 +4,5 @@ import game_logic.runescape.RunescapeRoutines
|
|||||||
|
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
RunescapeRoutines.processInventoryAtFurnace(1839)
|
RunescapeRoutines.processInventoryAtFurnace(2137)
|
||||||
}
|
}
|
||||||
11
src/main/kotlin/entries/NecromancyInk.kt
Normal file
11
src/main/kotlin/entries/NecromancyInk.kt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package entries
|
||||||
|
|
||||||
|
import game_logic.runescape.RunescapeRoutines
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
RunescapeRoutines.createNecromancyInk(2000)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2,7 +2,7 @@ package simulation.dice
|
|||||||
|
|
||||||
object Dice {
|
object Dice {
|
||||||
fun regular(rollString: String, modifiers: List<DiceModifier<Int>> = ArrayList()): DiceRoller {
|
fun regular(rollString: String, modifiers: List<DiceModifier<Int>> = ArrayList()): DiceRoller {
|
||||||
return DiceImpl(rollString, modifiers)
|
return DiceRollerImpl(rollString, modifiers)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun critDice(rollString: String, modifiers: List<DiceModifier<Int>> = ArrayList()): CritDiceRoller {
|
fun critDice(rollString: String, modifiers: List<DiceModifier<Int>> = ArrayList()): CritDiceRoller {
|
||||||
|
|||||||
@ -38,6 +38,15 @@ interface DiceRoller {
|
|||||||
val nDice: Int
|
val nDice: Int
|
||||||
val dieSize: Int
|
val dieSize: Int
|
||||||
|
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
internal fun defaultDiceStringParseFn(rollString: String): Pair<Int, Int> {
|
||||||
|
val cleanRollString = rollString.lowercase()
|
||||||
|
val parts = cleanRollString.split('d')
|
||||||
|
return Pair(parts[0].toInt(), parts[1].toInt())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rolls the dice and returns the result.
|
* Rolls the dice and returns the result.
|
||||||
*
|
*
|
||||||
@ -89,22 +98,18 @@ interface DiceRoller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun defaultParseFn(rollString: String): Pair<Int, Int> {
|
|
||||||
val cleanRollString = rollString.lowercase()
|
|
||||||
val parts = cleanRollString.split('d')
|
|
||||||
return Pair(parts[0].toInt(), parts[1].toInt())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class DiceImpl(
|
internal class DiceRollerImpl(
|
||||||
override val rollString: String,
|
override val rollString: String,
|
||||||
override val modifiers: List<DiceModifier<Int>> = ArrayList()
|
override val modifiers: List<DiceModifier<Int>> = ArrayList()
|
||||||
) : DiceRoller {
|
) : DiceRoller {
|
||||||
override val nDice: Int
|
override val nDice: Int
|
||||||
override val dieSize: Int
|
override val dieSize: Int
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val rollPair = defaultParseFn(rollString)
|
val rollPair = DiceRoller.defaultDiceStringParseFn(rollString)
|
||||||
nDice = rollPair.first
|
nDice = rollPair.first
|
||||||
dieSize = rollPair.second
|
dieSize = rollPair.second
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class RerollDiceImpl(
|
|||||||
override val dieSize: Int
|
override val dieSize: Int
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val rollPair = this.defaultParseFn(rollString)
|
val rollPair = DiceRoller.defaultDiceStringParseFn(rollString)
|
||||||
nDice = rollPair.first
|
nDice = rollPair.first
|
||||||
dieSize = rollPair.second
|
dieSize = rollPair.second
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user