Skip to content

Commit

Permalink
Separated chapels and flowers. Updated tiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentbons committed May 19, 2020
1 parent baa3c69 commit cf84606
Show file tree
Hide file tree
Showing 82 changed files with 320 additions and 87 deletions.
1 change: 0 additions & 1 deletion main/carcassonne_visualiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def __draw_meeple(self, player_index: int, meeple_position: MeeplePosition):
def __draw_tile(self, column_index, row_index, tile):
image_filename = tile.image
abs_file_path = os.path.join(self.images_path, image_filename)

image = Image.open(abs_file_path).resize((self.tile_size, self.tile_size), Image.ANTIALIAS).rotate(-90 * tile.turns)
height = image.height
width = image.width
Expand Down
3 changes: 2 additions & 1 deletion main/objects/terrain_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class TerrainType(Enum):
CITY = "city"
GRASS = "grass"
ROAD = "road"
CHAPEL_OR_FLOWERS = "chapel_or_flowers"
CHAPEL = "chapel"
FLOWERS = "flowers"
UNPLAYABLE = "unplayable"

def to_json(self):
Expand Down
19 changes: 13 additions & 6 deletions main/objects/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def __init__(self,
grass: [Side] = (),
farms: [FarmerConnection] = (),
shield: bool = False,
chapel_or_flowers: bool = False,
chapel: bool = False,
flowers: bool = False,
inn: [Side] = (),
cathedral: bool = False,
unplayable_sides: [Side] = (),
Expand All @@ -35,7 +36,8 @@ def __init__(self,
self.grass = grass
self.farms: [FarmerConnection] = farms
self.shield = shield
self.chapel_or_flowers = chapel_or_flowers
self.chapel = chapel
self.flowers = flowers
self.inn = inn
self.cathedral = cathedral
self.unplayable_sides = unplayable_sides
Expand Down Expand Up @@ -69,8 +71,11 @@ def get_type(self, side: Side):
if self.unplayable_sides.__contains__(side):
return TerrainType.UNPLAYABLE

if side == Side.CENTER and self.chapel_or_flowers:
return TerrainType.CHAPEL_OR_FLOWERS
if side == Side.CENTER and self.chapel:
return TerrainType.CHAPEL

if side == Side.CENTER and self.flowers:
return TerrainType.FLOWERS

if self.get_river_ends().__contains__(side):
return TerrainType.UNPLAYABLE
Expand All @@ -93,7 +98,8 @@ def to_json(self):
"grass": list(map(lambda x: x.to_json(), self.grass)),
"farms": list(map(lambda x: x.to_json(), self.farms)),
"shield": self.shield,
"chapel_or_flowers": self.chapel_or_flowers,
"chapel": self.chapel,
"flowers": self.flowers,
"inn": list(map(lambda x: x.to_json(), self.inn)),
"unplayable_sides": list(map(lambda x: x.to_json(), self.unplayable_sides))
}
Expand All @@ -111,7 +117,8 @@ def turn(self, times: int):
grass=list(map(lambda x: SideModificationUtil.turn_side(x, times), self.grass)),
farms=list(map(lambda x: SideModificationUtil.turn_farmer_connection(x, times), self.farms)),
shield=self.shield,
chapel_or_flowers=self.chapel_or_flowers,
chapel=self.chapel,
flowers=self.flowers,
inn=list(map(lambda x: SideModificationUtil.turn_side(x, times), self.inn)),
unplayable_sides=list(map(lambda x: SideModificationUtil.turn_side(x, times), self.unplayable_sides)),
image=self.image
Expand Down
Loading

0 comments on commit cf84606

Please sign in to comment.