Skip to content

Commit 4a0ef93

Browse files
committed
Fever spiders combat script
1 parent f9c7471 commit 4a0ef93

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package game.combat.npcHooks
2+
3+
import api.combat.npc.NpcCombatHandler.combat
4+
import api.predef.*
5+
import io.luna.Luna
6+
import io.luna.game.model.mob.Player
7+
import io.luna.game.model.mob.combat.damage.CombatDamageRequest
8+
import io.luna.game.model.mob.combat.damage.CombatDamageType
9+
import kotlin.math.floor
10+
11+
if (Luna.settings().skills().slayerEquipmentNeeded()) {
12+
13+
/**
14+
* The slayer gloves item id.
15+
*/
16+
val SLAYER_GLOVES = 6708
17+
18+
/**
19+
* Applies the fever spider glove penalty.
20+
*
21+
* If the victim is a player and is not wearing slayer gloves, the spider:
22+
* - Poisons the player if they are not already poisoned
23+
* - Adds bonus damage equal to 12.5% of the player's current hitpoints
24+
* - Forces the hit to use perfect base accuracy
25+
*
26+
* Players wearing slayer gloves use the normal melee damage request unchanged.
27+
*/
28+
combat(2850) {
29+
attack {
30+
melee {
31+
if (other is Player && other.equipment.hands?.id != SLAYER_GLOVES) {
32+
if (other.combat.poisonSeverity == 0) {
33+
other.combat.poisonSeverity = 20
34+
}
35+
36+
CombatDamageRequest.Builder(attacker, victim, CombatDamageType.MELEE)
37+
.setBaseMaxHit(5)
38+
.setFlatBonusDamage(floor(0.125 * other.health).toInt())
39+
.setBaseAccuracy(1.0)
40+
.build().resolve()
41+
} else {
42+
it
43+
}
44+
}
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)