|
@@ -1,7 +1,10 @@
|
|
|
package pathgame.tilemap;
|
|
|
|
|
|
+import pathgame.gameplay.PlayerAbilities;
|
|
|
+
|
|
|
public class Tiles
|
|
|
{
|
|
|
+
|
|
|
public final static Tile GRASS = buildGrass();
|
|
|
public final static Tile GRASS_WITH_STONE = buildGrass();
|
|
|
public final static Tile GRASS_WITH_6_BUSHES = buildGrass();
|
|
@@ -12,49 +15,61 @@ public class Tiles
|
|
|
public final static Tile GRASS_WITH_FLOWERS_4 = buildGrass();
|
|
|
public final static Tile GRASS_WITH_HILL = buildGrass();
|
|
|
public final static Tile GRASS_WITH_EARTH = buildGrass();
|
|
|
-
|
|
|
+
|
|
|
public final static Tile[] GRASS_VARIANTS = new Tile[]
|
|
|
{
|
|
|
- GRASS, GRASS_WITH_STONE, GRASS_WITH_6_BUSHES, GRASS_WITH_3_BUSHES,
|
|
|
+ GRASS, GRASS_WITH_STONE, GRASS_WITH_6_BUSHES, GRASS_WITH_3_BUSHES,
|
|
|
GRASS_WITH_FLOWERS_1, GRASS_WITH_FLOWERS_2, GRASS_WITH_FLOWERS_3,
|
|
|
GRASS_WITH_FLOWERS_4, GRASS_WITH_HILL, GRASS_WITH_EARTH
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
public final static Tile FOREST = Tile.TileBuilder.create()
|
|
|
- .setEnergyCost(2)
|
|
|
+ .setEnergyCost(4)
|
|
|
.setForestReplaceChance(0.0f)
|
|
|
- .setSpeedUp((pa) -> pa.getFasterForest())
|
|
|
+ .setSpeedUp((p) -> p.getAbilities().getFasterForest())
|
|
|
.pathHost()
|
|
|
.build();
|
|
|
public final static Tile SWAMP = buildSwamp();
|
|
|
public final static Tile SWAMP_DECO = buildSwamp();
|
|
|
public final static Tile SWAMP_TREE = buildSwamp();
|
|
|
public final static Tile SHALLOW_WATER = Tile.TileBuilder.create()
|
|
|
- .setEnergyCost(3)
|
|
|
+ .setEnergyCost(6)
|
|
|
.setForestReplaceChance(0.0f)
|
|
|
- .setSpeedUp((pa) -> pa.getFasterShallowWater())
|
|
|
+ .setSpeedUp((p) ->
|
|
|
+ {
|
|
|
+ int speedUp = p.getAbilities().getFasterShallowWater();
|
|
|
+ if(p.isSailing())
|
|
|
+ {
|
|
|
+ speedUp += 4;
|
|
|
+ if(p.getAbilities() == PlayerAbilities.SAILOR)
|
|
|
+ {
|
|
|
+ speedUp++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return speedUp;
|
|
|
+ })
|
|
|
.noTown()
|
|
|
.setRenderType(TileRenderType.WATER)
|
|
|
.setType(TileType.SHALLOW_WATER)
|
|
|
.build();
|
|
|
public final static Tile DEEP_WATER = Tile.TileBuilder.create()
|
|
|
- .setEnergyCost(3)
|
|
|
+ .setEnergyCost(2)
|
|
|
.setForestReplaceChance(0.0f)
|
|
|
- .setSpeedUp((pa) -> pa.getFasterDeepWater())
|
|
|
+ .setSpeedUp((p) -> p.getAbilities().getFasterDeepWater())
|
|
|
.noTown()
|
|
|
.setRenderType(TileRenderType.WATER)
|
|
|
.setType(TileType.DEEP_WATER)
|
|
|
.build();
|
|
|
public final static Tile HILL = Tile.TileBuilder.create()
|
|
|
- .setEnergyCost(3)
|
|
|
+ .setEnergyCost(6)
|
|
|
.setForestReplaceChance(0.5f)
|
|
|
- .setSpeedUp((pa) -> pa.getFasterHill())
|
|
|
+ .setSpeedUp((p) -> p.getAbilities().getFasterHill())
|
|
|
.pathHost()
|
|
|
.build();
|
|
|
public final static Tile MOUNTAIN = Tile.TileBuilder.create()
|
|
|
- .setEnergyCost(5)
|
|
|
+ .setEnergyCost(9)
|
|
|
.setForestReplaceChance(0.0f)
|
|
|
- .setSpeedUp((pa) -> pa.getFasterMountain())
|
|
|
+ .setSpeedUp((p) -> p.getAbilities().getFasterMountain())
|
|
|
.noTown()
|
|
|
.build();
|
|
|
public final static Tile TOWN = new TileTown();
|
|
@@ -62,31 +77,33 @@ public class Tiles
|
|
|
public final static Tile TOWN_BLOCKED_2 = buildBlockedTown();
|
|
|
public final static Tile TOWN_BLOCKED_3 = buildBlockedTown();
|
|
|
public final static Tile TOWN_BLOCKED_4 = buildBlockedTown();
|
|
|
-
|
|
|
+
|
|
|
public final static Tile[] TOWN_BLOCKED = new Tile[]
|
|
|
{
|
|
|
TOWN_BLOCKED_1, TOWN_BLOCKED_2, TOWN_BLOCKED_3, TOWN_BLOCKED_4
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
public final static Tile PORT = new TilePort();
|
|
|
-
|
|
|
+
|
|
|
public final static Tile buildGrass()
|
|
|
{
|
|
|
return Tile.TileBuilder.create()
|
|
|
- .setSpeedUp((pa) -> pa.getFasterGrass())
|
|
|
+ .setSpeedUp((p) -> p.getAbilities().getFasterGrass())
|
|
|
.pathHost()
|
|
|
+ .setEnergyCost(3)
|
|
|
.build();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public final static Tile buildSwamp()
|
|
|
{
|
|
|
return Tile.TileBuilder.create()
|
|
|
- .setEnergyCost(3)
|
|
|
+ .setEnergyCost(5)
|
|
|
.setForestReplaceChance(0.0f)
|
|
|
.setRenderType(TileRenderType.SWAMP)
|
|
|
+ .setSpeedUp((p) -> p.getAbilities().getFasterSwamp())
|
|
|
.build();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public final static Tile buildBlockedTown()
|
|
|
{
|
|
|
return Tile.TileBuilder.create()
|
|
@@ -94,9 +111,9 @@ public class Tiles
|
|
|
.noTown()
|
|
|
.build();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public final static Tile HOME_TOWN = new TileHomeTown();
|
|
|
-
|
|
|
+
|
|
|
public final static Tile buildPath()
|
|
|
{
|
|
|
return Tile.TileBuilder.create()
|
|
@@ -104,7 +121,7 @@ public class Tiles
|
|
|
.path()
|
|
|
.build();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public final static Tile PATH_N_E_S_W = buildPath();
|
|
|
public final static Tile PATH_N_E_S = buildPath();
|
|
|
public final static Tile PATH_N_E_W = buildPath();
|
|
@@ -120,7 +137,7 @@ public class Tiles
|
|
|
public final static Tile PATH_S_W = buildPath();
|
|
|
public final static Tile PATH_S = buildPath();
|
|
|
public final static Tile PATH_W = buildPath();
|
|
|
-
|
|
|
+
|
|
|
public final static Tile[] PATH = new Tile[]
|
|
|
{
|
|
|
PATH_N_E_S_W, PATH_N_E_S, PATH_N_E_W, PATH_N_E,
|
|
@@ -128,7 +145,7 @@ public class Tiles
|
|
|
PATH_E_S_W, PATH_E_S, PATH_E_W, PATH_E,
|
|
|
PATH_S_W, PATH_S, PATH_W, GRASS
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
public static Tile getPath(boolean north, boolean east, boolean south, boolean west)
|
|
|
{
|
|
|
return PATH[(north ? 0 : 8) + (east ? 0 : 4) + (south ? 0 : 2) + (west ? 0 : 1)];
|