new volcano damage calculation was broken.

This commit is contained in:
Enno Rehling 2021-03-24 20:55:51 +01:00
parent 335740d12b
commit 19db01af67
1 changed files with 4 additions and 8 deletions

View File

@ -92,6 +92,7 @@ int volcano_damage(unit* u, const char* dice)
} }
for (i = 0; i != u->number; ++i) { for (i = 0; i != u->number; ++i) {
int h = hp + ((i < remain) ? 1 : 0);
int damage = dice_rand(dice) - protect; int damage = dice_rand(dice) - protect;
if (damage > 0) { if (damage > 0) {
if (i == 0 || ac > 0) { if (i == 0 || ac > 0) {
@ -99,32 +100,27 @@ int volcano_damage(unit* u, const char* dice)
damage -= ac; damage -= ac;
} }
if (damage > 0) { if (damage > 0) {
int h = hp + ((i < remain) ? 1 : 0);
if (damage >= h) { if (damage >= h) {
if (rc_cat && u_race(u) == rc_cat && ((rng_int() % 7) == 0)) { if (rc_cat && u_race(u) == rc_cat && ((rng_int() % 7) == 0)) {
/* cats have nine lives */ /* cats have nine lives */
total += h;
continue; continue;
} }
else if (healings > 0) { else if (healings > 0) {
--healings; --healings;
if (resurrect_unit(u)) { if (resurrect_unit(u)) {
/* take no damage at all */ /* take no damage at all */
total += h;
continue; continue;
} }
} }
++dead; ++dead;
damage = h;
} }
else { total += damage;
total += (h - damage);
}
} }
} }
} }
scale_number(u, u->number - dead); scale_number(u, u->number - dead);
u->hp = total; u->hp -= total;
return dead; return dead;
} }