comparison pytouhou/game/item.py @ 264:3ac8b135592c

Homogenise score increase in item collection, in prevision for text handling.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 15 Jan 2012 19:39:01 +0100
parents 5afc75f71fed
children f3099ebf4f61
comparison
equal deleted inserted replaced
263:ac677dd0ffe0 264:3ac8b135592c
54 54
55 55
56 def on_collect(self, player): 56 def on_collect(self, player):
57 player_state = player.state 57 player_state = player.state
58 old_power = player_state.power 58 old_power = player_state.power
59 score = 0
59 60
60 if self._type == 0 or self._type == 2: # power or big power 61 if self._type == 0 or self._type == 2: # power or big power
61 if old_power < 128: 62 if old_power < 128:
62 player_state.power_bonus = 0 63 player_state.power_bonus = 0
63 score = 10 64 score = 10
75 elif bonus < 30: 76 elif bonus < 30:
76 score = (bonus - 17) * 1000 77 score = (bonus - 17) * 1000
77 elif bonus == 30: 78 elif bonus == 30:
78 score = 51200 79 score = 51200
79 player_state.power_bonus = bonus 80 player_state.power_bonus = bonus
80 player_state.score += score
81 self._game.modify_difficulty(+1) 81 self._game.modify_difficulty(+1)
82 82
83 elif self._type == 1: # point 83 elif self._type == 1: # point
84 player_state.points += 1 84 player_state.points += 1
85 poc = player.sht.point_of_collection 85 poc = player.sht.point_of_collection
86 if player_state.y < poc: 86 if player_state.y < poc:
87 score = 100000 87 score = 100000
88 self._game.modify_difficulty(+30) 88 self._game.modify_difficulty(+30)
89 else: 89 else:
90 score = 0 #TODO: find the formula. 90 #score = #TODO: find the formula.
91 self._game.modify_difficulty(+3) 91 self._game.modify_difficulty(+3)
92 player_state.score += score
93 92
94 elif self._type == 3: # bomb 93 elif self._type == 3: # bomb
95 if player_state.bombs < 8: 94 if player_state.bombs < 8:
96 player_state.bombs += 1 95 player_state.bombs += 1
97 self._game.modify_difficulty(+5) 96 self._game.modify_difficulty(+5)
98 97
99 elif self._type == 4: # full power 98 elif self._type == 4: # full power
100 player_state.score += 1000 99 score = 1000
101 player_state.power = 128 100 player_state.power = 128
102 101
103 elif self._type == 5: # 1up 102 elif self._type == 5: # 1up
104 if player_state.lives < 8: 103 if player_state.lives < 8:
105 player_state.lives += 1 104 player_state.lives += 1
106 self._game.modify_difficulty(+200) 105 self._game.modify_difficulty(+200)
107 106
108 elif self._type == 6: # star 107 elif self._type == 6: # star
109 player_state.score += 500 108 score = 500
110 109
111 if old_power < 128 and player_state.power >= 128: 110 if old_power < 128 and player_state.power == 128:
112 #TODO: display “full power”. 111 #TODO: display “full power”.
113 self._game.change_bullets_into_star_items() 112 self._game.change_bullets_into_star_items()
113
114 if score > 0:
115 #TODO: display the score.
116 player_state.score += score
114 117
115 self._removed = True 118 self._removed = True
116 119
117 120
118 def update(self): 121 def update(self):