dragon evolution gives full hitpoints.

This commit is contained in:
Enno Rehling 2019-03-24 17:24:16 +01:00
parent ea1bf3d3b9
commit f1c27f09e3
1 changed files with 11 additions and 11 deletions

View File

@ -27,26 +27,26 @@ static int age_chance(int a, int b, int p) {
return (r < 0) ? 0 : r;
}
#define DRAGONAGE 27
#define WYRMAGE 68
#define DRAGONAGE 27
#define WYRMAGE 68
static void evolve_dragon(unit * u, const struct race *rc) {
scale_number(u, 1);
u_setrace(u, rc);
u->irace = NULL;
u->hp = unit_max_hp(u);
}
void age_firedragon(unit * u)
{
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, DRAGONAGE, 1)) {
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
u_setrace(u, get_race(RC_DRAGON));
u->irace = NULL;
scale_number(u, 1);
u->hp = (int)(unit_max_hp(u) * u->number * q);
evolve_dragon(u, get_race(RC_DRAGON));
}
}
void age_dragon(unit * u)
{
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, WYRMAGE, 1)) {
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
u_setrace(u, get_race(RC_WYRM));
u->irace = NULL;
u->hp = (int)(unit_max_hp(u) * u->number * q);
evolve_dragon(u, get_race(RC_WYRM));
}
}