Browse Source

prod/test: creatd function spellLighning

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

10
src/c/spell.c

@ -24,3 +24,13 @@ SpellEffect spellHeal(Character *character) {
heal.effectDuration = 0; heal.effectDuration = 0;
return heal; return heal;
} }
SpellEffect spellLightning(Character *character) {
SpellEffect lightning;
lightning.damage = 10 + (getCharacterIntelligence(character) / 2);
lightning.healing = 0;
lightning.manaCost = 10;
lightning.effect = SPELL_EFFECT_STUN;
lightning.effectDuration = 1;
return lightning;
}

2
src/c/spell.h

@ -14,7 +14,7 @@ enum {
SpellEffect spellFireball(Character *character); SpellEffect spellFireball(Character *character);
SpellEffect spellHeal(Character *character); SpellEffect spellHeal(Character *character);
SpellEffect spellLightning(Character *character);
#endif #endif

8
test/c/test_spell.c

@ -47,5 +47,11 @@ void test_spellHeal(void)
TEST_ASSERT_EQUAL_INT(12,result); TEST_ASSERT_EQUAL_INT(12,result);
} }
void test_spellLightning(void)
{
int result = spellLightning(&testCharacter).damage;
TEST_ASSERT_EQUAL_INT(10,result);
result = spellLightning(&testCharacter2).damage;
TEST_ASSERT_EQUAL_INT(13,result);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save