village stages

main
Brett 2023-03-03 14:50:28 -05:00
parent f2793b1a97
commit 989c76ced9
4 changed files with 39 additions and 12 deletions

View File

@ -77,9 +77,7 @@ public class GameEngine implements Runnable {
}
private Map generateInitialMap(){
VillageStage villageHallInitialStage = new VillageStage(100, 0, 2, new Time(), 0,
0, 1000, 2500, 5000);
return new Map(new CasaDeNarino(1, villageHallInitialStage), 30);
return new Map(new CasaDeNarino(1, VillageHallStages.villageStages[0]), 30);
}
public Map generateMap() {
@ -112,6 +110,9 @@ public class GameEngine implements Runnable {
case 'p':
printState();
break;
case 'q':
System.exit(0);
break;
default:
break;
}

View File

@ -39,6 +39,12 @@ public class CasaDeNarino extends Building {
return currentGold;
}
public int getCurrentIron() {
return currentIron;
}
public int getCurrentWood() {return currentWood;}
public boolean addGold(int amount) {
int newGold = this.currentGold + amount;
if (newGold <= goldCapacity && this.currentGold + amount >= 0){
@ -48,10 +54,6 @@ public class CasaDeNarino extends Building {
return false;
}
public int getCurrentIron() {
return currentIron;
}
public boolean addIron(int amount) {
int newIron = this.currentIron + amount;
if (newIron <= ironCapacity && newIron >= 0) {
@ -61,10 +63,6 @@ public class CasaDeNarino extends Building {
return false;
}
public int getCurrentWood() {
return currentWood;
}
public boolean addWood(int amount) {
int newWood = this.currentWood + amount;
if (newWood <= woodCapacity && newWood >= 0) {

View File

@ -1,12 +1,14 @@
package ca.cosc3p91.a2.gameobjects;
import ca.cosc3p91.a2.util.Time;
class DefenseStage extends Stage {
protected int dDamage;
protected int dRange;
public DefenseStage(int dHealth, int goldCost, int requiredVillageLevel, int upgradeTime, int ironCost, int woodCost,
public DefenseStage(int dHealth, int goldCost, int requiredVillageLevel, Time upgradeTime, int ironCost, int woodCost,
int damageIncrease, int rangeIncrease) {
super(dHealth, goldCost, requiredVillageLevel, upgradeTime, ironCost, woodCost);
this.dDamage = damageIncrease;

View File

@ -1,4 +1,30 @@
package ca.cosc3p91.a2.gameobjects;
import ca.cosc3p91.a2.util.Time;
public class VillageHallStages {
public static class VillageStage1 extends VillageStage {
public VillageStage1() {
super(100, 0, 0, new Time(), 0,
0, 1000, 2500, 5000);
}
}
public static class VillageStage2 extends VillageStage {
public VillageStage2() {
super(550, 1000, 0, new Time().offsetHours(2), 2500,
5000, 2500, 5000, 10000);
}
}
public static class VillageStage3 extends VillageStage {
public VillageStage3() {
super(550, 2500, 0, new Time().offsetHours(2), 5000,
10000, 5000, 7500, 15000);
}
}
public static VillageStage[] villageStages = {new VillageStage1(), new VillageStage2(), new VillageStage3()};
}