RuneHive-Game
Loading...
Searching...
No Matches
PhoenixNecklaceListener.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.combat.attack.listener.item;
2
3import com.runehive.net.packet.out.SendMessage;
4import com.runehive.game.world.entity.combat.CombatType;
5import com.runehive.game.world.entity.combat.attack.listener.ItemCombatListenerSignature;
6import com.runehive.game.world.entity.combat.attack.listener.SimplifiedListener;
7import com.runehive.game.world.entity.combat.hit.Hit;
8import com.runehive.game.world.entity.mob.Mob;
9import com.runehive.game.world.entity.mob.player.Player;
10
11/**
12 * Handles the Pheonix necklace listener.
13 * OSRS Wiki: http://oldschoolrunescape.wikia.com/wiki/Phoenix_necklace
14 *
15 * @author Daniel
16 */
17@ItemCombatListenerSignature(requireAll = false, items = {11090})
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}
void block(Mob attacker, Player defender, Hit hit, CombatType combatType)
A Hit object holds the damage amount and hitsplat data.
Definition Hit.java:10
Handles the mob class.
Definition Mob.java:66
This class represents a character controlled by a player.
Definition Player.java:125
Combat< Player > getCombat()
The combat of the mob.
Definition Player.java:759
boolean remove(Item item, int preferredIndex, boolean refresh)
Removes an item from the equipment container.
The OutgoingPacket that sends a message to a Players chatbox in the client.