deal damage now returns the damage amount dealt
change repercuted in server.py attack tool
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user