Fixed regression causing random events to trigger for bots
This commit is contained in:
@@ -45,8 +45,8 @@ object TestUtils {
|
||||
var uidCounter = 0
|
||||
const val PLAYER_DEATH_TICKS = 14
|
||||
|
||||
fun getMockPlayer(name: String, ironman: IronmanMode = IronmanMode.NONE, rights: Rights = Rights.ADMINISTRATOR): MockPlayer {
|
||||
val p = MockPlayer(name)
|
||||
fun getMockPlayer(name: String, ironman: IronmanMode = IronmanMode.NONE, rights: Rights = Rights.ADMINISTRATOR, isBot: Boolean = false): MockPlayer {
|
||||
val p = MockPlayer(name, isBot)
|
||||
p.ironmanManager.mode = ironman
|
||||
p.details.accountInfo.uid = uidCounter++
|
||||
p.setPlaying(true);
|
||||
@@ -114,7 +114,7 @@ object TestUtils {
|
||||
}
|
||||
}
|
||||
|
||||
class MockPlayer(name: String) : Player(PlayerDetails(name)), AutoCloseable {
|
||||
class MockPlayer(name: String, val isBot: Boolean) : Player(PlayerDetails(name)), AutoCloseable {
|
||||
var hasInit = false
|
||||
init { configureBasicProperties(); flagTutComplete(false); init(); flagTutComplete(true) }
|
||||
|
||||
@@ -122,6 +122,7 @@ class MockPlayer(name: String) : Player(PlayerDetails(name)), AutoCloseable {
|
||||
this.details.session = MockSession()
|
||||
this.location = ServerConstants.HOME_LOCATION
|
||||
this.properties.attackStyle = WeaponInterface.AttackStyle(0, WeaponInterface.BONUS_CRUSH)
|
||||
this.artificial = isBot
|
||||
}
|
||||
|
||||
fun flagTutComplete(complete: Boolean) {
|
||||
|
||||
@@ -63,6 +63,13 @@ class RandomEventTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun shouldNotSpawnForArtificialPlayer() {
|
||||
TestUtils.getMockPlayer("antimacroshouldspawnrandom", isBot = true).use {p ->
|
||||
val timer = getTimer<AntiMacro>(p)
|
||||
Assertions.assertEquals(null, timer)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun teleportAndNotePunishmentShouldNotAffectAlreadyNotedItems() {
|
||||
TestUtils.getMockPlayer("teleportpunishment1").use {p ->
|
||||
val timer = getTimer<AntiMacro>(p) ?: Assertions.fail("AntiMacro timer is null!")
|
||||
|
||||
Reference in New Issue
Block a user