RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
PhoenixNecklaceListener.java
1package com.osroyale.game.world.entity.combat.attack.listener.item;
2
3import com.osroyale.net.packet.out.SendMessage;
4import com.osroyale.game.world.entity.combat.CombatType;
5import com.osroyale.game.world.entity.combat.attack.listener.ItemCombatListenerSignature;
6import com.osroyale.game.world.entity.combat.attack.listener.SimplifiedListener;
7import com.osroyale.game.world.entity.combat.hit.Hit;
8import com.osroyale.game.world.entity.mob.Mob;
9import com.osroyale.game.world.entity.mob.player.Player;
10
17@ItemCombatListenerSignature(requireAll = false, items = {11090})
18public class PhoenixNecklaceListener extends SimplifiedListener<Player> {
19
20 @Override
21 public void block(Mob attacker, Player defender, Hit hit, CombatType combatType) {
22 if (defender.getCurrentHealth() - hit.getDamage() <= 0)
23 return;
24 if (defender.getCurrentHealth() - hit.getDamage() <= defender.getMaximumHealth() * 0.20) {
25 defender.send(new SendMessage("The Phoenix necklace of life saves you but was destroyed in the process"));
26 defender.heal((int) (defender.getMaximumHealth() * 0.30));
27 defender.getCombat().removeListener(this);
28 defender.equipment.remove(11090);
29 }
30 }
31}
boolean remove(Item item, int preferredIndex, boolean refresh)