* Prefix im CR repariert.

* RACE_ADJUSTMENT korrekt deaktiviert.
* Schiffe werden nur noch beschädigt, wenn der Kampf für sie relevant war.
* Erneute Reparatur für Regionen ohne demand.
* KÄMPFE HELFE NICHT repariert.
* Setzen des Kampfzaubers ohne Stufenangabe setzt die Stufe auf 0 (=max)
* Übersetzung des HP-Status im Report
* Teilübersetzung der Spionage-Reports.
* locale_string() liefert auf NULL wieder NULL zurück (statt crash).
This commit is contained in:
Enno Rehling 2002-02-06 08:06:02 +00:00
parent 4fd1c237d1
commit 32bc84c970
14 changed files with 253 additions and 214 deletions

View File

@ -547,14 +547,17 @@ cr_output_unit(FILE * F, const region * r,
const attrib *a_otherfaction = a_find(u->attribs, &at_otherfaction);
/* my own faction, full info */
const attrib * a = a_find(u->attribs, &at_group);
const attrib * ap = 0;
if (a) {
const group * g = (const group*)a->data.v;
const attrib *a = a_find(g->attribs, &at_raceprefix);
ap = a_find(g->attribs, &at_raceprefix);
fprintf(F, "%d;gruppe\n", g->gid);
if (a) {
const char * name = (const char*)a->data.v;
fprintf(F, "\"%s\";typprefix\n", add_translation(name, LOC(f->locale, name)));
}
} else {
ap = a_find(u->faction->attribs, &at_raceprefix);
}
if (ap) {
const char * name = (const char*)a->data.v;
fprintf(F, "\"%s\";typprefix\n", add_translation(name, LOC(f->locale, name)));
}
fprintf(F, "%d;Partei\n", u->faction->no);
if (sf!=u->faction) fprintf(F, "%d;Verkleidung\n", sf->no);
@ -642,7 +645,7 @@ cr_output_unit(FILE * F, const region * r,
fprintf(F, "\"%s\";privat\n", c);
c = hp_status(u);
if (c && *c && (u->faction == f || omniscient(f)))
fprintf(F, "\"%s\";hp\n", c);
fprintf(F, "\"%s\";hp\n", add_translation(c, locale_string(u->faction->locale, c)));
if (fval(u, FL_HUNGER) && (u->faction == f))
fputs("1;hunger\n", F);
if (is_mage(u)) {

View File

@ -121,7 +121,6 @@ static struct scramble {
int rnd;
} * vec;
int
scramblecmp(const void *p1, const void *p2)
{
@ -297,26 +296,27 @@ expandrecruit(region * r, request * recruitorders)
if (u->number)
u->hp += u->n * unit_max_hp(u);
if (u->race == new_race[RC_ORC]) {
change_skill(u, SK_SWORD, 30 * u->n);
change_skill(u, SK_SPEAR, 30 * u->n);
change_skill(u, SK_SWORD, skill_level(1) * u->n);
change_skill(u, SK_SPEAR, skill_level(1) * u->n);
}
if (u->race->ec_flags & ECF_REC_HORSES) {
change_skill(u, SK_RIDING, 30 * u->n);
change_skill(u, SK_RIDING, skill_level(1) * u->n);
}
i = fspecial(u->faction, FS_MILITIA);
if (i > 0) {
if (u->race->bonus[SK_SPEAR] >= 0) change_skill(u, SK_SPEAR,
u->n * level_days(i));
if (u->race->bonus[SK_SWORD] >= 0) change_skill(u, SK_SWORD,
u->n * level_days(i));
if (u->race->bonus[SK_LONGBOW] >= 0) change_skill(u, SK_LONGBOW,
u->n * level_days(i));
if (u->race->bonus[SK_CROSSBOW] >= 0) change_skill(u, SK_CROSSBOW,
u->n * level_days(i));
if (u->race->bonus[SK_RIDING] >= 0) change_skill(u, SK_RIDING,
u->n * level_days(i));
if (u->race->bonus[SK_AUSDAUER] >= 0) change_skill(u, SK_AUSDAUER,
u->n * level_days(i));
int ld = skill_level(i);
if (u->race->bonus[SK_SPEAR] >= 0)
change_skill(u, SK_SPEAR, u->n * ld);
if (u->race->bonus[SK_SWORD] >= 0)
change_skill(u, SK_SWORD, u->n * ld);
if (u->race->bonus[SK_LONGBOW] >= 0)
change_skill(u, SK_LONGBOW, u->n * ld);
if (u->race->bonus[SK_CROSSBOW] >= 0)
change_skill(u, SK_CROSSBOW, u->n * ld);
if (u->race->bonus[SK_RIDING] >= 0)
change_skill(u, SK_RIDING, u->n * ld);
if (u->race->bonus[SK_AUSDAUER] >= 0)
change_skill(u, SK_AUSDAUER, u->n * ld);
}
if (u->n < u->wants) {
add_message(&u->faction->msgs,
@ -547,7 +547,7 @@ givemen(int n, unit * u, unit * u2, const char * cmd)
&& u2->faction != u->faction
&& ucontact(u2, u) == 0) {
error = 73;
} else if (u2 && (get_skill(u, SK_MAGIC) > 0 || get_skill(u2, SK_MAGIC) > 0)) {
} else if (u2 && (get_skill(u, SK_MAGIC) || get_skill(u2, SK_MAGIC))) {
error = 158;
} else {
if (n > u->number) n = u->number;
@ -570,7 +570,7 @@ givemen(int n, unit * u, unit * u2, const char * cmd)
}
}
}
if (u2 && (get_skill(u, SK_ALCHEMY) > 0 || get_skill(u2, SK_ALCHEMY) > 0)) {
if (u2 && (get_skill(u, SK_ALCHEMY) || get_skill(u2, SK_ALCHEMY))) {
k = count_skill(u2->faction, SK_ALCHEMY);
@ -580,7 +580,7 @@ givemen(int n, unit * u, unit * u2, const char * cmd)
k += u2->number;
/* Wenn in eine Alchemisteneinheit Personen verschoben werden */
if (get_skill(u2, SK_ALCHEMY) > 0 && !get_skill(u, SK_ALCHEMY))
if (get_skill(u2, SK_ALCHEMY) && !get_skill(u, SK_ALCHEMY))
k += n;
/* Wenn Parteigrenzen überschritten werden */
@ -1546,7 +1546,7 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
if (btype==&bt_mine)
al->save *= 0.5;
if (u->race == new_race[RC_DWARF])
#ifdef RACE_ADJUSTMENTS
#if RACE_ADJUSTMENTS
al->save *= 0.75;
#else
al->save *= 0.5;
@ -1556,7 +1556,7 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
const struct building_type * btype = b?b->type:NULL;
if (btype==&bt_quarry)
al->save = al->save*0.5;
#ifdef RACE_ADJUSTMENTS
#if RACE_ADJUSTMENTS
if (u->race == new_race[RC_TROLL])
al->save = al->save*0.75;
#endif
@ -1740,8 +1740,7 @@ split_allocations(region * r)
if (al->get) {
assert(itype || !"not implemented for non-items");
i_change(&al->unit->items, itype, al->get);
change_skill(al->unit, itype->construction->skill,
al->unit->number * PRODUCEEXP);
produceexp(al->unit, itype->construction->skill, al->unit->number);
#if NEW_RESOURCEGROWTH
fset(r, RF_DH);
#endif
@ -2502,7 +2501,7 @@ plant(region *r, unit *u, int raw)
for(i = n; i>0; i--) {
if (rand()%10 < skill) planted++;
}
change_skill(u, SK_HERBALISM, PRODUCEEXP * u->number);
produceexp(u, SK_HERBALISM, u->number);
/* Alles ok. Abziehen. */
new_use_pooled(u, oldresourcetype[R_TREES], GET_DEFAULT, 1);
@ -2556,7 +2555,7 @@ planttrees(region *r, unit *u, int raw)
rsettrees(r, 0, rtrees(r, 0)+planted);
/* Alles ok. Abziehen. */
change_skill(u, SK_HERBALISM, PRODUCEEXP * u->number);
produceexp(u, SK_HERBALISM, u->number);
new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
add_message(&u->faction->msgs, new_message(u->faction,
@ -2661,7 +2660,7 @@ breedtrees(region *r, unit *u, int raw)
rsettrees(r, 1, rtrees(r, 1)+planted);
/* Alles ok. Abziehen. */
change_skill(u, SK_HERBALISM, PRODUCEEXP * u->number);
produceexp(u, SK_HERBALISM, u->number);
new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
add_message(&u->faction->msgs, new_message(u->faction,
@ -2695,8 +2694,9 @@ breedhorses(region *r, unit *u)
}
}
if (gezuechtet > 0)
change_skill(u, SK_HORSE_TRAINING, PRODUCEEXP * u->number);
if (gezuechtet > 0) {
produceexp(u, SK_HORSE_TRAINING, u->number);
}
add_message(&u->faction->msgs, new_message(u->faction,
"raised%u:unit%i:amount", u, gezuechtet));
@ -2773,7 +2773,7 @@ research(region *r, unit *u)
return;
}
change_skill(u, SK_HERBALISM, PRODUCEEXP * u->number);
produceexp(u, SK_HERBALISM, u->number);
if (rherbs(r) > 0) {
const herb_type *rht = rherbtype(r);
@ -2917,7 +2917,7 @@ steal(region * r, unit * u, request ** stealorders)
/* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */
change_skill(u, SK_STEALTH, min(n, u->number) * PRODUCEEXP);
produceexp(u, SK_STEALTH, min(n, u->number));
}
/* ------------------------------------------------------------- */
@ -2960,8 +2960,7 @@ expandentertainment(region * r)
entertaining -= u->n;
/* Nur soviel PRODUCEEXP wie auch tatsächlich gemacht wurde */
change_skill(u, SK_ENTERTAINMENT, PRODUCEEXP * min(u->n, u->number));
produceexp(u, SK_ENTERTAINMENT, min(u->n, u->number));
add_income(u, IC_ENTERTAIN, o->qty, u->n);
}
}
@ -3215,7 +3214,7 @@ produce(void)
if (fval(u, FL_TRADER)) {
attrib * a = a_find(u->attribs, &at_trades);
if (a && a->data.i) {
change_skill(u, SK_TRADE, u->number * PRODUCEEXP);
produceexp(u, SK_TRADE, u->number);
}
u->thisorder[0]=0;
continue;

View File

@ -2350,16 +2350,15 @@ instant_orders(void)
case P_VORNE:
u->status = ST_FIGHT;
break;
#ifdef NOAID
case P_HELP:
param = getstrtoken();
if(findparam(param, u->faction->locale) == P_NOT) {
freset(u, FL_NOAID);
} else {
if( findparam(param, u->faction->locale) == P_NOT) {
fset(u, FL_NOAID);
} else {
freset(u, FL_NOAID);
}
break;
#endif
default:
if (strlen(param)) {
@ -2391,6 +2390,7 @@ instant_orders(void)
level = max(0, level);
s = getstrtoken();
}
else level = 0;
spell = find_spellbyname(u, s);

View File

@ -167,8 +167,8 @@ dissolve_units(void)
remove_empty_units();
}
int
improve_all(faction * f, skill_t s, int g)
static int
improve_all(faction * f, skill_t sk, int days)
{
region *r;
unit *u;
@ -177,9 +177,15 @@ improve_all(faction * f, skill_t s, int g)
for (r = firstregion(f); r != last; r = r->next) {
for (u = r->units; u; u = u->next) {
if (u->faction == f && get_skill(u, s) > 0) {
if (u->faction == f && get_skill(u, sk)) {
#if SKILLPOINTS
change_skill(u, sk, u->number * days);
n += u->number;
change_skill(u, s, u->number * g);
#else
if (learn_skill(u, sk, days * u->number)) {
change_skill(u, sk, 1);
}
#endif
}
}
}
@ -293,11 +299,15 @@ find_manual(region * r, unit * u)
addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
if (improve_all(u->faction, skill, 90) == 0) {
#if SKILLPOINTS
change_skill(u, skill, 270);
#else
change_skill(u, skill, 1);
#endif
}
}
void
static void
get_unit(region * r, unit * u)
{
unit *newunit;
@ -315,23 +325,23 @@ get_unit(region * r, unit * u)
if (fval(u, FL_PARTEITARNUNG)) fset(newunit, FL_PARTEITARNUNG);
switch (rand() % 4) {
case 0:
set_skill(newunit, SK_MINING, 30 * newunit->number);
set_skill(newunit, SK_MINING, skill_level(1) * newunit->number);
break;
case 1:
set_skill(newunit, SK_LUMBERJACK, 30 * newunit->number);
set_skill(newunit, SK_LUMBERJACK, skill_level(1) * newunit->number);
break;
case 2:
set_skill(newunit, SK_CARTMAKER, 30 * newunit->number);
set_skill(newunit, SK_CARTMAKER, skill_level(1) * newunit->number);
break;
case 3:
set_skill(newunit, SK_QUARRYING, 30 * newunit->number);
set_skill(newunit, SK_QUARRYING, skill_level(1) * newunit->number);
break;
}
set_item(newunit, I_WAGON, rand() % 2);
set_item(newunit, I_HORSE, min(get_item(newunit, I_WAGON) * 2, rand() % 5));
}
void
static void
get_allies(region * r, unit * u)
{
unit *newunit = NULL;
@ -348,19 +358,19 @@ get_allies(region * r, unit * u)
switch (rand() % 4) {
case 0:
set_skill(newunit, SK_SWORD, (30 + rand() % 120) * newunit->number);
set_skill(newunit, SK_SWORD, skill_level(1+rand()%3) * newunit->number);
set_item(newunit, I_SWORD, newunit->number);
break;
case 1:
set_skill(newunit, SK_SPEAR, (30 + rand() % 120) * newunit->number);
set_skill(newunit, SK_SPEAR, skill_level(1+rand()%3) * newunit->number);
set_item(newunit, I_SPEAR, newunit->number);
break;
case 2:
set_skill(newunit, SK_CROSSBOW, (30 + rand() % 120) * newunit->number);
set_skill(newunit, SK_CROSSBOW, skill_level(1+rand()%3) * newunit->number);
set_item(newunit, I_CROSSBOW, newunit->number);
break;
case 3:
set_skill(newunit, SK_LONGBOW, (30 + rand() % 120) * newunit->number);
set_skill(newunit, SK_LONGBOW, skill_level(1+rand()%3) * newunit->number);
set_item(newunit, I_LONGBOW, newunit->number);
break;
}
@ -369,7 +379,7 @@ get_allies(region * r, unit * u)
}
if (rand() % 100 < 30) {
set_item(newunit, I_HORSE, newunit->number);
set_skill(newunit, SK_RIDING, (30 + rand() % 120) * newunit->number);
set_skill(newunit, SK_RIDING, skill_level(1+rand()%3) * newunit->number);
}
break;
} else {
@ -381,12 +391,12 @@ get_allies(region * r, unit * u)
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
set_string(&newunit->name, "Waldbewohner");
set_money(newunit, (rand() % 20 + 10) * newunit->number);
set_skill(newunit, SK_LONGBOW, (90 + rand() % 210) * newunit->number);
set_skill(newunit, SK_LONGBOW, skill_level(2+rand()%3) * newunit->number);
set_item(newunit, I_LONGBOW, newunit->number);
set_skill(newunit, SK_OBSERVATION, (90 + rand() % 110) * newunit->number);
set_skill(newunit, SK_STEALTH, (30 + rand() % 80) * newunit->number);
set_skill(newunit, SK_OBSERVATION, skill_level(2+rand()%2) * newunit->number);
set_skill(newunit, SK_STEALTH, skill_level(1+rand()%2) * newunit->number);
if (rand() % 100 < 20) {
set_skill(newunit, SK_HERBALISM, (30 + rand() % 10) * newunit->number);
set_skill(newunit, SK_HERBALISM, skill_level(1+rand()%2) * newunit->number);
}
}
break;
@ -398,9 +408,9 @@ get_allies(region * r, unit * u)
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
set_string(&newunit->name, "Sumpfbewohner");
set_money(newunit, (rand() % 20 + 10) * newunit->number);
set_skill(newunit, SK_SPEAR, (90 + rand() % 210) * newunit->number);
set_skill(newunit, SK_SPEAR, skill_level(2+rand()%3) * newunit->number);
set_item(newunit, I_SPEAR, newunit->number);
set_skill(newunit, SK_STEALTH, (90 + rand() % 120) * newunit->number);
set_skill(newunit, SK_STEALTH, skill_level(2+rand()%3) * newunit->number);
break;
case T_DESERT:
@ -410,12 +420,12 @@ get_allies(region * r, unit * u)
newunit = createunit(r, u->faction, rand() % 12 + 2, u->faction->race);
set_string(&newunit->name, "Berber");
set_money(newunit, (rand() % 30 + 20) * newunit->number);
set_skill(newunit, SK_SWORD, (30 + rand() % 60) * newunit->number);
set_skill(newunit, SK_SWORD, skill_level(1+rand()%2) * newunit->number);
set_item(newunit, I_SWORD, newunit->number);
set_skill(newunit, SK_TRADE, (30 + rand() % 60) * newunit->number);
set_skill(newunit, SK_RIDING, (90 + rand() % 60) * newunit->number);
set_skill(newunit, SK_TRADE, skill_level(1+rand()%3) * newunit->number);
set_skill(newunit, SK_RIDING, skill_level(2+rand()%2) * newunit->number);
set_item(newunit, I_HORSE, newunit->number);
set_skill(newunit, SK_HORSE_TRAINING, (90 + rand() % 120) * newunit->number);
set_skill(newunit, SK_HORSE_TRAINING, skill_level(2+rand()%2) * newunit->number);
break;
case T_HIGHLAND:
@ -425,7 +435,7 @@ get_allies(region * r, unit * u)
newunit = createunit(r, u->faction, rand() % 8 + 2, u->faction->race);
set_string(&newunit->name, "Hochlandbarbaren");
set_money(newunit, (rand() % 10 + 20) * newunit->number);
set_skill(newunit, SK_SWORD, (60 + rand() % 60) * newunit->number);
set_skill(newunit, SK_SWORD, skill_level(1+rand()%2) * newunit->number);
set_item(newunit, I_SWORD, newunit->number);
break;
@ -437,10 +447,10 @@ get_allies(region * r, unit * u)
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
set_string(&newunit->name, "Bergbewohner");
set_money(newunit, (rand() % 40 + 60) * newunit->number);
set_skill(newunit, SK_SWORD, (90 + rand() % 60) * newunit->number);
set_skill(newunit, SK_SWORD, skill_level(2+rand()%2) * newunit->number);
set_item(newunit, I_SWORD, newunit->number);
set_skill(newunit, SK_ARMORER, (90 + rand() % 60) * newunit->number);
set_skill(newunit, SK_TRADE, (30 + rand() % 120) * newunit->number);
set_skill(newunit, SK_ARMORER, skill_level(2+rand()%2) * newunit->number);
set_skill(newunit, SK_TRADE, skill_level(1+rand()%3) * newunit->number);
if (rand() % 100 < 60) {
set_item(newunit, I_PLATE_ARMOR, newunit->number);
}
@ -454,9 +464,9 @@ get_allies(region * r, unit * u)
newunit = createunit(r, u->faction, rand() % 4 + 2, u->faction->race);
set_string(&newunit->name, "Eisleute");
set_money(newunit, (rand() % 20 + 20) * newunit->number);
set_skill(newunit, SK_SWORD, (90 + rand() % 60) * newunit->number);
set_skill(newunit, SK_SWORD, skill_level(2+rand()%2) * newunit->number);
set_item(newunit, I_SWORD, newunit->number);
set_skill(newunit, SK_ARMORER, (90 + rand() % 60) * newunit->number);
set_skill(newunit, SK_ARMORER, skill_level(2+rand()%2) * newunit->number);
break;
}
@ -475,7 +485,7 @@ get_allies(region * r, unit * u)
addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
}
void
static void
encounter(region * r, unit * u)
{
if (!fval(r, RF_ENCOUNTER)) return;
@ -1018,8 +1028,12 @@ godcurse(void)
for(u=r->units; u; u=u->next) {
for(sk=0; sk < MAXSKILLS; sk++) {
int s = get_skill(u, sk);
if(s > 0) {
if (s > 0) {
#if SKILLPOINTS
change_skill(u, sk, -min(s, (30+rand()%90)*u->number));
#else
change_skill(u, sk, -min(s, u->number));
#endif
}
}
}
@ -1070,8 +1084,8 @@ randomevents(void)
if (p && (p->flags & PFL_NOORCGROWTH)) continue;
for (u = r->units; u; u = u->next) {
if ( (u->race == new_race[RC_ORC] || is_cursed(u->attribs, C_ORC, 0))
&& get_skill(u, SK_MAGIC) == 0
&& get_skill(u, SK_ALCHEMY) == 0) {
&& !get_skill(u, SK_MAGIC)
&& !get_skill(u, SK_ALCHEMY)) {
int increase = 0;
int num, prob;
@ -1090,28 +1104,20 @@ randomevents(void)
}
if (increase) {
if (u->race == new_race[RC_ORC]) {
int s;
s = get_skill(u, SK_SWORD) / (u->number * 2);
change_skill(u, SK_SWORD,
increase * max(30, s));
s = get_skill(u, SK_SPEAR) / (u->number * 2);
change_skill(u, SK_SPEAR,
increase * max(30, s));
s = get_skill(u, SK_TACTICS) / (u->number * 2);
change_skill(u, SK_TACTICS,
increase * s);
s = get_skill(u, SK_LONGBOW) / (u->number * 2);
change_skill(u, SK_LONGBOW,
increase * s);
s = get_skill(u, SK_CROSSBOW) / (u->number * 2);
change_skill(u, SK_CROSSBOW,
increase * s);
s = get_skill(u, SK_CATAPULT) / (u->number * 2);
change_skill(u, SK_CATAPULT,
increase * s);
s = get_skill(u, SK_AUSDAUER) / (u->number * 2);
change_skill(u, SK_AUSDAUER,
increase * s);
int i;
struct orcskills {
skill_t skill;
int level;
} skills [] = {
{ SK_SWORD, 1 }, { SK_SPEAR, 1 }, { SK_TACTICS, 0 },
{ SK_LONGBOW, 0 }, { SK_CROSSBOW, 0 }, { SK_CATAPULT, 0 },
{ SK_AUSDAUER, 0 }, { NOSKILL, 0 }
};
for (i=0;skills[i].skill!=NOSKILL;++i) {
int s = get_skill(u, skills[i].skill) / (u->number * 2);
int k = skill_level(skills[i].level);
change_skill(u, skills[i].skill, increase * max(k, s));
}
}
set_number(u, u->number + increase);
@ -1176,20 +1182,25 @@ randomevents(void)
dc = max(0, dc);
rsetpeasants(r, dc);
for (sk = 0; sk != MAXSKILLS; sk++) {
if (get_skill(u, sk) > 0 && rand() % 100 < 25) {
if (get_skill(u, sk) && rand() % 100 < 25) {
int change = rand() % 90 + 1;
if (rand() % 100 < 60) {
change_skill(u, sk, u->number * (rand() % 90 + 1));
#if SKILLPOINTS
change_skill(u, sk, u->number * change);
#else
if (learn_skill(u, sk, change * u->number)) {
change_skill(u, sk, u->number);
}
#endif
} else {
int s = get_skill(u, sk);
int r = u->number * (rand() % 90 + 1);
r = min(s, r);
change_skill(u, sk, -r);
#if 0
/* ist kaputt. weiß nicht, wieso. */
if (r==s) {
sprintf(buf, "Durch Konzentrationsmangel vergißt %s das Talent %s vollständig",
unitname(u), skillname(u->faction->local, sk));
addmessage(0, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
#ifdef SKILLPOINTS
s = min(s, u->number * change);
change_skill(u, sk, -s);
#else
s = min(s, u->number);
if (learn_skill(u, sk, change * u->number)) {
change_skill(u, sk, -s);
}
#endif
}
@ -1200,13 +1211,11 @@ randomevents(void)
}
for (r = regions; r; r = r->next) {
#if (RACE_ADJUSTMENTS==0)
/* Elfen generieren Wald, Personen in Steinkreisen können Einhörner
* bekommen. */
#if !RACE_ADJUSTMENTS
/* Elfen generieren Wald */
if (r->land && !fval(r, RF_MALLORN)) {
#if GROWING_TREES
int trees = rtrees(r,2);
int trees = rtrees(r, 2);
#else
int trees = rtrees(r);
#endif
@ -1225,8 +1234,8 @@ randomevents(void)
rsettrees(r, 2, trees);
#else
rsettrees(r, trees);
#endif
}
#endif /* GROWING_TREES */
} /* !RACE_ADJUSTMENTS */
#endif
for (u=r->units; u; u=u->next) {
@ -1324,10 +1333,10 @@ randomevents(void)
unit * u;
if (rterrain(r) == T_OCEAN && rand()%10000 < 1) {
u = createunit(r, findfaction(MONSTER_FACTION), 1, new_race[RC_SEASERPENT]);
set_skill(u, SK_MAGIC, u->number * 300);
set_skill(u, SK_OBSERVATION, u->number * 180);
set_skill(u, SK_STEALTH, u->number * 90);
set_skill(u, SK_AUSDAUER, u->number * 30);
set_skill(u, SK_MAGIC, u->number * skill_level(4));
set_skill(u, SK_OBSERVATION, u->number * skill_level(3));
set_skill(u, SK_STEALTH, u->number * skill_level(2));
set_skill(u, SK_AUSDAUER, u->number * skill_level(1));
set_string(&u->name, "Seeschlange");
}
@ -1352,10 +1361,10 @@ randomevents(void)
}
set_money(u, u->number * (rand() % 500 + 100));
set_skill(u, SK_MAGIC, u->number * 300);
set_skill(u, SK_OBSERVATION, u->number * (rand() % 180));
set_skill(u, SK_AUSDAUER, u->number * 30);
set_skill(u, SK_STEALTH, u->number * 30);
set_skill(u, SK_MAGIC, u->number * skill_level(4));
set_skill(u, SK_OBSERVATION, u->number * skill_level(1+rand()%3));
set_skill(u, SK_AUSDAUER, u->number * skill_level(1));
set_skill(u, SK_STEALTH, u->number * skill_level(1));
log_printf("%d %s in %s.\n", u->number,
LOC(default_locale, rc_name(u->race, u->number!=1)), regionname(r, NULL));
@ -1428,7 +1437,7 @@ randomevents(void)
for (i=0;i < MAXSKILLS;i++) {
if (rc->bonus[i] >= 1) {
set_skill(u, i, 30 * u->number);
set_skill(u, i, skill_level(1) * u->number);
}
}
u->hp = unit_max_hp(u) * u->number;
@ -1498,7 +1507,13 @@ randomevents(void)
u = createunit(r, findfaction(MONSTER_FACTION),treemen, new_race[RC_TREEMAN]);
set_string(&u->lastorder, "WARTEN");
/* guard(u, GUARD_ALL); kein auto-guard! erst in monster.c! */
change_skill(u,SK_OBSERVATION,180*u->number);
#if SKILLPOINTS
change_skill(u, SK_OBSERVATION, u->number * 180);
#else
if (learn_skill(u, SK_OBSERVATION, u->number * 180)) {
change_skill(u, SK_OBSERVATION, u->number);
}
#endif
if (u->number == 1)
set_string(&u->name, "Ein wütender Ent");
else

View File

@ -2329,9 +2329,12 @@ aftermath(battle * b)
int sum_hp = 0;
int n;
if (relevant && df->action_counter >= du->number) {
ship * sh = du->ship?du->ship:leftship(du);
if (sh) fset(sh, SF_DAMAGED);
fset(du, FL_LONGACTION);
/* TODO: das sollte hier weg sobald anderswo üb
* erall HADBATTLE getestet wird. */
* erall FL_LONGACTION getestet wird. */
set_string(&du->thisorder, "");
}
for (n = 0; n != df->alive; ++n) {
@ -2441,8 +2444,6 @@ aftermath(battle * b)
* schonmal Schaden genommen hat. (moved und drifted
* sollten in flags überführt werden */
for (sh=r->ships; sh; sh=sh->next) sh->drifted = false;
for (fi = fighters->begin; fi != fighters->end; ++fi) {
fighter *df = *fi;
unit *du = df->unit;
@ -2462,9 +2463,9 @@ aftermath(battle * b)
if (du->ship) sh = du->ship; else sh = leftship(du);
if (sh && sh->drifted == false && b->turn+(b->has_tactics_turn?1:0)>2) {
if (sh && fval(sh, SF_DAMAGED) && b->turn+(b->has_tactics_turn?1:0)>2) {
damage_ship(sh, 0.20);
sh->drifted = true;
freset(sh, SF_DAMAGED);
}
}
@ -2472,7 +2473,7 @@ aftermath(battle * b)
ship **sp = &r->ships;
while (*sp) {
ship * sh = *sp;
sh->drifted = false;
freset(sh, SF_DAMAGED);
if (sh->damage >= sh->size * DAMAGE_SCALE) {
destroy_ship(sh, r);
}
@ -3225,10 +3226,8 @@ join_allies(battle * b)
for (si = 0; si != size; ++si) {
int se;
side *s = b->sides.begin[si];
#ifdef NOAID
/* Wenn alle attackierten noch FL_NOAIDF haben, dann kämpfe nicht mit. */
if (fval(s->bf->faction, FL_NOAIDF)) continue;
#endif
if (s->bf->faction!=f) {
/* Wenn wir attackiert haben, kommt niemand mehr hinzu: */
if (s->bf->attacker) continue;
@ -3361,14 +3360,13 @@ do_battle(void)
battle *b = NULL;
int sides = 0;
side *s;
ship * sh;
void **fi;
building *bu;
#ifdef NOAID
for (u = r->units; u != NULL; u = u->next) {
fset(u->faction, FL_NOAIDF);
}
#endif
/* list_foreach geht nicht, wegen flucht */
for (u = r->units; u != NULL; u = u->next) {
@ -3515,12 +3513,11 @@ do_battle(void)
c1 = join_battle(b, u, true);
c2 = join_battle(b, u2, false);
#ifdef NOAID
/* Hat die attackierte Einheit keinen Noaid-Status,
* wird das Flag von der Faction genommen, andere
* Einheiten greifen ein. */
if (!fval(u2, FL_NOAID)) freset(u2->faction, FL_NOAIDF);
#endif
if (c1 && c2) {
/* Merken, wer Angreifer ist, für die Rückzahlung der
* Präcombataura bei kurzem Kampf. */
@ -3568,6 +3565,9 @@ do_battle(void)
}
list_next(bu);
/* make sure no ships are damaged initially */
for (sh=r->ships; sh; sh=sh->next) freset(sh, SF_DAMAGED);
/* Gibt es eine Taktikrunde ? */
b->turn = 1;
#ifndef NEW_TACTICS

View File

@ -1684,7 +1684,7 @@ create_unit(region * r, faction * f, int number, const struct race *urace, int i
f->no_units++;
}
if (creator){
if (creator) {
attrib * a;
/* erbt Kampfstatus */

View File

@ -84,9 +84,6 @@ struct xml_stack;
#include <attrib.h>
#define AT_PERSISTENT
#undef RANDOMIZED_LEARNING
#undef NOVISIBLESKILLPOINTS
#undef SKILLMODIFIESLEARNING
/* eressea-defined attribute-type flags */
#define ATF_CURSE ATF_USER_DEFINED
@ -105,7 +102,6 @@ struct xml_stack;
#define NEW_TAVERN
#define GOBLINKILL
#undef HELFE_WAHRNEHMUNG
#define NOAID
#define USE_FIREWALL 1
#undef COMPATIBILITY
@ -880,10 +876,8 @@ typedef struct skillvalue {
#define MAX_UNIT_NR (36*36*36*36-1)
#define MAX_CONTAINER_NR (36*36*36*36-1)
#ifdef NOAID
#define FL_NOAIDF (1<<21) /* Hilfsflag Kampf */
#define FL_NOAID (1<<22) /* Einheit hat Noaid-Status */
#endif
#define FL_MARK (1<<23) /* für markierende algorithmen, die das hinterher auch wieder
löschen müssen! (Ist dafür nicht eigentlich FL_DH gedacht?) */
@ -892,13 +886,8 @@ typedef struct skillvalue {
#define FL_UNNAMED (1<<26) /* Partei/Einheit/Gebäude/Schiff ist unbenannt */
#define FL_RESTARTED (1<<27) /* Partei hat schon einen Neustart gemacht */
/* no longer used, may contain old data! */
/* Flags, die gespeichert werden sollen: */
#ifdef NOAID
#define FL_SAVEMASK (FL_NOAID | FL_RESTARTED | FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
#else
#define FL_SAVEMASK (FL_RESTARTED | FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
#endif
#define fval(u, i) ((u)->flags & (i))
#define fset(u, i) ((u)->flags |= (i))
@ -1191,4 +1180,6 @@ typedef struct settings {
extern settings global;
extern FILE * updatelog;
extern int produceexp(struct unit * u, skill_t sk, int n);
#endif

View File

@ -148,7 +148,7 @@ personcapacity(const unit *u)
if (old_race(u->race) == RC_TROLL)
cap += 540;
#ifdef RACE_ADJUSTMENTS
#if RACE_ADJUSTMENTS
else if(old_race(u->race) == RC_GOBLIN)
cap -= 100;
#endif
@ -465,7 +465,7 @@ move_ship(ship * sh, region * from, region * to, region ** route)
ulist = &u->next;
u->ship = sh;
if (route && eff_skill(u, SK_SAILING, from) >= 1) {
change_skill(u, SK_SAILING, PRODUCEEXP * u->number);
produceexp(u, SK_SAILING, u->number);
}
}
u = nu;
@ -486,7 +486,7 @@ drifting_ships(region * r)
sh2 = sh->next;
/* Schiff schon abgetrieben oder durch Zauber geschützt? */
if (sh->drifted == 1 || is_cursed(sh->attribs, C_SHIP_NODRIFT, 0)) {
if (fval(sh, SF_DRIFTED) || is_cursed(sh->attribs, C_SHIP_NODRIFT, 0)) {
sh = sh2;
continue;
}
@ -549,7 +549,7 @@ drifting_ships(region * r)
for (f = factions; f; f = f->next)
freset(f, FL_DH);
#endif
if (sh->drifted) {
if (fval(sh, SF_DRIFTED)) {
/* wenn schon einmal abgetrieben, dann durchreise eintragen */
route[0] = r;
sh = move_ship(sh, r, rconnect(r, d), route);
@ -559,7 +559,7 @@ drifting_ships(region * r)
continue;
}
sh->drifted = 1;
fset(sh, SF_DRIFTED);
if (rterrain(rconnect(r, d)) != T_OCEAN) {
/* Alle Attribute
@ -928,7 +928,7 @@ travel(region * first, unit * u, region * next, int flucht)
cmistake(u, findorder(u, u->thisorder), 143, MSG_MOVE);
return NULL;
}
} else if (rterrain(next) == T_OCEAN && u->ship && u->ship->moved == 1) {
} else if (rterrain(next) == T_OCEAN && u->ship && fval(u->ship, FL_MOVED)) {
cmistake(u, findorder(u, u->thisorder), 13, MSG_MOVE);
return NULL;
}
@ -1119,7 +1119,7 @@ travel(region * first, unit * u, region * next, int flucht)
mode = 0;
else if (canride(u)) {
mode = 1;
change_skill(u, SK_RIDING, u->number * PRODUCEEXP);
produceexp(u, SK_RIDING, u->number);
} else
mode = 2;
@ -1506,7 +1506,7 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
/* Falls kein Problem, eines weiter ziehen */
route[step] = dir;
tt[step] = current_point; /* travelthrough */
u->ship->moved = 1;
fset(u->ship, FL_MOVED);
step++;
m++;
@ -1533,7 +1533,7 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
* gekommen ist. Das ist nicht der Fall, wenn er von der Küste ins
* Inland zu segeln versuchte */
if (u->ship->moved) {
if (fval(u->ship, FL_MOVED)) {
ship * sh = u->ship;
/* nachdem alle Richtungen abgearbeitet wurden, und alle Einheiten
* transferiert wurden, kann der aktuelle Befehl gelöscht werden. */
@ -1544,7 +1544,7 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
} else {
sh->coast = NODIRECTION;
}
sh->moved = 1;
fset(sh, FL_MOVED);
sprintf(buf, "Die %s ", shipname(sh));
if( is_cursed(sh->attribs, C_SHIP_FLYING, 0) )
scat("fliegt");

View File

@ -28,6 +28,7 @@
#include "item.h"
#include "karma.h"
#include "magic.h"
#include "message.h"
#include "race.h"
#include "region.h"
#include "ship.h"
@ -103,12 +104,10 @@ report_kampfstatus(const unit * u, const struct locale * lang)
"status_avoid", "status_flee" };
strcpy(fsbuf, LOC(lang, azstatus[u->status]));
#ifdef NOAID
if(fval(u, FL_NOAID)) {
if (fval(u, FL_NOAID)) {
strcat(fsbuf, ", ");
strcat(fsbuf, LOC(lang, "status_noaid"));
}
#endif
return fsbuf;
}
@ -119,15 +118,15 @@ hp_status(const unit * u)
double p = (double) ((double) u->hp / (double) (u->number * unit_max_hp(u)));
if (p > 2.00)
return "sehr stark";
return "dmg_critical";
if (p > 1.50)
return "stark";
return "dmg_heavily";
if (p < 0.50)
return "schwer verwundet";
return "dmg_badly";
if (p < 0.75)
return "verwundet";
return "dmg_wounded";
if (p < 0.99)
return "erschöpft";
return "dmg_exhausted";
return NULL;
}
@ -265,7 +264,7 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
/* status */
if (u->number && (u->faction == f || telepath_see || isbattle)) {
const char * c = hp_status(u);
const char * c = locale_string(f->locale, hp_status(u));
scat(", ");
scat(report_kampfstatus(u, f->locale));
if (c || fval(u, FL_HUNGER)) {
@ -634,7 +633,7 @@ spskill(const struct locale * lang, const struct unit * u, skill_t sk, int *dh,
}
sbuf += sprintf(sbuf, "%d", effskill(u, sk));
#ifndef NOVISIBLESKILLPOINTS
#if SKILLPOINTS
if (days) {
assert(u->number);
sbuf += sprintf(sbuf, " [%d]", d / u->number);
@ -689,11 +688,7 @@ spy_message(int spy, unit *u, unit *target)
{
const char *c;
change_skill(u, SK_SPY, PRODUCEEXP);
sprintf(buf, "%s gelang es, Informationen über ", unitname(u));
scat(unitname(target));
scat(" herauszubekommen: ");
produceexp(u, SK_SPY, u->number);
/* Infos:
* - Kampfstatus
@ -705,6 +700,7 @@ spy_message(int spy, unit *u, unit *target)
*/
/* mit spy=100 (magische Spionage) soll alles herausgefunden werden */
buf[0]='\0';
if (spy > 99){
/* magische Spionage */
/* Zauberwirkungen */
@ -822,13 +818,14 @@ spy_message(int spy, unit *u, unit *target)
{ /* immer */
scat("Kampfstatus: ");
scat(report_kampfstatus(target, u->faction->locale));
c = hp_status(target);
c = locale_string(u->faction->locale, hp_status(target));
if (c && strlen(c))
sprintf(buf, "%s (%s)", buf, c);
scat(".");
}
addmessage(0, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
ADDMSG(&u->faction->msgs, msg_message("spyreport",
"spy target report", u, target, strdup(buf)));
}
const struct unit *

View File

@ -68,6 +68,10 @@ extern void st_register(const ship_type * type);
#define NOSHIP NULL
#define SF_DRIFTED 1<<0
#define SF_MOVED 1<<1
#define SF_DAMAGED 1<<2 /* for use in combat */
typedef struct ship {
struct ship *next;
struct ship *nexthash;
@ -78,11 +82,9 @@ typedef struct ship {
struct attrib * attribs;
int size;
int damage; /* damage in 100th of a point of size */
int flags;
unsigned int flags;
const struct ship_type * type;
direction_t coast;
boolean moved;
boolean drifted;
} ship;
extern void damage_ship(ship *sh, double percent);

View File

@ -103,31 +103,32 @@ locale_getstring(const locale * lang, const char * key)
const char *
locale_string(const locale * lang, const char * key)
{
unsigned int hkey = hashstring(key);
unsigned int id = hkey % SMAXHASH;
struct locale_string * find;
if (key == NULL || *key==0) return NULL;
if (lang == NULL) return key;
find = lang->strings[id];
while (find) {
if (find->hashkey == hkey && !strcmp(key, find->key)) break;
find = find->nexthash;
}
if (!find) {
const char * s = key;
log_warning(("missing translation for \"%s\" in locale %s\n", key, lang->name));
if (lang!=default_locale) {
s = locale_string(default_locale, key);
}
if (s_debug) {
fprintf(s_debug, "%s;%s;%s\n", key, lang->name, s);
fflush(s_debug);
locale_setstring((struct locale*)lang, key, s);
}
return s;
}
if (key==NULL) return NULL;
else {
unsigned int hkey = hashstring(key);
unsigned int id = hkey % SMAXHASH;
struct locale_string * find;
if (key == NULL || *key==0) return NULL;
if (lang == NULL) return key;
find = lang->strings[id];
while (find) {
if (find->hashkey == hkey && !strcmp(key, find->key)) break;
find = find->nexthash;
}
if (!find) {
const char * s = key;
log_warning(("missing translation for \"%s\" in locale %s\n", key, lang->name));
if (lang!=default_locale) {
s = locale_string(default_locale, key);
}
if (s_debug) {
fprintf(s_debug, "%s;%s;%s\n", key, lang->name, s);
fflush(s_debug);
locale_setstring((struct locale*)lang, key, s);
}
return s;
}
return find->str;
}
}

View File

@ -1043,6 +1043,7 @@ fix_demand_region(region *r)
}
for (rl=rlist;rl;rl=rl->next) {
region * r = rl->region;
log_warning(("fixing demand in %s\n", regionname(r, NULL)));
setluxuries(r, mlux[rand() % maxlux]);
}
while (rlist) {
@ -2707,7 +2708,6 @@ korrektur(void)
#endif
do_once("grat", fix_ratfamiliar());
do_once("fdmd", fix_demand());
do_once("fgms", fix_gms());
#if NEW_RESOURCEGROWTH
do_once("rndr", randomized_resources());
@ -2716,6 +2716,10 @@ korrektur(void)
do_once("szip", set_zip());
do_once("heal", heal_all());
/* seems something fishy is going on, do this just
* to be on the safe side:
*/
fix_demand();
/* trade_orders(); */
if (global.data_version < NEWROAD_VERSION) {
newroads();

View File

@ -4543,16 +4543,22 @@
</locale>
</message>
<message name="spyfail">
<message name="spyreport" section="events">
<type>
<arg name="spy" type="unit"></arg>
<arg name="target" type="unit"></arg>
<arg name="report" type="string"></arg>
</type>
<text locale="de">"$unit($spy) gelang es Informationen über $unit(target) herauszubekommen: ${report}."</text>
<text locale="en">"$unit($spy) managed to gather Information about $unit(target): ${report}."</text>
</message>
<message name="spyfail" section="events">
<type>
<arg name="spy" type="unit"></arg>
<arg name="target" type="unit"></arg>
</type>
<locale name="de">
<nr section="events">
<text>"$unit($spy) gelang es nicht, etwas über $unit($target) herauszufinden."</text>
</nr>
</locale>
<text locale="de">"$unit($spy) gelang es nicht, etwas über $unit($target) herauszufinden."</text>
</message>
<message name="stealfail">

View File

@ -3153,5 +3153,26 @@
<text locale="en">dwarf</text>
</string>
<string name="dmg_critical">
<text locale="de">sehr stark</text>
<text locale="en">critically wounded</text>
</string>
<string name="dmg_heavily">
<text locale="de">stark</text>
<text locale="en">heavily wounded</text>
</string>
<string name="dmg_badly">
<text locale="de">schwer verwundet</text>
<text locale="en">badly wounded</text>
</string>
<string name="dmg_wounded">
<text locale="de">verwundet</text>
<text locale="en">wounded</text>
</string>
<string name="dmg_exhausted">
<text locale="de">erschöpft</text>
<text locale="en">exhausted</text>
</string>
</namespace>
</strings>