From fa00a932a717419b9c3f1c3313885518840cde85 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Wed, 25 Mar 2020 15:44:06 -0500 Subject: [PATCH] closes #199 --- .../content/global/consumable/Potion.java | 7 +++- .../src/plugin/consumable/PotionPlugin.java | 41 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/Server/src/org/crandor/game/content/global/consumable/Potion.java b/Server/src/org/crandor/game/content/global/consumable/Potion.java index 7f5479dea..bb5daeee0 100644 --- a/Server/src/org/crandor/game/content/global/consumable/Potion.java +++ b/Server/src/org/crandor/game/content/global/consumable/Potion.java @@ -103,7 +103,12 @@ public class Potion extends Drink { */ public void remove(final Player player, final Item item, final int doses, boolean message) { int dose = getDose(item) - (doses == 1 ? 0 : doses - 1); - int replaceId = (int) (dose == 1 ? VIAL.getId() : effect.getItemIds()[(4 - dose) + 1]); + int replaceId; + if(item.getId() == 11465 || item.getId() == 11467){ + replaceId = (int) (dose == 1 ? VIAL.getId() : effect.getItemIds()[(2 - dose) + 1]); + } else { + replaceId = (int) (dose == 1 ? VIAL.getId() : effect.getItemIds()[(4 - dose) + 1]); + } if (replaceId != -1) { dose--; player.getInventory().replace(new Item(replaceId), item.getSlot()); diff --git a/Server/src/plugin/consumable/PotionPlugin.java b/Server/src/plugin/consumable/PotionPlugin.java index 6f688f04d..06f4a77d7 100644 --- a/Server/src/plugin/consumable/PotionPlugin.java +++ b/Server/src/plugin/consumable/PotionPlugin.java @@ -31,6 +31,7 @@ public final class PotionPlugin implements Plugin { new EnergyPotion().newInstance(arg); new FishingPotion().newInstance(arg); new PrayerPotion().newInstance(arg); + new PrayerMix().newInstance(arg); new RelicymsBalm().newInstance(arg); new RestorePotion().newInstance(arg); new SaradominBrew().newInstance(arg); @@ -315,6 +316,46 @@ public final class PotionPlugin implements Plugin { } } + /** + * Represents the barbarian prayer potion mix + * @author ceik + */ + public class PrayerMix extends Potion { + + public PrayerMix() { + /** + * empty. + */ + } + + public PrayerMix(Effect effect) { + super(effect); + super.emptyItem = VIAL; + } + + @Override + public Plugin newInstance(Object arg) throws Throwable { + Consumables.add(new PrayerMix(new Effect("Prayer mix", new int[] { 11465, 11467 }, null))); + return this; + } + + @Override + public void effect(final Player player, final Item item) { + int level = player.getSkills().getStaticLevel(Skills.PRAYER); + int amt = 7 + (level / 4); + player.getSkills().incrementPrayerPoints(amt); + int hpDeficit = player.getSkills().getLifepoints() - player.getSkills().getMaximumLifepoints(); + if(hpDeficit <= -6){ + player.getSkills().setLifepoints(player.getSkills().getLifepoints() + 6); + return; + } else if (hpDeficit <= 0){ + player.getSkills().setLifepoints(player.getSkills().getMaximumLifepoints()); + return; + } + } + + } + /** * Represents the anti-poison plugin. * @author 'Vexia