changeset 177:6e8653ff2b23

Fix boss mode and don’t suicide the boss when she just want to kill the other enemies.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 23 Oct 2011 01:53:44 -0700
parents 80a4c7ed43b3
children 0bd5e5f19a73
files pytouhou/game/enemy.py pytouhou/vm/eclrunner.py
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/enemy.py
+++ b/pytouhou/game/enemy.py
@@ -41,6 +41,7 @@ class Enemy(object):
         self.touchable = True
         self.damageable = True
         self.death_flags = 0
+        self.boss = False
         self.extended_bullet_attributes = (0, 0, 0, 0, 0., 0., 0., 0.)
         self.bullet_attributes = None
         self.bullet_launch_offset = (0, 0)
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -719,7 +719,7 @@ class ECLRunner(object):
     @instruction(96)
     def kill_enemies(self):
         for enemy in self._game.enemies:
-            if enemy.touchable:
+            if enemy.touchable and not enemy.boss:
                 enemy.life = 0
 
 
@@ -740,9 +740,18 @@ class ECLRunner(object):
 
 
     @instruction(101)
-    def set_boss_mode(self, unknown):
-        #TODO: unknown
-        self._game.boss = self._enemy
+    def set_boss_mode(self, value):
+        #TODO: if there are multiple boss, spawned by a 95,
+        #      only the last one has her life displayed,
+        #      but standard enemies are blocked only until any of them is killed.
+        if value == 0:
+            self._enemy.boss = True
+            self._game.boss = self._enemy
+        elif value == -1:
+            self._enemy.boss = False
+            self._game.boss = None
+        else:
+            raise Exception #TODO
 
 
     @instruction(103)