mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-21 09:02:07 -07:00
closes #199
This commit is contained in:
parent
679c8dd680
commit
fa00a932a7
2 changed files with 47 additions and 1 deletions
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
|||
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<Object> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<Object> 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue