1package com.osroyale.game.world.entity.combat.attack.listener.item;
3import com.osroyale.game.world.entity.combat.attack.listener.ItemCombatListenerSignature;
4import com.osroyale.game.world.entity.combat.attack.listener.SimplifiedListener;
5import com.osroyale.game.world.entity.combat.effect.impl.CombatPoisonEffect;
6import com.osroyale.game.world.entity.combat.effect.impl.CombatVenomEffect;
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;
10import com.osroyale.game.world.items.Item;
11import com.osroyale.game.world.items.containers.equipment.Equipment;
12import com.osroyale.util.RandomUtils;
15public class ZulrahHelm extends SimplifiedListener<Player> {
18 public void hit(
Player attacker,
Mob defender,
Hit hit) {
19 if (!defender.isNpc()) {
23 Item helm = attacker.equipment.get(
Equipment.HELM_SLOT);
29 if (helm.matchesId(12_931)) {
30 serp(attacker, defender,
this);
31 }
else if (helm.matchesId(13_197)) {
32 tanz(attacker, defender,
this);
33 }
else if (helm.matchesId(13_199)) {
34 magma(attacker, defender,
this);
38 private static void serp(
Player attacker,
Mob defender, ZulrahHelm listener) {
39 if (attacker.serpentineHelmCharges > 0) {
40 attacker.serpentineHelmCharges -= 2;
41 boolean poisonous =
false;
43 if (attacker.equipment.hasWeapon()) {
47 if (!poisonous && attacker.equipment.hasAmmo()) {
53 }
else if (RandomUtils.success(poisonous ? 0.50 : 1 / 6.0)) {
58 if (attacker.serpentineHelmCharges == 0) {
59 attacker.message(
"Your Serpentine helm is out of charges.");
60 attacker.equipment.set(
Equipment.HELM_SLOT,
new Item(12_929),
true);
61 attacker.getCombat().removeListener(listener);
65 private static void tanz(
Player attacker,
Mob defender, ZulrahHelm listener) {
66 if (attacker.tanzaniteHelmCharges > 0) {
67 attacker.tanzaniteHelmCharges -= 2;
68 boolean poisonous =
false;
70 if (attacker.equipment.hasWeapon()) {
74 if (!poisonous && attacker.equipment.hasAmmo()) {
80 }
else if (RandomUtils.success(poisonous ? 0.50 : 1 / 6.0)) {
85 if (attacker.tanzaniteHelmCharges == 0) {
86 attacker.message(
"Your Tanzanite helm is out of charges.");
87 attacker.equipment.set(
Equipment.HELM_SLOT,
new Item(13_196),
true);
88 attacker.getCombat().removeListener(listener);
92 private static void magma(
Player attacker,
Mob defender, ZulrahHelm listener) {
93 if (attacker.magmaHelmCharges > 0) {
94 attacker.magmaHelmCharges -= 2;
95 boolean poisonous =
false;
97 if (attacker.equipment.hasWeapon()) {
101 if (!poisonous && attacker.equipment.hasAmmo()) {
107 }
else if (RandomUtils.success(poisonous ? 0.50 : 1 / 6.0)) {
112 if (attacker.magmaHelmCharges == 0) {
113 attacker.message(
"Your Magma helm is out of charges.");
114 attacker.equipment.set(
Equipment.HELM_SLOT,
new Item(13_198),
true);
115 attacker.getCombat().removeListener(listener);
static Optional< PoisonType > getPoisonType(Item item)