Fixed rapid heal bug

Improved reliability of runecrafting unit tests
This commit is contained in:
Avi Weinstock 2023-11-11 05:52:09 +00:00 committed by Ryan
parent 2dce4fe98c
commit b2eb9cfdc9
2 changed files with 7 additions and 7 deletions

View file

@ -63,13 +63,13 @@ class SkillRestore : RSTimer (1, "skillrestore", isAuto = true, isSoft = true) {
when (event.type) {
PrayerType.RAPID_HEAL -> {
restore.restoreTicks [Skills.HITPOINTS] -= 50
restore.restoreTicks [Skills.HITPOINTS] = 50
restore.ticksSinceLastRestore [Skills.HITPOINTS] = 0
}
PrayerType.RAPID_RESTORE -> {
for (i in 0 until 24) {
if (i == Skills.HITPOINTS || i == Skills.PRAYER || i == Skills.SUMMONING) continue
restore.restoreTicks [i] -= 50
restore.restoreTicks [i] = 50
restore.ticksSinceLastRestore [i] = 0
}
}
@ -84,13 +84,13 @@ class SkillRestore : RSTimer (1, "skillrestore", isAuto = true, isSoft = true) {
when (event.type) {
PrayerType.RAPID_HEAL -> {
restore.restoreTicks [Skills.HITPOINTS] += 50
restore.restoreTicks [Skills.HITPOINTS] = 100
restore.ticksSinceLastRestore [Skills.HITPOINTS] = 0
}
PrayerType.RAPID_RESTORE -> {
for (i in 0 until 24) {
if (i == Skills.HITPOINTS || i == Skills.PRAYER || i == Skills.SUMMONING) continue
restore.restoreTicks [i] += 50
restore.restoreTicks [i] = 100
restore.ticksSinceLastRestore [i] = 0
}
}

View file

@ -7,10 +7,10 @@ import org.junit.jupiter.api.Test
class RunecraftTests {
fun rollRc(rcLevel: Int, rune: Rune, revision: Int, lo: Double, hi: Double) {
var total = 0.0
for(i in 0 until 1000) {
for(i in 0 until 3000) {
total += RuneCraftPulse.getMultiplier(rcLevel, rune, revision, false)
}
val average = total / 1000.0
val average = total / 3000.0
Assertions.assertTrue(lo <= average && average <= hi, "rollRc: ${rcLevel} ${rune.name} ${revision}: ${average}")
}
@ -33,7 +33,7 @@ class RunecraftTests {
rollRc(99, Rune.NATURE, 530, 2.0, 2.0);
rollRc(99, Rune.NATURE, 573, 2.0, 2.0);
rollRc(99, Rune.NATURE, 581, 2.0, 2.1);
rollRc(99, Rune.NATURE, 581, 2.04, 2.14);
}
@Test fun testLawRcMultipliers() {
rollRc(54, Rune.LAW, 530, 1.0, 1.0);