Hostile random events now take the player's summoning level into account

Random event combat level is now selected authentically resulting in more difficult hostile random events
This commit is contained in:
Player Name
2025-02-17 10:44:44 +00:00
committed by Ryan
parent 50ba3682b5
commit 45fb89ec73
6 changed files with 10 additions and 25 deletions
@@ -9,9 +9,8 @@ import core.tools.RandomFunction
import org.rs09.consts.Items import org.rs09.consts.Items
import content.global.ame.RandomEventNPC import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable import core.api.utils.WeightBasedTable
import java.lang.Integer.max
val ids = 2463..2468 val ids = (2463..2468).toList()
class EvilChickenNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(2463) { class EvilChickenNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(2463) {
val phrases = arrayOf("Bwuk","Bwuk bwuk bwuk","Flee from me, @name!","Begone, @name!","Bwaaaauuuk bwuk bwuk","MUAHAHAHAHAAA!") val phrases = arrayOf("Bwuk","Bwuk bwuk bwuk","Flee from me, @name!","Begone, @name!","Bwaaaauuuk bwuk bwuk","MUAHAHAHAHAAA!")
@@ -19,8 +18,7 @@ class EvilChickenNPC(override var loot: WeightBasedTable? = null) : RandomEventN
override fun init() { override fun init() {
super.init() super.init()
val index = max(0, (player.properties.combatLevel / 20) - 1) val id = idForCombatLevel(ids, player)
val id = ids.toList()[index]
this.transform(id) this.transform(id)
this.attack(player) this.attack(player)
sendChat(phrases.random().replace("@name",player.username.capitalize())) sendChat(phrases.random().replace("@name",player.username.capitalize()))
@@ -4,17 +4,14 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable import core.api.utils.WeightBasedTable
import java.lang.Integer.max
val ids = (391..396).toList()
val ids = 391..396
class RiverTrollRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(391){ class RiverTrollRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(391){
override fun talkTo(npc: NPC) {} override fun talkTo(npc: NPC) {}
override fun init() { override fun init() {
super.init() super.init()
val index = max(0, (player.properties.combatLevel / 20) - 1) val id = idForCombatLevel(ids, player)
val id = ids.toList()[index]
this.transform(id) this.transform(id)
this.attack(player) this.attack(player)
sendChat("Fishies be mine, leave dem fishies!") sendChat("Fishies be mine, leave dem fishies!")
@@ -4,17 +4,14 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable import core.api.utils.WeightBasedTable
import kotlin.math.max
val ids = (413..418).toList()
val ids = 413..418
class RockGolemRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(413){ class RockGolemRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(413){
override fun talkTo(npc: NPC) {} override fun talkTo(npc: NPC) {}
override fun init() { override fun init() {
super.init() super.init()
val index = max(0,(player.properties.combatLevel / 20) - 1) val id = idForCombatLevel(ids, player)
val id = ids.toList()[index]
this.transform(id) this.transform(id)
this.attack(player) this.attack(player)
sendChat("Raarrrgghh! Flee human!") sendChat("Raarrrgghh! Flee human!")
@@ -4,15 +4,13 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable import core.api.utils.WeightBasedTable
import kotlin.math.*
class ShadeRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(425){ class ShadeRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(425){
val ids = (425..430).toList() val ids = (425..430).toList()
override fun talkTo(npc: NPC) {} override fun talkTo(npc: NPC) {}
override fun init() { override fun init() {
super.init() super.init()
val index = max(0, min(ids.size, (player.properties.combatLevel / 20) - 1)) val id = idForCombatLevel(ids, player)
val id = ids[index]
this.transform(id) this.transform(id)
this.attack(player) this.attack(player)
sendChat("Leave this place!") sendChat("Leave this place!")
@@ -4,17 +4,14 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable import core.api.utils.WeightBasedTable
import kotlin.math.max
val ids = (438..443).toList()
val ids = 438..443
class TreeSpiritRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(438){ class TreeSpiritRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(438){
override fun talkTo(npc: NPC) {} override fun talkTo(npc: NPC) {}
override fun init() { override fun init() {
super.init() super.init()
val index = max(0,(player.properties.combatLevel / 20) - 1) val id = idForCombatLevel(ids, player)
val id = ids.toList()[index]
this.transform(id) this.transform(id)
this.attack(player) this.attack(player)
sendChat("Leave these woods and never return!") sendChat("Leave these woods and never return!")
@@ -4,15 +4,13 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable import core.api.utils.WeightBasedTable
import kotlin.math.*
class ZombieRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(419){ class ZombieRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(419){
val ids = (419..424).toList() val ids = (419..424).toList()
override fun talkTo(npc: NPC) {} override fun talkTo(npc: NPC) {}
override fun init() { override fun init() {
super.init() super.init()
val index = max(0, min(ids.size, (player.properties.combatLevel / 20) - 1)) val id = idForCombatLevel(ids, player)
val id = ids[index]
this.transform(id) this.transform(id)
this.attack(player) this.attack(player)
sendChat("Brainsssss!") sendChat("Brainsssss!")