diff --git a/bin/net/grosinger/nomads/DroneListItem.class b/bin/net/grosinger/nomads/DroneListItem.class index 6eb13af..4480a58 100644 Binary files a/bin/net/grosinger/nomads/DroneListItem.class and b/bin/net/grosinger/nomads/DroneListItem.class differ diff --git a/bin/net/grosinger/nomads/Nomads.class b/bin/net/grosinger/nomads/Nomads.class index ac5b0c2..ccdb9e2 100644 Binary files a/bin/net/grosinger/nomads/Nomads.class and b/bin/net/grosinger/nomads/Nomads.class differ diff --git a/bin/net/grosinger/nomads/UpgradeShop.class b/bin/net/grosinger/nomads/UpgradeShop.class index e6280a3..d0ca079 100644 Binary files a/bin/net/grosinger/nomads/UpgradeShop.class and b/bin/net/grosinger/nomads/UpgradeShop.class differ diff --git a/bin/net/grosinger/nomads/exceptions/InvalidUpgradeException.class b/bin/net/grosinger/nomads/exceptions/InvalidUpgradeException.class new file mode 100644 index 0000000..9d7188b Binary files /dev/null and b/bin/net/grosinger/nomads/exceptions/InvalidUpgradeException.class differ diff --git a/src/net/grosinger/nomads/DroneListItem.java b/src/net/grosinger/nomads/DroneListItem.java index 4457820..b93de18 100644 --- a/src/net/grosinger/nomads/DroneListItem.java +++ b/src/net/grosinger/nomads/DroneListItem.java @@ -235,6 +235,16 @@ public class DroneListItem { return y; } + /** + * Returnes the list of all objectives this drone should be currently + * looking for + * + * @return ArrayList + */ + public ArrayList getCurrentObjectives() { + return currentObjectives; + } + /** * Returns if the drone is wanted * @@ -322,6 +332,26 @@ public class DroneListItem { waiting += newWaiting; } + /** + * Adds a new objective to the list of current objectives + * + * @param newObj + * Objective to add to list + */ + public void addObjective(Objective newObj) { + currentObjectives.add(newObj); + } + + /** + * Removes an objective from the list of current objectives + * + * @param oldObj + * Objective to remove from list + */ + public void removeObjective(Objective oldObj) { + currentObjectives.remove(oldObj); + } + /** * Increases the Visible Distance by specified amount * diff --git a/src/net/grosinger/nomads/Nomads.java b/src/net/grosinger/nomads/Nomads.java index 91b2298..868b705 100644 --- a/src/net/grosinger/nomads/Nomads.java +++ b/src/net/grosinger/nomads/Nomads.java @@ -3,7 +3,6 @@ package net.grosinger.nomads; import java.io.IOException; import java.util.ArrayList; - public class Nomads { public static World awesomeWorld; @@ -47,7 +46,8 @@ public class Nomads { public static final int MAXOBJECTIVEBOUNTY = 30; public static final int MINOBJECTIVEBOUNTY = 10; - + public static final int MAXREQUESTEDOBJECTIVES = 2; + public static final int BASE_VISIBLEDISTANCE = 15; public static final int BASE_LUMALOCATORDISTANCE = 10; public static final int BASE_OBJECTLOCATORDISTANCE = 10; @@ -57,7 +57,7 @@ public class Nomads { public static final int BASE_SPEED = 1; public static final int BASE_CARGOSPACE = 3; public static final int BASE_THEFT = 1; - + public static final int MAXLEVEL_RADARS = 30; public static final int MAXLEVEL_STATS = 10; diff --git a/src/net/grosinger/nomads/UpgradeShop.java b/src/net/grosinger/nomads/UpgradeShop.java index e81f568..e72fc71 100644 --- a/src/net/grosinger/nomads/UpgradeShop.java +++ b/src/net/grosinger/nomads/UpgradeShop.java @@ -1,6 +1,7 @@ package net.grosinger.nomads; import net.grosinger.nomads.exceptions.InsufficientFundsException; +import net.grosinger.nomads.exceptions.InvalidUpgradeException; /** * A representation of an UpgradeShop. Allows Drones to interact with this @@ -12,8 +13,6 @@ public class UpgradeShop extends NeighborBuilding { super(x, y, name, building, drone); } - // TODO - Implement Upgrade Shop - /** * Performs an upgrade on the drone if it is possible. Must be passed an * upgrade that is not already of max level, and that has enough funds to @@ -22,13 +21,19 @@ public class UpgradeShop extends NeighborBuilding { * @param toPerform * An Upgrade that should be performed * @throws InsufficientFundsException + * @throws InvalidUpgradeException */ - public void performUpgrade(Upgrade toPerform) throws InsufficientFundsException { + public void performUpgrade(Upgrade toPerform) throws InsufficientFundsException, + InvalidUpgradeException { int teamBalance = drone.getTeam().getBalance(); int upgradeCost = toPerform.getPrice(); if (upgradeCost > teamBalance) { throw new InsufficientFundsException(); + } else if (toPerform.isMaxLevel()) { + throw new InvalidUpgradeException("Maximum level already achieved"); + } else { + // TODO - Implement Perform Upgrade } } diff --git a/src/net/grosinger/nomads/exceptions/InvalidUpgradeException.java b/src/net/grosinger/nomads/exceptions/InvalidUpgradeException.java new file mode 100644 index 0000000..2175373 --- /dev/null +++ b/src/net/grosinger/nomads/exceptions/InvalidUpgradeException.java @@ -0,0 +1,8 @@ +package net.grosinger.nomads.exceptions; + +public class InvalidUpgradeException extends Exception { + + public InvalidUpgradeException(String reason){ + super(reason); + } +}