Merge pull request #798 from ennorehling/develop

version 3.17, final preview
This commit is contained in:
Enno Rehling 2018-08-29 17:54:28 +02:00 committed by GitHub
commit 65a13d10ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1016,37 +1016,42 @@ static void eaten_by_monster(unit * u)
{ {
/* adjustment for smaller worlds */ /* adjustment for smaller worlds */
double multi = RESOURCE_QUANTITY * newterrain(T_PLAIN)->size / 10000.0; double multi = RESOURCE_QUANTITY * newterrain(T_PLAIN)->size / 10000.0;
int n = 0;
int horse = -1;
const resource_type *rhorse = get_resourcetype(R_HORSE); const resource_type *rhorse = get_resourcetype(R_HORSE);
const race *rc = u_race(u); const race *rc = u_race(u);
int scare; int p = rpeasants(u->region);
scare = rc_scare(rc); if (p > 0) {
if (scare>0) { int horse = -1;
n = rng_int() % scare * u->number; int scare = rc_scare(rc);
} else { int n = 0;
n = rng_int() % (u->number / 20 + 1);
horse = 0;
}
horse = horse ? i_get(u->items, rhorse->itype) : 0;
n = (int)(n * multi); if (scare > 0) {
if (n > 0) { n = rng_int() % scare * u->number;
}
n = lovar(n); else {
n = rng_int() % (u->number / 20 + 1);
if (n > 0) { horse = 0;
int p = rpeasants(u->region); }
if (p < n) n = p;
deathcounts(u->region, n); horse = horse ? i_get(u->items, rhorse->itype) : 0;
rsetpeasants(u->region, rpeasants(u->region) - n); if (horse > 0) {
ADDMSG(&u->region->msgs, msg_message("eatpeasants", "unit amount", u, n)); i_change(&u->items, rhorse->itype, -horse);
ADDMSG(&u->region->msgs, msg_message("eathorse", "unit amount", u, horse));
}
n = (int)(n * multi);
if (n > 0) {
n = lovar(n);
if (p < n) n = p;
if (n > 0) {
if (n > 0) {
deathcounts(u->region, n);
rsetpeasants(u->region, rpeasants(u->region) - n);
ADDMSG(&u->region->msgs, msg_message("eatpeasants", "unit amount", u, n));
}
}
} }
}
if (horse > 0) {
i_change(&u->items, rhorse->itype, -horse);
ADDMSG(&u->region->msgs, msg_message("eathorse", "unit amount", u, horse));
} }
} }
@ -1059,10 +1064,12 @@ static void absorbed_by_monster(unit * u)
if (n > 0) { if (n > 0) {
int p = rpeasants(u->region); int p = rpeasants(u->region);
if (p < n) n = p; if (p < n) n = p;
rsetpeasants(u->region, rpeasants(u->region) - n); if (n > 0) {
scale_number(u, u->number + n); rsetpeasants(u->region, rpeasants(u->region) - n);
ADDMSG(&u->region->msgs, msg_message("absorbpeasants", scale_number(u, u->number + n);
"unit race amount", u, u_race(u), n)); ADDMSG(&u->region->msgs, msg_message("absorbpeasants",
"unit race amount", u, u_race(u), n));
}
} }
} }
} }