mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Implemented swarm random event
This commit is contained in:
parent
fee56ae528
commit
b7851e7671
4 changed files with 46 additions and 1 deletions
|
|
@ -5395,6 +5395,7 @@
|
|||
"examine": "Insects buzzing around.",
|
||||
"melee_animation": "0",
|
||||
"range_animation": "0",
|
||||
"combat_audio": "819,821,820",
|
||||
"defence_animation": "0",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "0",
|
||||
|
|
@ -5404,7 +5405,7 @@
|
|||
"lifepoints": "10",
|
||||
"strength_level": "1",
|
||||
"id": "411",
|
||||
"aggressive": "true",
|
||||
"aggressive": "false",
|
||||
"range_level": "1",
|
||||
"attack_level": "1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import content.global.ame.events.rivertroll.RiverTrollRENPC
|
|||
import content.global.ame.events.rockgolem.RockGolemRENPC
|
||||
import content.global.ame.events.sandwichlady.SandwichLadyRENPC
|
||||
import content.global.ame.events.shade.ShadeRENPC
|
||||
import content.global.ame.events.swarm.SwarmNPC
|
||||
import content.global.ame.events.treespirit.TreeSpiritRENPC
|
||||
import content.global.ame.events.zombie.ZombieRENPC
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ enum class RandomEvents(val npc: RandomEventNPC, val loot: WeightBasedTable? = n
|
|||
)),
|
||||
DRILL_DEMON(npc = SeargentDamienNPC()),
|
||||
EVIL_CHICKEN(npc = EvilChickenNPC()),
|
||||
SWARM(npc = SwarmNPC()),
|
||||
EVIL_BOB(npc = EvilBobNPC(), skillIds = intArrayOf(Skills.FISHING, Skills.MAGIC)),
|
||||
DRUNKEN_DWARF(npc = DrunkenDwarfNPC()),
|
||||
RICK_TURPENTINE(npc = RickTurpentineNPC(), loot = CERTER.loot),
|
||||
|
|
|
|||
28
Server/src/main/content/global/ame/events/swarm/SwarmNPC.kt
Normal file
28
Server/src/main/content/global/ame/events/swarm/SwarmNPC.kt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package content.global.ame.events.swarm
|
||||
|
||||
import content.global.ame.RandomEventNPC
|
||||
import core.api.playGlobalAudio
|
||||
import core.api.utils.WeightBasedTable
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.tools.minutesToTicks
|
||||
import org.rs09.consts.NPCs
|
||||
import org.rs09.consts.Sounds
|
||||
|
||||
class SwarmNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(NPCs.SWARM_411) {
|
||||
override fun init() {
|
||||
super.init()
|
||||
this.setAttribute("no-spawn-return", true)
|
||||
this.attack(player)
|
||||
playGlobalAudio(this.location, Sounds.SWARM_APPEAR_818)
|
||||
this.ticksLeft = minutesToTicks(60)
|
||||
}
|
||||
|
||||
override fun tick() {
|
||||
super.tick()
|
||||
if (!this.inCombat())
|
||||
this.attack(player)
|
||||
}
|
||||
|
||||
override fun talkTo(npc: NPC) {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package content.global.ame.events.swarm
|
||||
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.combat.BattleState
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.npc.NPCBehavior
|
||||
import core.tools.RandomFunction
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
class SwarmNPCBehavior : NPCBehavior(NPCs.SWARM_411) {
|
||||
override fun beforeAttackFinalized(self: NPC, victim: Entity, state: BattleState) {
|
||||
state.estimatedHit = RandomFunction.getRandom(1)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue