From d29bf051404a416d51fa625e5b09d78a42cb030d Mon Sep 17 00:00:00 2001 From: Sakan Nirattisaykul <94357278+sakan811@users.noreply.github.com> Date: Sat, 18 Jan 2025 22:57:56 +0700 Subject: [PATCH 1/2] Refactor TheHerta damage calculation methods to clarify multiplier returns - Updated the _calculate_interpretation_multiplier method to return only the additional damage multiplier instead of the total. - Adjusted damage calculation calls in take_action and other methods to pass both primary and ice damage multipliers correctly. - Enhanced comments for clarity on the purpose of multipliers in damage calculations, improving code readability and maintainability. --- hsr_simulation/erudition/the_herta.py | 28 ++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/hsr_simulation/erudition/the_herta.py b/hsr_simulation/erudition/the_herta.py index c6c748c..c94bd3b 100644 --- a/hsr_simulation/erudition/the_herta.py +++ b/hsr_simulation/erudition/the_herta.py @@ -158,9 +158,10 @@ def _get_priority_target(self) -> int: def _calculate_interpretation_multiplier(self, enemy_id: int, is_primary_target: bool = False) -> float: """ Calculate damage multiplier from interpretation stacks. + Returns the additional multiplier (without base 1.0). :param enemy_id: ID of the enemy :param is_primary_target: Whether this is the primary target - :return: Damage multiplier + :return: Additional damage multiplier from interpretation """ stacks = self.enemy_interpretation_stacks.get(enemy_id, 0) @@ -171,12 +172,12 @@ def _calculate_interpretation_multiplier(self, enemy_id: int, is_primary_target: base_boost = self.INTERPRETATION_DMG_BOOST_OTHERS path_bonus = self.ERUDITION_PATH_BONUS_OTHERS - # Calculate total boost per stack + # Calculate total boost per stack (returns only the additional multiplier) boost_per_stack = base_boost if self.erudition_chars_in_team >= 2: boost_per_stack += path_bonus - return 1 + (boost_per_stack * stacks) + return boost_per_stack * stacks def take_action(self) -> None: """ @@ -292,16 +293,17 @@ def _use_enhanced_skill(self) -> None: # Check for Ice DMG boost before damage calculation self._check_and_apply_ice_dmg_boost(primary_target) - dmg_multipliers = [self.A2_ICE_DMG_BOOST] if self.ice_dmg_boost_active else [] + # Ice DMG boost is additional multiplier + ice_boost = self.A2_ICE_DMG_BOOST if self.ice_dmg_boost_active else 0 # First two hits (80% ATK) for _ in range(2): # Primary target primary_multiplier = self._calculate_interpretation_multiplier(primary_target, True) total_dmg += self._calculate_damage( - skill_multiplier=self.ENHANCED_SKILL_MULTIPLIER * primary_multiplier, + skill_multiplier=self.ENHANCED_SKILL_MULTIPLIER, break_amount=self.ENHANCED_SKILL_BREAK_AMOUNT, - dmg_multipliers=dmg_multipliers + dmg_multipliers=[primary_multiplier, ice_boost] # Pass both additional multipliers ) self._apply_interpretation_on_hit(primary_target) hit_enemies.add(primary_target) @@ -313,9 +315,9 @@ def _use_enhanced_skill(self) -> None: if adjacent_target != primary_target: other_multiplier = self._calculate_interpretation_multiplier(adjacent_target, False) total_dmg += self._calculate_damage( - skill_multiplier=self.ENHANCED_SKILL_MULTIPLIER * other_multiplier, + skill_multiplier=self.ENHANCED_SKILL_MULTIPLIER, break_amount=self.ENHANCED_SKILL_ADJACENT_BREAK, - dmg_multipliers=dmg_multipliers + dmg_multipliers=[other_multiplier, ice_boost] # Pass both additional multipliers ) self._apply_interpretation_on_hit(adjacent_target) hit_enemies.add(adjacent_target) @@ -324,9 +326,9 @@ def _use_enhanced_skill(self) -> None: for enemy_id in range(self.enemy_on_field): other_multiplier = self._calculate_interpretation_multiplier(enemy_id, False) total_dmg += self._calculate_damage( - skill_multiplier=self.ENHANCED_SKILL_AOE_MULTIPLIER * other_multiplier, + skill_multiplier=self.ENHANCED_SKILL_AOE_MULTIPLIER, break_amount=0, - dmg_multipliers=dmg_multipliers + dmg_multipliers=[other_multiplier, ice_boost] # Pass both additional multipliers ) self._apply_interpretation_on_hit(enemy_id) hit_enemies.add(enemy_id) @@ -362,8 +364,8 @@ def _use_ult(self) -> None: # Apply ATK boost (80% for 3 turns) self._apply_atk_boost() - # Calculate A6 damage boost from Answer stacks - dmg_multipliers = [self.answer_stacks * self.ANSWER_DMG_BOOST_PER_STACK] + # Calculate A6 damage boost from Answer stacks (returns only the additional multiplier) + answer_multiplier = self.answer_stacks * self.ANSWER_DMG_BOOST_PER_STACK main_logger.debug(f"A6: Ultimate boosted by {self.answer_stacks}% from Answer stacks") # Deal AoE damage to all enemies (200% ATK) @@ -372,7 +374,7 @@ def _use_ult(self) -> None: total_dmg += self._calculate_damage( skill_multiplier=self.ULT_MULTIPLIER, break_amount=self.ULT_BREAK_AMOUNT, - dmg_multipliers=dmg_multipliers + dmg_multipliers=[answer_multiplier] # Only pass the additional multiplier ) # Record damage From e773cd3d7241eaa8418b34288ba186c2c7dd8311 Mon Sep 17 00:00:00 2001 From: Sakan Nirattisaykul <94357278+sakan811@users.noreply.github.com> Date: Sat, 18 Jan 2025 23:18:56 +0700 Subject: [PATCH 2/2] Update VISUALS.md with corrected Facebook and Instagram links --- docs/VISUALS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/VISUALS.md b/docs/VISUALS.md index d60b00f..16a87b4 100644 --- a/docs/VISUALS.md +++ b/docs/VISUALS.md @@ -28,9 +28,9 @@ [Power BI](https://app.powerbi.com/view?r=eyJrIjoiOWE4MTY1Y2MtODc4NC00Mzk3LTk0ZTgtY2EwYThiMTZhYTVmIiwidCI6ImZlMzViMTA3LTdjMmYtNGNjMy1hZDYzLTA2NTY0MzcyMDg3OCIsImMiOjEwfQ%3D%3D) -[Facebook](https://www.facebook.com/share/p/195BdsJZoX/) +[Facebook](https://www.facebook.com/share/p/18rCoZjz5H/) -[Instagram](https://www.instagram.com/p/DE-PQKBPOz-/?utm_source=ig_web_copy_link&igsh=MzRlODBiNWFlZA==) +[Instagram](https://www.instagram.com/p/DE-S0lcPqFb/?utm_source=ig_web_copy_link&igsh=MzRlODBiNWFlZA==) ## Harmony Characters