Skip to content

Commit

Permalink
remove spell damage duplication eureka
Browse files Browse the repository at this point in the history
  • Loading branch information
1kuceraj committed Sep 23, 2024
1 parent 8a337c1 commit b7a8bf8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion combat_npc.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def handle_player_turn(user_data: Dict, user: str, enemy: Any, round_data: Dict,
else:
damage_dealt = handle_weapon_attack(user_data, enemy, round_data, max_total_hp)

enemy.hp = max(0, enemy.hp - damage_dealt)

round_data["actions"][-1].update({
"final_player_hp": user_data["hp"],
"final_enemy_hp": enemy.hp,
Expand Down Expand Up @@ -119,7 +121,6 @@ def handle_spell_cast(user_data: Dict, user: str, enemy: Any, spell_cast: Dict,
user_data['hp'] = min(max_total_hp, user_data['hp'] + healing_done)
elif 'damage_dealt' in spell_effect:
damage_dealt = spell_effect['damage_dealt']
enemy.hp = max(0, enemy.hp - damage_dealt)

# Add additional information to the message
message += f" Enemy {enemy.type} HP: {enemy.hp}/{enemy.max_hp}. "
Expand Down

0 comments on commit b7a8bf8

Please sign in to comment.