Implemented the herblore skill cape perk as described on the website - 15% chance to make a 4-dose potion
This commit is contained in:
@@ -6,6 +6,10 @@ import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.tools.StringUtils;
|
||||
import content.global.skill.skillcapeperks.*;
|
||||
import content.data.consumables.Consumables;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
|
||||
/**
|
||||
* Represents the skill pulse used to handle the creating of potions.
|
||||
@@ -130,7 +134,15 @@ public final class HerblorePulse extends SkillPulse<Item> {
|
||||
*/
|
||||
public void handleFinished() {
|
||||
if ((player.getInventory().containsItem(potion.getBase()) && player.getInventory().containsItem(potion.getIngredient())) && player.getInventory().remove(potion.getBase(), potion.getIngredient())) {
|
||||
final Item item = potion.getProduct();
|
||||
Item item = potion.getProduct();
|
||||
if (SkillcapePerks.isActive (SkillcapePerks.BREWMASTER, player)) {
|
||||
if (RandomFunction.random(100) < 15) {
|
||||
Consumables consum = Consumables.getConsumableById (item.getId());
|
||||
if (consum != null)
|
||||
item = new Item (consum.getConsumable().getIds()[0], item.getAmount());
|
||||
player.sendMessage ("Due to your expertise, you manage to make an extra dose.");
|
||||
}
|
||||
}
|
||||
player.getInventory().add(item);
|
||||
player.getSkills().addExperience(Skills.HERBLORE, potion.getExperience(), true);
|
||||
player.getPacketDispatch().sendMessage("You mix the " + potion.getIngredient().getName().toLowerCase() + " into your potion.");
|
||||
|
||||
@@ -77,7 +77,8 @@ enum class SkillcapePerks(val attribute: String, val effect: ((Player) -> Unit)?
|
||||
}),
|
||||
HASTY_COOKING("cape_perks:hasty-cooking"),
|
||||
SMOOTH_HANDS("cape_perks:smooth-hands"),
|
||||
PET_MASTERY("cape_perks.pet-mastery"),
|
||||
PET_MASTERY("cape_perks:pet-mastery"),
|
||||
BREWMASTER("cape_perks:brewmaster"),
|
||||
NONE("cape_perks:none")
|
||||
;
|
||||
|
||||
@@ -98,7 +99,7 @@ enum class SkillcapePerks(val attribute: String, val effect: ((Player) -> Unit)?
|
||||
Skillcape.RUNECRAFTING -> ABYSS_WARPING
|
||||
Skillcape.HITPOINTS -> DAMAGE_SPONG
|
||||
Skillcape.AGILITY -> MARATHON_RUNNER
|
||||
Skillcape.HERBLORE -> NONE
|
||||
Skillcape.HERBLORE -> BREWMASTER
|
||||
Skillcape.THIEVING -> SMOOTH_HANDS
|
||||
Skillcape.CRAFTING -> NONE
|
||||
Skillcape.FLETCHING -> NONE
|
||||
|
||||
Reference in New Issue
Block a user