Archived
1
0

-NeighborBuilding is now Drone specific.

Signed-off-by: Tony Grosinger <tony@grosinger.net>
This commit is contained in:
Tony Grosinger 2011-09-15 13:52:08 -07:00
parent 77c93d6c2c
commit 8d6840ac87
12 changed files with 40 additions and 23 deletions

View File

@ -160,23 +160,28 @@ public class DroneTools {
if (buildingHere.getType() == Structure.TOWNHALL) {
aWildNeighbor = new TownHall(buildingHere.getX(),
buildingHere.getY(),
buildingHere.getName(), buildingHere);
buildingHere.getName(), buildingHere,
listItem);
} else if (buildingHere.getType() == Structure.REPAIRSHOP) {
aWildNeighbor = new RepairShop(buildingHere.getX(),
buildingHere.getY(),
buildingHere.getName(), buildingHere);
buildingHere.getName(), buildingHere,
listItem);
} else if (buildingHere.getType() == Structure.UPGRADESHOP) {
aWildNeighbor = new UpgradeShop(
buildingHere.getX(), buildingHere.getY(),
buildingHere.getName(), buildingHere);
buildingHere.getName(), buildingHere,
listItem);
} else if (buildingHere.getType() == Structure.POLICESTATION) {
aWildNeighbor = new PoliceStation(
buildingHere.getX(), buildingHere.getY(),
buildingHere.getName(), buildingHere);
buildingHere.getName(), buildingHere,
listItem);
} else {
aWildNeighbor = new NeighborBuilding(
buildingHere.getX(), buildingHere.getY(),
buildingHere.getName(), buildingHere);
buildingHere.getName(), buildingHere,
listItem);
}
neighbors.add(aWildNeighbor);

View File

@ -11,6 +11,7 @@ public class NeighborBuilding implements GameObject {
private int x;
private int y;
private Building building;
private DroneListItem drone;
/**
* Class Constructor
@ -22,11 +23,12 @@ public class NeighborBuilding implements GameObject {
* @param name
* - Name of the Building
*/
public NeighborBuilding(int x, int y, String name, Building building) {
public NeighborBuilding(int x, int y, String name, Building building, DroneListItem drone) {
this.x = x;
this.y = y;
this.name = name;
this.building = building;
this.drone = drone;
turnCreated = Nomads.turn;
}

View File

@ -6,8 +6,9 @@ package net.grosinger.nomads;
*/
public class PoliceStation extends NeighborBuilding {
public PoliceStation(int x, int y, String name, Building building) {
super(x, y, name, building);
public PoliceStation(int x, int y, String name, Building building,
DroneListItem drone) {
super(x, y, name, building, drone);
}
}

View File

@ -6,8 +6,9 @@ package net.grosinger.nomads;
*/
public class RepairShop extends NeighborBuilding {
public RepairShop(int x, int y, String name, Building building) {
super(x, y, name, building);
public RepairShop(int x, int y, String name, Building building,
DroneListItem drone) {
super(x, y, name, building, drone);
}
}

View File

@ -9,8 +9,9 @@ public class TownHall extends NeighborBuilding {
// TODO - Rewrite class to make more accessible to Drones
public TownHall(int x, int y, String name, Building building) {
super(x, y, name, building);
public TownHall(int x, int y, String name, Building building,
DroneListItem drone) {
super(x, y, name, building, drone);
}
/**
@ -21,16 +22,21 @@ public class TownHall extends NeighborBuilding {
* @param team
*/
public void cashInventory(ArrayList<GameObject> inventory, DroneTeam team) {
while (!inventory.isEmpty()) {
GameObject currentObject = inventory.get(0);
if (currentObject instanceof MoneyPile) {
int value = ((MoneyPile) currentObject).getValue();
team.increaseBalance(value);
Nomads.awesomeWorld.generateMoneyPile();
} else if (currentObject instanceof Objective) {
team.increaseBalance(((Objective) currentObject).getBounty());
if (verifyObjectValidity()) {
while (!inventory.isEmpty()) {
GameObject currentObject = inventory.get(0);
if (currentObject instanceof MoneyPile) {
int value = ((MoneyPile) currentObject).getValue();
team.increaseBalance(value);
Nomads.awesomeWorld.generateMoneyPile();
} else if (currentObject instanceof Objective) {
team.increaseBalance(((Objective) currentObject)
.getBounty());
}
inventory.remove(currentObject);
}
inventory.remove(currentObject);
} else {
// Object not valid, do Nothing
}
}
@ -46,6 +52,7 @@ public class TownHall extends NeighborBuilding {
if (verifyObjectValidity()) {
return Nomads.awesomeWorld.generateObjective(UID);
} else {
// Object not valid, do nothing
return null;
}
}

View File

@ -6,8 +6,9 @@ package net.grosinger.nomads;
*/
public class UpgradeShop extends NeighborBuilding {
public UpgradeShop(int x, int y, String name, Building building) {
super(x, y, name, building);
public UpgradeShop(int x, int y, String name, Building building,
DroneListItem drone) {
super(x, y, name, building, drone);
}
}