From 6de1e3cd7c840bce14485cd3664a9a5b51c3aeee Mon Sep 17 00:00:00 2001 From: JohnTYH Date: Thu, 24 Oct 2019 12:11:49 +0800 Subject: [PATCH] updated check condition and error for harvestwheat and sellwheat --- src/main/java/UserCode/Actions/HarvestWheatAction.java | 2 +- src/main/java/UserCode/Actions/SellWheatAction.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/UserCode/Actions/HarvestWheatAction.java b/src/main/java/UserCode/Actions/HarvestWheatAction.java index 6db5b5f5a8..a37f67d89d 100644 --- a/src/main/java/UserCode/Actions/HarvestWheatAction.java +++ b/src/main/java/UserCode/Actions/HarvestWheatAction.java @@ -23,7 +23,7 @@ public void execute(Ui ui, Storage storage, Farmer farmer, Simulation simulation farmer.setTaskFailed(); simulation.animate("ErrorInExecution", 0); if (!farmer.getWheatFarm().hasWheat()) { - ui.typeWriter("Error! you have attempted to harvest wheat despite not having any seedlings/\n"); + ui.typeWriter("Error! you have attempted to harvest wheat despite not having any wheat/\n"); } else { ui.typeWriter("Error! you have attempted to harvest wheat despite not being at the Wheatfarm/\n"); } diff --git a/src/main/java/UserCode/Actions/SellWheatAction.java b/src/main/java/UserCode/Actions/SellWheatAction.java index 9b05d8a237..4dde92099b 100644 --- a/src/main/java/UserCode/Actions/SellWheatAction.java +++ b/src/main/java/UserCode/Actions/SellWheatAction.java @@ -15,19 +15,19 @@ public SellWheatAction() { @Override public void execute(Ui ui, Storage storage, Farmer farmer, Simulation simulation) throws FarmioFatalException, FarmioException { - if (!farmer.getWheatFarm().hasWheat() || !farmer.getLocation().equals("Market")) { + if (!farmer.getWheatFarm().hasGrain() || !farmer.getLocation().equals("Market")) { farmer.setTaskFailed(); simulation.animate("ErrorInExecution", 0); - if (!farmer.getWheatFarm().hasWheat()) { - ui.typeWriter("Error! you have attempted to sell wheat despite not having any wheat/\n"); + if (!farmer.getWheatFarm().hasGrain()) { + ui.typeWriter("Error! you have attempted to sell grain despite not having any grain/\n"); } else { - ui.typeWriter("Error! you have attempted to sell wheat despite not being at the market/\n"); + ui.typeWriter("Error! you have attempted to sell grain despite not being at the market/\n"); } throw new FarmioException("Task Error!"); } try { simulation.animate("SellWheatSimulation", 0, 6); - ui.show("Selling wheat!"); + ui.show("Selling grain!"); farmer.earnMoney(farmer.getWheatFarm().sell()); simulation.animate(1000, "SellWheatSimulation", 7); } catch (Exception e) {