balance initial heath points for players and NPCs

This commit is contained in:
2026-01-31 18:02:11 +01:00
parent 3d601e0f3c
commit e129815248

View File

@@ -306,7 +306,7 @@ async def toss_coin():
@mcp.tool() @mcp.tool()
async def create_player(name: str, strength: int, dexterity: int, intelligence: int, wisdom: int, charisma: int, hp: int, armor: int, speed: int, item_id:str): async def create_player(name: str, strength: int, dexterity: int, intelligence: int, wisdom: int, charisma: int, hp: int, armor: int, speed: int, item_id:str):
"""Create a new player. Need all the stats to function properly. Throw a d20 for every stats you don't have, """Create a new player. Need all the stats to function properly. Throw a d20 for every stats you don't have,
and a d50 for hp, armor and speed. and a d50 for the armor and speed.
Args: Args:
name: Name of the player name: Name of the player
@@ -328,7 +328,7 @@ async def create_player(name: str, strength: int, dexterity: int, intelligence:
intelligence=intelligence, intelligence=intelligence,
wisdom=wisdom, wisdom=wisdom,
charisma=charisma, charisma=charisma,
hp=50 + hp, hp=20 + hp,
armor=50 + armor, armor=50 + armor,
speed= 50 + speed, speed= 50 + speed,
equipped_item=game.get_item(item_id)) # Check if item exists equipped_item=game.get_item(item_id)) # Check if item exists
@@ -349,7 +349,7 @@ async def create_player(name: str, strength: int, dexterity: int, intelligence:
@mcp.tool() @mcp.tool()
async def create_npc(name: str, strength: int, dexterity: int, intelligence: int, wisdom: int, charisma: int, hp: int, armor: int, speed: int, item_id:str): async def create_npc(name: str, strength: int, dexterity: int, intelligence: int, wisdom: int, charisma: int, hp: int, armor: int, speed: int, item_id:str):
"""Create a new NPC. Need all the stats to function properly. Throw a d20 for every stats you don't have, """Create a new NPC. Need all the stats to function properly. Throw a d20 for every stats you don't have,
and a d100 for hp, armor and speed. and a d50 for the armor and speed.
Args: Args:
name: Name of the NPC name: Name of the NPC
@@ -366,7 +366,7 @@ async def create_npc(name: str, strength: int, dexterity: int, intelligence: int
logging.info(f"Creating NPC named {name}") logging.info(f"Creating NPC named {name}")
try: try:
item = game.get_item(item_id) # Check if item exists item = game.get_item(item_id) # Check if item exists
npc_id = game.create_npc(name=name, strength=strength, dexterity=dexterity, intelligence=intelligence, wisdom=wisdom, charisma=charisma, hp=50 + hp, armor=50 + armor, speed=50 + speed, equipped_item=item) npc_id = game.create_npc(name=name, strength=strength, dexterity=dexterity, intelligence=intelligence, wisdom=wisdom, charisma=charisma, hp=20 + hp, armor=50 + armor, speed=50 + speed, equipped_item=item)
game.add_item_to_entity(item_id=item_id, entity_id=npc_id) game.add_item_to_entity(item_id=item_id, entity_id=npc_id)
npc_dict = game.get_npc(npc_id=npc_id).serialize() npc_dict = game.get_npc(npc_id=npc_id).serialize()
logging.info(f"Creation of NPC successful") logging.info(f"Creation of NPC successful")