changeset 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
files gamelib/animal.py gamelib/constants.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/animal.py	Sat Nov 21 17:55:28 2009 +0000
+++ b/gamelib/animal.py	Sat Nov 21 18:15:01 2009 +0000
@@ -11,6 +11,7 @@
 import equipment
 import animations
 import serializer
+import constants
 
 class Animal(Sprite, serializer.Simplifiable):
     """Base class for animals"""
@@ -669,8 +670,10 @@
         if building and building.BLOCKS_VISION and not (watcher in building.occupants()):
             return False
     distance = watcher.pos.dist(watchee.pos) - 1
+    # Intervening forests get in the way a bit.
+    woods = len([pos for pos in positions if gameboard.tv.get(pos.to_tile_tuple()) == gameboard.WOODLAND])
     roll = random.randint(1, 100)
-    return roll > watchee.STEALTH - vision_bonus + range_penalty*distance
+    return roll > watchee.STEALTH - vision_bonus + range_penalty*distance + constants.WOODLAND_CONCEALMENT*woods
 
 # These don't have to add up to 100, but it's easier to think
 # about them if they do.
--- a/gamelib/constants.py	Sat Nov 21 17:55:28 2009 +0000
+++ b/gamelib/constants.py	Sat Nov 21 18:15:01 2009 +0000
@@ -40,6 +40,7 @@
 # Game constants, still to be made configurable
 
 LOGGING_PRICE = 50
+WOODLAND_CONCEALMENT = 10
 
 # Toolbar constants