51 STAMINA__POTION(12625, 12627, 12629, 12631) {
55 player.energyRate = 200;
58 SUPER_COMBAT_POTION(12695, 12697, 12699, 12701) {
66 ZAMORAK_BREW(2450, 189, 191, 193) {
72 SARADOMIN_BREW(6685, 6687, 6689, 6691) {
78 ANTIDOTE_PLUS(5943, 5945, 5947, 5949) {
81 PotionData.onAntiPoisonEffect(player,
true, 1000);
84 ANTIDOTE_PLUS_PLUS(5952, 5954, 5956, 5958) {
87 PotionData.onAntiPoisonEffect(player,
true, 1200);
90 AGILITY_POTION(3032, 3034, 3036, 3038) {
96 FISHING_POTION(2438, 151, 153, 155) {
102 RANGE_POTIONS(2444, 169, 171, 173) {
108 ENERGY_POTIONS(3008, 3010, 3012, 3014) {
114 SUPER_ENERGY_POTIONS(3016, 3018, 3020, 3022) {
120 MAGIC_POTIONS(3040, 3042, 3044, 3046) {
126 DEFENCE_POTIONS(2432, 133, 135, 137) {
132 STRENGTH_POTIONS(113, 115, 117, 119) {
138 ATTACK_POTIONS(2428, 121, 123, 125) {
144 SUPER_DEFENCE_POTIONS(2442, 163, 165, 167) {
150 SUPER_ATTACK_POTIONS(2436, 145, 147, 149) {
156 SUPER_STRENGTH_POTIONS(2440, 157, 159, 161) {
162 RESTORE_POTIONS(2430, 127, 129, 131) {
165 onRestoreEffect(player,
false);
168 SUPER_RESTORE_POTIONS(3024, 3026, 3028, 3030) {
177 PRAYER_POTIONS(2434, 139, 141, 143) {
183 SUPER_PRAYER_POTIONS(15328, 15329, 15330, 15331) {
189 ANTIFIRE_POTIONS(2452, 2454, 2456, 2458) {
195 SUPER_ANTIFIRE_POTIONS(15304, 15305, 15306, 15307) {
201 ANTIPOISON_POTIONS(2446, 175, 177, 179) {
204 PotionData.onAntiPoisonEffect(player,
false, 0);
207 SUPER_ANTIPOISON_POTIONS(2448, 181, 183, 185) {
210 PotionData.onAntiPoisonEffect(player,
true, 500);
213 ANTI_VENOM(12905, 12907, 12909, 12911) {
219 if (player.getPoisonImmunity().get() <= 0) {
220 player.send(
new SendMessage(
"You have been granted immunity against poison."));
222 }
else if (player.getPoisonImmunity().get() > 0) {
223 player.send(
new SendMessage(
"Your immunity against poison has been restored!"));
225 player.getPoisonImmunity().set(1200);
227 if (player.getVenomImmunity().get() <= 0) {
228 player.send(
new SendMessage(
"You have been granted immunity against venom."));
230 }
else if (player.getVenomImmunity().get() > 0) {
231 player.send(
new SendMessage(
"Your immunity against venom has been restored!"));
233 player.getVenomImmunity().set(300);
236 ANTI_VENOM_PLUS(12913, 12915, 12917, 12919) {
242 if (player.getPoisonImmunity().get() <= 0) {
243 player.send(
new SendMessage(
"You have been granted immunity against poison."));
245 }
else if (player.getPoisonImmunity().get() > 0) {
246 player.send(
new SendMessage(
"Your immunity against poison has been restored!"));
248 player.getPoisonImmunity().set(1500);
250 if (player.getVenomImmunity().get() <= 0) {
251 player.send(
new SendMessage(
"You have been granted immunity against venom."));
253 }
else if (player.getVenomImmunity().get() > 0) {
254 player.send(
new SendMessage(
"Your immunity against venom has been restored!"));
256 player.getVenomImmunity().set(3000);
263 private static final ImmutableSet<PotionData> VALUES = Sets.immutableEnumSet(EnumSet.allOf(
PotionData.class));
268 private static final Item VIAL =
new Item(229);
273 private final int[] ids;
289 private static void onFishingEffect(
Player player) {
299 private static void onAgilityEffect(
Player player) {
309 private static void onSaradominEffect(Player player) {
310 modifySkill(player, Skill.HITPOINTS, 0.15, 2);
311 modifySkill(player, Skill.DEFENCE, 0.20, 2);
312 modifySkill(player, Skill.ATTACK, -0.10, 2);
313 modifySkill(player, Skill.STRENGTH, -0.10, 2);
314 modifySkill(player, Skill.RANGED, -0.10, 2);
315 modifySkill(player, Skill.MAGIC, -0.10, 2);
323 private static void onZamorakEffect(Player player) {
324 modifySkill(player, Skill.ATTACK, 0.20, 2);
325 modifySkill(player, Skill.STRENGTH, 0.12, 2);
326 modifySkill(player, Skill.DEFENCE, -0.10, 2);
327 modifySkill(player, Skill.HITPOINTS, -0.10, 2);
328 modifySkill(player, Skill.PRAYER, 0.10, 0);
337 private static void onPrayerEffect(Player player,
boolean superPrayer) {
338 int realLevel = player.skills.get(Skill.PRAYER).getMaxLevel();
339 player.skills.get(Skill.PRAYER).modifyLevel(level -> level + (
int) Math.floor(7 + (realLevel * (superPrayer ? 0.35 : 0.25))));
340 player.skills.refresh(Skill.PRAYER);
353 if (player.isVenomed()) {
354 player.getVenomDamage().set(0);
360 if (player.isPoisoned()) {
361 player.getPoisonDamage().set(0);
364 player.send(
new SendMessage(
"You have been cured of your poison!"));
369 if (length > 0 && player.getPoisonImmunity().get() <= 0) {
370 player.send(
new SendMessage(
"You have been granted immunity against poison."));
371 player.getPoisonImmunity().incrementAndGet(length);
373 }
else if (player.getPoisonImmunity().get() > 0) {
374 player.send(
new SendMessage(
"Your immunity against poison has been restored!"));
375 player.getPoisonImmunity().set(length);
387 private static void onEnergyEffect(
Player player,
boolean superPotion) {
388 int amount = superPotion ? 20 : 10;
389 int energy = player.runEnergy;
391 if (amount + energy > 100) {
392 player.runEnergy = 100;
394 player.runEnergy += amount;
397 player.send(
new SendRunEnergy());
405 private static void onRestoreEffect(Player player,
boolean superRestore) {
406 for (
int index = 0; index <= 6; index++) {
407 if ((index == Skill.PRAYER) || (index == Skill.HITPOINTS)) {
411 Skill skill = player.skills.get(index);
412 int realLevel = skill.getMaxLevel();
414 if (skill.getLevel() >= realLevel) {
418 int formula = superRestore ? (int) Math.floor(8 + (realLevel * 0.25)) : (int) Math.floor(10 + (realLevel * 0.30));
419 player.skills.get(index).modifyLevel(level -> level + formula);
420 player.skills.refresh(index);
430 private static void onAntiFireEffect(
Player player,
boolean superVariant) {
444 private static void onBasicEffect(
Player player,
int skill, BoostType type) {
445 modifySkill(player, skill, type.amount, type.base);
454 private static void modifySkill(
Player player,
int skill,
double percentage,
int base) {
455 Skill s = player.skills.get(skill);
458 final int boostLevel = (int) (realLevel * percentage + base);
460 int cap = s.getLevel();
461 if (cap < realLevel + boostLevel) {
462 cap = realLevel + boostLevel;
466 int damage = boostLevel;
467 if (player.getCurrentHealth() + damage <= 0) damage = -player.getCurrentHealth() + 1;
468 player.damage(
new Hit(-damage));
470 player.skills.get(skill).modifyLevel(level -> level + boostLevel, 0, cap);
473 player.skills.refresh(skill);
484 Optional<PotionData> potion =
forId(item.getId());
485 if (potion.isPresent()) {
486 int length = potion.get().getIds().length;
487 for (
int index = 0; index < length; index++) {
488 if (potion.get().getIds()[index] == item.getId() && index + 1 < length) {
489 return new Item(potion.get().getIds()[index + 1]);
503 public static Optional<PotionData>
forId(
int id) {
505 for (
int potionId : potion.getIds()) {
506 if (
id == potionId) {
507 return Optional.of(potion);
511 return Optional.empty();
546 return ids[ids.length - dose];
564 private final int base;
569 private final float amount;
578 this.amount = boostAmount;