diff pytouhou/game/enemy.py @ 329:1bb78c469f64

Fix difficulty influence on bullet launch interval, and fix instruction 77's rand usage
author Thibaut Girka <thib@sitedethib.com>
date Sun, 24 Jun 2012 17:00:07 +0200
parents 56523a16db1d
children 2350147cf043
line wrap: on
line diff
--- a/pytouhou/game/enemy.py
+++ b/pytouhou/game/enemy.py
@@ -109,12 +109,13 @@ class Enemy(object):
             self.fire()
 
 
-    def set_bullet_launch_interval(self, value, start=0.):
+    def set_bullet_launch_interval(self, value, start=0):
         # Apply difficulty-specific modifiers:
-        value *= 1. - .4 * (self._game.difficulty - 16.) / 32.
+        #TODO: check every value possible! Look around 102h.exe@0x408720
+        value -= value * (self._game.difficulty - 16) // 80
 
-        self.bullet_launch_interval = int(value)
-        self.bullet_launch_timer = int(value * start)
+        self.bullet_launch_interval = value
+        self.bullet_launch_timer = start % value if value else 0
 
 
     def fire(self, offset=None, bullet_attributes=None, launch_pos=None):