diff pytouhou/vm/eclrunner.py @ 192:5e84dfd153ab

Use the right “random” item drop function.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 27 Oct 2011 15:17:21 -0700
parents dbe6b7b2d3fc
children 9f58e2a6e950
line wrap: on
line diff
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -132,8 +132,13 @@ class ECLRunner(object):
                     enm.drop_particles(7, 0)
                     self._game.drop_bonus(enm.x, enm.y, enm._bonus_dropped)
                 elif enm._bonus_dropped == -1:
-                    enm.drop_particles(10, 0)
-                    self._game.drop_bonus(enm.x, enm.y, self._game.prng.rand_uint16() % 2) #TODO: find the formula in the binary. Can be big power sometimes.
+                    if self._game.deaths_count % 3:
+                        enm.drop_particles(10, 0)
+                        self._game.drop_bonus(enm.x, enm.y, self._game.bonus_list[self._game.next_bonus])
+                        self._game.next_bonus = (self._game.next_bonus + 1) % 32
+                    else:
+                        enm.drop_particles(4, 0)
+                    self._game.deaths_count += 1
                 else:
                     enm.drop_particles(4, 0)