diff --git a/src/c/spell.c b/src/c/spell.c index b8ce864..4fca537 100644 --- a/src/c/spell.c +++ b/src/c/spell.c @@ -3,14 +3,24 @@ #include #include "character.h" +#include "spell.h" -int spellFireball(Character *character) { - int damage = 10 + (getCharacterIntelligence(character) / 2); - return damage; +SpellEffect spellFireball(Character *character) { + SpellEffect fireball; + fireball.damage = 10 + (getCharacterIntelligence(character) / 2); + fireball.healing = 0; + fireball.manaCost = 10; + fireball.effect = SPELL_EFFECT_NONE; + fireball.effectDuration = 0; + return fireball; } - -int spellHeal(Character *character) { - int heal = 10 + (getCharacterIntelligence(character) / 3); +SpellEffect spellHeal(Character *character) { + SpellEffect heal; + heal.damage = 0; + heal.healing = 10 + (getCharacterIntelligence(character) / 3); + heal.manaCost = 10; + heal.effect = SPELL_EFFECT_NONE; + heal.effectDuration = 0; return heal; -} \ No newline at end of file +} diff --git a/src/c/spell.h b/src/c/spell.h index fec8dd8..6b94b8e 100644 --- a/src/c/spell.h +++ b/src/c/spell.h @@ -3,7 +3,16 @@ #include "character.h" -int spellFireball(Character *character); -int spellHeal(Character *character); +typedef struct { + int damage, healing, manaCost, effect, effectDuration; +} SpellEffect; + +enum { + SPELL_EFFECT_NONE = 0, SPELL_EFFECT_BURN = 1, SPELL_EFFECT_FREEZE = 2, SPELL_EFFECT_STUN =3 , SPELL_EFFECT_REGENERATION = 4 +}; + + +SpellEffect spellFireball(Character *character); +SpellEffect spellHeal(Character *character); #endif \ No newline at end of file diff --git a/test/c/test_spell.c b/test/c/test_spell.c index 86e55ee..dce3114 100644 --- a/test/c/test_spell.c +++ b/test/c/test_spell.c @@ -32,13 +32,20 @@ void tearDown(void) void test_spellFireball(void) { - TEST_ASSERT_EQUAL_INT(10,spellFireball(&testCharacter)); - TEST_ASSERT_EQUAL_INT(13,spellFireball(&testCharacter2)); + int result = spellFireball(&testCharacter).damage; + TEST_ASSERT_EQUAL_INT(10,result); + result = spellFireball(&testCharacter2).damage; + TEST_ASSERT_EQUAL_INT(13,result); } void test_spellHeal(void) { - TEST_ASSERT_EQUAL_INT(10,spellHeal(&testCharacter)); - TEST_ASSERT_EQUAL_INT(12,spellHeal(&testCharacter2)); + + int result = spellHeal(&testCharacter).healing; + TEST_ASSERT_EQUAL_INT(10,result); + result = spellHeal(&testCharacter2).healing; + TEST_ASSERT_EQUAL_INT(12,result); } + + #endif // TEST \ No newline at end of file