changeset 290:664bba9be40a

Fences are eclectic.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 05 Sep 2009 16:07:48 +0000
parents 37d88a9fc097
children 3e994b3f750d
files gamelib/animal.py gamelib/gameboard.py
diffstat 2 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/animal.py	Sat Sep 05 16:05:41 2009 +0000
+++ b/gamelib/animal.py	Sat Sep 05 16:07:48 2009 +0000
@@ -423,8 +423,7 @@
 
     def _make_hole(self, gameboard):
         """Make a hole in the fence"""
-        gameboard.tv.set(self.dig_pos.to_tuple(),
-                tiles.REVERSE_TILE_MAP['broken fence'])
+        gameboard.tv.set(self.dig_pos.to_tuple(), gameboard.BROKEN_FENCE)
         self.dig_pos = None
 
     def move(self, gameboard):
@@ -491,6 +490,26 @@
             self.hunting = False
         self.last_steps = []
 
+class Rinkhals(Fox):
+    """The Rinkhals has eclectic tastes"""
+    STEALTH = 80
+    IMAGE_FILE = 'sprites/rinkhals.png'
+
+    def _catch_chicken(self, chicken, gameboard):
+        """The Rinkhals hunts for sport, catch and release style"""
+        self.closest = None
+        self.hunting = False
+        self.last_steps = []
+
+    def _make_hole(self, gameboard):
+        """The Rinkhals eats fences"""
+        gameboard.tv.set(self.dig_pos.to_tuple(), gameboard.GRASSLAND)
+        self.dig_pos = None
+
+    def damage(self, gameboard):
+        """The Rinkhals is invincible!"""
+        return True
+
 def _get_vision_param(parameter, watcher):
     param = getattr(watcher, parameter)
     if watcher.abode:
--- a/gamelib/gameboard.py	Sat Sep 05 16:05:41 2009 +0000
+++ b/gamelib/gameboard.py	Sat Sep 05 16:07:48 2009 +0000
@@ -287,11 +287,14 @@
     WOODLAND = tiles.REVERSE_TILE_MAP['woodland']
     BROKEN_FENCE = tiles.REVERSE_TILE_MAP['broken fence']
 
+    # These don't have to add up to 100, but it's easier to think
+    # about them if they do.
     FOX_WEIGHTINGS = (
-        (animal.Fox, 60),
+        (animal.Fox, 59),
         (animal.GreedyFox, 30),
         (animal.NinjaFox, 5),
         (animal.DemoFox, 5),
+        (animal.Rinkhals, 1),
         )
 
     def __init__(self, main_app):