Orkbonus für Rekrutierungszauber
This commit is contained in:
Enno Rehling 2004-08-21 23:11:23 +00:00
parent f1f887d1ae
commit e657058251
1 changed files with 29 additions and 27 deletions

View File

@ -4519,16 +4519,14 @@ static int
sp_recruit(castorder *co) sp_recruit(castorder *co)
{ {
unit *u; unit *u;
faction *f;
int n;
region *r = co->rt; region *r = co->rt;
int n, maxp = rpeasants(r);
unit *mage = (unit *)co->magician; unit *mage = (unit *)co->magician;
int cast_level = co->level; int cast_level = co->level;
double force = co->force; double force = co->force;
faction *f = mage->faction;
f = mage->faction; if (maxp == 0) {
if (rpeasants(r) == 0){
report_failure(mage, co->order); report_failure(mage, co->order);
return 0; return 0;
} }
@ -4539,22 +4537,26 @@ sp_recruit(castorder *co)
* ein mehrfaches von Stufe 1, denn in beiden Fällen gibt es nur 1 * ein mehrfaches von Stufe 1, denn in beiden Fällen gibt es nur 1
* Bauer, nur die Kosten steigen. */ * Bauer, nur die Kosten steigen. */
n = (int)((pow(force, 1.6) * 100)/f->race->recruitcost); n = (int)((pow(force, 1.6) * 100)/f->race->recruitcost);
n = min(rpeasants(r),n); if (f->race==new_race[RC_URUK]) {
n = max(n, 1); n = min(2*maxp, n);
n = max(n, 1);
rsetpeasants(r, maxp - (n+1) / 2);
} else {
n = min(maxp, n);
n = max(n, 1);
rsetpeasants(r, maxp - n);
}
if(n <= 0){
report_failure(mage, co->order);
return 0;
}
rsetpeasants(r, rpeasants(r) - n);
u = create_unit(r, f, n, f->race, 0, (n == 1 ? "Bauer" : "Bauern"), mage); u = create_unit(r, f, n, f->race, 0, (n == 1 ? "Bauer" : "Bauern"), mage);
set_order(&u->thisorder, default_order(f->locale)); set_order(&u->thisorder, default_order(f->locale));
sprintf(buf, "%s konnte %d %s anwerben", unitname(mage), n, sprintf(buf, "%s konnte %d %s anwerben", unitname(mage), n,
n == 1 ? "Bauer" : "Bauern"); n == 1 ? "Bauer" : "Bauern");
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO); addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO);
return cast_level;
if (f->race==new_race[RC_URUK]) n = (n+1) / 2;
return cast_level;
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
@ -4570,31 +4572,31 @@ static int
sp_bigrecruit(castorder *co) sp_bigrecruit(castorder *co)
{ {
unit *u; unit *u;
faction *f;
int n;
region *r = co->rt; region *r = co->rt;
int n, maxp = rpeasants(r);
unit *mage = (unit *)co->magician; unit *mage = (unit *)co->magician;
int cast_level = co->level; int cast_level = co->level;
double force = co->force; double force = co->force;
faction *f = mage->faction;
f = mage->faction; if (maxp <= 0) {
if (rpeasants(r) == 0){
report_failure(mage, co->order); report_failure(mage, co->order);
return 0; return 0;
} }
/* Für vergleichbare Erfolge bei unterschiedlichen Rassen die /* Für vergleichbare Erfolge bei unterschiedlichen Rassen die
* Rekrutierungskosten mit einfliessen lassen. */ * Rekrutierungskosten mit einfliessen lassen. */
n = (int)force + lovar((force * force * 1000)/f->race->recruitcost);
/* natürlich nur maximal soviele Bauern, wie auch in der Region sind */
n = min(rpeasants(r), n);
if (n <= 0) { n = (int)force + lovar((force * force * 1000)/f->race->recruitcost);
report_failure(mage, co->order); if (f->race==new_race[RC_URUK]) {
return 0; n = min(2*maxp, n);
} n = max(n, 1);
rsetpeasants(r, maxp - (n+1) / 2);
} else {
n = min(maxp, n);
n = max(n, 1);
rsetpeasants(r, maxp - n);
}
rsetpeasants(r, rpeasants(r) - n);
u = create_unit(r, f, n, f->race, 0, (n == 1 ? "Bauer" : "Bauern"), mage); u = create_unit(r, f, n, f->race, 0, (n == 1 ? "Bauer" : "Bauern"), mage);
set_order(&u->thisorder, default_order(f->locale)); set_order(&u->thisorder, default_order(f->locale));