44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
# Cell Class
|
|
# Stores the attack/defense modifiers and the color
|
|
# for each terrain type. Terrain types are defined in
|
|
# cell_terrain.py
|
|
#
|
|
# Currently, Open terrain gives a +2 for an attacker and
|
|
# nothing to a defender. Forest gives a +2 to the defender
|
|
# and nothing to the attacker.
|
|
#
|
|
# Feel free to modify.
|
|
|
|
|
|
import cell_terrain
|
|
|
|
# Modified
|
|
# Open: -2 for Zombies
|
|
# Shadows: +4 for Zombies
|
|
class Cell:
|
|
def __init__(self, terrain):
|
|
self.terrain = terrain
|
|
|
|
# TODO: replace this with a data member instead
|
|
# of a function.
|
|
def get_color(self):
|
|
match self.terrain:
|
|
case cell_terrain.Terrain.Open:
|
|
return "cornsilk2"
|
|
case cell_terrain.Terrain.Shadows:
|
|
return "cornsilk3"
|
|
|
|
def get_attack_mod(self, unitType):
|
|
match self.terrain:
|
|
case cell_terrain.Terrain.Open:
|
|
return -2 if unitType == "Z" else 0
|
|
case cell_terrain.Terrain.Shadows:
|
|
return 4 if unitType == "Z" else 0
|
|
|
|
def get_defense_mod(self, unitType):
|
|
match self.terrain:
|
|
case cell_terrain.Terrain.Open:
|
|
return -2 if unitType == "Z" else 0
|
|
case cell_terrain.Terrain.Shadows:
|
|
return +4 if unitType == "Z" else 0
|