Archived
1
0

-Finished upgrades

Signed-off-by: Tony Grosinger <tony@grosinger.net>
This commit is contained in:
Tony Grosinger 2011-09-16 14:14:59 -07:00
parent e323a0064d
commit 47ddadc865
8 changed files with 55 additions and 6 deletions

View File

@ -2,6 +2,7 @@ package net.grosinger.nomads;
import java.util.ArrayList; import java.util.ArrayList;
import net.grosinger.nomads.Upgrade.UpgradeType;
import net.grosinger.nomads.exceptions.FullInventoryException; import net.grosinger.nomads.exceptions.FullInventoryException;
/** /**
@ -56,8 +57,6 @@ public class DroneListItem {
private Inventory inventory; private Inventory inventory;
private ArrayList<Objective> currentObjectives; private ArrayList<Objective> currentObjectives;
// TODO - Implement max number of objectives
/* /*
* Default constructor, includes all references * Default constructor, includes all references
*/ */
@ -244,8 +243,8 @@ public class DroneListItem {
public ArrayList<Objective> getCurrentObjectives() { public ArrayList<Objective> getCurrentObjectives() {
return currentObjectives; return currentObjectives;
} }
public boolean getCurrentObjectivesFull(){ public boolean getCurrentObjectivesFull() {
return currentObjectives.size() >= Nomads.MAXREQUESTEDOBJECTIVES; return currentObjectives.size() >= Nomads.MAXREQUESTEDOBJECTIVES;
} }
@ -366,6 +365,56 @@ public class DroneListItem {
visibleDistance += amount; visibleDistance += amount;
} }
/**
* Increments the level specified by the type.
*
* @param type
* Level to be increased
*/
public void incrementLevel(UpgradeType type) {
switch (type) {
case visibleDistance: {
visibleDistance++;
break;
}
case lumaLocatorDistance: {
lumaLocatorDistance++;
break;
}
case objectLocatorDistance: {
objectLocatorDistance++;
break;
}
case reliability: {
reliability++;
break;
}
case attack: {
attack++;
break;
}
case defenses: {
defenses++;
break;
}
case speed: {
speed++;
break;
}
case cargoSpace: {
cargoSpace++;
break;
}
case theft: {
theft++;
break;
}
default: {
// Must specify an Upgrade Type
}
}
}
/** /**
* Increases the age of the drone by 1 turn * Increases the age of the drone by 1 turn
*/ */

View File

@ -82,7 +82,6 @@ public class Upgrade {
break; break;
} }
case lumaLocatorDistance: { case lumaLocatorDistance: {
allInfo.put("multiplier", (double) 2.5); allInfo.put("multiplier", (double) 2.5);
allInfo.put("currentLevel", (double) oldBrokenDrone.getLumaLocatorDistance()); allInfo.put("currentLevel", (double) oldBrokenDrone.getLumaLocatorDistance());
allInfo.put("originalLevel", (double) Nomads.BASE_LUMALOCATORDISTANCE); allInfo.put("originalLevel", (double) Nomads.BASE_LUMALOCATORDISTANCE);

View File

@ -33,7 +33,8 @@ public class UpgradeShop extends NeighborBuilding {
} else if (toPerform.isMaxLevel()) { } else if (toPerform.isMaxLevel()) {
throw new InvalidUpgradeException("Maximum level already achieved"); throw new InvalidUpgradeException("Maximum level already achieved");
} else { } else {
// TODO - Implement Perform Upgrade drone.incrementLevel(toPerform.getUpgradeType());
drone.getTeam().deductFromBalance(upgradeCost);
} }
} }