Mercurial > rinkhals
comparison gamelib/buildings.py @ 198:355eaae40b1f
Buildings now affect weapon range and accuracy.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Fri, 04 Sep 2009 19:34:01 +0000 |
parents | b400991ccce1 |
children | 696936621a93 |
comparison
equal
deleted
inserted
replaced
197:d74693555b86 | 198:355eaae40b1f |
---|---|
49 class Building(Sprite): | 49 class Building(Sprite): |
50 """Base class for buildings""" | 50 """Base class for buildings""" |
51 | 51 |
52 IS_BUILDING = True | 52 IS_BUILDING = True |
53 GRASSLAND = tiles.REVERSE_TILE_MAP['grassland'] | 53 GRASSLAND = tiles.REVERSE_TILE_MAP['grassland'] |
54 MODIFY_KNIFE_RANGE = lambda s, x: 0 | |
55 MODIFY_GUN_RANGE = lambda s, x: -1 | |
54 | 56 |
55 def __init__(self, pos): | 57 def __init__(self, pos): |
56 """Initial image, tile vid position, size and tile number for building.""" | 58 """Initial image, tile vid position, size and tile number for building.""" |
57 self.day_image = imagecache.load_image(self.IMAGE) | 59 self.day_image = imagecache.load_image(self.IMAGE) |
58 self.night_image = imagecache.load_image(self.IMAGE, ('night',)) | 60 self.night_image = imagecache.load_image(self.IMAGE, ('night',)) |
185 NAME = 'Henhouse' | 187 NAME = 'Henhouse' |
186 FLOORS = 1 | 188 FLOORS = 1 |
187 | 189 |
188 class DoubleStoryHenHouse(HenHouse): | 190 class DoubleStoryHenHouse(HenHouse): |
189 """A double story hen house.""" | 191 """A double story hen house.""" |
192 | |
190 TILE_NO = tiles.REVERSE_TILE_MAP['hendominium'] | 193 TILE_NO = tiles.REVERSE_TILE_MAP['hendominium'] |
191 BUY_PRICE = 300 | 194 BUY_PRICE = 300 |
192 SELL_PRICE = 150 | 195 SELL_PRICE = 150 |
193 SIZE = (2, 3) | 196 SIZE = (2, 3) |
194 IMAGE = 'sprites/hendominium.png' | 197 IMAGE = 'sprites/hendominium.png' |
206 IMAGE = 'sprites/watchtower.png' | 209 IMAGE = 'sprites/watchtower.png' |
207 SELECTED_IMAGE = 'sprites/select_watchtower.png' | 210 SELECTED_IMAGE = 'sprites/select_watchtower.png' |
208 NAME = 'Watchtower' | 211 NAME = 'Watchtower' |
209 FLOORS = 1 | 212 FLOORS = 1 |
210 | 213 |
214 MODIFY_GUN_RANGE = lambda s, x: (3*x)/2 | |
215 MODIFY_GUN_BASE_HIT = lambda s, x: x-5 | |
216 MODIFY_GUN_RANGE_PENALTY = lambda s, x: x-1 | |
217 | |
211 def is_building(obj): | 218 def is_building(obj): |
212 """Return true if obj is a build class.""" | 219 """Return true if obj is a build class.""" |
213 return getattr(obj, "IS_BUILDING", False) and hasattr(obj, "NAME") | 220 return getattr(obj, "IS_BUILDING", False) and hasattr(obj, "NAME") |
214 | 221 |
215 # Building hens can lay eggs in | 222 # Building hens can lay eggs in |