From 8f0b7bf08810c13005ea74253da8a1de56ae71d4 Mon Sep 17 00:00:00 2001 From: Kai Kehres Date: Sun, 29 Jan 2023 13:05:09 +0100 Subject: [PATCH] prod/test: creatd function spellLighning --- src/c/spell.c | 10 ++++++++++ src/c/spell.h | 2 +- test/c/test_spell.c | 8 +++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/c/spell.c b/src/c/spell.c index 4fca537..e14482b 100644 --- a/src/c/spell.c +++ b/src/c/spell.c @@ -24,3 +24,13 @@ SpellEffect spellHeal(Character *character) { heal.effectDuration = 0; 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; +} diff --git a/src/c/spell.h b/src/c/spell.h index b5d65f0..cd3b1c9 100644 --- a/src/c/spell.h +++ b/src/c/spell.h @@ -14,7 +14,7 @@ enum { SpellEffect spellFireball(Character *character); SpellEffect spellHeal(Character *character); - +SpellEffect spellLightning(Character *character); #endif \ No newline at end of file diff --git a/test/c/test_spell.c b/test/c/test_spell.c index dce3114..58dc18e 100644 --- a/test/c/test_spell.c +++ b/test/c/test_spell.c @@ -47,5 +47,11 @@ void test_spellHeal(void) 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 \ No newline at end of file