forked from github/server
begin removing orcification
This commit is contained in:
parent
7557b97dee
commit
8b0ee77bda
2 changed files with 20 additions and 12 deletions
11
src/give.c
11
src/give.c
|
@ -396,9 +396,14 @@ message * give_men(int n, unit * u, unit * u2, struct order *ord)
|
|||
|
||||
message * disband_men(int n, unit * u, struct order *ord) {
|
||||
message * msg;
|
||||
static const race *rc_snotling;
|
||||
static int rccache;
|
||||
|
||||
// TODO: cache RC_SNOTLING
|
||||
if (u_race(u) == get_race(RC_SNOTLING)) {
|
||||
if (rc_changed(&rccache)) {
|
||||
rc_snotling = get_race(RC_SNOTLING);
|
||||
}
|
||||
|
||||
if (u_race(u) == rc_snotling) {
|
||||
/* snotlings may not be given to the peasants. */
|
||||
return msg_error(u, ord, 307);
|
||||
}
|
||||
|
@ -408,7 +413,7 @@ message * disband_men(int n, unit * u, struct order *ord) {
|
|||
transfermen(u, NULL, n);
|
||||
//TODO: is ORCIFICATION still working? snotlings cannot be given to peasants
|
||||
#ifdef ORCIFICATION
|
||||
if (u_race(u) == get_race(RC_SNOTLING) && !fval(u->region, RF_ORCIFIED)) {
|
||||
if (u_race(u) == rc_snotling && !fval(u->region, RF_ORCIFIED)) {
|
||||
attrib *a = a_find(u->region->attribs, &at_orcification);
|
||||
if (!a) {
|
||||
a = a_add(&u->region->attribs, a_new(&at_orcification));
|
||||
|
|
|
@ -827,19 +827,22 @@ void randomevents(void)
|
|||
else {
|
||||
attrib *a = a_find(r->attribs, &at_orcification);
|
||||
if (a != NULL) {
|
||||
double probability = 0.0;
|
||||
if (rpeasants(r) <= 0)
|
||||
continue;
|
||||
probability = a->data.i / (double)rpeasants(r);
|
||||
if (chance(probability)) {
|
||||
fset(r, RF_ORCIFIED);
|
||||
if (rpeasants(r) <= 0) {
|
||||
a_remove(&r->attribs, a);
|
||||
ADDMSG(&r->msgs, msg_message("orcified", "region", r));
|
||||
}
|
||||
else {
|
||||
a->data.i -= _max(10, a->data.i / 10);
|
||||
if (a->data.i <= 0)
|
||||
double probability = 0.0;
|
||||
probability = a->data.i / (double)rpeasants(r);
|
||||
if (chance(probability)) {
|
||||
fset(r, RF_ORCIFIED);
|
||||
a_remove(&r->attribs, a);
|
||||
ADDMSG(&r->msgs, msg_message("orcified", "region", r));
|
||||
}
|
||||
else {
|
||||
a->data.i -= _max(10, a->data.i / 10);
|
||||
if (a->data.i <= 0)
|
||||
a_remove(&r->attribs, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue