diff --git a/src/main/java/Commands/CommandDayEnd.java b/src/main/java/Commands/CommandDayEnd.java index 76f0742cb4..5d38adcd98 100644 --- a/src/main/java/Commands/CommandDayEnd.java +++ b/src/main/java/Commands/CommandDayEnd.java @@ -15,7 +15,7 @@ public void execute(Farmio farmio) throws FarmioException, FarmioFatalException Farmer farmer = farmio.getFarmer(); farmio.getSimulation().animate("DayEnd", 0, true); farmio.getUi().show("Press ENTER to start your next day!"); - farmer.nextDay(farmio); + farmer.nextDay(); farmio.setStage(Farmio.Stage.DAY_START); } } diff --git a/src/main/java/Farmio/Farmer.java b/src/main/java/Farmio/Farmer.java index fd3a059475..fbc5aecd37 100644 --- a/src/main/java/Farmio/Farmer.java +++ b/src/main/java/Farmio/Farmer.java @@ -39,8 +39,8 @@ public class Farmer { private ArrayList levelList = new ArrayList(Arrays.asList(1.1,1.2,1.3,1.4,1.5,1.6,2.1,2.2)); public Farmer() { - this.money = 10; - this.level = 1.1; + this.money = 95; + this.level = 1.6; this.day = 1; this.location = "WheatFarm"; this.wheatFarm = new WheatFarm(); @@ -177,8 +177,9 @@ public void startDay(Farmio farmio) throws FarmioException, FarmioFatalException } } - public void nextDay(Farmio farmio) throws FarmioException, FarmioFatalException { + public void nextDay() throws FarmioException, FarmioFatalException { wheatFarm.growSeedlings(); + day += 1; } diff --git a/src/main/java/Farmio/Level.java b/src/main/java/Farmio/Level.java index 8c2fa9a2dd..29d4898bd4 100644 --- a/src/main/java/Farmio/Level.java +++ b/src/main/java/Farmio/Level.java @@ -155,7 +155,7 @@ else if (currentLevelState == objectiveResult.FAILED){ public Map getGoals() { Map goals = new HashMap< String,Integer>(); - goals.put("Gold", endMoney); + goals.put("Gold", gold); goals.put("Seeds", endWheatSeed); goals.put("Wheat", endWheatGreen); goals.put("Grain", endWheatRipe); diff --git a/src/main/java/Places/WheatFarm.java b/src/main/java/Places/WheatFarm.java index fdd5f486aa..3253fea8cf 100644 --- a/src/main/java/Places/WheatFarm.java +++ b/src/main/java/Places/WheatFarm.java @@ -20,11 +20,11 @@ public boolean hasSeeds() { } public boolean hasWheat() { - return grain > 0; + return wheat > 0; } - public boolean hasRipened() { - return wheat > 0; + public boolean hasGrain() { + return grain > 0; } public WheatFarm() { 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 dbf4c25c5b..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().hasRipened() || !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) { diff --git a/src/main/java/UserCode/Conditions/BooleanConditionType.java b/src/main/java/UserCode/Conditions/BooleanConditionType.java index ee13bfb8c0..b1a8094049 100644 --- a/src/main/java/UserCode/Conditions/BooleanConditionType.java +++ b/src/main/java/UserCode/Conditions/BooleanConditionType.java @@ -2,6 +2,8 @@ public enum BooleanConditionType { hasSeeds, + hasWheat, + hasGrain, wheatRipened, wheatHarvested, TRUE diff --git a/src/main/java/UserCode/Conditions/ConditionChecker.java b/src/main/java/UserCode/Conditions/ConditionChecker.java index 60617adbad..f4822ecc38 100644 --- a/src/main/java/UserCode/Conditions/ConditionChecker.java +++ b/src/main/java/UserCode/Conditions/ConditionChecker.java @@ -12,6 +12,13 @@ public static boolean check(BooleanConditionType condition, Farmio farmio) { if (condition == BooleanConditionType.hasSeeds) { return farmio.getFarmer().getWheatFarm().hasSeeds(); } + if (condition == BooleanConditionType.hasWheat) { + return farmio.getFarmer().getWheatFarm().hasWheat() ; + } + if (condition == BooleanConditionType.hasGrain) + { + return farmio.getFarmer().getWheatFarm().hasGrain(); + } if (condition == BooleanConditionType.TRUE) { return true; }