Merge branch 'develop' into stm2-confusion_and_panic

This commit is contained in:
Enno Rehling 2021-03-24 21:07:16 +01:00
commit 44765edede
2 changed files with 4 additions and 1 deletions

View File

@ -119,8 +119,9 @@ int volcano_damage(unit* u, const char* dice)
} }
} }
} }
total = u->hp - total;
scale_number(u, u->number - dead); scale_number(u, u->number - dead);
u->hp -= total; u->hp = total;
return dead; return dead;
} }

View File

@ -47,6 +47,8 @@ static void test_volcano_damage(CuTest* tc) {
u = test_create_unit(test_create_faction(), test_create_plain(0, 0)); u = test_create_unit(test_create_faction(), test_create_plain(0, 0));
scale_number(u, 100); scale_number(u, 100);
u->hp = u->number * 20; u->hp = u->number * 20;
CuAssertIntEquals(tc, 0, volcano_damage(u, "0"));
CuAssertIntEquals(tc, u->number * 20, u->hp);
CuAssertIntEquals(tc, 0, volcano_damage(u, "10")); CuAssertIntEquals(tc, 0, volcano_damage(u, "10"));
CuAssertIntEquals(tc, u->number * 10, u->hp); CuAssertIntEquals(tc, u->number * 10, u->hp);
CuAssertIntEquals(tc, 0, volcano_damage(u, "d9")); CuAssertIntEquals(tc, 0, volcano_damage(u, "d9"));