Merge pull request #59 from badgerman/master

report volcano outbreaks in affected regions.
This commit is contained in:
Enno Rehling 2014-12-08 21:31:12 +01:00
commit 7bf395e7fb
1 changed files with 946 additions and 926 deletions

View File

@ -89,7 +89,8 @@ static void dissolve_units(void)
/* TODO: Durch einzelne Berechnung ersetzen */
if (a->data.ca[1] == 100) {
n = u->number;
} else {
}
else {
n = 0;
for (i = 0; i < u->number; i++) {
if (rng_int() % 100 < a->data.ca[1])
@ -117,7 +118,8 @@ static void dissolve_units(void)
msg =
msg_message("dissolve_units_2", "unit region number race", u, r,
n, u_race(u));
} else {
}
else {
msg =
msg_message("dissolve_units_3", "unit region number race", u, r,
n, u_race(u));
@ -129,7 +131,8 @@ static void dissolve_units(void)
msg =
msg_message("dissolve_units_4", "unit region number race", u, r,
n, u_race(u));
} else {
}
else {
msg =
msg_message("dissolve_units_5", "unit region number race", u, r,
n, u_race(u));
@ -285,7 +288,8 @@ static void get_allies(region * r, unit * u)
equip = "random_plain";
number = rng_int() % 8 + 2;
break;
} else {
}
else {
if (eff_skill(u, SK_LONGBOW, r) < 3
&& eff_skill(u, SK_HERBALISM, r) < 2
&& eff_skill(u, SK_MAGIC, r) < 2) {
@ -549,7 +553,8 @@ void chaos(region * r)
}
terraform_region(r, newterrain(T_OCEAN));
}
} else {
}
else {
direction_t dir;
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
region *rn = rconnect(r, dir);
@ -641,7 +646,8 @@ damage_unit(unit * u, const char *dam, bool physical, bool magic)
if (get_effect(u, oldpotiontype[P_HEAL]) > 0) {
change_effect(u, oldpotiontype[P_HEAL], -1);
heiltrank = 1;
} else if (i_get(u->items, oldpotiontype[P_HEAL]->itype) > 0) {
}
else if (i_get(u->items, oldpotiontype[P_HEAL]->itype) > 0) {
i_change(&u->items, oldpotiontype[P_HEAL]->itype, -1);
change_effect(u, oldpotiontype[P_HEAL], 3);
heiltrank = 1;
@ -653,7 +659,8 @@ damage_unit(unit * u, const char *dam, bool physical, bool magic)
}
}
dead++;
} else {
}
else {
hp_rem += hp[i];
}
}
@ -683,11 +690,13 @@ void drown(region * r)
if (dead) {
ADDMSG(&u->faction->msgs, msg_message("drown_amphibian_dead",
"amount unit region", dead, u, r));
} else {
}
else {
ADDMSG(&u->faction->msgs, msg_message("drown_amphibian_nodead",
"unit region", u, r));
}
} else if (!(canswim(u) || canfly(u))) {
}
else if (!(canswim(u) || canfly(u))) {
scale_number(u, 0);
ADDMSG(&u->faction->msgs, msg_message("drown", "unit region", u, r));
}
@ -727,8 +736,7 @@ region *rrandneighbour(region * r)
}
static void
volcano_destruction(region * volcano, region * r, region * rn,
const char *damage)
volcano_destruction(region * volcano, region * r, const char *damage)
{
attrib *a;
unit **up;
@ -741,7 +749,8 @@ volcano_destruction(region * volcano, region * r, region * rn,
a = a_find(r->attribs, &at_reduceproduction);
if (!a) {
a = make_reduceproduction(percent, time);
} else {
}
else {
/* Produktion vierteln ... */
a->data.sa[0] = (short)percent;
/* Für 6-17 Runden */
@ -758,21 +767,21 @@ volcano_destruction(region * volcano, region * r, region * rn,
ADDMSG(&u->faction->msgs, msg_message("volcano_dead",
"unit region dead", u, volcano, dead));
}
if (r == volcano && !fval(u->faction, FFL_SELECT)) {
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
if (rn) {
ADDMSG(&u->faction->msgs, msg_message("volcanooutbreak",
"regionv regionn", r, rn));
} else {
ADDMSG(&u->faction->msgs, msg_message("volcanooutbreaknn",
"region", r));
}
}
}
if (u == *up)
if (u == *up) {
up = &u->next;
}
}
if (r != volcano) {
ADDMSG(&r->msgs, msg_message("volcanooutbreak",
"regionv regionn", volcano, r));
}
remove_empty_units_in_region(r);
}
@ -791,10 +800,9 @@ void volcano_outbreak(region * r)
/* Zufällige Nachbarregion verwüsten */
rn = rrandneighbour(r);
volcano_destruction(r, r, rn, "4d10");
volcano_destruction(r, r, "4d10");
if (rn) {
volcano_destruction(r, rn, NULL, "3d10");
volcano_destruction(r, rn, "3d10");
}
}
@ -839,11 +847,13 @@ static void move_iceberg(region * r)
if (!a) {
dir = (direction_t)(rng_int() % MAXDIRECTIONS);
a = a_add(&r->attribs, make_iceberg(dir));
} else {
}
else {
if (rng_int() % 100 < 20) {
dir = (direction_t)(rng_int() % MAXDIRECTIONS);
a->data.i = dir;
} else {
}
else {
dir = (direction_t)a->data.i;
}
}
@ -927,7 +937,8 @@ static void move_iceberg(region * r)
"ship", sh));
}
remove_ship(&sh->region->ships, sh);
} else if (u != NULL) {
}
else if (u != NULL) {
ADDMSG(&u->faction->msgs, msg_message("overrun_by_iceberg",
"ship", sh));
}
@ -935,7 +946,8 @@ static void move_iceberg(region * r)
sh = shn;
}
} else if (rng_int() % 100 < 20) { /* Eisberg bleibt als Gletscher liegen */
}
else if (rng_int() % 100 < 20) { /* Eisberg bleibt als Gletscher liegen */
unit *u;
rsetterrain(r, T_GLACIER);
@ -963,7 +975,8 @@ static void move_icebergs(void)
/* 4% chance */
fset(r, RF_SELECT);
melt_iceberg(r);
} else if (select < 64) {
}
else if (select < 64) {
/* 60% chance */
fset(r, RF_SELECT);
move_iceberg(r);
@ -1135,11 +1148,13 @@ static void demon_skillchanges(void)
/* demons should never forget below 1 */
set_level(u, sv->id, 1);
}
} else {
while (weeks--)
}
else {
while (weeks--) {
learn_skill(u, sv->id, 1.0);
}
}
}
++sv;
}
}
@ -1226,7 +1241,8 @@ void randomevents(void)
ADDMSG(&r->msgs, msg_message("deorcified", "region", r));
freset(r, RF_ORCIFIED);
}
} else {
}
else {
attrib *a = a_find(r->attribs, &at_orcification);
if (a != NULL) {
double probability = 0.0;
@ -1237,7 +1253,8 @@ void randomevents(void)
fset(r, RF_ORCIFIED);
a_remove(&r->attribs, a);
ADDMSG(&r->msgs, msg_message("orcified", "region", r));
} else {
}
else {
a->data.i -= _max(10, a->data.i / 10);
if (a->data.i <= 0)
a_remove(&r->attribs, a);
@ -1252,15 +1269,18 @@ void randomevents(void)
if (a_find(r->attribs, &at_reduceproduction)) {
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
rsetterrain(r, T_VOLCANO);
} else {
}
else {
if (rng_int() % 100 < 12) {
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
rsetterrain(r, T_VOLCANO);
} else if (r->age > 20 && rng_int() % 100 < 8) {
}
else if (r->age > 20 && rng_int() % 100 < 8) {
volcano_outbreak(r);
}
}
} else if (r->terrain == newterrain(T_VOLCANO)) {
}
else if (r->terrain == newterrain(T_VOLCANO)) {
if (rng_int() % 100 < 4) {
ADDMSG(&r->msgs, msg_message("volcanostartsmoke", "region", r));
rsetterrain(r, T_VOLCANO_SMOKING);