diff --git a/bin/net/grosinger/nomads/Drone.class b/bin/net/grosinger/nomads/Drone.class
index c8918d6..d679c5f 100644
Binary files a/bin/net/grosinger/nomads/Drone.class and b/bin/net/grosinger/nomads/Drone.class differ
diff --git a/bin/net/grosinger/nomads/DroneListItem.class b/bin/net/grosinger/nomads/DroneListItem.class
index f126802..03ebfc5 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/DroneTools.class b/bin/net/grosinger/nomads/DroneTools.class
index 3e06367..2bf1f3e 100644
Binary files a/bin/net/grosinger/nomads/DroneTools.class and b/bin/net/grosinger/nomads/DroneTools.class differ
diff --git a/bin/net/grosinger/nomads/NeighborBuilding.class b/bin/net/grosinger/nomads/NeighborBuilding.class
new file mode 100644
index 0000000..ef0dc2d
Binary files /dev/null and b/bin/net/grosinger/nomads/NeighborBuilding.class differ
diff --git a/bin/net/grosinger/nomads/Neighbor.class b/bin/net/grosinger/nomads/NeighborDrone.class
similarity index 58%
rename from bin/net/grosinger/nomads/Neighbor.class
rename to bin/net/grosinger/nomads/NeighborDrone.class
index 93fb961..a76a08f 100644
Binary files a/bin/net/grosinger/nomads/Neighbor.class and b/bin/net/grosinger/nomads/NeighborDrone.class differ
diff --git a/bin/net/grosinger/nomads/Police.class b/bin/net/grosinger/nomads/Police.class
index 9abe438..486e194 100644
Binary files a/bin/net/grosinger/nomads/Police.class and b/bin/net/grosinger/nomads/Police.class differ
diff --git a/src/net/grosinger/nomads/Drone.java b/src/net/grosinger/nomads/Drone.java
index c9bd3e6..0dcb26b 100644
--- a/src/net/grosinger/nomads/Drone.java
+++ b/src/net/grosinger/nomads/Drone.java
@@ -43,7 +43,7 @@ public interface Drone extends GameObject {
*
* @return Neighbor
;
*/
- public Neighbor steal();
+ public NeighborDrone steal();
/**
* Asks for which drone should be attacked. Will be called whenever the Move
@@ -51,7 +51,7 @@ public interface Drone extends GameObject {
*
* @return Neighbor
*/
- public Neighbor attack();
+ public NeighborDrone attack();
/**
* Asks what the drone would like to upgrade. Will be called whenever the Move
diff --git a/src/net/grosinger/nomads/DroneListItem.java b/src/net/grosinger/nomads/DroneListItem.java
index a31efa7..9ea899f 100644
--- a/src/net/grosinger/nomads/DroneListItem.java
+++ b/src/net/grosinger/nomads/DroneListItem.java
@@ -32,7 +32,8 @@ public class DroneListItem {
// Statistics about this robot
- private int visibleDistance;
+ private int visibleDistance; // Distance that this drone can see buildings
+ // and other drones
private int lumaLocatorDistance;
private int objectLocatorDistance;
private int reliability;
@@ -400,7 +401,7 @@ public class DroneListItem {
* Finds who the drone wants to attack and attempts to perform attack.
*/
private void doAttack() {
- Neighbor victimNeighbor = current.attack();
+ NeighborDrone victimNeighbor = current.attack();
if (victimNeighbor == null) {
// Seems they did something wrong. Turn wasted.
@@ -440,7 +441,7 @@ public class DroneListItem {
* Finds who the drone wants to steal from and attempts to perform steal.
*/
private void doSteal() {
- Neighbor victimNeighbor = current.steal();
+ NeighborDrone victimNeighbor = current.steal();
if (victimNeighbor == null) {
// Seems they did something wrong. Turn wasted.
diff --git a/src/net/grosinger/nomads/DroneTools.java b/src/net/grosinger/nomads/DroneTools.java
index 7502ef1..20ba9eb 100644
--- a/src/net/grosinger/nomads/DroneTools.java
+++ b/src/net/grosinger/nomads/DroneTools.java
@@ -14,6 +14,7 @@ public class DroneTools {
private DroneListItem listItem;
private DroneTeam currentTeam;
private World worldReference;
+ private Point townCenter;
private int worldSize;
public DroneTools(Drone aDrone, DroneListItem droneParent, World theWorld) {
@@ -122,14 +123,31 @@ public class DroneTools {
return worldReference.inSafeZone(getX(), getY(), listItem);
}
+ /**
+ * Return the location of the center of the main town. Buildings are located
+ * on the corners of this point.
+ *
+ * @return Point
+ */
+ public Point getTownCenter() {
+ if (townCenter == null) {
+ townCenter = new Point(30, 50);
+ }
+ return townCenter;
+ }
+
+ public ArrayList checkBuildings() {
+ return worldReference.buildingsInRange(getX(), getY(), listItem.getVisibleDistance());
+ }
+
/**
* Retrieve a list of all Drones that are visible within your sight range.
* (Sight range can be upgraded)
*
* @return ArrayList of Neighbors
*/
- public ArrayList checkRadar() {
- ArrayList neighbors = new ArrayList();
+ public ArrayList checkRadar() {
+ ArrayList neighbors = new ArrayList();
int maxDistance = listItem.getVisibleDistance();
for (int i = maxDistance * -1; i <= maxDistance; i++) {
for (int j = maxDistance * -1; j <= maxDistance; j++) {
@@ -143,7 +161,7 @@ public class DroneTools {
Drone droneHere = (Drone) objectHere;
DroneListItem listItemHere = Nomads
.droneToListItem(droneHere);
- Neighbor aWildNeighbor = new Neighbor(
+ NeighborDrone aWildNeighbor = new NeighborDrone(
listItemHere.getX(), listItemHere.getY(),
droneHere.getName(), droneHere.getUID());
neighbors.add(aWildNeighbor);
diff --git a/src/net/grosinger/nomads/NeighborBuilding.java b/src/net/grosinger/nomads/NeighborBuilding.java
new file mode 100644
index 0000000..4c0f1da
--- /dev/null
+++ b/src/net/grosinger/nomads/NeighborBuilding.java
@@ -0,0 +1,82 @@
+package net.grosinger.nomads;
+
+import net.grosinger.nomads.Building.Structure;
+
+/**
+ * An array of NeigborBuildings will be given to a drone that is searching for
+ * the buildings it is near. This is typically done from the town center.
+ */
+public class NeighborBuilding implements GameObject {
+
+ private String name;
+ private int x;
+ private int y;
+ private String UID;
+ private Building building;
+
+ /**
+ * Class Constructor
+ *
+ * @param x
+ * - X location of the Building
+ * @param y
+ * - Y location of the Building
+ * @param name
+ * - Name of the Building
+ */
+ public NeighborBuilding(int x, int y, String name, String UID,
+ Building building) {
+ this.x = x;
+ this.y = y;
+ this.name = name;
+ this.UID = UID;
+ this.building = building;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Retrieve x location
+ *
+ * @return int
- x Location
+ */
+ public int getX() {
+ return x;
+ }
+
+ /**
+ * Retrieve y location
+ *
+ * @return int
- y Location
+ */
+ public int getY() {
+ return y;
+ }
+
+ /**
+ * Retrieve type of building that this is
+ *
+ * @return Structure
+ */
+ public Structure getType() {
+ return building.getType();
+ }
+
+ /**
+ * Retrieve UID of this Neighbor
+ *
+ * @return String
- UID
+ */
+ public String getUID() {
+ return UID;
+ }
+
+ @Override
+ public void setName(String newName) {
+ name = newName;
+ }
+
+}
diff --git a/src/net/grosinger/nomads/Neighbor.java b/src/net/grosinger/nomads/NeighborDrone.java
similarity index 81%
rename from src/net/grosinger/nomads/Neighbor.java
rename to src/net/grosinger/nomads/NeighborDrone.java
index cfbf37d..eaa9985 100644
--- a/src/net/grosinger/nomads/Neighbor.java
+++ b/src/net/grosinger/nomads/NeighborDrone.java
@@ -1,9 +1,9 @@
package net.grosinger.nomads;
/**
- * An array of Neighbors will be given to a drone that is using it's radar
+ * An array of NeighborDrones will be given to a drone that is using it's radar
*/
-public class Neighbor implements GameObject {
+public class NeighborDrone implements GameObject {
private String name;
private int x;
@@ -20,7 +20,7 @@ public class Neighbor implements GameObject {
* @param name
* - Name of the Drone
*/
- public Neighbor(int x, int y, String name, String UID) {
+ public NeighborDrone(int x, int y, String name, String UID) {
this.x = x;
this.y = y;
this.name = name;
diff --git a/src/net/grosinger/nomads/Police.java b/src/net/grosinger/nomads/Police.java
index 5266a50..31b4a97 100644
--- a/src/net/grosinger/nomads/Police.java
+++ b/src/net/grosinger/nomads/Police.java
@@ -66,13 +66,13 @@ public class Police implements Drone {
}
@Override
- public Neighbor steal() {
+ public NeighborDrone steal() {
// This method is not used by the police drones
return null;
}
@Override
- public Neighbor attack() {
+ public NeighborDrone attack() {
// When attacked, a police drone will automatically retaliate, dealing
// 2x the damage that was done to itself.
// TODO - Implement Police Attack