The javascript update

main
mike 2023-03-02 11:17:56 -05:00
parent f0844a6564
commit a357975440
16 changed files with 62 additions and 244 deletions

View File

@ -1,34 +1,13 @@
package ca.cosc3p91.a2; package ca.cosc3p91.a2;
import ca.cosc3p91.a2.game.GameEngine; import ca.cosc3p91.a2.game.GameEngine;
import ca.cosc3p91.a2.util.Print;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
GameEngine engine = new GameEngine(); GameEngine engine = new GameEngine();
<<<<<<< HEAD
engine.printMap(); 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(); engine.run();
} }

View File

@ -7,15 +7,14 @@ import ca.cosc3p91.a2.player.Player;
public class GameEngine implements Runnable { 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;
<<<<<<< HEAD public Map map;
public GameEngine () { public GameEngine () {
player = new Player(); player = new Player();
VillageStage vInitialStage = new VillageStage(100,0,2,30,0, VillageStage vInitialStage = new VillageStage(100,0,2,30,0,
@ -27,18 +26,12 @@ public class GameEngine implements Runnable {
System.out.println("~ Current Map State ~\n\n"); System.out.println("~ Current Map State ~\n\n");
System.out.println("In Map:\n"); System.out.println("In Map:\n");
for (Building b : map.contains) { 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 void attackVillage(Map map) {
} }
=======
public Map map;
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
public void attackVIllage(Map map) {
}
public Map generateMap() { public Map generateMap() {
return null; return null;
@ -49,8 +42,6 @@ public class GameEngine implements Runnable {
@Override @Override
public void run() { public void run() {
while (running) {
} }
}
} }

View File

@ -5,30 +5,18 @@ import ca.cosc3p91.a2.gameobjects.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
<<<<<<< HEAD
public class Map { public class Map {
static int MAXSIZE = 400; static int MAXSIZE = 400;
private Village_Hall townHall; private Village_Hall townHall;
=======
public class Map {
private Village_Hall townHall;
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
private int guardTime; private int guardTime;
<<<<<<< HEAD
public List<Building> contains; public List<Building> contains;
=======
private List<Building> contains;
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
public List<Inhabitant> inhabitants; public List<Inhabitant> inhabitants;
<<<<<<< HEAD
public Map (Village_Hall villageHall, int gTime) { public Map (Village_Hall villageHall, int gTime) {
contains = new ArrayList<>(); contains = new ArrayList<>();
inhabitants = new ArrayList<>(); inhabitants = new ArrayList<>();
@ -48,28 +36,13 @@ public class Map {
public void build(Village_Hall hall, Tile t, Building b) { public void build(Village_Hall hall, Tile t, Building b) {
contains.add(b); contains.add(b);
} }
=======
public void move(Infantry i, Tile t) {
}
public void inRange(Infantry i, Building b) {
}
public void build(Village_Hall hall, Tile t, Building b) {
}
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
public int getGuardTime() { public int getGuardTime() {
return guardTime; return guardTime;
} }
<<<<<<< HEAD
public void setGuardTime(int gTime) { public void setGuardTime(int gTime) {
this.guardTime = gTime; this.guardTime = gTime;
} }
=======
public void setGuardTime() {
}
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
} }

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
public abstract class Building { public abstract class Building {
<<<<<<< HEAD
// members // members
private int level; private int level;
private int health; private int health;
@ -14,33 +13,13 @@ public abstract class Building {
private int goldCost; private int goldCost;
private int ironCost; private int ironCost;
private int woodCost; private int woodCost;
=======
private static int level;
private int health;
private static Stage stages;
private int goldCost;
private int ironCost;
private int woodCost;
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
private int buildTime; private int buildTime;
<<<<<<< HEAD
public ArrayList<Tile> tiles = new ArrayList<>(); public ArrayList<Tile> tiles = new ArrayList<>();
public ArrayList<Inhabitant> inhabitants = new ArrayList<>(); public ArrayList<Inhabitant> inhabitants = new ArrayList<>();
// functions // functions
=======
public List<Stage> stage;
public Tile tile;
public List<Inhabitant> inhabitant;
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
public int getLevel() { public int getLevel() {
return level; return level;
@ -50,7 +29,6 @@ public abstract class Building {
return health; return health;
} }
<<<<<<< HEAD
public int getCost(String type) { public int getCost(String type) {
return (type.equals("gold"))?(goldCost): return (type.equals("gold"))?(goldCost):
(type.equals("iron"))?(ironCost):woodCost; (type.equals("iron"))?(ironCost):woodCost;
@ -59,17 +37,11 @@ public abstract class Building {
public Stage getStage() { public Stage getStage() {
return stage; return stage;
} }
=======
public int getCost(String type) {
return 0;
}
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
public int getUpgradeCost() { public int getUpgradeCost() {
return 0; return 0;
} }
<<<<<<< HEAD
public void setLevel(int level) { public void setLevel(int level) {
this.level = level; this.level = level;
} }
@ -94,14 +66,4 @@ public abstract class Building {
public int getBuildTime() { public int getBuildTime() {
return buildTime; return buildTime;
} }
=======
public void upgrade() {
}
public int getBuildTime() {
return 0;
}
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
} }

View File

@ -2,7 +2,6 @@ package ca.cosc3p91.a2.gameobjects;
public class DefenseBuilding extends Building { public class DefenseBuilding extends Building {
<<<<<<< HEAD
private int damage; private int damage;
private int range; private int range;
@ -11,11 +10,6 @@ public class DefenseBuilding extends Building {
this.damage += stage.getDamageChange(); this.damage += stage.getDamageChange();
this.range += stage.getRangeChange(); this.range += stage.getRangeChange();
} }
=======
public int damage;
public int range;
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
public void attack(Infantry attacker) { public void attack(Infantry attacker) {

View File

@ -2,15 +2,10 @@ package ca.cosc3p91.a2.gameobjects;
class DefenseStage extends Stage { class DefenseStage extends Stage {
<<<<<<< HEAD
protected int dDamage; 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, public DefenseStage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost,
int damageIncrease, int rangeIncrease) { int damageIncrease, int rangeIncrease) {
super(dHealth,goldCost,requiredVillageLevel,upgradeTime,ironCost,woodCost); super(dHealth,goldCost,requiredVillageLevel,upgradeTime,ironCost,woodCost);
@ -25,12 +20,5 @@ class DefenseStage extends Stage {
public int getRangeChange() { public int getRangeChange() {
return dRange; return dRange;
} }
=======
public void getDamageChange() {
}
public void getRangeChange() {
}
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
} }

View File

@ -2,16 +2,12 @@ package ca.cosc3p91.a2.gameobjects;
public class GoldMine extends ResourceBuilding { public class GoldMine extends ResourceBuilding {
<<<<<<< HEAD
public static String resource = "gold"; public static String resource = "gold";
public GoldMine (int lvl, ResourceStage baseStage) { public GoldMine (int lvl, ResourceStage baseStage) {
setLevel(lvl); setLevel(lvl);
upgrade(baseStage); upgrade(baseStage);
} }
=======
public static String resource = "good";
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
@Override @Override
public void harvest(Village_Hall hall) { public void harvest(Village_Hall hall) {

View File

@ -4,7 +4,6 @@ public class IronMine extends ResourceBuilding {
public static String resource = "iron"; public static String resource = "iron";
<<<<<<< HEAD
public IronMine (int lvl, ResourceStage baseStage) { public IronMine (int lvl, ResourceStage baseStage) {
setLevel(lvl); setLevel(lvl);
upgrade(baseStage); upgrade(baseStage);
@ -12,10 +11,6 @@ public class IronMine extends ResourceBuilding {
@Override @Override
public void harvest(Village_Hall hall) { public void harvest(Village_Hall hall) {
=======
@Override
public void harvest(Village_Hall hall) {
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
} }
} }

View File

@ -4,17 +4,13 @@ public class LumberMine extends ResourceBuilding {
public static String resource = "wood"; public static String resource = "wood";
<<<<<<< HEAD
public LumberMine (int lvl, ResourceStage baseStage) { public LumberMine (int lvl, ResourceStage baseStage) {
setLevel(lvl); setLevel(lvl);
upgrade(baseStage); upgrade(baseStage);
} }
public void harvest(Village_Hall hall) { public void harvest(Village_Hall hall) {
=======
public void harvest(Village_Hall hall) {
} }
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
} }

View File

@ -4,7 +4,6 @@ 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, public ResourceStage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost,
int harvestRateIncr) { int harvestRateIncr) {
super(dHealth,goldCost,requiredVillageLevel,upgradeTime,ironCost,woodCost); super(dHealth,goldCost,requiredVillageLevel,upgradeTime,ironCost,woodCost);
@ -14,10 +13,5 @@ public class ResourceStage extends Stage {
public int getHarvestRateIncrease() { public int getHarvestRateIncrease() {
return harvestRateIncrease; return harvestRateIncrease;
} }
=======
public int getHarvestRateIncrease() {
return harvestRateIncrease;
}
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
} }

View File

@ -14,7 +14,6 @@ abstract class Stage {
protected int woodCost; protected int woodCost;
<<<<<<< HEAD
public Stage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost) { public Stage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost) {
this.dHealth = dHealth; this.dHealth = dHealth;
this.goldCost = goldCost; this.goldCost = goldCost;
@ -32,16 +31,6 @@ abstract class Stage {
return (type.equals("gold"))?(goldCost): return (type.equals("gold"))?(goldCost):
(type.equals("iron"))?(ironCost):woodCost; (type.equals("iron"))?(ironCost):woodCost;
} }
=======
public Building building;
public void getHealthChange() {
}
public int getCost(String type) {
return 0;
}
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
public int getRequiredVillageLevel() { public int getRequiredVillageLevel() {
return requiredVillageLevel; return requiredVillageLevel;

View File

@ -8,9 +8,4 @@ public class Tile {
public int y; public int y;
<<<<<<< HEAD
=======
public List<Building> building;
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
} }

View File

@ -8,7 +8,6 @@ public class VillageStage extends Stage {
protected int woodCapacityIncrease; protected int woodCapacityIncrease;
<<<<<<< HEAD
public VillageStage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost, public VillageStage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost,
int goldCapIncrease, int ironCapIncrease, int woodCapIncrease) { int goldCapIncrease, int ironCapIncrease, int woodCapIncrease) {
super(dHealth,goldCost,requiredVillageLevel,upgradeTime,ironCost,woodCost); super(dHealth,goldCost,requiredVillageLevel,upgradeTime,ironCost,woodCost);
@ -20,11 +19,6 @@ public class VillageStage extends Stage {
public int getGoldCapacityIncrease() { public int getGoldCapacityIncrease() {
return goldCapacityIncrease; return goldCapacityIncrease;
} }
=======
public int getGoldCapacityIncrease() {
return goldCapacityIncrease;
}
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
public int getIronCapacityIncrease() { public int getIronCapacityIncrease() {
return ironCapacityIncrease; return ironCapacityIncrease;

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
public class Village_Hall extends Building { public class Village_Hall extends Building {
<<<<<<< HEAD
private int goldCapacity = 0; private int goldCapacity = 0;
private int ironCapacity = 0; private int ironCapacity = 0;
@ -35,24 +34,5 @@ public class Village_Hall extends Building {
public int getWoodCapacity() { public int getWoodCapacity() {
return woodCapacity; 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
} }

View File

@ -2,16 +2,8 @@ package ca.cosc3p91.a2.player;
public class Player { public class Player {
<<<<<<< HEAD
public int currentGold; public int currentGold;
public int currentIron; public int currentIron;
public int currentWood; public int currentWood;
=======
public int currentGold;
public int currentIron;
public int currentWood;
>>>>>>> abf784868daa920a9ca8b3b9d291a7cf521aa9c7
} }