comparison gamelib/gameboard.py @ 77:65958516c7d9

Implement separate fence repair cost (currently 25 groats).
author Simon Cross <hodgestar@gmail.com>
date Tue, 01 Sep 2009 10:40:57 +0000
parents f3ce3346e25e
children 8241386a1651
comparison
equal deleted inserted replaced
76:615a5afaf1a4 77:65958516c7d9
172 172
173 def buy_fence(self, tile_pos): 173 def buy_fence(self, tile_pos):
174 this_tile = self.tv.get(tile_pos) 174 this_tile = self.tv.get(tile_pos)
175 if this_tile not in [self.GRASSLAND, self.BROKEN_FENCE]: 175 if this_tile not in [self.GRASSLAND, self.BROKEN_FENCE]:
176 return 176 return
177 if self.cash < constants.BUY_PRICE_FENCE: 177 if this_tile == self.GRASSLAND:
178 cost = constants.BUY_PRICE_FENCE
179 else:
180 cost = constants.REPAIR_PRICE_FENCE
181 if self.cash < cost:
178 print "You can't afford a fence." 182 print "You can't afford a fence."
179 return 183 return
180 self.add_cash(-constants.BUY_PRICE_FENCE) 184 self.add_cash(-cost)
181 self.tv.set(tile_pos, self.FENCE) 185 self.tv.set(tile_pos, self.FENCE)
182 186
183 def sell_fence(self, tile_pos): 187 def sell_fence(self, tile_pos):
184 if self.tv.get(tile_pos) != self.FENCE: 188 if self.tv.get(tile_pos) != self.FENCE:
185 return 189 return