forked from github/server
dragon evolution gives full hitpoints.
This commit is contained in:
parent
ea1bf3d3b9
commit
f1c27f09e3
1 changed files with 11 additions and 11 deletions
|
@ -27,26 +27,26 @@ static int age_chance(int a, int b, int p) {
|
||||||
return (r < 0) ? 0 : r;
|
return (r < 0) ? 0 : r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DRAGONAGE 27
|
#define DRAGONAGE 27
|
||||||
#define WYRMAGE 68
|
#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)
|
void age_firedragon(unit * u)
|
||||||
{
|
{
|
||||||
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, DRAGONAGE, 1)) {
|
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);
|
evolve_dragon(u, get_race(RC_DRAGON));
|
||||||
u_setrace(u, get_race(RC_DRAGON));
|
|
||||||
u->irace = NULL;
|
|
||||||
scale_number(u, 1);
|
|
||||||
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void age_dragon(unit * u)
|
void age_dragon(unit * u)
|
||||||
{
|
{
|
||||||
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, WYRMAGE, 1)) {
|
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);
|
evolve_dragon(u, get_race(RC_WYRM));
|
||||||
u_setrace(u, get_race(RC_WYRM));
|
|
||||||
u->irace = NULL;
|
|
||||||
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue