Browse Source

prod: created spellRegeneration

remotes/origin/nextcycle
Kai Kehres 2 years ago
parent
commit
cf7d5d026d
  1. 10
      src/c/spell.c
  2. 1
      src/c/spell.h
  3. 8
      test/c/test_spell.c

10
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;
}

1
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

8
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
Loading…
Cancel
Save