mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-01 14:39:13 -06:00
Improved combat level brackets for hostile random events
This commit is contained in:
parent
9a4566cb0e
commit
6cccaa79de
1 changed files with 2 additions and 1 deletions
|
|
@ -39,6 +39,7 @@ abstract class RandomEventNPC(id: Int) : NPC(id) {
|
|||
var finalized = false
|
||||
var timerPaused = false
|
||||
var ticksLeft = secondsToTicks(180)
|
||||
private val combatBracket = intArrayOf(10, 20, 40, 60, 90)
|
||||
|
||||
open fun create(player: Player, loot: WeightBasedTable? = null, type: String = ""): RandomEventNPC {
|
||||
val event = this::class.createInstance()
|
||||
|
|
@ -144,7 +145,7 @@ abstract class RandomEventNPC(id: Int) : NPC(id) {
|
|||
}
|
||||
|
||||
fun idForCombatLevel(ids: List<Int>, player: Player): Int {
|
||||
val index = min(ids.size, ceil(player.properties.currentCombatLevel / 20.0).toInt()) - 1
|
||||
val index = combatBracket.indexOfFirst { player.properties.currentCombatLevel <= it }.takeIf { it != -1 }?: ids.lastIndex
|
||||
return ids[index]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue