comparison eosd @ 499:5426825c11a6

Fix boss mode
author Thibaut Girka <thib@sitedethib.com>
date Fri, 08 Nov 2013 13:24:37 +0100
parents 6be9c99a3a24
children 777544d11578
comparison
equal deleted inserted replaced
498:c9c2fb873dbd 499:5426825c11a6
71 if args.game == 'EoSD': 71 if args.game == 'EoSD':
72 from pytouhou.games.eosd import EoSDCommon as Common, EoSDGame as Game 72 from pytouhou.games.eosd import EoSDCommon as Common, EoSDGame as Game
73 73
74 74
75 class GameBossRush(Game): 75 class GameBossRush(Game):
76 def run_iter(self, keystate): 76 def run_iter(self, keystates):
77 for i in range(20): 77 for i in range(20):
78 skip = not (self.enemies or self.items or self.lasers 78 skip = not (self.enemies or self.items or self.lasers
79 or self.bullets or self.cancelled_bullets) 79 or self.bullets or self.cancelled_bullets)
80 if skip: 80 if skip:
81 keystate &= ~1 81 keystates = [k & ~1 for k in keystates]
82 Game.run_iter(self, keystate | 256 if i == 0 else 0) 82 Game.run_iter(self, [0 if i else k | 256 for k in keystates])
83 if not self.enemies and self.frame % 90 == 0: 83 if not self.enemies and self.frame % 90 == 0:
84 for player in self.players: 84 for player in self.players:
85 if player.power < 128: 85 if player.power < 128:
86 player.power += 1 86 player.power += 1
87 if not skip: 87 if not skip:
89 89
90 def cleanup(self): 90 def cleanup(self):
91 boss_wait = any(ecl_runner.boss_wait for ecl_runner in self.ecl_runners) 91 boss_wait = any(ecl_runner.boss_wait for ecl_runner in self.ecl_runners)
92 if not (self.boss or self.msg_wait or boss_wait): 92 if not (self.boss or self.msg_wait or boss_wait):
93 self.enemies = [enemy for enemy in self.enemies 93 self.enemies = [enemy for enemy in self.enemies
94 if enemy.boss_callback != -1 or enemy.frame > 1] 94 if enemy.boss_callback or enemy.frame > 1]
95 self.lasers = [laser for laser in self.lasers if laser.frame > 1] 95 self.lasers = [laser for laser in self.lasers if laser.frame > 1]
96 self.effects = [effect for effect in self.effects 96 self.effects = [effect for effect in self.effects
97 if not hasattr(effect, '_laser') 97 if not hasattr(effect, '_laser')
98 or effect._laser in self.lasers] 98 or effect._laser in self.lasers]
99 self.bullets = [bullet for bullet in self.bullets if bullet.frame > 1] 99 self.bullets = [bullet for bullet in self.bullets if bullet.frame > 1]