Archived
1
0

-Continued work on Upgrade Class

Signed-off-by: Tony Grosinger <tony@grosinger.net>
This commit is contained in:
Tony Grosinger 2011-08-29 15:53:53 -07:00
parent 29f8d0c633
commit 2de93e31e6
8 changed files with 131 additions and 8 deletions

View File

@ -60,8 +60,15 @@ public class DroneListItem {
next = theNext;
previous = thePrevious;
current = theCurrent;
visibleDistance = 15;
speed = 1;
visibleDistance = Nomads.BASE_VISIBLEDISTANCE;
lumaLocatorDistance = Nomads.BASE_LUMALOCATORDISTANCE;
objectLocatorDistance = Nomads.BASE_OBJECTLOCATORDISTANCE;
reliability = Nomads.BASE_RELIABILITY;
attack = Nomads.BASE_ATTACK;
defenses = Nomads.BASE_DEFENSES;
speed = Nomads.BASE_SPEED;
cargoSpace = Nomads.BASE_CARGOSPACE;
theft = Nomads.BASE_THEFT;
team = theTeam;
waiting = 0;
inventory = new ArrayList<GameObject>();
@ -486,6 +493,7 @@ public class DroneListItem {
private void doUpgrade() {
Upgrade newUpgrade = current.upgrade();
int price = newUpgrade.getPrice();
//TODO - Hand price of upgrade being null
if (team.getBalance() >= price) {
// TODO - Implement purchasing upgrades

View File

@ -46,6 +46,16 @@ public class Nomads {
public static final int MAXOBJECTIVEBOUNTY = 30;
public static final int MINOBJECTIVEBOUNTY = 10;
public static final int BASE_VISIBLEDISTANCE = 15;
public static final int BASE_LUMALOCATORDISTANCE = 10;
public static final int BASE_OBJECTLOCATORDISTANCE = 10;
public static final int BASE_RELIABILITY = 1;
public static final int BASE_ATTACK = 1;
public static final int BASE_DEFENSES = 1;
public static final int BASE_SPEED = 1;
public static final int BASE_CARGOSPACE = 3;
public static final int BASE_THEFT = 1;
public static void main(String[] args) {
if (DEBUGSTATUS)

View File

@ -1,9 +1,73 @@
package net.grosinger.nomads;
import net.grosinger.nomads.DroneListItem.EnumMove;
/**
* Enforcer of the law. Has the ability to arrest drones that are wanted.
* Police have a move speed of 2 squares/turn and get faster each time they catch a criminal.
* Captured money and objects are turned into money which funds the police department.
*
* Police have a visible distance of 2X BASE_VISIBLEDISTANCE
*
*/
public class Police {
//TODO - Implement Police
public class Police implements Drone{
// TODO - Implement Police
private static final boolean DEBUGGINGALL = true;
//Do not change these
private String name;
private String UID;
// Define any variables that you need
private DroneTools tools;
// Leave these methods alone, they are required //
@Override
public String getName() {
return name;
}
@Override
public void setName(String newName) {
name = newName;
}
@Override
public void setUID(String newUID) {
UID = newUID;
}
@Override
public String getUID() {
return UID;
}
@Override
public void setDroneTools(DroneTools newTools) {
tools = newTools;
}
// Edit from here down //
@Override
public EnumMove move() {
return null;
}
@Override
public Neighbor steal() {
return null;
}
@Override
public Neighbor attack() {
return null;
}
@Override
public Upgrade upgrade() {
return null;
}
}

View File

@ -1,14 +1,55 @@
package net.grosinger.nomads;
public class Upgrade {
public enum UpgradeType {
visibleDistance, lumaLocatorDistance, objectLocatorDistance, reliability, attack, defenses, speed, cargoSpace, theft
}
private UpgradeType typeToUpgrade;
public Upgrade(UpgradeType type){
public Upgrade(UpgradeType type) {
typeToUpgrade = type;
}
/**
* Provides the prices for a given update type
* Algorithm: (((Current Level - Original Level) + 5) * Multiplier)^2
*
* @return <code>int</code>
*/
public int getPrice() {
switch (typeToUpgrade) {
case visibleDistance: {
}
case lumaLocatorDistance: {
}
case objectLocatorDistance: {
}
case reliability: {
}
case attack: {
}
case defenses: {
}
case speed: {
}
case cargoSpace: {
}
case theft: {
}
default: {
return (Integer) null;
}
}
}
}