comparison pytouhou/vm/eclrunner.py @ 244:2b7f69ad9ccd

Drop the correct amount of power with 119.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 31 Dec 2011 02:25:06 +0100
parents 1d3c8c7473a2
children 2ef8f4e181e3
comparison
equal deleted inserted replaced
243:3893a6fc66f1 244:2b7f69ad9ccd
861 self._enemy.touchable = bool(value) 861 self._enemy.touchable = bool(value)
862 862
863 863
864 @instruction(119) 864 @instruction(119)
865 def drop_some_bonus(self, number): 865 def drop_some_bonus(self, number):
866 bonus = 0 if self._enemy.select_player().state.power < 128 else 1 866 if self._enemy.select_player().state.power < 128:
867 for i in range(number): 867 if number > 0:
868 #TODO: find the formula in the binary. 868 #TODO: find the real formula in the binary.
869 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_uint16() % 128, 869 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_uint16() % 128,
870 self._enemy.y - 64 + self._game.prng.rand_uint16() % 128, 870 self._enemy.y - 64 + self._game.prng.rand_uint16() % 128,
871 bonus) 871 2)
872 for i in xrange(number - 1):
873 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_uint16() % 128,
874 self._enemy.y - 64 + self._game.prng.rand_uint16() % 128,
875 0)
876 else:
877 for i in xrange(number):
878 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_uint16() % 128,
879 self._enemy.y - 64 + self._game.prng.rand_uint16() % 128,
880 1)
872 881
873 882
874 @instruction(120) 883 @instruction(120)
875 def set_automatic_orientation(self, flags): 884 def set_automatic_orientation(self, flags):
876 #TODO: does it change anything else than the sprite's rotation? 885 #TODO: does it change anything else than the sprite's rotation?