From a35797544087c9930162737d22a55edb292ca0ae Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 2 Mar 2023 11:17:56 -0500 Subject: [PATCH] The javascript update --- Assignment 2/src/ca/cosc3p91/a2/Main.java | 21 ------- .../src/ca/cosc3p91/a2/game/GameEngine.java | 35 ++++------- Assignment 2/src/ca/cosc3p91/a2/game/Map.java | 37 ++--------- .../ca/cosc3p91/a2/gameobjects/Building.java | 58 +++--------------- .../a2/gameobjects/DefenseBuilding.java | 10 +-- .../cosc3p91/a2/gameobjects/DefenseStage.java | 14 +---- .../ca/cosc3p91/a2/gameobjects/GoldMine.java | 10 +-- .../ca/cosc3p91/a2/gameobjects/IronMine.java | 9 +-- .../cosc3p91/a2/gameobjects/LumberMine.java | 8 +-- .../a2/gameobjects/ResourceStage.java | 8 +-- .../src/ca/cosc3p91/a2/gameobjects/Stage.java | 35 ++++------- .../src/ca/cosc3p91/a2/gameobjects/Tile.java | 9 +-- .../cosc3p91/a2/gameobjects/VillageStage.java | 24 +++----- .../cosc3p91/a2/gameobjects/Village_Hall.java | 20 ------ .../src/ca/cosc3p91/a2/player/Player.java | 8 --- .../ca/cosc3p91/a2/game/GameEngine.class | Bin 2315 -> 2336 bytes 16 files changed, 62 insertions(+), 244 deletions(-) diff --git a/Assignment 2/src/ca/cosc3p91/a2/Main.java b/Assignment 2/src/ca/cosc3p91/a2/Main.java index 311e498..e65efa7 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/Main.java +++ b/Assignment 2/src/ca/cosc3p91/a2/Main.java @@ -1,34 +1,13 @@ package ca.cosc3p91.a2; import ca.cosc3p91.a2.game.GameEngine; -import ca.cosc3p91.a2.util.Print; public class Main { public static void main(String[] args) { GameEngine engine = new GameEngine(); -<<<<<<< HEAD engine.printMap(); -======= - Print test = new Print("Hello There", 2); - - test.addColumn(new Print.Column("I am value 1")); - test.addColumn(new Print.Column("Super Value")); - test.addColumn(new Print.Column("SOLD!")); - - Print.Row row = new Print.Row(); - row.add("HelloThere"); - row.add("Goodbye"); - row.add("3"); - - test.addRow(row); - test.addRow(row); - test.addRow(row); - - Print.print(test.createTable()); - ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 engine.run(); } diff --git a/Assignment 2/src/ca/cosc3p91/a2/game/GameEngine.java b/Assignment 2/src/ca/cosc3p91/a2/game/GameEngine.java index a5be66c..e48016f 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/game/GameEngine.java +++ b/Assignment 2/src/ca/cosc3p91/a2/game/GameEngine.java @@ -7,15 +7,14 @@ import ca.cosc3p91.a2.player.Player; public class GameEngine implements Runnable { - private final boolean running = true; + private Player player; - private Player player; + private int pillageFactor; - private int pillageFactor; + private int currentTime; - private int currentTime; + public Map map; -<<<<<<< HEAD public GameEngine () { player = new Player(); VillageStage vInitialStage = new VillageStage(100,0,2,30,0, @@ -27,30 +26,22 @@ public class GameEngine implements Runnable { System.out.println("~ Current Map State ~\n\n"); System.out.println("In Map:\n"); for (Building b : map.contains) { - System.out.println("|> "+b.getClass().toString()+" lvl: "+b.getLevel()+" health: "+b.getHealth()); + System.out.println("|> "+b.getClass().getSimpleName()+" lvl: "+b.getLevel()+" health: "+b.getHealth()); } } public void attackVillage(Map map) { } -======= - public Map map; ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - public void attackVIllage(Map map) { - } + public Map generateMap() { + return null; + } - public Map generateMap() { - return null; - } + public void getScore(Map map) { + } - public void getScore(Map map) { - } + @Override + public void run() { - @Override - public void run() { - while (running) { - - } - } + } } diff --git a/Assignment 2/src/ca/cosc3p91/a2/game/Map.java b/Assignment 2/src/ca/cosc3p91/a2/game/Map.java index e8169ac..8564a36 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/game/Map.java +++ b/Assignment 2/src/ca/cosc3p91/a2/game/Map.java @@ -5,30 +5,18 @@ import ca.cosc3p91.a2.gameobjects.*; import java.util.ArrayList; import java.util.List; -<<<<<<< HEAD public class Map { static int MAXSIZE = 400; private Village_Hall townHall; -======= -public class Map { + private int guardTime; - private Village_Hall townHall; ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - - private int guardTime; - -<<<<<<< HEAD public List contains; -======= - private List contains; ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - public List inhabitants; + public List inhabitants; -<<<<<<< HEAD public Map (Village_Hall villageHall, int gTime) { contains = new ArrayList<>(); inhabitants = new ArrayList<>(); @@ -48,28 +36,13 @@ public class Map { public void build(Village_Hall hall, Tile t, Building b) { contains.add(b); } -======= - public void move(Infantry i, Tile t) { - } - public void inRange(Infantry i, Building b) { - } + public int getGuardTime() { + return guardTime; + } - public void build(Village_Hall hall, Tile t, Building b) { - } ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - - public int getGuardTime() { - return guardTime; - } - -<<<<<<< HEAD public void setGuardTime(int gTime) { this.guardTime = gTime; } -======= - public void setGuardTime() { - } ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java index 80a6990..91f5a03 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java @@ -4,7 +4,6 @@ import java.util.ArrayList; public abstract class Building { -<<<<<<< HEAD // members private int level; private int health; @@ -14,43 +13,22 @@ public abstract class Building { private int goldCost; private int ironCost; private int woodCost; -======= - private static int level; - private int health; + private int buildTime; - private static Stage stages; - - private int goldCost; - - private int ironCost; - - private int woodCost; ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - - private int buildTime; - -<<<<<<< HEAD public ArrayList tiles = new ArrayList<>(); public ArrayList inhabitants = new ArrayList<>(); // functions -======= - public List stage; - public Tile tile; - public List inhabitant; ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 + public int getLevel() { + return level; + } - public int getLevel() { - return level; - } + public int getHealth() { + return health; + } - public int getHealth() { - return health; - } - -<<<<<<< HEAD public int getCost(String type) { return (type.equals("gold"))?(goldCost): (type.equals("iron"))?(ironCost):woodCost; @@ -59,17 +37,11 @@ public abstract class Building { public Stage getStage() { return stage; } -======= - public int getCost(String type) { - return 0; - } ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - public int getUpgradeCost() { - return 0; - } + public int getUpgradeCost() { + return 0; + } -<<<<<<< HEAD public void setLevel(int level) { this.level = level; } @@ -94,14 +66,4 @@ public abstract class Building { public int getBuildTime() { return buildTime; } -======= - public void upgrade() { - - } - - public int getBuildTime() { - return 0; - } - ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseBuilding.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseBuilding.java index c2fe0bf..30b3692 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseBuilding.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseBuilding.java @@ -2,7 +2,6 @@ package ca.cosc3p91.a2.gameobjects; public class DefenseBuilding extends Building { -<<<<<<< HEAD private int damage; private int range; @@ -11,14 +10,9 @@ public class DefenseBuilding extends Building { this.damage += stage.getDamageChange(); this.range += stage.getRangeChange(); } -======= - public int damage; - public int range; ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 + public void attack(Infantry attacker) { - public void attack(Infantry attacker) { - - } + } } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseStage.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseStage.java index c095aaf..bc0320c 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseStage.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseStage.java @@ -2,15 +2,10 @@ package ca.cosc3p91.a2.gameobjects; class DefenseStage extends Stage { -<<<<<<< HEAD protected int dDamage; -======= - protected int dDamge; ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - protected int dRange; + protected int dRange; -<<<<<<< HEAD public DefenseStage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost, int damageIncrease, int rangeIncrease) { super(dHealth,goldCost,requiredVillageLevel,upgradeTime,ironCost,woodCost); @@ -25,12 +20,5 @@ class DefenseStage extends Stage { public int getRangeChange() { return dRange; } -======= - public void getDamageChange() { - } - - public void getRangeChange() { - } ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 } \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/GoldMine.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/GoldMine.java index a369ee1..7aa95f9 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/GoldMine.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/GoldMine.java @@ -2,19 +2,15 @@ package ca.cosc3p91.a2.gameobjects; public class GoldMine extends ResourceBuilding { -<<<<<<< HEAD public static String resource = "gold"; public GoldMine (int lvl, ResourceStage baseStage) { setLevel(lvl); upgrade(baseStage); } -======= - public static String resource = "good"; ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - @Override - public void harvest(Village_Hall hall) { + @Override + public void harvest(Village_Hall hall) { - } + } } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/IronMine.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/IronMine.java index 2d4a98c..ec38c21 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/IronMine.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/IronMine.java @@ -2,9 +2,8 @@ package ca.cosc3p91.a2.gameobjects; public class IronMine extends ResourceBuilding { - public static String resource = "iron"; + public static String resource = "iron"; -<<<<<<< HEAD public IronMine (int lvl, ResourceStage baseStage) { setLevel(lvl); upgrade(baseStage); @@ -12,10 +11,6 @@ public class IronMine extends ResourceBuilding { @Override public void harvest(Village_Hall hall) { -======= - @Override - public void harvest(Village_Hall hall) { ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - } + } } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/LumberMine.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/LumberMine.java index bcdc494..f4bcf10 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/LumberMine.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/LumberMine.java @@ -2,19 +2,15 @@ package ca.cosc3p91.a2.gameobjects; public class LumberMine extends ResourceBuilding { - public static String resource = "wood"; + public static String resource = "wood"; -<<<<<<< HEAD public LumberMine (int lvl, ResourceStage baseStage) { setLevel(lvl); upgrade(baseStage); } public void harvest(Village_Hall hall) { -======= - public void harvest(Village_Hall hall) { - } ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 + } } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceStage.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceStage.java index 6809500..a2092b0 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceStage.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceStage.java @@ -2,9 +2,8 @@ package ca.cosc3p91.a2.gameobjects; public class ResourceStage extends Stage { - protected int harvestRateIncrease; + protected int harvestRateIncrease; -<<<<<<< HEAD public ResourceStage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost, int harvestRateIncr) { super(dHealth,goldCost,requiredVillageLevel,upgradeTime,ironCost,woodCost); @@ -14,10 +13,5 @@ public class ResourceStage extends Stage { public int getHarvestRateIncrease() { return harvestRateIncrease; } -======= - public int getHarvestRateIncrease() { - return harvestRateIncrease; - } ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Stage.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Stage.java index 687781a..71e10a1 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Stage.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Stage.java @@ -2,19 +2,18 @@ package ca.cosc3p91.a2.gameobjects; abstract class Stage { - protected int dHealth; + protected int dHealth; - protected int goldCost; + protected int goldCost; - protected int requiredVillageLevel; + protected int requiredVillageLevel; - protected int upgradeTime; + protected int upgradeTime; - protected int ironCost; + protected int ironCost; - protected int woodCost; + protected int woodCost; -<<<<<<< HEAD public Stage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost) { this.dHealth = dHealth; this.goldCost = goldCost; @@ -32,23 +31,13 @@ abstract class Stage { return (type.equals("gold"))?(goldCost): (type.equals("iron"))?(ironCost):woodCost; } -======= - public Building building; - public void getHealthChange() { - } + public int getRequiredVillageLevel() { + return requiredVillageLevel; + } - public int getCost(String type) { - return 0; - } ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - - public int getRequiredVillageLevel() { - return requiredVillageLevel; - } - - public int getUpgradeTime() { - return upgradeTime; - } + public int getUpgradeTime() { + return upgradeTime; + } } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Tile.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Tile.java index ae976cc..bbc6f6f 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Tile.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Tile.java @@ -4,13 +4,8 @@ import java.util.List; public class Tile { - public int x; + public int x; - public int y; + public int y; -<<<<<<< HEAD -======= - public List building; - ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/VillageStage.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/VillageStage.java index f1d1986..71c7019 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/VillageStage.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/VillageStage.java @@ -2,13 +2,12 @@ package ca.cosc3p91.a2.gameobjects; public class VillageStage extends Stage { - protected int goldCapacityIncrease; + protected int goldCapacityIncrease; - protected int ironCapacityIncrease; + protected int ironCapacityIncrease; - protected int woodCapacityIncrease; + protected int woodCapacityIncrease; -<<<<<<< HEAD public VillageStage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost, int goldCapIncrease, int ironCapIncrease, int woodCapIncrease) { super(dHealth,goldCost,requiredVillageLevel,upgradeTime,ironCost,woodCost); @@ -20,18 +19,13 @@ public class VillageStage extends Stage { public int getGoldCapacityIncrease() { return goldCapacityIncrease; } -======= - public int getGoldCapacityIncrease() { - return goldCapacityIncrease; - } ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 - public int getIronCapacityIncrease() { - return ironCapacityIncrease; - } + public int getIronCapacityIncrease() { + return ironCapacityIncrease; + } - public int getWoodCapacityIncrease() { - return woodCapacityIncrease; - } + public int getWoodCapacityIncrease() { + return woodCapacityIncrease; + } } diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Village_Hall.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Village_Hall.java index ebd891e..039216a 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Village_Hall.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Village_Hall.java @@ -4,7 +4,6 @@ import java.util.ArrayList; public class Village_Hall extends Building { -<<<<<<< HEAD private int goldCapacity = 0; private int ironCapacity = 0; @@ -35,24 +34,5 @@ public class Village_Hall extends Building { public int getWoodCapacity() { return woodCapacity; } -======= - private int goldCapacity; - - private int ironCapacity; - - private int woodCapacity; - - public int getGoldCapacity() { - return goldCapacity; - } - - public int getIronCapacity() { - return ironCapacity; - } - - public int getWoodCapacity() { - return woodCapacity; - } ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 } diff --git a/Assignment 2/src/ca/cosc3p91/a2/player/Player.java b/Assignment 2/src/ca/cosc3p91/a2/player/Player.java index 195cb1e..0dcbff3 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/player/Player.java +++ b/Assignment 2/src/ca/cosc3p91/a2/player/Player.java @@ -2,16 +2,8 @@ package ca.cosc3p91.a2.player; public class Player { -<<<<<<< HEAD public int currentGold; public int currentIron; public int currentWood; -======= - public int currentGold; - - public int currentIron; - - public int currentWood; ->>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7 } \ No newline at end of file diff --git a/out/production/untitled104/ca/cosc3p91/a2/game/GameEngine.class b/out/production/untitled104/ca/cosc3p91/a2/game/GameEngine.class index 8d8c078677f450673e0e8a338c1d98966a6f5650..f0734b406a1601d01d7d34a01ad217cf207c94b5 100644 GIT binary patch delta 264 zcmWlTKTE?v9ERVEA*bh03w3al!w#Z?lT&eXa?mB4;1KjoqL(zrYt>j|>pu{uaOCvCnb9p*RlTo_84w?JxUwBZhhV z$>ywdT>Im!?Zt#u91)hW!f{N{NGhe2o83HDsgc`3CVdkaB}*YVQbGqA!{k<4Pi;Xs zLC$eXFz9lGgdWZa=eS^KRZlJZI;F8eC6-P<9#(=?-x~JQcFvJa^z%9d+j8vda tRMWef-q+$nojY#04QF;HRK|~!OskzBQFh7mr>hdv@l775;kfWd&OcUCLEHcU delta 231 zcmWm3y-vbV7=YpT6w(9DHxU!p6N!U5kub43IXHDQVQ92av=*!f6o0CSi*YdI%qAvY zfnjqnarH911Scn=tk3gOd#nXti}w$p$^9&N2-=!`&4DIu`!YNkM z5r&L}GtL!t_o?dcwY1h8b0J)ErMVUgZWO*rM`_Clw@idFcZ#Y>;wZJrQm0Jji_*GR Tt=N8O^Iq0<4L_Ve`7`eiEIm1O