2010-08-08 09:40:42 +02:00
|
|
|
/* vi: set ts=2:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Eressea PB(E)M host Copyright (C) 1998-2003
|
|
|
|
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
|
|
|
* Katja Zedel (katze@felidae.kn-bremen.de)
|
|
|
|
* Henning Peters (faroul@beyond.kn-bremen.de)
|
|
|
|
* Enno Rehling (enno@eressea.de)
|
|
|
|
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
|
|
|
*
|
|
|
|
* This program may not be used, modified or distributed without
|
|
|
|
* prior permission by the authors of Eressea.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <platform.h>
|
|
|
|
#include <kernel/config.h>
|
|
|
|
|
|
|
|
/* kernel includes */
|
2014-06-30 03:10:02 +02:00
|
|
|
#include <kernel/race.h>
|
2010-08-08 09:40:42 +02:00
|
|
|
#include <kernel/region.h>
|
|
|
|
#include <kernel/unit.h>
|
|
|
|
|
|
|
|
/* util includes */
|
|
|
|
#include <util/rng.h>
|
|
|
|
|
2014-03-16 05:03:17 +01:00
|
|
|
#define age_chance(a,b,p) (_max(0,a-b)*p)
|
2010-08-08 09:40:42 +02:00
|
|
|
|
|
|
|
#define DRAGONAGE 27
|
|
|
|
#define WYRMAGE 68
|
|
|
|
|
2011-03-07 08:03:10 +01:00
|
|
|
void age_firedragon(unit * u)
|
2010-08-08 09:40:42 +02:00
|
|
|
{
|
2011-03-07 08:03:10 +01:00
|
|
|
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);
|
2014-06-30 03:10:02 +02:00
|
|
|
u_setrace(u, get_race(RC_DRAGON));
|
2010-08-08 09:40:42 +02:00
|
|
|
u->irace = NULL;
|
2011-03-07 08:03:10 +01:00
|
|
|
scale_number(u, 1);
|
|
|
|
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
2010-08-08 09:40:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-07 08:03:10 +01:00
|
|
|
void age_dragon(unit * u)
|
2010-08-08 09:40:42 +02:00
|
|
|
{
|
2011-03-07 08:03:10 +01:00
|
|
|
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);
|
2014-06-30 03:10:02 +02:00
|
|
|
u_setrace(u, get_race(RC_WYRM));
|
2010-08-08 09:40:42 +02:00
|
|
|
u->irace = NULL;
|
2011-03-07 08:03:10 +01:00
|
|
|
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
2010-08-08 09:40:42 +02:00
|
|
|
}
|
|
|
|
}
|