diff --git a/src/c/spell.c b/src/c/spell.c index e14482b..1266eec 100644 --- a/src/c/spell.c +++ b/src/c/spell.c @@ -34,3 +34,13 @@ SpellEffect spellLightning(Character *character) { lightning.effectDuration = 1; return lightning; } + +SpellEffect spellRegeneration (Character *character) { + SpellEffect regeneration; + regeneration.damage = 0; + regeneration.healing = 5 + (getCharacterIntelligence(character) / 4); + regeneration.manaCost = 10; + regeneration.effect = SPELL_EFFECT_REGENERATION; + regeneration.effectDuration = 2; + return regeneration; +} \ No newline at end of file diff --git a/src/c/spell.h b/src/c/spell.h index cd3b1c9..0c31a09 100644 --- a/src/c/spell.h +++ b/src/c/spell.h @@ -15,6 +15,7 @@ enum { SpellEffect spellFireball(Character *character); SpellEffect spellHeal(Character *character); SpellEffect spellLightning(Character *character); +SpellEffect spellRegeneration (Character *character); #endif \ No newline at end of file diff --git a/test/c/test_spell.c b/test/c/test_spell.c index 58dc18e..00651aa 100644 --- a/test/c/test_spell.c +++ b/test/c/test_spell.c @@ -54,4 +54,12 @@ void test_spellLightning(void) result = spellLightning(&testCharacter2).damage; TEST_ASSERT_EQUAL_INT(13,result); } + +void test_spellRegeneration(void) +{ + int result = spellRegeneration(&testCharacter).healing; + TEST_ASSERT_EQUAL_INT(5,result); + result = spellRegeneration(&testCharacter2).healing; + TEST_ASSERT_EQUAL_INT(6,result); +} #endif // TEST \ No newline at end of file