From a5e5999b4d588d38c6952e196dc42e71f550509f Mon Sep 17 00:00:00 2001 From: Tony Grosinger Date: Tue, 13 Sep 2011 15:12:14 -0700 Subject: [PATCH] -Created classes for additional building types -Restructred how buildings are represented Signed-off-by: Tony Grosinger --- README.md | 2 +- .../grosinger/nomads/Building$Structure.class | Bin 1318 -> 1318 bytes bin/net/grosinger/nomads/Building.class | Bin 2450 -> 2450 bytes bin/net/grosinger/nomads/DroneTools.class | Bin 6781 -> 7419 bytes bin/net/grosinger/nomads/House.class | Bin 1189 -> 799 bytes bin/net/grosinger/nomads/InitializeGame.class | Bin 5071 -> 5576 bytes .../grosinger/nomads/NeighborBuilding.class | Bin 1342 -> 1124 bytes bin/net/grosinger/nomads/PoliceStation.class | Bin 0 -> 512 bytes bin/net/grosinger/nomads/RepairShop.class | Bin 0 -> 503 bytes bin/net/grosinger/nomads/TownHall.class | Bin 1867 -> 1875 bytes bin/net/grosinger/nomads/UpgradeShop.class | Bin 0 -> 506 bytes src/net/grosinger/nomads/Building.java | 3 -- src/net/grosinger/nomads/DroneTools.java | 29 +++++++++++++--- src/net/grosinger/nomads/House.java | 31 ++---------------- src/net/grosinger/nomads/InitializeGame.java | 21 +++++++----- .../grosinger/nomads/NeighborBuilding.java | 11 ------- src/net/grosinger/nomads/PoliceStation.java | 13 ++++++++ src/net/grosinger/nomads/RepairShop.java | 13 ++++++++ src/net/grosinger/nomads/TownHall.java | 13 +++++--- src/net/grosinger/nomads/UpgradeShop.java | 13 ++++++++ 20 files changed, 88 insertions(+), 61 deletions(-) create mode 100644 bin/net/grosinger/nomads/PoliceStation.class create mode 100644 bin/net/grosinger/nomads/RepairShop.class create mode 100644 bin/net/grosinger/nomads/UpgradeShop.class create mode 100644 src/net/grosinger/nomads/PoliceStation.java create mode 100644 src/net/grosinger/nomads/RepairShop.java create mode 100644 src/net/grosinger/nomads/UpgradeShop.java diff --git a/README.md b/README.md index 6e5ebec..5fc2673 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A small Java based game where creating the A.I. is the fun part. About ----- -Using the API (coming soon) and the [SampleDrone](https://github.com/tgrosinger/Nomads-Sample-Drone) create a drone of your own that can destroy all the other drones. +Using the [API](https://github.com/tgrosinger/Nomads/downloads) and the [SampleDrone](https://github.com/tgrosinger/Nomads-Sample-Drone) create a drone of your own that can destroy all the other drones. A sucessful drone will be able to gather resources, avoid the law and other malicious drones, and even reproduce to increase it's forces. Wiki diff --git a/bin/net/grosinger/nomads/Building$Structure.class b/bin/net/grosinger/nomads/Building$Structure.class index f8e0131ba8f5c47ac1992ab52ca1d6bfea38a78f..867b1c9631efd853fbaaf43bedf9e84b775d6dfe 100644 GIT binary patch delta 23 ecmZ3+wTx?n4GXI{gCm33WJeYgMzP6dEE@nsBn6}Z delta 23 ecmZ3+wTx?n4GXIjgCm3FWJeYgM#;%#EE@nsfd#Dq diff --git a/bin/net/grosinger/nomads/Building.class b/bin/net/grosinger/nomads/Building.class index 1d7da41af0304202d36ecf5581c45201be524aaa..4753945ba7e31f1de543a7b51b72ad793b00aecf 100644 GIT binary patch delta 170 zcmbOvJV|)NSyo3W1{MZs22KVU1|A@`V31?5V~}TXWKd#oXHaJFVo+lUU{GfWX3%1Y zWYA`aVbEhpVlZaNU@&3GWiVwZVlbP`$JWefHTgW7=;Y;W>Wt1nmJg>d0~doIgAhZ& zWEFN-#wf6CJ-a$%GMKf8U4u1)ft4Y1awCWMBn|`CA|R(2#F^{^q8yEid+xIqaUtklm*=(|FmZX?8Awh&DWHSf|vDqoje@f$Y23N8rOhY!a zgo3tpt42^tRk%P&Q>q{mkO(B$4G@bzE&o-apsl5#^v9M8l&ZA?3HIFGO zyXWtI=R4(xI{k6(iN%eYUpj8HbBt7eO6*aT`b@i3i zH5z^#&(%>>7i=)>!k^x><87;ueD7m5JQZ*uF3vXb#3r z*2YaX82E`aNv^4$>z`dw-!QAeUtOi4i;yFYGHODtixvdyI|3bxLTx%WVx@+k5hjSu zmI-5ZbYrEC7Cd9%S!~{$uC#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kUO_s_72x>+*j-NmwH z7ps=*7-i3$v(3fIK|_(xT{F4nRH|NWzUq3$v6^Ll4(hV=M1&J0ci>iY(&TjWlwcEpT=(`Z0(h z?85{`VB-L8;V|xC6w4UH102C49K{;O@dYRFm0x|sN&LVh)-gqdQ>5ZFX*fd(j1hBE zKQ2-p(}=R_5@M}S@f^vQA!C-MuPi4TJ1r=z6o01*QUeg3|p!QeZ4oD9A}1yZok`%Y+U+MygHW znN{kUdP!35HAVePsr2{?L_9$ZPm#n5kL6jwvpMM7f)-wJcMKBsQk-=@GU8vb4zUYq J6GMR#zX2BT!)O2i diff --git a/bin/net/grosinger/nomads/NeighborBuilding.class b/bin/net/grosinger/nomads/NeighborBuilding.class index 014ff27ed6d7ee56e5441821833eb6853802922e..ba10c9dd1d37441277a2015d7a349560fde0b68f 100644 GIT binary patch delta 230 zcmYj~%?bel6ot>78O%)5lt%uBEXL1_p~!Be*xAWmDYEh?7SnwOd$y7XkY}*sHRKv4 zn|tr+p7WiH`OvNF>vRFoLpKG5;6^i>cVrz0d&;brTN4emQfLw!`9x=3O~d7>GUulf zP?EFi$j(DU0S1c5poA>Sq8#3+E2{BL4as9e3k!WX(vt?sOrV0QZ0SRd7h2A%A4Dn= m1(LC4_-EIDb`L(^HP;^tViG%YlKN!6z|Yl&E(Agl6FYAv4jwH4 delta 392 zcmZvYJxjw-6o%h(o0<=T1ZtF4YYBL8*d^f(lZ>!Kr9)(IQDYICXY#koz0l z6~w`zKfwRs=HE~}Nx?z8-20yQ-1p&}`>72K>;3y}0HBEt6@uVC9NY4qtY`m`^xK<& zP%Bps67!3+$%S?t_Riy87;G9SqpG4pC=R=3u0&8TgZL!qTqoUziJH_z+a{R%-EI)> zUUi}~~D|KjDDXpk!J#I{|4f@$cO!8nS@VHSBf@xuz zYfBXmB4cmID(N!

(aZ%5Df($E{X46we|^gpPwwX1U)Cb7B6zH&40*@6Pn4j|Eg~ zD56BDhf2%#coa$dD569X8lmZlq${j)`ESw71}Y^S=2OfmY7*#$UyI)>GiouKp#EEz zP>E*J_VSTu%M<*L8QY$`SCb{@D9;@>_CYMn9cFgw*p@ka;<(7(Ki%0q+xFg3dE=}A t-__VVTg4(@;Bq>N8kRV7on_P+$3-g~O{Z7Um@xTR!#X_fZ}3C`n?FEFe6Roj literal 0 HcmV?d00001 diff --git a/bin/net/grosinger/nomads/RepairShop.class b/bin/net/grosinger/nomads/RepairShop.class new file mode 100644 index 0000000000000000000000000000000000000000..f40258852a1bb20e7233c39257bb2c3fb0707745 GIT binary patch literal 503 zcmZus$w~u35PcOV+Zc_;4N(X=2u9EW5ib!B3PNDW!AQ>bB+aB{(j7Vz(a-WEc<=-K zD6u-x0@DlI$HQ6%kyh!RPtg{Ci(p0LWrzez70stKWyO|d+uMW7d!Hp?s1X)&5X{@ayM ziWYa(vtbvT6a223+P=I~Zo}%5@5}+C0pgR~V_J6?>mo;w?C06~CkKb8``$ZBZye>| tyBu4m%UI|{p<-JrP(Uiuo3zz}ts?ZUG%;x+Z3#|;kWgr3#Xs

D<^`-XdQq>;2~7Bs$@E_KAR8`Zi}~yC-#|NT(0BsTRwc6zW~SZ=2ShXKVq{j^(TyJdrDoKNGmxn}ahBRS-nHR8 z6u!SRGP|bgM@R&u2KtWSSq^>1;2~V0V+=MhJRt|2as%FX2sLo+2u{k=hv*DapKc&V zDL`dzGtfZ%@YhF^TV_{quO_X76kTNPCPxq4Jcq~=AWeikvm{BtQO8|w?C)@?)8SHB z#O>yADcnJlz#1l5ouaLq=4n1Mme@%9Q?-a?Mk~DOfGqulSAnPd2j>)6#Trj@@);VL ldr~WFlnvZ+VmM{(wGZl(J76J`y7Iw1v1V0&EJo%n;ifE delta 876 zcmYL{%TE(g6vn^XnRcebv<0+Kq1X{rT4{OIN|l#dL@kesJW5=S?WGPWGi2J5u;NcZ zG7CfE-h~SviFKiguy&{ajnU}osE|p{oIBsS=lh+L`5ycle4b`~&It=29?1I)zA3{r z>N5=9cs`#fGKjNQnM?39gtqiueWa?Jm618ywrm+~44dnw&1+V5mzTAYwY_6h^}1o1 z+Kz2Kt@7;&P4TZi<0P52y4@(%EnCYqjB431EAjuy@Tw~{>?xkq472Wrgl5#VhFRvD zhRMr{0vQ1nUIZD!@x?O~x=Xz#6UD>VE6xi0;ESL~!UZSbi3q)jI&qICUSx>Th%rHe z<{S!<BsM1@g*8W{=K8G2gk;D%*a%PMYQ zoS~z_O>XOTeoEy66eZjw?}3Y1OsJS_5&DTRXEn_Fo`MLbRm|YF^Gz6#Be<&~hgs*B z@Y2Kb&I|F4oW_cZRV+INZ`5gLVQ0&mnae<+2T(pie$uIYg!+X}9)u|Rz$nUSr>MHQ zf(~@jiQyd1Q&pI954xO?FTCGdKfj}PqH8^jHrG@@fUJXL7ebUk`Uzl&5YqHzn(Svuokuq* z`#^^N24LYIV=KFdIhT6@_wj&8Rb=rHd73y%4dasN diff --git a/bin/net/grosinger/nomads/UpgradeShop.class b/bin/net/grosinger/nomads/UpgradeShop.class new file mode 100644 index 0000000000000000000000000000000000000000..b4580ada1c60d8bf805f3b102bc988e5e43ae453 GIT binary patch literal 506 zcmZus%SyvQ6g^YZSFEKT--gEB#`u_L?aE{F?N(_5SqN$oGRM{>;6UtHcX)L-kHj2=h1IIqoqyw>lOs7Eo`X zj0!_DkVz-`yoNhVqsJ&5C uf@^bRt*&E{K5#MZL<36{*~&7Sgk!xHdDHF{v?ok1Rg&`|!p0A*)_N8I literal 0 HcmV?d00001 diff --git a/src/net/grosinger/nomads/Building.java b/src/net/grosinger/nomads/Building.java index 86c934e..3413350 100644 --- a/src/net/grosinger/nomads/Building.java +++ b/src/net/grosinger/nomads/Building.java @@ -9,9 +9,6 @@ package net.grosinger.nomads; * UpgradeShop - 2 * PoliceStation - 3 * Home - 1 - * - * - * */ public class Building implements GameObject { Structure structure; diff --git a/src/net/grosinger/nomads/DroneTools.java b/src/net/grosinger/nomads/DroneTools.java index ee0121e..09c7f37 100644 --- a/src/net/grosinger/nomads/DroneTools.java +++ b/src/net/grosinger/nomads/DroneTools.java @@ -155,9 +155,30 @@ public class DroneTools { + i, getY() + j); if (objectHere instanceof Building) { Building buildingHere = (Building) objectHere; - NeighborBuilding aWildNeighbor = new NeighborBuilding( - buildingHere.getX(), buildingHere.getY(), - buildingHere.getName(), buildingHere); + NeighborBuilding aWildNeighbor; + + if (buildingHere.getType() == Structure.TOWNHALL) { + aWildNeighbor = new TownHall(buildingHere.getX(), + buildingHere.getY(), + buildingHere.getName(), buildingHere); + } else if (buildingHere.getType() == Structure.REPAIRSHOP) { + aWildNeighbor = new RepairShop(buildingHere.getX(), + buildingHere.getY(), + buildingHere.getName(), buildingHere); + } else if (buildingHere.getType() == Structure.UPGRADESHOP) { + aWildNeighbor = new UpgradeShop( + buildingHere.getX(), buildingHere.getY(), + buildingHere.getName(), buildingHere); + } else if (buildingHere.getType() == Structure.POLICESTATION) { + aWildNeighbor = new PoliceStation( + buildingHere.getX(), buildingHere.getY(), + buildingHere.getName(), buildingHere); + } else { + aWildNeighbor = new NeighborBuilding( + buildingHere.getX(), buildingHere.getY(), + buildingHere.getName(), buildingHere); + } + neighbors.add(aWildNeighbor); } } @@ -212,7 +233,7 @@ public class DroneTools { findEmptyPoint(intendedPoint); House newHouse = new House(Structure.HOUSE, intendedPoint.getX(), - intendedPoint.getY(), referredDrone.getName()); + intendedPoint.getY(), currentTeam); worldReference.placeNewBuilding(newHouse); currentTeam.deductFromBalance(Nomads.HOUSEPRICE); listItem.setWaiting(Nomads.CREATIONTIME); diff --git a/src/net/grosinger/nomads/House.java b/src/net/grosinger/nomads/House.java index 2001dbb..9a031b4 100644 --- a/src/net/grosinger/nomads/House.java +++ b/src/net/grosinger/nomads/House.java @@ -5,30 +5,13 @@ package net.grosinger.nomads; * team */ public class House extends Building { - - private String team; private int turnCreated; - public House(Structure thisBuilding, int newX, int newY) { - super(thisBuilding, newX, newY); + public House(Structure thisBuilding, int newX, int newY, DroneTeam team) { + super(thisBuilding, newX, newY, team); turnCreated = Nomads.turn; } - public House(Structure thisBuilding, int newX, int newY, String teamName) { - super(thisBuilding, newX, newY); - team = teamName; - turnCreated = Nomads.turn; - } - - /** - * Retrieve the name of team that owns this house - * - * @return String - */ - public String getTeam() { - return team; - } - /** * Calculates the age of the house * @@ -37,14 +20,4 @@ public class House extends Building { public int getAge() { return Nomads.turn - turnCreated; } - - /** - * Sets the name of the team that owns this house - * - * @param newTeam - * String House owner - */ - public void setTeam(String newTeam) { - team = newTeam; - } } diff --git a/src/net/grosinger/nomads/InitializeGame.java b/src/net/grosinger/nomads/InitializeGame.java index 7f59baf..5444f2e 100644 --- a/src/net/grosinger/nomads/InitializeGame.java +++ b/src/net/grosinger/nomads/InitializeGame.java @@ -29,7 +29,8 @@ public class InitializeGame { * @throws IOException * @throws ClassNotFoundException */ - public static void initializeDrones() throws ClassNotFoundException, IOException { + public static void initializeDrones() throws ClassNotFoundException, + IOException { if (Nomads.DEBUGSTATUS) System.out.println("Loading the drones into world..."); /* @@ -52,9 +53,11 @@ public class InitializeGame { if (Nomads.DEBUGSTATUS) System.out.println("Loading " + filename); - File file = new File(System.getProperty("user.dir") + "/drones/" + filename); + File file = new File(System.getProperty("user.dir") + "/drones/" + + filename); - URLClassLoader clazzLoader = URLClassLoader.newInstance(new URL[] { file.toURI().toURL() }); + URLClassLoader clazzLoader = URLClassLoader + .newInstance(new URL[] { file.toURI().toURL() }); // System.class.getClassLoader() JarFile jarFile = new JarFile(file); @@ -65,7 +68,8 @@ public class InitializeGame { if (element.getName().endsWith(className + ".class")) { try { @SuppressWarnings("rawtypes") - Class c = clazzLoader.loadClass(element.getName().replaceAll(".class", "").replaceAll("/", ".")); + Class c = clazzLoader.loadClass(element.getName() + .replaceAll(".class", "").replaceAll("/", ".")); // Create new GameObject GameObject newGameObject = (GameObject) c.newInstance(); @@ -145,10 +149,11 @@ public class InitializeGame { if (Nomads.DEBUGSTATUS) System.out.println("Generating and placing required buildings..."); - Building townHall = new Building(Structure.TOWNHALL, 30, 40); - Building upgradeShop = new Building(Structure.UPGRADESHOP, 30, 60); - Building policeStation = new Building(Structure.POLICESTATION, 50, 40); - Building RepairShop = new Building(Structure.REPAIRSHOP, 50, 60); + Building townHall = new Building(Structure.TOWNHALL, 30, 40, null); + Building upgradeShop = new Building(Structure.UPGRADESHOP, 30, 60, null); + Building policeStation = new Building(Structure.POLICESTATION, 50, 40, + null); + Building RepairShop = new Building(Structure.REPAIRSHOP, 50, 60, null); if (Nomads.DEBUGSTATUS) System.out.println("Building generation complete"); diff --git a/src/net/grosinger/nomads/NeighborBuilding.java b/src/net/grosinger/nomads/NeighborBuilding.java index 046907d..f5a14cd 100644 --- a/src/net/grosinger/nomads/NeighborBuilding.java +++ b/src/net/grosinger/nomads/NeighborBuilding.java @@ -1,7 +1,5 @@ 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. @@ -53,15 +51,6 @@ public class NeighborBuilding implements GameObject { return y; } - /** - * Retrieve type of building that this is - * - * @return Structure - */ - public Structure getType() { - return building.getType(); - } - /** * Retrieve the name of the team that owns the current building. If the * building is a public building, the string will be "Public". diff --git a/src/net/grosinger/nomads/PoliceStation.java b/src/net/grosinger/nomads/PoliceStation.java new file mode 100644 index 0000000..ef01478 --- /dev/null +++ b/src/net/grosinger/nomads/PoliceStation.java @@ -0,0 +1,13 @@ +package net.grosinger.nomads; + +/** + * A representation of a PoliceStation. Allows Drones to interact with this + * building. + */ +public class PoliceStation extends NeighborBuilding { + + public PoliceStation(int x, int y, String name, Building building) { + super(x, y, name, building); + } + +} diff --git a/src/net/grosinger/nomads/RepairShop.java b/src/net/grosinger/nomads/RepairShop.java new file mode 100644 index 0000000..790fc89 --- /dev/null +++ b/src/net/grosinger/nomads/RepairShop.java @@ -0,0 +1,13 @@ +package net.grosinger.nomads; + +/** + * A representation of a RepairShop. Allows Drones to interact with this + * building. + */ +public class RepairShop extends NeighborBuilding { + + public RepairShop(int x, int y, String name, Building building) { + super(x, y, name, building); + } + +} diff --git a/src/net/grosinger/nomads/TownHall.java b/src/net/grosinger/nomads/TownHall.java index 36645b3..fff8340 100644 --- a/src/net/grosinger/nomads/TownHall.java +++ b/src/net/grosinger/nomads/TownHall.java @@ -2,10 +2,13 @@ package net.grosinger.nomads; import java.util.ArrayList; -public class TownHall extends Building { +/** + * A representation of a TownHall. Allows Drones to interact with this building. + */ +public class TownHall extends NeighborBuilding { - public TownHall(int newX, int newY) { - super(Structure.TOWNHALL, newX, newY); + public TownHall(int x, int y, String name, Building building) { + super(x, y, name, building); } public void cashInventory(ArrayList inventory, DroneTeam team) { @@ -21,8 +24,8 @@ public class TownHall extends Building { inventory.remove(currentObject); } } - - public Point requestNewObjective(String UID){ + + public Point requestNewObjective(String UID) { return Nomads.awesomeWorld.generateObjective(UID); } } diff --git a/src/net/grosinger/nomads/UpgradeShop.java b/src/net/grosinger/nomads/UpgradeShop.java new file mode 100644 index 0000000..54331d0 --- /dev/null +++ b/src/net/grosinger/nomads/UpgradeShop.java @@ -0,0 +1,13 @@ +package net.grosinger.nomads; + +/** + * A representation of an UpgradeShop. Allows Drones to interact with this + * building. + */ +public class UpgradeShop extends NeighborBuilding { + + public UpgradeShop(int x, int y, String name, Building building) { + super(x, y, name, building); + } + +}