/* * Eressea PB(E)M host Copyright (C) 1998-2015 * 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 /* kernel includes */ #include #include #include #include #include /* util iclude */ #include #include "monsters.h" /* libc includes */ #include #define UNDEAD_MIN 90 /* mind. zahl vor weg gehen */ #define UNDEAD_BREAKUP 25 /* chance dafuer */ #define UNDEAD_BREAKUP_FRACTION (25+rng_int()%70) /* anteil der weg geht */ #define age_chance(a,b,p) (MAX(0,a-b)*p) void make_undead_unit(unit * u) { free_orders(&u->orders); name_unit(u); u->flags |= UFL_ISNEW; } void age_skeleton(unit * u) { if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) { int n = MAX(1, u->number / 2); double q = (double)u->hp / (double)(unit_max_hp(u) * u->number); u_setrace(u, get_race(RC_SKELETON_LORD)); u->irace = NULL; scale_number(u, n); u->hp = (int)(unit_max_hp(u) * u->number * q); } } void age_zombie(unit * u) { if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) { int n = MAX(1, u->number / 2); double q = (double)u->hp / (double)(unit_max_hp(u) * u->number); u_setrace(u, get_race(RC_ZOMBIE_LORD)); u->irace = NULL; scale_number(u, n); u->hp = (int)(unit_max_hp(u) * u->number * q); } } void age_ghoul(unit * u) { if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) { int n = MAX(1, u->number / 2); double q = (double)u->hp / (double)(unit_max_hp(u) * u->number); u_setrace(u, get_race(RC_GHOUL_LORD)); u->irace = NULL; scale_number(u, n); u->hp = (int)(unit_max_hp(u) * u->number * q); } }