-NeighborBuilding is now Drone specific.
Signed-off-by: Tony Grosinger <tony@grosinger.net>
This commit is contained in:
parent
77c93d6c2c
commit
8d6840ac87
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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,6 +22,7 @@ public class TownHall extends NeighborBuilding {
|
||||
* @param team
|
||||
*/
|
||||
public void cashInventory(ArrayList<GameObject> inventory, DroneTeam team) {
|
||||
if (verifyObjectValidity()) {
|
||||
while (!inventory.isEmpty()) {
|
||||
GameObject currentObject = inventory.get(0);
|
||||
if (currentObject instanceof MoneyPile) {
|
||||
@ -28,10 +30,14 @@ public class TownHall extends NeighborBuilding {
|
||||
team.increaseBalance(value);
|
||||
Nomads.awesomeWorld.generateMoneyPile();
|
||||
} else if (currentObject instanceof Objective) {
|
||||
team.increaseBalance(((Objective) currentObject).getBounty());
|
||||
team.increaseBalance(((Objective) currentObject)
|
||||
.getBounty());
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user