1+ package game.combat.npcHooks
2+
3+ import api.combat.npc.NpcCombatHandler.combat
4+ import api.predef.*
5+ import api.predef.ext.*
6+ import game.player.Sound
7+ import io.luna.Luna
8+ import io.luna.game.model.mob.Player
9+ import io.luna.game.model.mob.block.Graphic
10+
11+ if (Luna .settings().skills().slayerEquipmentNeeded()) {
12+
13+ /* *
14+ * The wearable earmuffs item id.
15+ */
16+ val EARMUFFS = 4166
17+
18+ /* *
19+ * The banshee scream graphic.
20+ */
21+ val GRAPHIC = Graphic (337 , 150 , 0 ) // TODO Projectile looks a bit weird.
22+
23+ /*
24+ * Banshee slayer equipment hook.
25+ *
26+ * When slayer equipment checks are enabled, banshees require earmuffs. Players who are attacked without earmuffs
27+ * equipped are hit by the banshee scream effect, which reduces several combat-related levels to 1 and causes
28+ * the banshee melee hit to use a higher max hit.
29+ *
30+ * This script currently handles the effect during the melee attack flow.
31+ */
32+ combat(1612 ) {
33+ attack {
34+ if (rand(1 of 5 )) {
35+ // 1/3 chance of scream attack.
36+ npc.graphic(GRAPHIC )
37+ if (other is Player && other.equipment.head?.id != EARMUFFS ) {
38+ // We're wearing earmuffs, use scream attack with max hit of 8 that also drains stats.
39+ other.playSound(Sound .BANSHEE_ATTACK_NORMAL )
40+ melee(animationId = - 1 ,
41+ maxHit = 8 ) {
42+ other.attack.level = 1
43+ other.strength.level = 1
44+ other.defence.level = 1
45+ other.ranged.level = 1
46+ other.magic.level = 1
47+ other.agility.level = 1
48+ other.sendMessage(" You have been weakened." )
49+ it
50+ }
51+ } else {
52+ // We're wearing earmuffs, use scream attack with max hit of 2.
53+ if (other is Player ) {
54+ other.playSound(Sound .BANSHEE_ATTACK_EARMUFFS )
55+ }
56+ melee(animationId = - 1 ,
57+ maxHit = 2 )
58+ }
59+ } else {
60+ // Use the default attack.
61+ default()
62+ }
63+ }
64+ }
65+ }
0 commit comments