From def1a4be3ec821b371661424b9d3f3fba4a0f2e0 Mon Sep 17 00:00:00 2001 From: Hemithermos Date: Fri, 30 Jan 2026 18:40:21 +0100 Subject: [PATCH] deal damage now returns the damage amount dealt change repercuted in server.py attack tool --- server.py | 5 +++-- utils/game.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index ce4e26e..d8202a1 100644 --- a/server.py +++ b/server.py @@ -97,10 +97,11 @@ async def perform_attack(src_entity_id:str, target_entity_id:str, attack_type:St attack_type: The type of attack being performed using the class Stat, can be Stat.STRENGTH, Stat.INTELLIGENCE, Stat.DEXTERITY which are 0, 1 and 2 respectively """ logging.info(f"Entity {src_entity_id} is performing an attack on {target_entity_id} using {attack_type}") - game.deal_damage(src=src_entity_id, target=target_entity_id, roll=Dice.roll(20), stat=attack_type, description=f"Entity {src_entity_id} attacks {target_entity_id} with a {attack_type} based attack.") + dmg = game.deal_damage(src=src_entity_id, target=target_entity_id, roll=Dice.roll(20), stat=attack_type, description=f"Entity {src_entity_id} attacks {target_entity_id} with a {attack_type} based attack.") return { "success": True, - "msg": f"Attack performed by {src_entity_id} on {target_entity_id} using {attack_type}" + "msg": f"Attack performed by {src_entity_id} on {target_entity_id} using {attack_type}", + "damage": dmg } @mcp.tool() diff --git a/utils/game.py b/utils/game.py index e76e958..218fbbf 100644 --- a/utils/game.py +++ b/utils/game.py @@ -174,6 +174,7 @@ class Game(Serializable): self.turn_idx += 1 if turn_finished: self.update_turn_order() + return int(dmg_amount) def modifying_stat(self, src:str, value:int, stat:int, description:str): if not self.is_turn_coherent(src):