Skip to content

Commit

Permalink
add Tile enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-Aghayari committed Apr 18, 2022
1 parent 21cac3b commit 9f45dd2
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 28 deletions.
21 changes: 12 additions & 9 deletions src/models/Tile/Tile.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,26 @@ public class Tile {
private NoneCombatUnits noneCombatUnits;
private CombatUnits combatUnits;

public Tile() {
public Tile(TileMode mode, TileResource resource, TileFeature feature) {
setMode(mode);
setResource(resource);
setFeature(feature);
}

public int getMp() {
return 0;
public Double getMp() {
return mode.getMovementCost() + feature.getMovementCost();
}

public Gold getGold() {
return null;
public int getGold() {
return mode.getGold() + resource.getGold() + feature.getGold() + improvement.getGold();
}

public Food getFood() {
return null;
public int getFood() {
return mode.getFood() + resource.getFood() + feature.getFood() + improvement.getFood();
}

public float getCombatImpact() {
return 0;
public double getCombatBonus() {
return mode.getTroopBoost() + feature.getTroopBoost();
}

public TileMode getMode() {
Expand Down
29 changes: 18 additions & 11 deletions src/models/Tile/TileMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@

public class TileMode {
private TileModeEnum TileName;
private int MovementCost;
private Double MovementCost;
private int food;
private int production;
private int gold;
private float combatBonus;
private double troopBoost;
private ArrayList<TileFeatureEnum> possibleFeature;
private ArrayList<TileResourceEnum> possibleResources;

public TileMode(TileModeEnum tileName) {
setTileName(tileName);
setMovementCost(tileName.getMovementCost());
setFood(tileName.getFood());
setProduction(tileName.getProduction());
setGold(tileName.getGold());
}

public ArrayList<TileFeatureEnum> getPossibleFeature() {
return possibleFeature;
}
Expand Down Expand Up @@ -63,20 +71,19 @@ public void setGold(int gold) {
this.gold = gold;
}

public float getCombatBonus() {
return combatBonus;
public Double getMovementCost() {
return MovementCost;
}

public void setCombatBonus(float combatBonus) {
this.combatBonus = combatBonus;
public void setMovementCost(Double movementCost) {
MovementCost = movementCost;
}


public int getMovementCost() {
return MovementCost;
public double getTroopBoost() {
return troopBoost;
}

public void setMovementCost(int movementCost) {
MovementCost = movementCost;
public void setTroopBoost(double troopBoost) {
this.troopBoost = troopBoost;
}
}
54 changes: 46 additions & 8 deletions src/models/Tile/TileModeEnum.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,53 @@
package models.Tile;

public enum TileModeEnum {
desert("desert"),
grassland("grassland"),
hill("hill"),
mountain("mountain"),
ocean("ocean"),
snow("snow"),
tundra("tundra");
desert("desert", 0, 0, 0, -0.33, 1.0),
grassland("grassland", 2, 0, 0, -0.33, 1.0),
hill("hill", 0, 2, 0, 0.25, 2.0),
mountain("mountain", 0, 0, 0, 0, Double.POSITIVE_INFINITY),
ocean("ocean", 0, 0, 0, 0, Double.POSITIVE_INFINITY),
PLAIN("plain", 1, 1, 0, -0.33, 1.0),
snow("snow", 0, 0, 0, -0.33, 1.0),
tundra("tundra", 1, 0, 0, -0.33, 1.0);

TileModeEnum(String name) {
private final String name;
private final int food;
private final int production;
private final int gold;
private final double troopBoost;
private final Double movementCost;


TileModeEnum(String name, int food, int production, int gold, double troopBoost, Double movementCost) {
this.name = name;
this.food = food;
this.production = production;
this.gold = gold;
this.troopBoost = troopBoost;
this.movementCost = movementCost;
}

public String getName() {
return name;
}

public int getFood() {
return food;
}

public int getProduction() {
return production;
}

public int getGold() {
return gold;
}

public double getTroopBoost() {
return troopBoost;
}

public Double getMovementCost() {
return movementCost;
}
}

0 comments on commit 9f45dd2

Please sign in to comment.