changeset 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 16ed1ab1e14b
files TODO pytouhou/game/enemy.py pytouhou/vm/eclrunner.py
diffstat 3 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/TODO
+++ b/TODO
@@ -25,7 +25,6 @@ Engine
 - Patchouli replaces Flandre in the last MSG
 
 ECL
-- fix 77 interval
 - 118 and 102
 - 121
  * 12
--- 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):
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -647,7 +647,7 @@ class ECLRunner(object):
 
     @instruction(77)
     def set_bullet_interval_ex(self, value):
-        self._enemy.set_bullet_launch_interval(value, self._game.prng.rand_double()) #TODO: check
+        self._enemy.set_bullet_launch_interval(value, self._game.prng.rand_uint32())
 
 
     @instruction(78)