Equipped armor now reduces effectiveness of enemy attack.
Justin Armstrong justinmeister@gmail.com
Fri, 23 May 2014 00:06:45 -0700
3 files changed,
8 insertions(+),
4 deletions(-)
M
data/components/person.py
→
data/components/person.py
@@ -377,11 +377,14 @@ """
for observer in self.observers: observer.on_notify(event) - def calculate_hit(self): + def calculate_hit(self, armor_list, inventory): """ Calculate hit strength based on attack stats. """ - max_strength = self.level * 5 + armor_power = 0 + for armor in armor_list: + armor_power += inventory[armor]['power'] + max_strength = max(1, (self.level * 5) - armor_power) min_strength = 0 return random.randint(min_strength, max_strength)
M
data/states/battle.py
→
data/states/battle.py
@@ -526,7 +526,8 @@ self.state = self.info_box.state = c.PLAYER_DAMAGED
if self.enemy_index > len(self.enemy_list) - 1: self.enemy_index = 0 enemy = self.enemy_list[self.enemy_index] - player_damage = enemy.calculate_hit() + player_damage = enemy.calculate_hit(self.inventory['equipped armor'], + self.inventory) self.damage_points.add( attackitems.HealthPoints(player_damage, self.player.rect.topright))
M
data/tools.py
→
data/tools.py
@@ -181,7 +181,7 @@ 'Cure': dict([('magic points', 25),
('power', 50)]), 'Rapier': dict([('quantity', 1), ('value', 50), - ('power', 10)]), + ('power', 5)]), 'equipped weapon': 'Rapier', 'equipped armor': []}