forked from github/server
Merge branch 'develop' of github.com:ennorehling/eressea into develop
This commit is contained in:
commit
721b160cb5
12
src/chaos.c
12
src/chaos.c
|
@ -76,7 +76,7 @@ static unit *random_unit(const region * r)
|
|||
return u;
|
||||
}
|
||||
|
||||
static void chaos(region * r)
|
||||
static void chaos(region * r, faction *monsters)
|
||||
{
|
||||
if (rng_int() % 100 < 8) {
|
||||
switch (rng_int() % 3) {
|
||||
|
@ -84,7 +84,7 @@ static void chaos(region * r)
|
|||
if (!(r->terrain->flags & SEA_REGION)) {
|
||||
unit *u = random_unit(r);
|
||||
if (u && !undeadrace(u_race(u))) {
|
||||
if (join_monsters(u)) {
|
||||
if (join_monsters(u, monsters)) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("chaos_disease", "unit", u));
|
||||
u_setrace(u, get_race(RC_GHOUL));
|
||||
}
|
||||
|
@ -99,17 +99,17 @@ static void chaos(region * r)
|
|||
case 0:
|
||||
mfac = 100;
|
||||
u =
|
||||
create_unit(r, get_monsters(), rng_int() % 8 + 1,
|
||||
create_unit(r, monsters, rng_int() % 8 + 1,
|
||||
get_race(RC_FIREDRAGON), 0, NULL, NULL);
|
||||
break;
|
||||
case 1:
|
||||
mfac = 500;
|
||||
u = create_unit(r, get_monsters(), rng_int() % 4 + 1,
|
||||
u = create_unit(r, monsters, rng_int() % 4 + 1,
|
||||
get_race(RC_DRAGON), 0, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
mfac = 1000;
|
||||
u = create_unit(r, get_monsters(), rng_int() % 2 + 1,
|
||||
u = create_unit(r, monsters, rng_int() % 2 + 1,
|
||||
get_race(RC_WYRM), 0, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ void chaos_update(void) {
|
|||
/* Chaos */
|
||||
for (r = regions; r; r = r->next) {
|
||||
if ((r->flags & RF_CHAOTIC)) {
|
||||
chaos(r);
|
||||
chaos(r, get_monsters());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ static int forget_cmd(unit * u, order * ord)
|
|||
else {
|
||||
unit *ufam = get_familiar(u);
|
||||
if (ufam) {
|
||||
if (join_monsters(ufam)) {
|
||||
if (join_monsters(ufam, NULL)) {
|
||||
a_removeall(&ufam->attribs, NULL);
|
||||
unit_convert_race(ufam, NULL, "ghost");
|
||||
}
|
||||
|
|
|
@ -180,8 +180,7 @@ static order *monster_attack(unit * u, const unit * target)
|
|||
return create_order(K_ATTACK, u->faction->locale, "%i", target->no);
|
||||
}
|
||||
|
||||
bool join_monsters(unit *u) {
|
||||
static faction *monsters = NULL;
|
||||
bool join_monsters(unit *u, faction *monsters) {
|
||||
if (monsters == NULL) {
|
||||
monsters = get_monsters();
|
||||
if (monsters == NULL) {
|
||||
|
@ -211,7 +210,7 @@ void monsters_desert(struct faction *monsters)
|
|||
if (fval(u, UFL_ISNEW))
|
||||
continue;
|
||||
if (rng_int() % 100 < 5) {
|
||||
if (join_monsters(u)) {
|
||||
if (join_monsters(u, monsters)) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("desertion",
|
||||
"unit region", u, r));
|
||||
}
|
||||
|
@ -1193,7 +1192,7 @@ void monster_kills_peasants(unit * u)
|
|||
|
||||
void make_zombie(unit * u)
|
||||
{
|
||||
if (join_monsters(u)) {
|
||||
if (join_monsters(u, NULL)) {
|
||||
u_freeorders(u);
|
||||
scale_number(u, 1);
|
||||
u->hp = unit_max_hp(u) * u->number;
|
||||
|
|
|
@ -23,7 +23,7 @@ extern "C" {
|
|||
void spawn_undead(void);
|
||||
void plan_monsters(struct faction *f);
|
||||
|
||||
bool join_monsters(struct unit *u);
|
||||
bool join_monsters(struct unit *u, struct faction *monsters);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue