Mercurial > rinkhals
comparison gamelib/animal.py @ 438:16437cf4a2b8
Trees provide a modicum of cover.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 18:15:01 +0000 |
parents | 95b81e917399 |
children | cf4b020e6385 |
comparison
equal
deleted
inserted
replaced
437:95b81e917399 | 438:16437cf4a2b8 |
---|---|
9 from misc import Position | 9 from misc import Position |
10 import sound | 10 import sound |
11 import equipment | 11 import equipment |
12 import animations | 12 import animations |
13 import serializer | 13 import serializer |
14 import constants | |
14 | 15 |
15 class Animal(Sprite, serializer.Simplifiable): | 16 class Animal(Sprite, serializer.Simplifiable): |
16 """Base class for animals""" | 17 """Base class for animals""" |
17 | 18 |
18 STEALTH = 0 | 19 STEALTH = 0 |
667 building = gameboard.get_building(pos.to_tile_tuple()) | 668 building = gameboard.get_building(pos.to_tile_tuple()) |
668 # This allows chickens to fire across GuardTowers and Fences. | 669 # This allows chickens to fire across GuardTowers and Fences. |
669 if building and building.BLOCKS_VISION and not (watcher in building.occupants()): | 670 if building and building.BLOCKS_VISION and not (watcher in building.occupants()): |
670 return False | 671 return False |
671 distance = watcher.pos.dist(watchee.pos) - 1 | 672 distance = watcher.pos.dist(watchee.pos) - 1 |
673 # Intervening forests get in the way a bit. | |
674 woods = len([pos for pos in positions if gameboard.tv.get(pos.to_tile_tuple()) == gameboard.WOODLAND]) | |
672 roll = random.randint(1, 100) | 675 roll = random.randint(1, 100) |
673 return roll > watchee.STEALTH - vision_bonus + range_penalty*distance | 676 return roll > watchee.STEALTH - vision_bonus + range_penalty*distance + constants.WOODLAND_CONCEALMENT*woods |
674 | 677 |
675 # These don't have to add up to 100, but it's easier to think | 678 # These don't have to add up to 100, but it's easier to think |
676 # about them if they do. | 679 # about them if they do. |
677 DEFAULT_FOX_WEIGHTINGS = ( | 680 DEFAULT_FOX_WEIGHTINGS = ( |
678 (Fox, 59), | 681 (Fox, 59), |