From b3c14a0611d6a25316019c1b2a3f52c814f7fbe3 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Wed, 1 Mar 2023 13:23:35 -0500 Subject: [PATCH] Add code, gitignore, commit script --- .gitignore | 0 .idea/vcs.xml | 6 +++ .../src/ca/cosc3p91/a2/game/GameEngine.java | 25 ++++++++++ Assignment 2/src/ca/cosc3p91/a2/game/Map.java | 35 +++++++++++++ .../ca/cosc3p91/a2/gameobjects/Archer.java | 4 ++ .../cosc3p91/a2/gameobjects/ArcherTower.java | 4 ++ .../ca/cosc3p91/a2/gameobjects/Building.java | 50 +++++++++++++++++++ .../ca/cosc3p91/a2/gameobjects/Cannon.java | 4 ++ .../ca/cosc3p91/a2/gameobjects/Catapult.java | 4 ++ .../ca/cosc3p91/a2/gameobjects/Collector.java | 11 ++++ .../a2/gameobjects/DefenseBuilding.java | 13 +++++ .../cosc3p91/a2/gameobjects/DefenseStage.java | 15 ++++++ .../src/ca/cosc3p91/a2/gameobjects/Farm.java | 13 +++++ .../ca/cosc3p91/a2/gameobjects/GoldMine.java | 11 ++++ .../ca/cosc3p91/a2/gameobjects/Infantry.java | 23 +++++++++ .../cosc3p91/a2/gameobjects/Inhabitant.java | 14 ++++++ .../ca/cosc3p91/a2/gameobjects/IronMine.java | 11 ++++ .../ca/cosc3p91/a2/gameobjects/Knight.java | 4 ++ .../cosc3p91/a2/gameobjects/LumberMine.java | 11 ++++ .../a2/gameobjects/ResourceBuidling.java | 11 ++++ .../a2/gameobjects/ResourceStage.java | 11 ++++ .../ca/cosc3p91/a2/gameobjects/Soldier.java | 4 ++ .../src/ca/cosc3p91/a2/gameobjects/Stage.java | 34 +++++++++++++ .../src/ca/cosc3p91/a2/gameobjects/Tile.java | 13 +++++ .../cosc3p91/a2/gameobjects/VillageStage.java | 23 +++++++++ .../cosc3p91/a2/gameobjects/Village_Hall.java | 23 +++++++++ .../ca/cosc3p91/a2/gameobjects/Worker.java | 11 ++++ .../src/ca/cosc3p91/a2/player/Player.java | 11 ++++ .../cosc3p91/a2/userinterface/GuiManager.java | 4 ++ commit.sh | 3 ++ src/ca/cosc3p91/a2/game/Main.java | 8 --- untitled104.iml | 5 +- 32 files changed, 408 insertions(+), 11 deletions(-) create mode 100644 .gitignore create mode 100644 .idea/vcs.xml create mode 100644 Assignment 2/src/ca/cosc3p91/a2/game/GameEngine.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/game/Map.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Archer.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/ArcherTower.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Cannon.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Catapult.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Collector.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseBuilding.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseStage.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Farm.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/GoldMine.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Infantry.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Inhabitant.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/IronMine.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Knight.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/LumberMine.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceBuidling.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceStage.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Soldier.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Stage.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Tile.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/VillageStage.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Village_Hall.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/gameobjects/Worker.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/player/Player.java create mode 100644 Assignment 2/src/ca/cosc3p91/a2/userinterface/GuiManager.java create mode 100755 commit.sh delete mode 100644 src/ca/cosc3p91/a2/game/Main.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/game/GameEngine.java b/Assignment 2/src/ca/cosc3p91/a2/game/GameEngine.java new file mode 100644 index 0000000..8f35444 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/game/GameEngine.java @@ -0,0 +1,25 @@ +package ca.cosc3p91.a2.game; + +import ca.cosc3p91.a2.player.Player; + +public class GameEngine { + + private Player player; + + private int pillageFactor; + + private int currentTime; + + public Map map; + + public void attackVIllage(Map map) { + } + + public Map generateMap() { + return null; + } + + public void getScore(Map map) { + } + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/game/Map.java b/Assignment 2/src/ca/cosc3p91/a2/game/Map.java new file mode 100644 index 0000000..4f1deb9 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/game/Map.java @@ -0,0 +1,35 @@ +package ca.cosc3p91.a2.game; + +import ca.cosc3p91.a2.gameobjects.*; + +import java.util.List; + + + +public class Map { + + private Village_Hall townHall; + + private int guardTime; + + private List contains; + + public List inhabitants; + + public void move(Infantry i, Tile t) { + } + + public void inRange(Infantry i, Building b) { + } + + public void build(Village_Hall hall, Tile t, Building b) { + } + + public int getGuardTime() { + return guardTime; + } + + public void setGuardTime() { + } + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Archer.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Archer.java new file mode 100644 index 0000000..02701ad --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Archer.java @@ -0,0 +1,4 @@ +package ca.cosc3p91.a2.gameobjects; + +public class Archer extends Infantry { +} \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ArcherTower.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ArcherTower.java new file mode 100644 index 0000000..bfafb2a --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ArcherTower.java @@ -0,0 +1,4 @@ +package ca.cosc3p91.a2.gameobjects; + +public class ArcherTower extends DefenseBuilding { +} \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java new file mode 100644 index 0000000..13d2f1b --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java @@ -0,0 +1,50 @@ +package ca.cosc3p91.a2.gameobjects; + +import java.util.List; + +public abstract class Building { + + private static int level; + + private int health; + + private static Stage stages; + + private int goldCost; + + private int ironCost; + + private int woodCost; + + private int buildTime; + + public List stage; + public Tile tile; + + public List inhabitant; + + public int getLevel() { + return level; + } + + public int getHealth() { + return health; + } + + public int getCost(String type) { + return 0; + } + + public int getUpgradeCost() { + return 0; + } + + public void upgrade() { + + } + + public int getBuildTime() { + return 0; + } + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Cannon.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Cannon.java new file mode 100644 index 0000000..4a7ae5a --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Cannon.java @@ -0,0 +1,4 @@ +package ca.cosc3p91.a2.gameobjects; + +public class Cannon extends DefenseBuilding { +} \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Catapult.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Catapult.java new file mode 100644 index 0000000..fc0071c --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Catapult.java @@ -0,0 +1,4 @@ +package ca.cosc3p91.a2.gameobjects; + +public class Catapult extends Infantry { +} \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Collector.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Collector.java new file mode 100644 index 0000000..7d63c27 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Collector.java @@ -0,0 +1,11 @@ +package ca.cosc3p91.a2.gameobjects; + +public class Collector { + + private int averageCollectionRate; + + public int getCollectionRate() { + return averageCollectionRate; + } + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseBuilding.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseBuilding.java new file mode 100644 index 0000000..669945f --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseBuilding.java @@ -0,0 +1,13 @@ +package ca.cosc3p91.a2.gameobjects; + +public class DefenseBuilding extends Building { + + public int damage; + + public int range; + + 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 new file mode 100644 index 0000000..ea2c8fa --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/DefenseStage.java @@ -0,0 +1,15 @@ +package ca.cosc3p91.a2.gameobjects; + +class DefenseStage extends Stage { + + protected int dDamge; + + protected int dRange; + + public void getDamageChange() { + } + + public void getRangeChange() { + } + +} \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Farm.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Farm.java new file mode 100644 index 0000000..3f39711 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Farm.java @@ -0,0 +1,13 @@ +package ca.cosc3p91.a2.gameobjects; + +public class Farm extends ResourceBuidling { + + public int getPopulationContribution() { + return 0; + } + + @Override + public void harvest(Village_Hall hall) { + + } +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/GoldMine.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/GoldMine.java new file mode 100644 index 0000000..43e25de --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/GoldMine.java @@ -0,0 +1,11 @@ +package ca.cosc3p91.a2.gameobjects; + +public class GoldMine extends ResourceBuidling { + + public static String resource = "good"; + + @Override + public void harvest(Village_Hall hall) { + + } +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Infantry.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Infantry.java new file mode 100644 index 0000000..9a3c078 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Infantry.java @@ -0,0 +1,23 @@ +package ca.cosc3p91.a2.gameobjects; + +public abstract class Infantry { + + private int health; + + private int damage; + + private int range; + + public void attack(Building b) { + } + + public void getHealth() { + } + + public void getDamage() { + } + + public void getRange() { + } + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Inhabitant.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Inhabitant.java new file mode 100644 index 0000000..96c6da8 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Inhabitant.java @@ -0,0 +1,14 @@ +package ca.cosc3p91.a2.gameobjects; + +import ca.cosc3p91.a2.game.Map; + +public interface Inhabitant { + + public Map map = null; + public Building building = null; + + public void move(Tile t); + + public void getPosition(); + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/IronMine.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/IronMine.java new file mode 100644 index 0000000..296fc76 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/IronMine.java @@ -0,0 +1,11 @@ +package ca.cosc3p91.a2.gameobjects; + +public class IronMine extends ResourceBuidling { + + public static String resource = "iron"; + + @Override + public void harvest(Village_Hall hall) { + + } +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Knight.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Knight.java new file mode 100644 index 0000000..8e78d73 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Knight.java @@ -0,0 +1,4 @@ +package ca.cosc3p91.a2.gameobjects; + +public class Knight extends Infantry { +} \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/LumberMine.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/LumberMine.java new file mode 100644 index 0000000..658839f --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/LumberMine.java @@ -0,0 +1,11 @@ +package ca.cosc3p91.a2.gameobjects; + +public class LumberMine extends ResourceBuidling { + + public static String resource = "wood"; + + public void harvest(Village_Hall hall) { + + } + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceBuidling.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceBuidling.java new file mode 100644 index 0000000..3560777 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceBuidling.java @@ -0,0 +1,11 @@ +package ca.cosc3p91.a2.gameobjects; + +public abstract class ResourceBuidling extends Building { + + public static String resource; + + private int harvest_rate; + + public abstract void harvest(Village_Hall hall); + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceStage.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceStage.java new file mode 100644 index 0000000..90401bf --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/ResourceStage.java @@ -0,0 +1,11 @@ +package ca.cosc3p91.a2.gameobjects; + +public class ResourceStage extends Stage { + + protected int harvestRateIncrease; + + public int getHarvestRateIncrease() { + return harvestRateIncrease; + } + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Soldier.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Soldier.java new file mode 100644 index 0000000..7cbbe32 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Soldier.java @@ -0,0 +1,4 @@ +package ca.cosc3p91.a2.gameobjects; + +public class Soldier extends Infantry { +} \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Stage.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Stage.java new file mode 100644 index 0000000..2779c75 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Stage.java @@ -0,0 +1,34 @@ +package ca.cosc3p91.a2.gameobjects; + +abstract class Stage { + + protected int dHealth; + + protected int goldCost; + + protected int requiredVillageLevel; + + protected int upgradeTime; + + protected int ironCost; + + protected int woodCost; + + public Building building; + + public void getHealthChange() { + } + + public int getCost(String type) { + return 0; + } + + public int getRequiredVillageLevel() { + return requiredVillageLevel; + } + + 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 new file mode 100644 index 0000000..708c2e4 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Tile.java @@ -0,0 +1,13 @@ +package ca.cosc3p91.a2.gameobjects; + +import java.util.List; + +public class Tile { + + public int x; + + public int y; + + public List building; + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/VillageStage.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/VillageStage.java new file mode 100644 index 0000000..225a504 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/VillageStage.java @@ -0,0 +1,23 @@ +package ca.cosc3p91.a2.gameobjects; + +class VillageStage extends Stage { + + protected int goldCapacityIncrease; + + protected int ironCapacityIncrease; + + protected int woodCapacityIncrease; + + public int getGoldCapacityIncrease() { + return goldCapacityIncrease; + } + + public int getIronCapacityIncrease() { + return ironCapacityIncrease; + } + + 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 new file mode 100644 index 0000000..ca5a801 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Village_Hall.java @@ -0,0 +1,23 @@ +package ca.cosc3p91.a2.gameobjects; + +public class Village_Hall extends Building { + + private int goldCapacity; + + private int ironCapacity; + + private int woodCapacity; + + public int getGoldCapacity() { + return goldCapacity; + } + + public int getIronCapacity() { + return ironCapacity; + } + + public int getWoodCapacity() { + return woodCapacity; + } + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Worker.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Worker.java new file mode 100644 index 0000000..ae319b1 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Worker.java @@ -0,0 +1,11 @@ +package ca.cosc3p91.a2.gameobjects; + +public class Worker { + + private boolean currentlyBuilding; + + public boolean isCurrentlyBuilding() { + return currentlyBuilding; + } + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/player/Player.java b/Assignment 2/src/ca/cosc3p91/a2/player/Player.java new file mode 100644 index 0000000..6508591 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/player/Player.java @@ -0,0 +1,11 @@ +package ca.cosc3p91.a2.player; + +public class Player { + + public int currentGold; + + public int currentIron; + + public int currentWood; + +} \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/userinterface/GuiManager.java b/Assignment 2/src/ca/cosc3p91/a2/userinterface/GuiManager.java new file mode 100644 index 0000000..45e4b54 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/userinterface/GuiManager.java @@ -0,0 +1,4 @@ +package ca.cosc3p91.a2.userinterface; + +public class GuiManager { +} \ No newline at end of file diff --git a/commit.sh b/commit.sh new file mode 100755 index 0000000..8db0770 --- /dev/null +++ b/commit.sh @@ -0,0 +1,3 @@ +git add * +git commit +git push -u origin main diff --git a/src/ca/cosc3p91/a2/game/Main.java b/src/ca/cosc3p91/a2/game/Main.java deleted file mode 100644 index f2640b9..0000000 --- a/src/ca/cosc3p91/a2/game/Main.java +++ /dev/null @@ -1,8 +0,0 @@ -package ca.cosc3p91.a2.game; - -public class Main { - - public static void main(String[] args) { - System.out.println("Hog Ridah!");// write your code here - } -} diff --git a/untitled104.iml b/untitled104.iml index d5c0743..61baa9c 100644 --- a/untitled104.iml +++ b/untitled104.iml @@ -3,10 +3,9 @@ - + - - + \ No newline at end of file