Mercurial > touhou
comparison pytouhou/game/item.pyx @ 625:3168e5ff22dc
Cast things closer to their usage, in Item.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 08 Apr 2015 20:13:12 +0200 |
parents | a6af3ff86612 |
children |
comparison
equal
deleted
inserted
replaced
624:dd393fa6e988 | 625:3168e5ff22dc |
---|---|
79 self.target = player | 79 self.target = player |
80 self.speed = player.sht.autocollection_speed | 80 self.speed = player.sht.autocollection_speed |
81 | 81 |
82 | 82 |
83 cdef bint on_collect(self, Player player) except True: | 83 cdef bint on_collect(self, Player player) except True: |
84 cdef long level, poc | |
85 | |
86 if not (self.player is None or self.player is player): | 84 if not (self.player is None or self.player is player): |
87 return False | 85 return False |
88 | 86 |
89 old_power = player.power | 87 old_power = player.power |
90 score = 0 | 88 score = 0 |
121 player.power_bonus = bonus | 119 player.power_bonus = bonus |
122 self._game.modify_difficulty(+1) | 120 self._game.modify_difficulty(+1) |
123 | 121 |
124 elif self._type == 1: # point | 122 elif self._type == 1: # point |
125 player.points += 1 | 123 player.points += 1 |
126 poc = player.sht.point_of_collection | 124 poc = <long>player.sht.point_of_collection |
127 if player.y < poc: | 125 if player.y < poc: |
128 score = 100000 | 126 score = 100000 |
129 self._game.modify_difficulty(+30) | 127 self._game.modify_difficulty(+30) |
130 color = 'yellow' | 128 color = 'yellow' |
131 else: | 129 else: |
132 score = (728 - int(self.y)) * 100 #TODO: check the formula some more. | 130 score = (728 - <int>(self.y)) * 100 #TODO: check the formula some more. |
133 self._game.modify_difficulty(+3) | 131 self._game.modify_difficulty(+3) |
134 | 132 |
135 elif self._type == 3: # bomb | 133 elif self._type == 3: # bomb |
136 if player.bombs < 8: | 134 if player.bombs < 8: |
137 player.bombs += 1 | 135 player.bombs += 1 |