Improve farming trees:
- Trees regrow from their stumps over time, or from Hydra's regrowth scrolls. - Diseased trees can be cured with secateurs. - Willow branches can be harvested from willow trees. - Giant ent improves yields of certain patch types by 50%.
This commit is contained in:
@@ -1,17 +1,27 @@
|
||||
package core.game.node.entity.npc.familiar;
|
||||
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.summoning.familiar.Familiar;
|
||||
import core.game.node.entity.skill.summoning.familiar.FamiliarSpecial;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.summoning.familiar.Familiar;
|
||||
import core.game.node.entity.skill.summoning.familiar.FamiliarSpecial;
|
||||
import core.game.node.entity.skill.summoning.familiar.Forager;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.RandomFunction;
|
||||
import org.rs09.consts.Items;
|
||||
import rs09.game.node.entity.skill.farming.FarmingPatch;
|
||||
import rs09.game.node.entity.skill.farming.PatchType;
|
||||
|
||||
/**
|
||||
* Represents the Giant Ent familiar.
|
||||
* @author Aero
|
||||
*/
|
||||
@Initializable
|
||||
public class GiantEntNPC extends Familiar {
|
||||
public class GiantEntNPC extends Forager {
|
||||
private static final Item[] ITEMS = new Item[] { new Item(Items.OAK_LOGS_1521) };
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GiantEntNPC} {@code Object}.
|
||||
@@ -26,7 +36,7 @@ public class GiantEntNPC extends Familiar {
|
||||
* @param id The id.
|
||||
*/
|
||||
public GiantEntNPC(Player owner, int id) {
|
||||
super(owner, id, 4900, 12013, 6, WeaponInterface.STYLE_CONTROLLED);
|
||||
super(owner, id, 4900, 12013, 6, WeaponInterface.STYLE_CONTROLLED, ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,4 +54,39 @@ public class GiantEntNPC extends Familiar {
|
||||
return new int[] { 6800, 6801 };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureFamiliar() {
|
||||
UseWithHandler.addHandler(6800, UseWithHandler.NPC_TYPE, new UseWithHandler(Items.PURE_ESSENCE_7936) {
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(6800, UseWithHandler.NPC_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
player.lock(1);
|
||||
int runeType = RandomFunction.random(9) < 4 ? Items.EARTH_RUNE_557 : Items.NATURE_RUNE_561;
|
||||
Item runes = new Item(runeType, 1);
|
||||
if (player.getInventory().remove(event.getUsedItem())) {
|
||||
player.getInventory().add(runes);
|
||||
player.sendMessage(String.format("The giant ent transmutes the pure essence into a %s.", runes.getName().toLowerCase()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void modifyFarmingReward(FarmingPatch fPatch, Item reward) {
|
||||
PatchType patchType = fPatch.getType();
|
||||
if(patchType == PatchType.FRUIT_TREE ||
|
||||
patchType == PatchType.BUSH ||
|
||||
patchType == PatchType.BELLADONNA ||
|
||||
patchType == PatchType.CACTUS) {
|
||||
if(RandomFunction.roll(2)) {
|
||||
reward.setAmount(2 * reward.getAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package core.game.node.entity.npc.familiar;
|
||||
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.summoning.familiar.Familiar;
|
||||
import core.game.node.entity.skill.summoning.familiar.FamiliarSpecial;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.summoning.familiar.Familiar;
|
||||
import core.game.node.entity.skill.summoning.familiar.FamiliarSpecial;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.plugin.Initializable;
|
||||
import rs09.game.node.entity.skill.farming.FarmingPatch;
|
||||
import rs09.game.node.entity.skill.farming.Patch;
|
||||
|
||||
/**
|
||||
* Represents the Hydra familiar.
|
||||
@@ -36,6 +40,17 @@ public class HydraNPC extends Familiar {
|
||||
|
||||
@Override
|
||||
protected boolean specialMove(FamiliarSpecial special) {
|
||||
Node node = special.getNode();
|
||||
if(node instanceof Scenery) {
|
||||
Scenery scenery = (Scenery)node;
|
||||
FarmingPatch farmingPatch = FarmingPatch.forObject(scenery);
|
||||
if(farmingPatch != null) {
|
||||
Patch patch = farmingPatch.getPatchFor(owner);
|
||||
patch.regrowIfTreeStump();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ public class UnicornStallionNPC extends Familiar {
|
||||
Player player = (Player) special.getNode();
|
||||
player.getAudioManager().send(4372);
|
||||
visualize(Animation.create(8267), Graphics.create(1356));
|
||||
player.getSettings().updateRunEnergy(player.getSettings().getRunEnergy() * 0.10);
|
||||
player.getSkills().heal((int) (player.getSkills().getMaximumLifepoints() * 0.15));
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user