Return to repo list

heart-of-gold

Tactical RPG written in python, using pygame.
Return to HMagellan.com

commit dacb40e5fd621534994080abd131dfddd1a0437d
parent 3ce61d56227ef240f824cd6142c872e75ceffc49
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Tue, 24 Nov 2020 12:40:20 -0600

Added specific modulator for hp damage

Diffstat:
Msrc/piece.py | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/piece.py b/src/piece.py @@ -255,7 +255,7 @@ class PieceManager(manager.Manager): self.pieces.update(surface) self.tile_cursor.update(surface) self.center_plumb_bob() - if self.game.control_mode == CTRL_MODES.Turn_Normal: + if self.game.control_mode in (CTRL_MODES.Turn_Normal, CTRL_MODES.Turn_Select_Move, CTRL_MODES.Turn_Select_Attack): self.plumb_bob.update(surface) ############################### @@ -305,6 +305,7 @@ class Piece(entity.Entity): self.effect_mod = { i : 0 for i in self.normal_stats } # this mod can only be applied in battle, defaults empty always self.dist_mod = { i : stat_dist[i] if i in stat_dist else 0 for i in self.normal_stats } self.other_mod = { i : stat_mod[i] if i in stat_mod else 0 for i in self.normal_stats } + self.hp_damage_mod = 0 self.team = team self.equipment = { "weapon" : None, @@ -413,6 +414,7 @@ class Piece(entity.Entity): if self.level % int(g) == 0: for s in self.growth[g]: self.normal_stats[s] += self.growth[g][s] + self.normal_stats["HP"] += self.normal_stats["DEF"] // 3 def render_damage_number(self): """ @@ -608,7 +610,7 @@ class Piece(entity.Entity): self.set_animation(self.manager.bus.fetch("sheet_manager", "animations")[self.sheet.name]["hurt_" + self.facing.name], True) elif self.damage_timer == 30: # TODO: This is possibly not the best way - self.effect_mod["HP"] -= self.damage_to_receive + self.hp_damage_mod -= self.damage_to_receive self.modulate_stats() if self.active_stats["HP"] > 0: self.create_health_bar() @@ -643,7 +645,10 @@ class Piece(entity.Entity): self.equip_mod[n] += ITEMBASE[self.equipment[e]]["stats"][n] for s in self.normal_stats: - self.active_stats[s] = self.normal_stats[s] + self.equip_mod[s] + self.other_mod[s] + self.dist_mod[s] + self.effect_mod[s] + if s != "HP": + self.active_stats[s] = self.normal_stats[s] + self.equip_mod[s] + self.other_mod[s] + self.dist_mod[s] + self.effect_mod[s] + else: + self.active_stats[s] = self.normal_stats[s] + self.hp_damage_mod def act(self): """