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;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chaos(region * r)
|
static void chaos(region * r, faction *monsters)
|
||||||
{
|
{
|
||||||
if (rng_int() % 100 < 8) {
|
if (rng_int() % 100 < 8) {
|
||||||
switch (rng_int() % 3) {
|
switch (rng_int() % 3) {
|
||||||
|
@ -84,7 +84,7 @@ static void chaos(region * r)
|
||||||
if (!(r->terrain->flags & SEA_REGION)) {
|
if (!(r->terrain->flags & SEA_REGION)) {
|
||||||
unit *u = random_unit(r);
|
unit *u = random_unit(r);
|
||||||
if (u && !undeadrace(u_race(u))) {
|
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));
|
ADDMSG(&u->faction->msgs, msg_message("chaos_disease", "unit", u));
|
||||||
u_setrace(u, get_race(RC_GHOUL));
|
u_setrace(u, get_race(RC_GHOUL));
|
||||||
}
|
}
|
||||||
|
@ -99,17 +99,17 @@ static void chaos(region * r)
|
||||||
case 0:
|
case 0:
|
||||||
mfac = 100;
|
mfac = 100;
|
||||||
u =
|
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);
|
get_race(RC_FIREDRAGON), 0, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
mfac = 500;
|
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);
|
get_race(RC_DRAGON), 0, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mfac = 1000;
|
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);
|
get_race(RC_WYRM), 0, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ void chaos_update(void) {
|
||||||
/* Chaos */
|
/* Chaos */
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
if ((r->flags & RF_CHAOTIC)) {
|
if ((r->flags & RF_CHAOTIC)) {
|
||||||
chaos(r);
|
chaos(r, get_monsters());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,7 +290,7 @@ static int forget_cmd(unit * u, order * ord)
|
||||||
else {
|
else {
|
||||||
unit *ufam = get_familiar(u);
|
unit *ufam = get_familiar(u);
|
||||||
if (ufam) {
|
if (ufam) {
|
||||||
if (join_monsters(ufam)) {
|
if (join_monsters(ufam, NULL)) {
|
||||||
a_removeall(&ufam->attribs, NULL);
|
a_removeall(&ufam->attribs, NULL);
|
||||||
unit_convert_race(ufam, NULL, "ghost");
|
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);
|
return create_order(K_ATTACK, u->faction->locale, "%i", target->no);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool join_monsters(unit *u) {
|
bool join_monsters(unit *u, faction *monsters) {
|
||||||
static faction *monsters = NULL;
|
|
||||||
if (monsters == NULL) {
|
if (monsters == NULL) {
|
||||||
monsters = get_monsters();
|
monsters = get_monsters();
|
||||||
if (monsters == NULL) {
|
if (monsters == NULL) {
|
||||||
|
@ -211,7 +210,7 @@ void monsters_desert(struct faction *monsters)
|
||||||
if (fval(u, UFL_ISNEW))
|
if (fval(u, UFL_ISNEW))
|
||||||
continue;
|
continue;
|
||||||
if (rng_int() % 100 < 5) {
|
if (rng_int() % 100 < 5) {
|
||||||
if (join_monsters(u)) {
|
if (join_monsters(u, monsters)) {
|
||||||
ADDMSG(&u->faction->msgs, msg_message("desertion",
|
ADDMSG(&u->faction->msgs, msg_message("desertion",
|
||||||
"unit region", u, r));
|
"unit region", u, r));
|
||||||
}
|
}
|
||||||
|
@ -1193,7 +1192,7 @@ void monster_kills_peasants(unit * u)
|
||||||
|
|
||||||
void make_zombie(unit * u)
|
void make_zombie(unit * u)
|
||||||
{
|
{
|
||||||
if (join_monsters(u)) {
|
if (join_monsters(u, NULL)) {
|
||||||
u_freeorders(u);
|
u_freeorders(u);
|
||||||
scale_number(u, 1);
|
scale_number(u, 1);
|
||||||
u->hp = unit_max_hp(u) * u->number;
|
u->hp = unit_max_hp(u) * u->number;
|
||||||
|
|
|
@ -23,7 +23,7 @@ extern "C" {
|
||||||
void spawn_undead(void);
|
void spawn_undead(void);
|
||||||
void plan_monsters(struct faction *f);
|
void plan_monsters(struct faction *f);
|
||||||
|
|
||||||
bool join_monsters(struct unit *u);
|
bool join_monsters(struct unit *u, struct faction *monsters);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue