changeset 320:1a4ffdda8735

Cancel the bullets when a boss is killed and transfer them to the score.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 23 May 2012 19:33:17 +0200
parents 9a4119e2cc74
children 61adb5453e46
files pytouhou/game/enemy.py pytouhou/game/game.py pytouhou/vm/eclrunner.py
diffstat 3 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/enemy.py
+++ b/pytouhou/game/enemy.py
@@ -350,6 +350,10 @@ class Enemy(object):
             #TODO: verify if the score is added with all the different flags.
             self._game.players[0].state.score += self.die_score #TODO: better distribution amongst the players.
 
+            #TODO: verify if that should really be there.
+            if self.boss:
+                self._game.change_bullets_into_bonus()
+
             if death_flags < 4:
                 if self.bonus_dropped > -1:
                     self.drop_particles(7, 0)
--- a/pytouhou/game/game.py
+++ b/pytouhou/game/game.py
@@ -141,6 +141,19 @@ class Game(object):
         self.bullets = []
 
 
+    def change_bullets_into_bonus(self):
+        player = self.players[0] #TODO
+        score = 0
+        bonus = 2000
+        for bullet in self.bullets:
+            #TODO: display the labels.
+            score += bonus
+            bonus += 10
+        self.bullets = []
+        player.state.score += score
+        #TODO: display the final bonus score.
+
+
     def new_effect(self, pos, anim, anm_wrapper=None):
         self.effects.append(Effect(pos, anim, anm_wrapper or self.etama4))
 
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -745,7 +745,7 @@ class ECLRunner(object):
     def end_spellcard(self):
         #TODO: return everything back to normal
         #TODO: give the spellcard bonus.
-        if self._game.spellcard:
+        if self._game.spellcard is not None:
             self._game.change_bullets_into_star_items()
         self._game.spellcard = None
         self._game.disable_spellcard_effect()