diff --git a/src/c/weapon.c b/src/c/weapon.c index a2f7add..c3f5cfc 100644 --- a/src/c/weapon.c +++ b/src/c/weapon.c @@ -38,4 +38,9 @@ int getDamageModifier(Weapon *weapon) void setDamageModifier(Weapon *weapon, int modifierSet) { weapon->damageModifier = modifierSet; +} + +int getBaseDamage(Weapon *weapon) +{ + return weapon->baseDamage; } \ No newline at end of file diff --git a/src/c/weapon.h b/src/c/weapon.h index ff6e1de..0e11197 100644 --- a/src/c/weapon.h +++ b/src/c/weapon.h @@ -32,4 +32,6 @@ void setTypeID(Weapon *weapon, int typeToSet); int getDamageModifier(Weapon *weapon); void setDamageModifier(Weapon *weapon, int modifierSet); +int getBaseDamage(Weapon *weapon); + #endif \ No newline at end of file diff --git a/test/c/test_weapon.c b/test/c/test_weapon.c index 56e0cb4..4984557 100644 --- a/test/c/test_weapon.c +++ b/test/c/test_weapon.c @@ -151,4 +151,22 @@ void test_setDamageModifier(void) TEST_ASSERT_EQUAL(damageModifier, result); } +void test_getBaseDamage(void) +{ + // arrange + int baseDamage = 10, result; + Weapon test; + test.baseDamage = baseDamage; + + /* act */ + // Die Funktion wird ausgeführt + result = getBaseDamage(&test); + + // output + printf("getBaseDamage | baseDamage should be: %d -> is: %d", baseDamage, result); + + // assert + TEST_ASSERT_EQUAL(baseDamage, result); +} + #endif // TEST