57public abstract class HarvestablePatch
extends FarmingPatch {
70 super(player, zone, boundaries);
81 private boolean harvest(
int min,
int max) {
88 player.dialogueFactory.sendStatement(
"You need secateurs to harvest here.").execute();
92 min = min * compost.produceIncrease() / 100;
93 player.action.execute(createHarvestAction(player, min, max));
109 protected boolean canSchedule() {
110 return !player.locking.locked() && player.inventory.getFreeSlots() > 0;
114 protected void onSchedule() {
115 player.locking.lock(2);
117 player.message(
"You begin to harvest the crop for " + plant.getProductType() +
".");
121 public void execute() {
122 if (player.inventory.getFreeSlots() <= 0) {
128 harvest = RandomUtils.inclusive(min, max);
131 harvest = harvest * 13 / 12;
135 harvest += harvest * 13 / 12;
148 if (harvest % 2 == 0)
150 player.inventory.add(plant.getHarvestId(), 1);
155 public void onCancel(
boolean logout) {
156 player.resetAnimation();
157 zone.sendPatchConfigs(player);
166 public String getName() {
167 return "Farming Harvest";
182 public boolean clickObject(
int opcode) {
183 if (opcode == 1 && !isDead() && fullyGrown) {
186 return super.clickObject(opcode);
190 protected void resetPatch() {
196 public JsonObject toJson() {
197 JsonObject
object = super.toJson();
198 object.addProperty(
"harvest", harvest);
203 public void fromJson(JsonObject
object) {
204 harvest =
object.get(
"harvest").getAsInt();
205 super.fromJson(
object);