Merge branch 'master' of ctpug.org.za:koperkapel
[koperkapel.git] / koperkapel / roaches.py
index 0d2448216c16a00900759736ed66e32fe975dbcb..95353ee18a441bdf947bb4cf07586c41e1faa18b 100644 (file)
@@ -8,6 +8,13 @@ from .actors.orientatedsurf import OrientatedSurfActor
 from .serums import roach_serum_color
 
 
+def roach_by_name(world, roach_name):
+    roaches = [r for r in world.roaches if r.name == roach_name]
+    if not roaches:
+        return None
+    return roaches[0]
+
+
 class RoachActor(OrientatedSurfActor):
     def __init__(self, frames):
         self._frames = frames
@@ -26,6 +33,15 @@ class RoachActor(OrientatedSurfActor):
         self.surf = self._frames[self._frame]
 
 
+class WorldRoach(object):
+    """A roach proxy with no properties for display on the game level."""
+
+    def __init__(self):
+        self.smart = False
+        self.strong = False
+        self.fast = False
+
+
 class RoachFactory:
 
     def __init__(self, suffix, frames=4):
@@ -52,3 +68,5 @@ default_roaches = RoachFactory("")
 t32_roaches = RoachFactory("_32")
 t21_roaches = RoachFactory("_21")
 big_roaches = RoachFactory("_big")
+roaches_quartet = RoachFactory("_quartet")
+roaches_nonet = RoachFactory("_nonet")