forked from github/server
The incomplete fspecial functions cause quite a bit of attribute-lookups, so I'm putting them in a #define until they get implemented (if ever).
#define KARMA_MODULE is you want to use fspecial in the future.
This commit is contained in:
parent
da213e5f16
commit
dceb83c6a7
25 changed files with 244 additions and 190 deletions
|
@ -629,8 +629,10 @@ cr_output_unit(FILE * F, const region * r,
|
|||
|
||||
assert(u);
|
||||
|
||||
if(fspecial(u->faction, FS_HIDDEN))
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_HIDDEN))
|
||||
a_fshidden = a_find(u->attribs, &at_fshidden);
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
fprintf(F, "EINHEIT %d\n", u->no);
|
||||
fprintf(F, "\"%s\";Name\n", u->name);
|
||||
|
|
|
@ -226,7 +226,9 @@ add_recruits(unit * u, int number, int wanted)
|
|||
assert(number<=wanted);
|
||||
if (number > 0) {
|
||||
unit * unew;
|
||||
#ifdef KARMA_MODULE
|
||||
int i = fspecial(u->faction, FS_MILITIA);
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
if (u->number==0) {
|
||||
set_number(u, number);
|
||||
|
@ -244,6 +246,7 @@ add_recruits(unit * u, int number, int wanted)
|
|||
change_level(unew, SK_RIDING, 1);
|
||||
}
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if (i > 0) {
|
||||
if (unew->race->bonus[SK_SPEAR] >= 0)
|
||||
change_level(unew, SK_SPEAR, i);
|
||||
|
@ -258,6 +261,7 @@ add_recruits(unit * u, int number, int wanted)
|
|||
if (unew->race->bonus[SK_AUSDAUER] >= 0)
|
||||
change_level(unew, SK_AUSDAUER, i);
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
if (unew!=u) {
|
||||
transfermen(unew, u, unew->number);
|
||||
destroy_unit(unew);
|
||||
|
|
|
@ -2705,9 +2705,11 @@ instant_orders(void)
|
|||
case K_SETSTEALTH:
|
||||
setstealth_cmd(u, ord);
|
||||
break;
|
||||
#ifdef KARMA_MODULE
|
||||
case K_WEREWOLF:
|
||||
setwere_cmd(u, ord);
|
||||
break;
|
||||
#endif /* KARMA_MODULE */
|
||||
case K_STATUS:
|
||||
/* KAEMPFE [ NICHT | AGGRESSIV | DEFENSIV | HINTEN | FLIEHE ] */
|
||||
status_cmd(u, ord);
|
||||
|
@ -2875,7 +2877,6 @@ renumber_factions(void)
|
|||
funhash(f);
|
||||
f->no = rp->want;
|
||||
fhash(f);
|
||||
register_faction_id(rp->want);
|
||||
fset(f, FF_NEWID);
|
||||
}
|
||||
while (renum) {
|
||||
|
@ -3351,18 +3352,23 @@ static int
|
|||
maxunits(const faction *f)
|
||||
{
|
||||
if (global.unitsperalliance == true) {
|
||||
faction *f2;
|
||||
float mult = 1.0;
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
faction *f2;
|
||||
for (f2 = factions; f2; f2 = f2->next) {
|
||||
if (f2->alliance == f->alliance) {
|
||||
mult += 0.4f * fspecial(f2, FS_ADMINISTRATOR);
|
||||
}
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
return (int) (global.maxunits * mult);
|
||||
}
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
return (int) (global.maxunits * (1 + 0.4 * fspecial(f, FS_ADMINISTRATOR)));
|
||||
#else
|
||||
return global.maxunits;
|
||||
#endif /* KARMA_MODULE */
|
||||
}
|
||||
|
||||
static boolean
|
||||
|
@ -3654,16 +3660,19 @@ monthly_healing(void)
|
|||
|
||||
if (u->race->flags & RCF_NOHEAL) continue;
|
||||
if (fval(u, UFL_HUNGER)) continue;
|
||||
if (fspecial(u->faction, FS_UNDEAD)) continue;
|
||||
|
||||
if (fval(r->terrain, SEA_REGION) && u->ship==NULL && !(canswim(u) || canfly(u))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_UNDEAD)) continue;
|
||||
|
||||
if(fspecial(u->faction, FS_REGENERATION)) {
|
||||
u->hp = umhp;
|
||||
continue;
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
p *= heal_factor(u->race);
|
||||
if (u->hp < umhp) {
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
|
||||
#define STANDARD_LUCK 0
|
||||
|
||||
static void
|
||||
|
@ -182,4 +184,4 @@ check_luck(void)
|
|||
lucky_event(f);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* KARMA_MODULE */
|
||||
|
|
|
@ -676,8 +676,11 @@ drown(region *r)
|
|||
unit ** up = up=&r->units;
|
||||
while (*up) {
|
||||
unit *u = *up;
|
||||
int amphibian_level = fspecial(u->faction, FS_AMPHIBIAN);
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
int amphibian_level = fspecial(u->faction, FS_AMPHIBIAN);
|
||||
#else
|
||||
int amphibian_level = 0;
|
||||
#endif
|
||||
if (u->ship || u->race == new_race[RC_SPELL]) {
|
||||
up=&u->next;
|
||||
continue;
|
||||
|
@ -1180,7 +1183,9 @@ icebergs(void)
|
|||
void
|
||||
randomevents(void)
|
||||
{
|
||||
#ifdef KARMA_MODULE
|
||||
faction *f;
|
||||
#endif /* KARMA_MODULE */
|
||||
region *r;
|
||||
building *b, *b2;
|
||||
unit *u;
|
||||
|
@ -1274,10 +1279,11 @@ randomevents(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
/* lycanthropen werden werwölfe */
|
||||
for (f = factions; f; f=f->next) {
|
||||
int level = fspecial(f, FS_LYCANTROPE);
|
||||
if(level > 0) {
|
||||
if (level > 0) {
|
||||
for(u = f->units; u; u=u->nextF) {
|
||||
if(rand()%100 < 2*level) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("becomewere",
|
||||
|
@ -1287,6 +1293,7 @@ randomevents(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Chaos */
|
||||
for (r = regions; r; r = r->next) {
|
||||
|
@ -1324,8 +1331,9 @@ randomevents(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
dissolve_units();
|
||||
check_split();
|
||||
#ifdef KARMA_MODULE
|
||||
check_luck();
|
||||
#endif /* KARMA_MODULE */
|
||||
}
|
||||
|
|
|
@ -1759,12 +1759,13 @@ report_plaintext(const char * filename, report_context * ctx)
|
|||
centre(F, alliancename(f->alliance), true);
|
||||
}
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
buf[0] = 0;
|
||||
dh = 0;
|
||||
for (a=a_find(f->attribs, &at_faction_special); a; a=a->nexttype) {
|
||||
char buf2[80];
|
||||
dh++;
|
||||
if(fspecials[a->data.sa[0]].maxlevel != 100) {
|
||||
if (fspecials[a->data.sa[0]].maxlevel != 100) {
|
||||
sprintf(buf2, "%s (%d)", fspecials[a->data.sa[0]].name, a->data.sa[1]);
|
||||
} else {
|
||||
sprintf(buf2, "%s", fspecials[a->data.sa[0]].name);
|
||||
|
@ -1773,13 +1774,14 @@ report_plaintext(const char * filename, report_context * ctx)
|
|||
strcat(buf, buf2);
|
||||
}
|
||||
if(dh > 0) centre(F, buf, true);
|
||||
dh = 0;
|
||||
|
||||
if (f->karma > 0) {
|
||||
sprintf(buf, "Deine Partei hat %d Karma.", f->karma);
|
||||
centre(F, buf, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
dh = 0;
|
||||
if (f->age <= 2) {
|
||||
if (f->age <= 1) {
|
||||
ADDMSG(&f->msgs, msg_message("changepasswd",
|
||||
|
|
|
@ -118,6 +118,7 @@ spy_cmd(unit * u, struct order * ord)
|
|||
int
|
||||
setwere_cmd(unit *u, struct order * ord)
|
||||
{
|
||||
#ifdef KARMA_MODULE
|
||||
int level = fspecial(u->faction, FS_LYCANTROPE);
|
||||
const char *s;
|
||||
|
||||
|
@ -148,7 +149,7 @@ setwere_cmd(unit *u, struct order * ord)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* KARMA_MODULE */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -158,7 +159,6 @@ setstealth_cmd(unit * u, struct order * ord)
|
|||
const char *s;
|
||||
char level;
|
||||
const race * trace;
|
||||
attrib *a;
|
||||
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
|
@ -264,23 +264,26 @@ setstealth_cmd(unit * u, struct order * ord)
|
|||
/* TARNE ALLES (was nicht so alles geht?) */
|
||||
u_seteffstealth(u, -1);
|
||||
break;
|
||||
#ifdef KARMA_MODULE
|
||||
case P_NUMBER:
|
||||
/* TARNE ANZAHL [NICHT] */
|
||||
if(!fspecial(u->faction, FS_HIDDEN)) {
|
||||
if (!fspecial(u->faction, FS_HIDDEN)) {
|
||||
cmistake(u, ord, 277, MSG_EVENT);
|
||||
return 0;
|
||||
}
|
||||
s = getstrtoken();
|
||||
if (findparam(s, u->faction->locale) == P_NOT) {
|
||||
a = a_find(u->attribs, &at_fshidden);
|
||||
if(a) a->data.ca[0] = 0;
|
||||
if(a->data.i == 0) a_remove(&u->attribs, a);
|
||||
attrib * a = a_find(u->attribs, &at_fshidden);
|
||||
if (a==NULL) a->data.ca[0] = 0;
|
||||
if (a->data.i == 0) a_remove(&u->attribs, a);
|
||||
} else {
|
||||
a = a_find(u->attribs, &at_fshidden);
|
||||
if(!a) a = a_add(&u->attribs, a_new(&at_fshidden));
|
||||
attrib * a = a_find(u->attribs, &at_fshidden);
|
||||
if (a!=NULL) a = a_add(&u->attribs, a_new(&at_fshidden));
|
||||
a->data.ca[0] = 1;
|
||||
}
|
||||
break;
|
||||
#endif /* KARMA_MODULE */
|
||||
#ifdef KARMA_MODULE
|
||||
case P_ITEMS:
|
||||
/* TARNE GEGENSTÄNDE [NICHT] */
|
||||
if(!fspecial(u->faction, FS_HIDDEN)) {
|
||||
|
@ -288,15 +291,16 @@ setstealth_cmd(unit * u, struct order * ord)
|
|||
return 0;
|
||||
}
|
||||
if (findparam(s, u->faction->locale) == P_NOT) {
|
||||
a = a_find(u->attribs, &at_fshidden);
|
||||
if(a) a->data.ca[1] = 0;
|
||||
if(a->data.i == 0) a_remove(&u->attribs, a);
|
||||
attrib * a = a_find(u->attribs, &at_fshidden);
|
||||
if (a!=NULL) a->data.ca[1] = 0;
|
||||
if (a->data.i == 0) a_remove(&u->attribs, a);
|
||||
} else {
|
||||
a = a_find(u->attribs, &at_fshidden);
|
||||
if(!a) a = a_add(&u->attribs, a_new(&at_fshidden));
|
||||
attrib * a = a_find(u->attribs, &at_fshidden);
|
||||
if (a==NULL) a = a_add(&u->attribs, a_new(&at_fshidden));
|
||||
a->data.ca[1] = 1;
|
||||
}
|
||||
break;
|
||||
#endif /* KARMA_MODULE */
|
||||
case P_NOT:
|
||||
u_seteffstealth(u, -1);
|
||||
break;
|
||||
|
|
|
@ -447,7 +447,6 @@ learn(void)
|
|||
int p;
|
||||
magic_t mtyp;
|
||||
int l;
|
||||
int warrior_skill;
|
||||
int studycost;
|
||||
|
||||
/* lernen nach lehren */
|
||||
|
@ -645,18 +644,20 @@ learn(void)
|
|||
change_effect(u, oldpotiontype[P_FOOL], -l);
|
||||
}
|
||||
|
||||
warrior_skill = fspecial(u->faction, FS_WARRIOR);
|
||||
if(warrior_skill > 0) {
|
||||
if(sk == SK_CROSSBOW || sk == SK_LONGBOW
|
||||
#ifdef KARMA_MODULE
|
||||
l = fspecial(u->faction, FS_WARRIOR);
|
||||
if (l > 0) {
|
||||
if (sk == SK_CROSSBOW || sk == SK_LONGBOW
|
||||
|| sk == SK_CATAPULT || sk == SK_MELEE || sk == SK_SPEAR
|
||||
|| sk == SK_AUSDAUER || sk == SK_WEAPONLESS)
|
||||
{
|
||||
teach->value += u->number * (5+warrior_skill*5);
|
||||
teach->value += u->number * 5 * (l+1);
|
||||
} else {
|
||||
teach->value -= u->number * (5+warrior_skill*5);
|
||||
teach->value -= u->number * 5 * (l+1);
|
||||
teach->value = max(0, teach->value);
|
||||
}
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
if (p != studycost) {
|
||||
/* ist_in_gebaeude(r, u, BT_UNIVERSITAET) == 1) { */
|
||||
|
|
|
@ -905,7 +905,6 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
unit *du = df->unit;
|
||||
battle *b = df->side->battle;
|
||||
int heiltrank = 0;
|
||||
int faerie_level;
|
||||
char debugbuf[512];
|
||||
|
||||
/* Schild */
|
||||
|
@ -929,10 +928,12 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
++at.fighter->hits;
|
||||
#endif
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if (fval(au, UFL_WERE)) {
|
||||
int level = fspecial(du->faction, FS_LYCANTROPE);
|
||||
da += level;
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
switch (type) {
|
||||
case AT_STANDARD:
|
||||
|
@ -964,11 +965,14 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
/* magische Rüstung durch Artefakte oder Sprüche */
|
||||
/* Momentan nur Trollgürtel und Werwolf-Eigenschaft */
|
||||
am = select_magicarmor(dt);
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if(fval(du, UFL_WERE)) {
|
||||
/* this counts as magical armor */
|
||||
int level = fspecial(du->faction, FS_LYCANTROPE);
|
||||
am += level;
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
#if CHANGED_CROSSBOWS == 1
|
||||
if(awtype && fval(awtype,WTF_ARMORPIERCING)) {
|
||||
|
@ -989,6 +993,22 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
if (type!=AT_COMBATSPELL && type!=AT_SPELL) {
|
||||
/* Kein Zauber, normaler Waffenschaden */
|
||||
double kritchance = (sk * 3 - sd) / 200.0;
|
||||
#ifdef KARMA_MODULE
|
||||
int faerie_level = fspecial(du->faction, FS_FAERIE);
|
||||
|
||||
da += jihad(au->faction, du->race);
|
||||
if (type == AT_STANDARD && faerie_level) {
|
||||
int c;
|
||||
|
||||
for (c=0;weapon->type->itype->construction->materials[c].number; c++) {
|
||||
if(weapon->type->itype->construction->materials[c].rtype == oldresourcetype[R_IRON]) {
|
||||
da += faerie_level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
kritchance = max(kritchance, 0.005);
|
||||
kritchance = min(0.9, kritchance);
|
||||
|
||||
|
@ -1000,20 +1020,6 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
}
|
||||
|
||||
da += rc_specialdamage(au->race, du->race, awtype);
|
||||
#ifdef KARMA_MODULE
|
||||
da += jihad(au->faction, du->race);
|
||||
#endif
|
||||
faerie_level = fspecial(du->faction, FS_FAERIE);
|
||||
if (type == AT_STANDARD && faerie_level) {
|
||||
int c;
|
||||
|
||||
for (c=0;weapon->type->itype->construction->materials[c].number; c++) {
|
||||
if(weapon->type->itype->construction->materials[c].rtype == oldresourcetype[R_IRON]) {
|
||||
da += faerie_level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (awtype!=NULL && fval(awtype, WTF_MISSILE)) {
|
||||
/* Fernkampfschadenbonus */
|
||||
|
@ -1615,10 +1621,12 @@ skilldiff(troop at, troop dt, int dist)
|
|||
skdiff += 5;
|
||||
}
|
||||
|
||||
/* Werwolf */
|
||||
if(fval(au, UFL_WERE)) {
|
||||
#ifdef KARMA_MODULE
|
||||
/* Werwolf */
|
||||
if(fval(au, UFL_WERE)) {
|
||||
skdiff += fspecial(au->faction, FS_LYCANTROPE);
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
if (au->race == new_race[RC_GOBLIN] &&
|
||||
af->side->size[SUM_ROW] >= df->side->size[SUM_ROW] * 10)
|
||||
|
@ -1640,13 +1648,16 @@ skilldiff(troop at, troop dt, int dist)
|
|||
init=true;
|
||||
}
|
||||
if (df->building->type->flags & BTF_PROTECTION) {
|
||||
if(fspecial(au->faction, FS_SAPPER)) {
|
||||
int beff = buildingeffsize(df->building, false)-1;
|
||||
/* -1 because the tradepost has no protection value */
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(au->faction, FS_SAPPER)) {
|
||||
/* Halbe Schutzwirkung, aufgerundet */
|
||||
/* -1 because the tradepost has no protection value */
|
||||
skdiff -= (buildingeffsize(df->building, false)-1+1)/2;
|
||||
} else {
|
||||
skdiff -= buildingeffsize(df->building, false)-1;
|
||||
beff = (beff+1)/2;
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
skdiff -= beff;
|
||||
is_protected = 2;
|
||||
}
|
||||
if (strongwall_ct) {
|
||||
|
@ -2342,14 +2353,16 @@ aftermath(battle * b)
|
|||
fighter *df = *fi;
|
||||
unit *du = df->unit;
|
||||
int dead = du->number - df->alive - df->run.number;
|
||||
const attrib *a;
|
||||
int pr_mercy = 0;
|
||||
#ifdef KARMA_MODULE
|
||||
const attrib *a;
|
||||
|
||||
for (a = a_find(du->attribs, &at_prayer_effect); a; a = a->nexttype) {
|
||||
if (a->data.sa[0] == PR_MERCY) {
|
||||
pr_mercy = a->data.sa[1];
|
||||
}
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
#ifdef TROLLSAVE
|
||||
/* Trolle können regenerieren */
|
||||
|
@ -2900,12 +2913,14 @@ make_fighter(battle * b, unit * u, side * s1, boolean attack)
|
|||
/* Effekte von Artefakten */
|
||||
strongmen = min(fig->unit->number, get_item(u, I_TROLLBELT));
|
||||
|
||||
for (a = a_find(u->attribs, &at_prayer_effect); a; a = a->nexttype) {
|
||||
#ifdef KARMA_MODULE
|
||||
for (a = a_find(u->attribs, &at_prayer_effect); a; a = a->nexttype) {
|
||||
if (a->data.sa[0] == PR_AID) {
|
||||
pr_aid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
/* Hitpoints, Attack- und Defence-Boni für alle Personen */
|
||||
for (i = 0; i < fig->alive; i++) {
|
||||
|
@ -3916,16 +3931,18 @@ do_battle(void)
|
|||
do_attack(fig);
|
||||
}
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
/* Regeneration */
|
||||
for (fi = b->fighters.begin; fi != b->fighters.end; ++fi) {
|
||||
fighter *fig = *fi;
|
||||
|
||||
if(fspecial(fig->unit->faction, FS_REGENERATION)) {
|
||||
if (fspecial(fig->unit->faction, FS_REGENERATION)) {
|
||||
fig->fighting = fig->alive - fig->removed;
|
||||
if(fig->fighting == 0) continue;
|
||||
do_regenerate(fig);
|
||||
}
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
|
|
@ -530,7 +530,9 @@ max_skill(faction * f, skill_t sk)
|
|||
m = MAXMAGICIANS;
|
||||
}
|
||||
if (f->race == new_race[RC_ELF]) m += 1;
|
||||
#ifdef KARMA_MODULE
|
||||
m += fspecial(f, FS_MAGOCRACY) * 2;
|
||||
#endif /* KARMA_MODULE */
|
||||
break;
|
||||
case SK_ALCHEMY:
|
||||
m = MAXALCHEMISTS;
|
||||
|
@ -1166,38 +1168,42 @@ static attrib_type at_lighthouse = {
|
|||
void
|
||||
update_lighthouse(building * lh)
|
||||
{
|
||||
region * r = lh->region;
|
||||
short d = (short)log10(lh->size) + 1;
|
||||
short x, y;
|
||||
static boolean init_lighthouse = false;
|
||||
static const struct building_type * bt_lighthouse = 0;
|
||||
|
||||
if (!init_lighthouse) {
|
||||
bt_lighthouse = bt_find("lighthouse");
|
||||
if (bt_lighthouse==NULL) return;
|
||||
init_lighthouse = true;
|
||||
}
|
||||
|
||||
if (bt_lighthouse==NULL || lh->type!=bt_lighthouse) return;
|
||||
if (lh->type==bt_lighthouse) {
|
||||
region * r = lh->region;
|
||||
short d = (short)log10(lh->size) + 1;
|
||||
short x;
|
||||
|
||||
for (x=-d;x<=d;++x) {
|
||||
short y;
|
||||
for (y=-d;y<=d;++y) {
|
||||
attrib * a;
|
||||
region * r2 = findregion(x+r->x, y+r->y);
|
||||
if (r2==NULL) continue;
|
||||
if (!fval(r2->terrain, SEA_REGION)) continue;
|
||||
if (distance(r, r2) > d) continue;
|
||||
a = a_find(r2->attribs, &at_lighthouse);
|
||||
while (a) {
|
||||
building * b = (building*)a->data.v;
|
||||
if (b==lh) break;
|
||||
a=a->nexttype;
|
||||
}
|
||||
if (!a) {
|
||||
a = a_add(&r2->attribs, a_new(&at_lighthouse));
|
||||
a->data.v = (void*)lh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (x=-d;x<=d;++x) {
|
||||
for (y=-d;y<=d;++y) {
|
||||
attrib * a;
|
||||
region * r2 = findregion(x+r->x, y+r->y);
|
||||
if (r2==NULL) continue;
|
||||
if (!fval(r2->terrain, SEA_REGION)) continue;
|
||||
if (distance(r, r2) > d) continue;
|
||||
a = a_find(r2->attribs, &at_lighthouse);
|
||||
while (a) {
|
||||
building * b = (building*)a->data.v;
|
||||
if (b==lh) break;
|
||||
a=a->nexttype;
|
||||
}
|
||||
if (!a) {
|
||||
a = a_add(&r2->attribs, a_new(&at_lighthouse));
|
||||
a->data.v = (void*)lh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -2549,38 +2555,17 @@ remove_empty_units(void)
|
|||
}
|
||||
}
|
||||
|
||||
int *used_faction_ids = NULL;
|
||||
int no_used_faction_ids = 0;
|
||||
|
||||
static int
|
||||
_cmp_int(const void *i1, const void *i2)
|
||||
{
|
||||
if(i2==NULL)
|
||||
return(*(int*)i1);
|
||||
return (*(int*)i1 - *(int *)i2);
|
||||
}
|
||||
|
||||
void
|
||||
register_faction_id(int id)
|
||||
{
|
||||
no_used_faction_ids++;
|
||||
used_faction_ids = realloc(used_faction_ids, no_used_faction_ids*sizeof(int));
|
||||
used_faction_ids[no_used_faction_ids-1] = id;
|
||||
if(no_used_faction_ids > 1)
|
||||
qsort(used_faction_ids, (size_t)no_used_faction_ids, sizeof(int), _cmp_int);
|
||||
}
|
||||
|
||||
boolean
|
||||
faction_id_is_unused(int id)
|
||||
{
|
||||
return findfaction(id)==NULL;
|
||||
return findfaction(id)==NULL && id!=MONSTER_FACTION;
|
||||
}
|
||||
|
||||
int
|
||||
weight(const unit * u)
|
||||
{
|
||||
int w, n = 0, in_bag = 0;
|
||||
int faerie_level;
|
||||
int faerie_level = 0;
|
||||
|
||||
item * itm;
|
||||
for (itm=u->items;itm;itm=itm->next) {
|
||||
|
@ -2590,7 +2575,10 @@ weight(const unit * u)
|
|||
in_bag += w;
|
||||
}
|
||||
|
||||
faerie_level = fspecial(u->faction, FS_FAERIE);
|
||||
#ifdef KARMA_MODULE
|
||||
faerie_level = fspecial(u->faction, FS_FAERIE);
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
if (faerie_level) {
|
||||
n += (u->number * u->race->weight)/(1+faerie_level);
|
||||
} else {
|
||||
|
@ -2605,18 +2593,6 @@ weight(const unit * u)
|
|||
return n;
|
||||
}
|
||||
|
||||
void
|
||||
init_used_faction_ids(void)
|
||||
{
|
||||
faction *f;
|
||||
|
||||
no_used_faction_ids = 0;
|
||||
for(f = factions; f; f = f->next) {
|
||||
register_faction_id(f->no);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
make_undead_unit(unit * u)
|
||||
{
|
||||
|
@ -2683,14 +2659,15 @@ lifestyle(const unit * u)
|
|||
if(u->region->planep && fval(u->region->planep, PFL_NOFEED))
|
||||
return 0;
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if(fspecial(u->faction, FS_REGENERATION))
|
||||
need += 1;
|
||||
if(fspecial(u->faction, FS_ADMINISTRATOR))
|
||||
need += 1;
|
||||
if(fspecial(u->faction, FS_WYRM) && u->race == new_race[RC_WYRM])
|
||||
need *= 500;
|
||||
|
||||
return need;
|
||||
#endif /* KARMA_MODULE */
|
||||
return need;
|
||||
}
|
||||
|
||||
boolean
|
||||
|
@ -2812,9 +2789,11 @@ default_wage(const region *r, const faction * f, const race * rc)
|
|||
index = 1;
|
||||
}
|
||||
wage = wagetable[esize][index];
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(f, FS_URBAN)) {
|
||||
wage += wagetable[esize][3];
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
} else {
|
||||
if (fval(r->terrain, SEA_REGION)) {
|
||||
wage = 11;
|
||||
|
@ -3121,10 +3100,15 @@ attrib_init(void)
|
|||
at_register(&at_icastle);
|
||||
at_register(&at_guard);
|
||||
at_register(&at_group);
|
||||
at_register(&at_faction_special);
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
at_register(&at_faction_special);
|
||||
at_register(&at_prayer_timeout);
|
||||
at_register(&at_wyrm);
|
||||
at_register(&at_building_generic_type);
|
||||
at_register(&at_jihad);
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
at_register(&at_building_generic_type);
|
||||
at_register(&at_maxmagicians);
|
||||
at_register(&at_npcfaction);
|
||||
|
||||
|
@ -3136,7 +3120,6 @@ attrib_init(void)
|
|||
register_bordertype(&bt_road);
|
||||
register_bordertype(&bt_questportal);
|
||||
|
||||
at_register(&at_jihad);
|
||||
at_register(&at_germs);
|
||||
at_register(&at_laen); /* required for old datafiles */
|
||||
#ifdef XECMD_MODULE
|
||||
|
|
|
@ -848,9 +848,6 @@ extern int turn;
|
|||
extern int quiet;
|
||||
|
||||
/* parteinummern */
|
||||
extern int *used_faction_ids;
|
||||
extern int no_used_faction_ids;
|
||||
extern void register_faction_id(int id);
|
||||
extern boolean faction_id_is_unused(int);
|
||||
|
||||
/* leuchtturm */
|
||||
|
|
|
@ -87,7 +87,7 @@ unused_faction_id(void)
|
|||
{
|
||||
int id = rand()%MAX_FACTION_ID;
|
||||
|
||||
while(!faction_id_is_unused(id)) {
|
||||
while (!faction_id_is_unused(id)) {
|
||||
id++; if(id == MAX_FACTION_ID) id = 0;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,6 @@ addfaction(const char *email, const char * password,
|
|||
f->options = Pow(O_REPORT) | Pow(O_ZUGVORLAGE) | Pow(O_SILBERPOOL) | Pow(O_COMPUTER) | Pow(O_COMPRESS) | Pow(O_ADRESSEN) | Pow(O_STATISTICS);
|
||||
|
||||
f->no = unused_faction_id();
|
||||
register_faction_id(f->no);
|
||||
addlist(&factions, f);
|
||||
fhash(f);
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@ typedef struct faction {
|
|||
int num_total; /* Anzahl Personen mit Monstern */
|
||||
int options;
|
||||
int no_units;
|
||||
int karma;
|
||||
struct ally *allies;
|
||||
struct group *groups;
|
||||
boolean alive; /* enno: sollte ein flag werden */
|
||||
|
@ -84,6 +83,9 @@ typedef struct faction {
|
|||
int money;
|
||||
#ifdef SCORE_MODULE
|
||||
int score;
|
||||
#endif
|
||||
#ifdef KARMA_MODULE
|
||||
int karma;
|
||||
#endif
|
||||
struct alliance * alliance;
|
||||
#ifdef VICTORY_DELAY
|
||||
|
|
|
@ -68,6 +68,7 @@ attrib_type at_jihad = {
|
|||
"jihad", NULL, NULL, NULL, a_writeshorts, a_readshorts
|
||||
};
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
struct fspecialdata fspecials[MAXFACTIONSPECIALS] = {
|
||||
{
|
||||
"Regeneration",
|
||||
|
@ -352,13 +353,11 @@ buy_special(unit *u, struct order * ord, fspecial_t special)
|
|||
int
|
||||
fspecial(const faction *f, fspecial_t special)
|
||||
{
|
||||
#ifdef KARMA_MODULE
|
||||
attrib *a;
|
||||
|
||||
for(a=a_find(f->attribs, &at_faction_special); a; a=a->nexttype) {
|
||||
for (a=a_find(f->attribs, &at_faction_special); a; a=a->nexttype) {
|
||||
if(a->data.sa[0] == special) return a->data.sa[1];
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -604,3 +603,4 @@ karma(void)
|
|||
parse(K_SETJIHAD, jihad_cmd, false);
|
||||
parse(K_SACRIFICE, sacrifice_cmd, true);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct faction;
|
||||
|
||||
typedef enum {
|
||||
FS_REGENERATION,
|
||||
FS_URBAN,
|
||||
|
@ -44,18 +42,18 @@ typedef enum {
|
|||
MAXFACTIONSPECIALS
|
||||
} fspecial_t;
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
typedef enum {
|
||||
PR_AID,
|
||||
PR_MERCY,
|
||||
MAXPRAYEREFFECTS
|
||||
} prayereffect_t;
|
||||
|
||||
typedef struct fspecialdata fspecialdata;
|
||||
struct fspecialdata {
|
||||
typedef struct fspecialdata {
|
||||
const char *name;
|
||||
const char *description;
|
||||
const short maxlevel;
|
||||
};
|
||||
} fspecialdata;
|
||||
|
||||
extern struct attrib_type at_faction_special;
|
||||
extern struct attrib_type at_prayer_timeout;
|
||||
|
@ -67,7 +65,6 @@ extern struct attrib_type at_jihad;
|
|||
extern struct fspecialdata fspecials[];
|
||||
|
||||
extern int fspecial(const struct faction *f, fspecial_t special);
|
||||
#ifdef KARMA_MODULE
|
||||
extern void karma(void);
|
||||
extern int jihad(struct faction *, const struct race *);
|
||||
extern void jihad_attacks(void);
|
||||
|
|
|
@ -418,9 +418,12 @@ updatespelllist(unit * u)
|
|||
|
||||
/* Nur Wyrm-Magier bekommen den Wyrmtransformationszauber */
|
||||
sp = find_spellbyid(M_GRAU, SPL_BECOMEWYRM);
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_WYRM) && !has_spell(u, sp) && sp->level<=sk) {
|
||||
add_spell(mage, find_spellbyid(M_GRAU, SPL_BECOMEWYRM));
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
/* Transformierte Wyrm-Magier bekommen Drachenodem */
|
||||
if (dragonrace(u->race)) {
|
||||
|
@ -1147,33 +1150,34 @@ magic_resistance(unit *target)
|
|||
boolean
|
||||
target_resists_magic(unit *magician, void *obj, int objtyp, int t_bonus)
|
||||
{
|
||||
double probability = 0.0;
|
||||
double probability = 0.0;
|
||||
|
||||
if (magician == NULL) return true;
|
||||
if (obj == NULL) return true;
|
||||
if (magician == NULL) return true;
|
||||
if (obj == NULL) return true;
|
||||
|
||||
switch(objtyp) {
|
||||
case TYP_UNIT:
|
||||
{
|
||||
int at, pa = 0;
|
||||
skill * sv;
|
||||
switch(objtyp) {
|
||||
case TYP_UNIT:
|
||||
{
|
||||
int at, pa = 0;
|
||||
skill * sv;
|
||||
unit * u = (unit*)obj;
|
||||
|
||||
if (fspecial(u->faction, FS_MAGICIMMUNE)) return true;
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_MAGICIMMUNE)) return true;
|
||||
#endif /* KARMA_MODULE */
|
||||
at = effskill(magician, SK_MAGIC);
|
||||
|
||||
at = effskill(magician, SK_MAGIC);
|
||||
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||
int sk = effskill(u, sv->id);
|
||||
if (pa < sk) pa = sk;
|
||||
}
|
||||
|
||||
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||
int sk = effskill(u, sv->id);
|
||||
if (pa < sk) pa = sk;
|
||||
}
|
||||
/* Contest */
|
||||
probability = 0.05 * (10 + pa - at);
|
||||
|
||||
/* Contest */
|
||||
probability = 0.05 * (10 + pa - at);
|
||||
|
||||
probability += magic_resistance((unit *)obj);
|
||||
break;
|
||||
}
|
||||
probability += magic_resistance((unit *)obj);
|
||||
break;
|
||||
}
|
||||
|
||||
case TYP_REGION:
|
||||
/* Bonus durch Zauber */
|
||||
|
@ -1396,9 +1400,11 @@ regeneration(unit * u)
|
|||
double potenz = 1.5;
|
||||
double divisor = 2.0;
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_MAGICIMMUNE)) return 0;
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
sk = effskill(u, SK_MAGIC);
|
||||
sk = effskill(u, SK_MAGIC);
|
||||
/* Rassenbonus/-malus */
|
||||
d = (int)(pow(sk, potenz) * u->race->regaura / divisor);
|
||||
d++;
|
||||
|
|
|
@ -210,8 +210,10 @@ personcapacity(const unit *u)
|
|||
{
|
||||
int cap = u->race->weight+u->race->capacity;
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_QUICK))
|
||||
cap -= 200;
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
return cap;
|
||||
}
|
||||
|
@ -391,8 +393,9 @@ canswim(unit *u)
|
|||
if (get_item(u, I_DOLPHIN) >= u->number && effskill(u, SK_RIDING) >= 4)
|
||||
return true;
|
||||
|
||||
if(fspecial(u->faction, FS_AMPHIBIAN)) return true;
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_AMPHIBIAN)) return true;
|
||||
#endif /* KARMA_MODULE */
|
||||
if (u->race->flags & RCF_FLY) return true;
|
||||
|
||||
if (u->race->flags & RCF_SWIM) return true;
|
||||
|
@ -1259,8 +1262,10 @@ movement_speed(unit * u)
|
|||
|
||||
default:
|
||||
mp = BP_WALKING;
|
||||
#ifdef KARMA_MODULE
|
||||
/* faction special */
|
||||
if (fspecial(u->faction, FS_QUICK)) mp = BP_RIDING;
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
/* Siebenmeilentee */
|
||||
if (!fval(u->region->terrain, SEA_REGION) && get_effect(u, oldpotiontype[P_FAST]) >= u->number) {
|
||||
|
|
|
@ -207,9 +207,11 @@ unit_max_hp(const unit * u)
|
|||
p = pow(effskill(u, SK_AUSDAUER) / 2.0, 1.5) * 0.2;
|
||||
h += (int) (h * p + 0.5);
|
||||
|
||||
if(fspecial(u->faction, FS_UNDEAD)) {
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_UNDEAD)) {
|
||||
h *= 2;
|
||||
}
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
/* der healing curse verändert die maximalen hp */
|
||||
if (heal_ct) {
|
||||
|
|
|
@ -203,7 +203,7 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
|
|||
const char *pzTmp;
|
||||
building * b;
|
||||
boolean isbattle = (boolean)(mode == see_battle);
|
||||
int telepath_see = fspecial(f, FS_TELEPATHY);
|
||||
int telepath_see = 0;
|
||||
attrib *a_fshidden = NULL;
|
||||
item * itm;
|
||||
item * show;
|
||||
|
@ -222,8 +222,12 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
|
|||
itemcloak = curse_active(get_curse(u->attribs, itemcloak_ct));
|
||||
}
|
||||
|
||||
if (fspecial(u->faction, FS_HIDDEN))
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_HIDDEN)) {
|
||||
a_fshidden = a_find(u->attribs, &at_fshidden);
|
||||
}
|
||||
telepath_see = fspecial(f, FS_TELEPATHY);
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
rsize = strlcpy(bufp, unitname(u), size);
|
||||
if (rsize>size) rsize = size-1;
|
||||
|
|
|
@ -1528,7 +1528,14 @@ readfaction(FILE * F)
|
|||
convertunique(f);
|
||||
#endif
|
||||
f->magiegebiet = (magic_t)ri(F);
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
f->karma = ri(F);
|
||||
#else
|
||||
/* ignore karma */
|
||||
ri(F);
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
f->flags = ri(F);
|
||||
freset(f, FFL_OVERRIDE);
|
||||
|
||||
|
@ -1620,7 +1627,12 @@ writefaction(FILE * F, const faction * f)
|
|||
ws(F, f->race->_name[0]);
|
||||
wnl(F);
|
||||
wi(F, f->magiegebiet);
|
||||
#ifdef KARMA_MODULE
|
||||
wi(F, f->karma);
|
||||
#else
|
||||
wi(F, 0);
|
||||
#endif /* KARMA_MODULE */
|
||||
|
||||
wi(F, f->flags);
|
||||
a_write(F, f->attribs);
|
||||
wnl(F);
|
||||
|
@ -1663,7 +1675,7 @@ readgame(const char * filename, int backup)
|
|||
faction *f, **fp;
|
||||
region *r;
|
||||
building *b, **bp;
|
||||
ship *sh, **shp;
|
||||
ship **shp;
|
||||
unit *u;
|
||||
FILE * F;
|
||||
int rmax = maxregions;
|
||||
|
@ -1752,18 +1764,18 @@ readgame(const char * filename, int backup)
|
|||
|
||||
while (--n >= 0) {
|
||||
faction * f = readfaction(F);
|
||||
addlist2(fp, f);
|
||||
|
||||
*fp = f;
|
||||
fp = &f->next;
|
||||
fhash(f);
|
||||
}
|
||||
*fp = 0;
|
||||
|
||||
/* Benutzte Faction-Ids */
|
||||
|
||||
no_used_faction_ids = ri(F);
|
||||
/* used_faction_ids = gc_add(malloc(no_used_faction_ids*sizeof(int))); */
|
||||
used_faction_ids = malloc(no_used_faction_ids*sizeof(int));
|
||||
for(i=0; i < no_used_faction_ids; i++) {
|
||||
used_faction_ids[i] = ri(F);
|
||||
i = ri(F);
|
||||
while (i--) {
|
||||
ri(F); /* used faction ids. ignore. */
|
||||
}
|
||||
|
||||
/* Regionen */
|
||||
|
@ -1795,7 +1807,7 @@ readgame(const char * filename, int backup)
|
|||
if (dirtyload) break;
|
||||
skip = true;
|
||||
}
|
||||
if ((n%1024)==0) { /* das spart extrem Zeit */
|
||||
if ((n & 0x3FF) == 0) { /* das spart extrem Zeit */
|
||||
printf(" - Einzulesende Regionen: %d/%d ", rmax, n);
|
||||
printf("* %d,%d \r", x, y);
|
||||
}
|
||||
|
@ -1818,6 +1830,8 @@ readgame(const char * filename, int backup)
|
|||
|
||||
b = (building *) calloc(1, sizeof(building));
|
||||
b->no = rid(F);
|
||||
*bp = b;
|
||||
bp = &b->next;
|
||||
bhash(b);
|
||||
rds(F, &b->name);
|
||||
if (lomem) rds(F, 0);
|
||||
|
@ -1837,7 +1851,6 @@ readgame(const char * filename, int backup)
|
|||
}
|
||||
b->region = r;
|
||||
a_read(F, &b->attribs);
|
||||
addlist2(bp, b);
|
||||
}
|
||||
/* Schiffe */
|
||||
|
||||
|
@ -1845,10 +1858,11 @@ readgame(const char * filename, int backup)
|
|||
shp = &r->ships;
|
||||
|
||||
while (--p >= 0) {
|
||||
sh = (ship *) calloc(1, sizeof(ship));
|
||||
|
||||
ship * sh = (ship *) calloc(1, sizeof(ship));
|
||||
sh->region = r;
|
||||
sh->no = rid(F);
|
||||
*shp = sh;
|
||||
shp = &sh->next;
|
||||
shash(sh);
|
||||
rds(F, &sh->name);
|
||||
if (lomem) rds(F, 0);
|
||||
|
@ -1868,8 +1882,6 @@ readgame(const char * filename, int backup)
|
|||
|
||||
sh->coast = (direction_t)ri(F);
|
||||
a_read(F, &sh->attribs);
|
||||
|
||||
addlist2(shp, sh);
|
||||
}
|
||||
|
||||
*shp = 0;
|
||||
|
@ -1882,9 +1894,12 @@ readgame(const char * filename, int backup)
|
|||
while (--p >= 0) {
|
||||
unit * u = readunit(F);
|
||||
sc_mage * mage;
|
||||
|
||||
assert(u->region==NULL);
|
||||
u->region = r;
|
||||
addlist2(up,u);
|
||||
*up = u;
|
||||
up = &u->next;
|
||||
|
||||
update_interval(u->faction, u->region);
|
||||
mage = get_mage(u);
|
||||
if (mage && mage->spellcount<0) {
|
||||
|
@ -1943,7 +1958,7 @@ int
|
|||
writegame(const char *filename, char quiet)
|
||||
{
|
||||
char *base;
|
||||
int i,n;
|
||||
int n;
|
||||
faction *f;
|
||||
region *r;
|
||||
building *b;
|
||||
|
@ -2035,14 +2050,7 @@ writegame(const char *filename, char quiet)
|
|||
writefaction(F, f);
|
||||
}
|
||||
|
||||
wi(F, no_used_faction_ids);
|
||||
wnl(F);
|
||||
|
||||
for(i=0; i<no_used_faction_ids; i++) {
|
||||
wi(F, used_faction_ids[i]);
|
||||
wnl(F);
|
||||
}
|
||||
|
||||
wi(F, 0); /* used faction ids. old stuff */
|
||||
wnl(F);
|
||||
|
||||
/* Write regions */
|
||||
|
|
|
@ -1124,6 +1124,7 @@ get_modifier(const unit *u, skill_t sk, int level, const region *r, boolean noit
|
|||
}
|
||||
skill = skillmod(u->attribs, u, r, sk, skill, SMF_ALWAYS);
|
||||
|
||||
#ifdef KARMA_MODULE
|
||||
if (fspecial(u->faction, FS_TELEPATHY)) {
|
||||
switch(sk) {
|
||||
case SK_ALCHEMY:
|
||||
|
@ -1137,6 +1138,7 @@ get_modifier(const unit *u, skill_t sk, int level, const region *r, boolean noit
|
|||
skill -= 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HUNGER_REDUCES_SKILL
|
||||
if (fval(u, UFL_HUNGER)) {
|
||||
|
|
|
@ -7046,14 +7046,15 @@ sp_destroy_curse(castorder *co)
|
|||
int
|
||||
sp_becomewyrm(castorder *co)
|
||||
{
|
||||
#ifdef KARMA_MODULE
|
||||
unit *u = co->magician.u;
|
||||
int wyrms_already_created = 0;
|
||||
int wyrms_allowed;
|
||||
int wyrms_allowed = 0;
|
||||
attrib *a;
|
||||
|
||||
wyrms_allowed = fspecial(u->faction, FS_WYRM);
|
||||
a = a_find(u->faction->attribs, &at_wyrm);
|
||||
if(a) wyrms_already_created = a->data.i;
|
||||
if (a) wyrms_already_created = a->data.i;
|
||||
|
||||
if(wyrms_already_created >= wyrms_allowed) {
|
||||
cmistake(u, co->order, 262, MSG_MAGIC);
|
||||
|
@ -7073,6 +7074,9 @@ sp_becomewyrm(castorder *co)
|
|||
ADDMSG(&u->faction->msgs, msg_message("becomewyrm", "u", u));
|
||||
|
||||
return co->level;
|
||||
#else
|
||||
return 0;
|
||||
#endif /* KARMA_MODULE */
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
|
|
@ -310,7 +310,6 @@ game_done(void)
|
|||
faction *f, *f2;
|
||||
ship *s, *s2;
|
||||
|
||||
free(used_faction_ids);
|
||||
for (r = regions; r; r = r2) {
|
||||
for (u = r->units; u; u = u2) {
|
||||
u2 = u->next;
|
||||
|
|
|
@ -356,8 +356,6 @@ game_done(void)
|
|||
* nicht freigegebenem Speicher sucht, der nicht bis zum Ende benötigt
|
||||
* wird (temporäre Hilsstrukturen) */
|
||||
|
||||
free(used_faction_ids);
|
||||
|
||||
while (regions) {
|
||||
region *r = regions;
|
||||
regions = r->next;
|
||||
|
|
|
@ -1525,7 +1525,6 @@ makemonsters(void)
|
|||
factions=f;
|
||||
f->options = Pow(O_REPORT);
|
||||
f->no=MONSTER_FACTION;
|
||||
register_faction_id(f->no);
|
||||
f->subscription = 0;
|
||||
f->name=strdup("Monster");
|
||||
f->passw=strdup("abc123");
|
||||
|
|
Loading…
Reference in a new issue