# HG changeset patch # User Thibaut Girka # Date 1341703427 -7200 # Node ID 488c094ed51d721c971d200259b69858c29efd8b # Parent 26f78fc7aceafdc32ef143c750fec3f64182bbbc Make bosses clean their mess when timeouting diff --git a/pytouhou/game/enemy.py b/pytouhou/game/enemy.py --- a/pytouhou/game/enemy.py +++ b/pytouhou/game/enemy.py @@ -420,6 +420,8 @@ class Enemy(object): self.timeout_callback = -1 elif self.timeout != -1 and self.frame == self.timeout: self.timeout = -1 + self._game.kill_enemies() + self._game.cancel_bullets() if self.low_life_trigger > 0: self.life = self.low_life_trigger diff --git a/pytouhou/game/game.py b/pytouhou/game/game.py --- a/pytouhou/game/game.py +++ b/pytouhou/game/game.py @@ -175,6 +175,18 @@ class Game(object): #TODO: display the final bonus score. + def kill_enemies(self): + for enemy in self.enemies: + if enemy.boss: + pass # Bosses are immune to 96 + elif enemy.touchable: + enemy.life = 0 + elif enemy.death_callback > 0: + #TODO: check + enemy.process.switch_to_sub(enemy.death_callback) + enemy.death_callback = -1 + + def new_effect(self, pos, anim, anm_wrapper=None): self.effects.append(Effect(pos, anim, anm_wrapper or self.etama4)) diff --git a/pytouhou/vm/eclrunner.py b/pytouhou/vm/eclrunner.py --- a/pytouhou/vm/eclrunner.py +++ b/pytouhou/vm/eclrunner.py @@ -761,15 +761,7 @@ class ECLRunner(object): @instruction(96) def kill_enemies(self): - for enemy in self._game.enemies: - if enemy.boss: - pass # Bosses are immune to 96 - elif enemy.touchable: - enemy.life = 0 - elif enemy.death_callback > 0: - #TODO: check - enemy.process.switch_to_sub(enemy.death_callback) - enemy.death_callback = -1 + self.game.kill_enemies() @instruction(97)