From cb948599c8037329aca3c82cb09a1935dc7a085d Mon Sep 17 00:00:00 2001 From: Kai Kehres Date: Sat, 28 Jan 2023 18:34:47 +0100 Subject: [PATCH] prod: new function initializeCharacter --- src/c/character.c | 17 +++++++++++++++++ src/c/character.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/c/character.c b/src/c/character.c index fe3a73e..b49a45b 100644 --- a/src/c/character.c +++ b/src/c/character.c @@ -180,4 +180,21 @@ void setCharacterStatPoints (Character* character, int newStatPoints) { int getCharacterStatPoints (Character* character) { return character->statPoints; +} + +void initializeCharacter (Character *character,int weaponClass) { + setCharacterHealthPoints(character,100); + setCharacterStrength(character,10); + setCharacterDexterity(character,10); + setCharacterIntelligence(character,10); + setCharacterLevel(character,1); + setCharacterExp(character,0); + setCharacterMaxExp(character,100); + setCharacterMaxHealthPoints(character,100); + setCharacterAttack(character,10); + setCharacterArmor(character,0); + setCharacterGold(character,0); + setCharacterName(character,"Player"); + setCharacterWeaponClass(character,weaponClass); + setCharacterStatPoints(character,0); } \ No newline at end of file diff --git a/src/c/character.h b/src/c/character.h index c7b8056..99d354e 100644 --- a/src/c/character.h +++ b/src/c/character.h @@ -89,4 +89,6 @@ int calculateDamage (Character *character,Weapon *weapon); void setCharacterStatPoints (Character *character, int newStatPoints); int getCharacterStatPoints (Character *character); + +void initializeCharacter (Character *character,int weaponClass); #endif \ No newline at end of file