diff --git a/src/main/kotlin/Entry.kt b/src/main/kotlin/Entry.kt deleted file mode 100644 index aa44208..0000000 --- a/src/main/kotlin/Entry.kt +++ /dev/null @@ -1,7 +0,0 @@ -import game_logic.runescape.RunescapeRoutines - -fun main() { - RunescapeRoutines.fullRunIncense( 0, 0, 0, 1839) -// RunescapeRoutines.processInventoryAtFurnace(2500) -} - diff --git a/src/main/kotlin/entries/BGSimulation.kt b/src/main/kotlin/entries/BGSimulation.kt new file mode 100644 index 0000000..1e04089 --- /dev/null +++ b/src/main/kotlin/entries/BGSimulation.kt @@ -0,0 +1,29 @@ +package entries + +import simulation.* + +fun main(){ + val start = System.currentTimeMillis() + doSimulation() + val finish = System.currentTimeMillis() + println("Simulation finished in: ${finish-start}ms") +} + +fun doSimulation(){ + val itt = 10_000_000 + val simulator = Simulator.getInstance(Runtime.getRuntime().availableProcessors()) + + val critAttack = SimpleMeleeAttack( + actionRoll = AttackDice("1d20"), + damageRoll = Dice.makeDice("1d8"), + 10 + ) + + + + val normalAttackModel = AttackSimulatorModel(itt, critAttack) + val normalResults = simulator.doSimulation(normalAttackModel) + + + AttackResult.printSimulationStatistics(normalResults, "Normal Attack") +} \ No newline at end of file diff --git a/src/main/kotlin/entries/FurnaceEntry.kt b/src/main/kotlin/entries/FurnaceEntry.kt new file mode 100644 index 0000000..d753473 --- /dev/null +++ b/src/main/kotlin/entries/FurnaceEntry.kt @@ -0,0 +1,8 @@ +package entries + +import game_logic.runescape.RunescapeRoutines + + +fun main() { + RunescapeRoutines.processInventoryAtFurnace(1839) +} \ No newline at end of file diff --git a/src/main/kotlin/entries/IncenceEntry.kt b/src/main/kotlin/entries/IncenceEntry.kt new file mode 100644 index 0000000..e68d047 --- /dev/null +++ b/src/main/kotlin/entries/IncenceEntry.kt @@ -0,0 +1,12 @@ +package entries + +import game_logic.runescape.RunescapeRoutines + + +fun main() { + RunescapeRoutines.fullRunIncense(0, 0, 0, 1839) +} + + + + diff --git a/src/main/kotlin/simulation/AttackDice.kt b/src/main/kotlin/simulation/AttackDice.kt index 8523219..57a0f81 100644 --- a/src/main/kotlin/simulation/AttackDice.kt +++ b/src/main/kotlin/simulation/AttackDice.kt @@ -1,5 +1,21 @@ package simulation +/** + * AttackDice class represents dice used for attack rolls. + * If the roll string contains a 'c' modifier, the value after 'c' is used as the crit threshold. + * Otherwise, the crit threshold defaults to the max possible roll (number of dice * die size). + * + * + * Example rollStrings: + * + * "1d20" + * + * "1d20c18" + * + * "3d8c15" + * + * The isCrit() method checks if a roll result meets the crit threshold. + */ class AttackDice( override val rollString: String, override val rollType: RollType = RollType.Normal, @@ -23,11 +39,21 @@ class AttackDice( val parts = cleanRollString.split('d') nDice = parts[0].toInt() dieSize = parts[1].toInt() - critThreshold = dieSize + critThreshold = dieSize * nDice } } + /** + * Checks if the given [RollResult] meets or exceeds the critical hit threshold + * for these attack dice. + * + * The critical hit threshold is determined based on the roll string used to construct + * this [AttackDice] instance. + * + * @param result The [RollResult] to check for crit. + * @return True if result meets or exceeds the crit threshold. + */ fun isCrit(result: RollResult): Boolean { return result.result >= critThreshold }