curse-flags funktionieren jetzt anders, und koennen per curse-type gesetzt werden so dass der spell es nicht tun muss, aber dann vom spell ueberschrieben werden (passiert per XOR).

This commit is contained in:
Enno Rehling 2007-04-21 23:04:24 +00:00
parent 8d804fecdb
commit af0a7b225a
17 changed files with 108 additions and 117 deletions

View file

@ -81,7 +81,7 @@ use_speedsail(struct unit * u, const struct item_type * itype, int amount, struc
effect.i = SPEEDSAIL_EFFECT; effect.i = SPEEDSAIL_EFFECT;
c = create_curse(u, &sh->attribs, ct_find("shipspeedup"), 20, INT_MAX, effect, 0); c = create_curse(u, &sh->attribs, ct_find("shipspeedup"), 20, INT_MAX, effect, 0);
curse_setflag(c, CURSE_NOAGE); c_setflag(c, CURSE_NOAGE);
ADDMSG(&u->faction->msgs, msg_message("use_speedsail", "unit speed", u, SPEEDSAIL_EFFECT)); ADDMSG(&u->faction->msgs, msg_message("use_speedsail", "unit speed", u, SPEEDSAIL_EFFECT));
itype->rtype->uchange(u, itype->rtype, -1); itype->rtype->uchange(u, itype->rtype, -1);
@ -131,7 +131,7 @@ use_antimagiccrystal(unit * u, const struct item_type * itype, int amount, struc
c = (curse*)a->data.v; c = (curse*)a->data.v;
/* Immunität prüfen */ /* Immunität prüfen */
if (c->flag & CURSE_IMMUNE) { if (c_flags(c) & CURSE_IMMUNE) {
do { ap = &(*ap)->next; } while (*ap && a->type==(*ap)->type); do { ap = &(*ap)->next; } while (*ap && a->type==(*ap)->type);
continue; continue;
} }
@ -143,7 +143,7 @@ use_antimagiccrystal(unit * u, const struct item_type * itype, int amount, struc
if(*ap) ap = &(*ap)->next; if(*ap) ap = &(*ap)->next;
} }
if(force > 0) { if (force > 0) {
variant var ; variant var ;
var.i = effect; var.i = effect;
create_curse(u, &r->attribs, ct_find("antimagiczone"), force, duration, var, 0); create_curse(u, &r->attribs, ct_find("antimagiczone"), force, duration, var, 0);

View file

@ -3116,7 +3116,7 @@ ageing(void)
if (is_cursed(u->attribs, C_OLDRACE, 0)){ if (is_cursed(u->attribs, C_OLDRACE, 0)){
curse *c = get_curse(u->attribs, ct_find("oldrace")); curse *c = get_curse(u->attribs, ct_find("oldrace"));
if (c->duration == 1 && !(c->flag & CURSE_NOAGE)) { if (c->duration == 1 && !(c_flags(c) & CURSE_NOAGE)) {
u->race = new_race[curse_geteffect(c)]; u->race = new_race[curse_geteffect(c)];
u->irace = new_race[curse_geteffect(c)]; u->irace = new_race[curse_geteffect(c)];
} }

View file

@ -1131,8 +1131,10 @@ spawn_undead(void)
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
int unburied = deathcount(r); int unburied = deathcount(r);
static const curse_type * ctype = NULL;
if (is_cursed(r->attribs, C_HOLYGROUND, 0)) continue; if (!ctype) ctype = ct_find("holyground");
if (ctype && curse_active(get_curse(r->attribs, ctype))) continue;
/* Chance 0.1% * chaosfactor */ /* Chance 0.1% * chaosfactor */
if (r->land && unburied > r->land->peasants / 20 && rng_int() % 10000 < (100 + 100 * chaosfactor(r))) { if (r->land && unburied > r->land->peasants / 20 && rng_int() % 10000 < (100 + 100 * chaosfactor(r))) {

View file

@ -1204,7 +1204,7 @@ buildingmaintenance(const building * b, const resource_type * rtype)
int c, cost=0; int c, cost=0;
static boolean init = false; static boolean init = false;
static const curse_type * nocost_ct; static const curse_type * nocost_ct;
if (!init) { init = true; nocost_ct = ct_find("nocost"); } if (!init) { init = true; nocost_ct = ct_find("nocostbuilding"); }
if (curse_active(get_curse(b->attribs, nocost_ct))) { if (curse_active(get_curse(b->attribs, nocost_ct))) {
return 0; return 0;
} }

View file

@ -122,7 +122,7 @@ useonother_trappedairelemental(struct unit * u, int shipId,
effect.i = SPEEDUP; effect.i = SPEEDUP;
c = create_curse(u, &sh->attribs, ct_find("shipspeedup"), 20, INT_MAX, effect, 0); c = create_curse(u, &sh->attribs, ct_find("shipspeedup"), 20, INT_MAX, effect, 0);
curse_setflag(c, CURSE_NOAGE); c_setflag(c, CURSE_NOAGE);
ADDMSG(&u->faction->msgs, msg_message("trappedairelemental_success", ADDMSG(&u->faction->msgs, msg_message("trappedairelemental_success",
"unit region command ship", u, u->region, ord, sh)); "unit region command ship", u, u->region, ord, sh));

View file

@ -112,7 +112,7 @@ curse_age(attrib * a)
} }
if (result!=0) { if (result!=0) {
c->duration = 0; c->duration = 0;
} else if (c->flag & CURSE_NOAGE) { } else if (c_flags(c) & CURSE_NOAGE) {
c->duration = 1; c->duration = 1;
} else if (c->duration!=INT_MAX) { } else if (c->duration!=INT_MAX) {
c->duration = max(0, c->duration-1); c->duration = max(0, c->duration-1);
@ -145,19 +145,26 @@ curse_read(attrib * a, FILE * f) {
const curse_type * ct; const curse_type * ct;
char cursename[64]; char cursename[64];
unsigned int flags;
if(global.data_version >= CURSEVIGOURISFLOAT_VERSION) { if (global.data_version >= CURSEVIGOURISFLOAT_VERSION) {
fscanf(f, "%d %s %d %d %lf %d %d ", &c->no, cursename, &c->flag, fscanf(f, "%d %s %u %d %lf %d %d ", &c->no, cursename, &flags,
&c->duration, &c->vigour, &mageid.i, &c->effect.i); &c->duration, &c->vigour, &mageid.i, &c->effect.i);
} else { } else {
int vigour; int vigour;
fscanf(f, "%d %s %d %d %d %d %d ", &c->no, cursename, &c->flag, fscanf(f, "%d %s %u %d %d %d %d ", &c->no, cursename, &flags,
&c->duration, &vigour, &mageid.i, &c->effect.i); &c->duration, &vigour, &mageid.i, &c->effect.i);
c->vigour = vigour; c->vigour = vigour;
} }
ct = ct_find(cursename); ct = ct_find(cursename);
assert(ct!=NULL); assert(ct!=NULL);
c->type = ct;
if (global.data_version < CURSEFLAGS_VERSION) {
c_setflag(c, flags);
} else {
c->flags = flags;
}
#ifdef CONVERT_DBLINK #ifdef CONVERT_DBLINK
if (global.data_version<DBLINK_VERSION) { if (global.data_version<DBLINK_VERSION) {
@ -168,7 +175,6 @@ curse_read(attrib * a, FILE * f) {
} }
} }
#endif #endif
c->type = ct;
/* beim Einlesen sind noch nicht alle units da, muss also /* beim Einlesen sind noch nicht alle units da, muss also
* zwischengespeichert werden. */ * zwischengespeichert werden. */
@ -195,12 +201,12 @@ curse_read(attrib * a, FILE * f) {
void void
curse_write(const attrib * a, FILE * f) { curse_write(const attrib * a, FILE * f) {
int flag; unsigned int flags;
int mage_no; int mage_no;
curse * c = (curse*)a->data.v; curse * c = (curse*)a->data.v;
const curse_type * ct = c->type; const curse_type * ct = c->type;
flag = (c->flag & ~(CURSE_ISNEW)); flags = (c->flags & ~(CURSE_ISNEW));
if (c->magician){ if (c->magician){
mage_no = c->magician->no; mage_no = c->magician->no;
@ -208,7 +214,7 @@ curse_write(const attrib * a, FILE * f) {
mage_no = -1; mage_no = -1;
} }
fprintf(f, "%d %s %d %d %f %d %d ", c->no, ct->cname, flag, fprintf(f, "%d %s %d %d %f %d %d ", c->no, ct->cname, flags,
c->duration, c->vigour, mage_no, c->effect.i); c->duration, c->vigour, mage_no, c->effect.i);
if (c->type->write) c->type->write(f, c); if (c->type->write) c->type->write(f, c);
@ -436,9 +442,10 @@ set_cursedmen(curse *c, int cursedmen)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
void void
curse_setflag(curse *c, int flag) c_setflag(curse *c, unsigned int flags)
{ {
if (c) c->flag = (c->flag | flag); assert(c);
c->flags = (c->flags & ~flags) | (flags & (c->type->flags ^ flags));
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
@ -446,7 +453,7 @@ curse_setflag(curse *c, int flag)
* dieses Typs geben, gibt es den bestehenden zurück. * dieses Typs geben, gibt es den bestehenden zurück.
*/ */
static curse * static curse *
set_curse(unit *mage, attrib **ap, const curse_type *ct, double vigour, make_curse(unit *mage, attrib **ap, const curse_type *ct, double vigour,
int duration, variant effect, int men) int duration, variant effect, int men)
{ {
curse *c; curse *c;
@ -457,7 +464,7 @@ set_curse(unit *mage, attrib **ap, const curse_type *ct, double vigour,
c = (curse*)a->data.v; c = (curse*)a->data.v;
c->type = ct; c->type = ct;
c->flag = 0; c->flags = CURSE_ISNEW;
c->vigour = vigour; c->vigour = vigour;
c->duration = duration; c->duration = duration;
c->effect = effect; c->effect = effect;
@ -497,7 +504,7 @@ create_curse(unit *magician, attrib **ap, const curse_type *ct, double vigour,
c = get_curse(*ap, ct); c = get_curse(*ap, ct);
if(c && (c->flag & CURSE_ONLYONE)){ if (c && (c_flags(c) & CURSE_ONLYONE)){
return NULL; return NULL;
} }
assert(c==NULL || ct==c->type); assert(c==NULL || ct==c->type);
@ -533,7 +540,7 @@ create_curse(unit *magician, attrib **ap, const curse_type *ct, double vigour,
} }
set_curseingmagician(magician, *ap, ct); set_curseingmagician(magician, *ap, ct);
} else { } else {
c = set_curse(magician, ap, ct, vigour, duration, effect, men); c = make_curse(magician, ap, ct, vigour, duration, effect, men);
} }
return c; return c;
} }
@ -545,7 +552,6 @@ create_curse(unit *magician, attrib **ap, const curse_type *ct, double vigour,
static void static void
do_transfer_curse(curse *c, unit * u, unit * u2, int n) do_transfer_curse(curse *c, unit * u, unit * u2, int n)
{ {
int flag = c->flag;
int cursedmen = 0; int cursedmen = 0;
int men = 0; int men = 0;
boolean dogive = false; boolean dogive = false;
@ -562,7 +568,7 @@ do_transfer_curse(curse *c, unit * u, unit * u2, int n)
cursedmen = u->number; cursedmen = u->number;
} }
switch (ct->spread){ switch ((ct->flags | c->flags) & CURSE_SPREADMASK) {
case CURSE_SPREADALWAYS: case CURSE_SPREADALWAYS:
dogive = true; dogive = true;
men = u2->number + n; men = u2->number + n;
@ -593,9 +599,9 @@ do_transfer_curse(curse *c, unit * u, unit * u2, int n)
} }
if (dogive == true) { if (dogive == true) {
curse * cnew = set_curse(c->magician, &u2->attribs, c->type, c->vigour, curse * cnew = make_curse(c->magician, &u2->attribs, c->type, c->vigour,
c->duration, c->effect, men); c->duration, c->effect, men);
curse_setflag(cnew, flag); cnew->flags = c->flags;
if (ct->typ == CURSETYP_UNIT) set_cursedmen(cnew, men); if (ct->typ == CURSETYP_UNIT) set_cursedmen(cnew, men);
} }
@ -620,7 +626,7 @@ boolean
curse_active(const curse *c) curse_active(const curse *c)
{ {
if (!c) return false; if (!c) return false;
if (c->flag & CURSE_ISNEW) return false; if (c_flags(c) & CURSE_ISNEW) return false;
if (c->vigour <= 0) return false; if (c->vigour <= 0) return false;
return true; return true;
@ -706,14 +712,7 @@ static const char * oldnames[MAXCURSE] = {
"fumble", "fumble",
"riotzone", "riotzone",
"nocostbuilding", "nocostbuilding",
"holyground",
"godcursezone", "godcursezone",
"",
"",
"",
"",
"",
"",
"speed", "speed",
"orcish", "orcish",
"magicboost", "magicboost",
@ -723,9 +722,6 @@ static const char * oldnames[MAXCURSE] = {
"magicresistance", "magicresistance",
"itemcloak", "itemcloak",
"sparkle", "sparkle",
"",
"",
"",
"skillmod" "skillmod"
}; };

View file

@ -123,14 +123,7 @@ enum {
C_FUMBLE, C_FUMBLE,
C_RIOT, /*region in Aufruhr */ C_RIOT, /*region in Aufruhr */
C_NOCOST, C_NOCOST,
C_HOLYGROUND,
C_CURSED_BY_THE_GODS, C_CURSED_BY_THE_GODS,
C_FREE_14,
C_FREE_15,
C_FREE_16,
C_FREE_17,
C_FREE_18,
C_FREE_19,
/* struct's vom untertyp curse_unit: */ /* struct's vom untertyp curse_unit: */
C_SPEED, /* Beschleunigt */ C_SPEED, /* Beschleunigt */
C_ORC, C_ORC,
@ -141,9 +134,6 @@ enum {
C_MAGICRESISTANCE, /* 44 - verändert Magieresistenz */ C_MAGICRESISTANCE, /* 44 - verändert Magieresistenz */
C_ITEMCLOAK, C_ITEMCLOAK,
C_SPARKLE, C_SPARKLE,
C_FREE_22,
C_FREE_23,
C_FREE_24,
/* struct's vom untertyp curse_skill: */ /* struct's vom untertyp curse_skill: */
C_SKILL, C_SKILL,
MAXCURSE MAXCURSE
@ -152,19 +142,23 @@ enum {
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Flags */ /* Flags */
#define CURSE_ISNEW 1 /* wirkt in der zauberrunde nicht (default)*/
#define CURSE_NOAGE 2 /* wirkt ewig */
#define CURSE_IMMUNE 4 /* ignoriert Antimagie */
#define CURSE_ONLYONE 8 /* Verhindert, das ein weiterer Zauber dieser Art
auf das Objekt gezaubert wird */
/* Verhalten von Zaubern auf Units beim Übergeben von Personen */ /* Verhalten von Zaubern auf Units beim Übergeben von Personen */
typedef enum { typedef enum {
CURSE_SPREADNEVER, /* wird nie mit übertragen */ CURSE_ISNEW = 0x01, /* wirkt in der zauberrunde nicht (default)*/
CURSE_SPREADALWAYS, /* wird immer mit übertragen */ CURSE_NOAGE = 0x02, /* wirkt ewig */
CURSE_SPREADMODULO, /* personenweise weitergabe */ CURSE_IMMUNE = 0x04, /* ignoriert Antimagie */
CURSE_SPREADCHANCE /* Ansteckungschance je nach Mengenverhältnis*/ CURSE_ONLYONE = 0x08, /* Verhindert, das ein weiterer Zauber dieser Art auf das Objekt gezaubert wird */
} spread_t;
/* the following are mutually exclusive */
CURSE_SPREADNEVER = 0x00, /* wird nie mit übertragen */
CURSE_SPREADALWAYS = 0x10, /* wird immer mit übertragen */
CURSE_SPREADMODULO = 0x20, /* personenweise weitergabe */
CURSE_SPREADCHANCE = 0x30 /* Ansteckungschance je nach Mengenverhältnis*/
} curseflags;
#define CURSE_FLAGSMASK 0x0F
#define CURSE_SPREADMASK 0x30
/* typ von struct */ /* typ von struct */
enum { enum {
@ -195,7 +189,7 @@ typedef struct curse {
struct curse *nexthash; struct curse *nexthash;
int no; /* 'Einheitennummer' dieses Curse */ int no; /* 'Einheitennummer' dieses Curse */
const struct curse_type * type; /* Zeiger auf ein curse_type-struct */ const struct curse_type * type; /* Zeiger auf ein curse_type-struct */
int flag; /* generelle Flags wie zb CURSE_ISNEW oder CURSE_NOAGE */ unsigned int flags; /* generelle Flags wie zb CURSE_ISNEW oder CURSE_NOAGE */
int duration; /* Dauer der Verzauberung. Wird jede Runde vermindert */ int duration; /* Dauer der Verzauberung. Wird jede Runde vermindert */
double vigour; /* Stärke der Verzauberung, Widerstand gegen Antimagie */ double vigour; /* Stärke der Verzauberung, Widerstand gegen Antimagie */
struct unit *magician; /* Pointer auf den Magier, der den Spruch gewirkt hat */ struct unit *magician; /* Pointer auf den Magier, der den Spruch gewirkt hat */
@ -203,6 +197,8 @@ typedef struct curse {
variant data; /* pointer auf spezielle curse-unterstructs*/ variant data; /* pointer auf spezielle curse-unterstructs*/
} curse; } curse;
#define c_flags(c) ((c)->type->flags ^ (c)->flags)
/* Die Unterattribute curse->data: */ /* Die Unterattribute curse->data: */
/* Einheitenzauber: /* Einheitenzauber:
* auf Einzelpersonen in einer Einheit bezogene Zauber. Für Zauber, die * auf Einzelpersonen in einer Einheit bezogene Zauber. Für Zauber, die
@ -218,7 +214,7 @@ typedef struct curse_unit {
typedef struct curse_type { typedef struct curse_type {
const char *cname; /* Name der Zauberwirkung, Identifizierung des curse */ const char *cname; /* Name der Zauberwirkung, Identifizierung des curse */
int typ; int typ;
spread_t spread; unsigned int flags;
unsigned int mergeflags; unsigned int mergeflags;
const char *info_str; /* Wirkung des curse, wird bei einer gelungenen const char *info_str; /* Wirkung des curse, wird bei einer gelungenen
Zauberanalyse angezeigt */ Zauberanalyse angezeigt */
@ -280,7 +276,7 @@ extern int get_cursedmen(struct unit *u, struct curse *c);
/* gibt bei Personenbeschränkten Verzauberungen die Anzahl der /* gibt bei Personenbeschränkten Verzauberungen die Anzahl der
* betroffenen Personen zurück. Ansonsten wird 0 zurückgegeben. */ * betroffenen Personen zurück. Ansonsten wird 0 zurückgegeben. */
extern void curse_setflag(curse * c, int flag); extern void c_setflag(curse * c, unsigned int flag);
/* setzt Spezialflag einer Verzauberung (zB 'dauert ewig') */ /* setzt Spezialflag einer Verzauberung (zB 'dauert ewig') */
void transfer_curse(struct unit * u, struct unit * u2, int n); void transfer_curse(struct unit * u, struct unit * u2, int n);

View file

@ -176,6 +176,7 @@ struct building_type;
#define TERRAIN_VERSION 322 /* terrains are a full type and saved by name */ #define TERRAIN_VERSION 322 /* terrains are a full type and saved by name */
#define REGIONITEMS_VERSION 323 /* regions have items */ #define REGIONITEMS_VERSION 323 /* regions have items */
#define ATTRIBREAD_VERSION 324 /* remove a_readint */ #define ATTRIBREAD_VERSION 324 /* remove a_readint */
#define CURSEFLAGS_VERSION 325 /* remove a_readint */
#define MIN_VERSION CURSETYPE_VERSION #define MIN_VERSION CURSETYPE_VERSION
#define REGIONOWNERS_VERSION 400 #define REGIONOWNERS_VERSION 400
@ -183,7 +184,7 @@ struct building_type;
#ifdef ENEMIES #ifdef ENEMIES
# define RELEASE_VERSION ENEMIES_VERSION # define RELEASE_VERSION ENEMIES_VERSION
#else #else
# define RELEASE_VERSION ATTRIBREAD_VERSION # define RELEASE_VERSION CURSEFLAGS_VERSION
#endif #endif
#define RESOURCE_CONVERSION #define RESOURCE_CONVERSION

View file

@ -144,9 +144,11 @@ void
deathcounts (region * r, int fallen) deathcounts (region * r, int fallen)
{ {
attrib * a; attrib * a;
static const curse_type * ctype = NULL;
if (fallen==0) return; if (fallen==0) return;
if (is_cursed(r->attribs, C_HOLYGROUND,0)) return; if (!ctype) ctype = ct_find("holyground");
if (ctype && curse_active(get_curse(r->attribs, ctype))) return;
a = a_find(r->attribs, &at_deathcount); a = a_find(r->attribs, &at_deathcount);
if (!a) a = a_add(&r->attribs, a_new(&at_deathcount)); if (!a) a = a_add(&r->attribs, a_new(&at_deathcount));

View file

@ -731,11 +731,13 @@ can_survive(const unit *u, const region *r)
|| (fval(r->terrain, SWIM_INTO) && (u->race->flags & RCF_SWIM)) || (fval(r->terrain, SWIM_INTO) && (u->race->flags & RCF_SWIM))
|| (fval(r->terrain, FLY_INTO) && (u->race->flags & RCF_FLY))) || (fval(r->terrain, FLY_INTO) && (u->race->flags & RCF_FLY)))
{ {
static const curse_type * ctype = NULL;
if (get_item(u, I_HORSE) && !fval(r->terrain, WALK_INTO)) if (get_item(u, I_HORSE) && !fval(r->terrain, WALK_INTO))
return false; return false;
if (fval(u->race, RCF_UNDEAD) && is_cursed(r->attribs, C_HOLYGROUND, 0)) if (!ctype) ctype = ct_find("holyground");
if (fval(u->race, RCF_UNDEAD) && curse_active(get_curse(r->attribs, ctype)))
return false; return false;
return true; return true;

View file

@ -162,8 +162,6 @@ alp_findet_opfer(unit *alp, region *r)
c = create_curse(mage, &opfer->attribs, ct_find("worse"), 2, 2, effect, opfer->number); c = create_curse(mage, &opfer->attribs, ct_find("worse"), 2, 2, effect, opfer->number);
/* solange es noch keine spezielle alp-Antimagie gibt, reagiert der /* solange es noch keine spezielle alp-Antimagie gibt, reagiert der
* auch auf normale */ * auch auf normale */
/* set_curseflag(opfer->attribs, C_ALLSKILLS, 0, CURSE_NOAGE+CURSE_IMMUN); */
curse_setflag(c, CURSE_NOAGE);
destroy_unit(alp); destroy_unit(alp);
{ {

View file

@ -95,7 +95,7 @@ static struct curse_type ct_strongwall = { "strongwall",
/* Ewige Mauern-Zauber */ /* Ewige Mauern-Zauber */
static struct curse_type ct_nocostbuilding = { "nocostbuilding", static struct curse_type ct_nocostbuilding = { "nocostbuilding",
CURSETYP_NORM, 0, NO_MERGE, CURSETYP_NORM, CURSE_NOAGE|CURSE_ONLYONE, NO_MERGE,
"Die Macht dieses Zaubers ist fast greifbar und tief in die Mauern " "Die Macht dieses Zaubers ist fast greifbar und tief in die Mauern "
"gebunden. Unbeeindruck vom Zahn der Zeit wird dieses Gebäude wohl " "gebunden. Unbeeindruck vom Zahn der Zeit wird dieses Gebäude wohl "
"auf Ewig stehen.", "auf Ewig stehen.",

View file

@ -58,7 +58,7 @@ cinfo_cursed_by_the_gods(const void * obj, typ_t typ, const curse *c, int self)
static struct curse_type ct_godcursezone = { static struct curse_type ct_godcursezone = {
"godcursezone", "godcursezone",
CURSETYP_NORM, 0, (NO_MERGE), CURSETYP_NORM, CURSE_IMMUNE, (NO_MERGE),
"Diese Region wurde von den Göttern verflucht. Stinkende Nebel ziehen " "Diese Region wurde von den Göttern verflucht. Stinkende Nebel ziehen "
"über die tote Erde, furchbare Kreaturen ziehen über das Land. Die Brunnen " "über die tote Erde, furchbare Kreaturen ziehen über das Land. Die Brunnen "
"sind vergiftet, und die wenigen essbaren Früchte sind von einem rosa Pilz " "sind vergiftet, und die wenigen essbaren Früchte sind von einem rosa Pilz "
@ -305,7 +305,7 @@ static struct curse_type ct_riotzone = {
}; };
static struct curse_type ct_holyground = { static struct curse_type ct_holyground = {
"holyground", "holyground",
CURSETYP_NORM, 0, (M_VIGOUR_ADD), CURSETYP_NORM, CURSE_NOAGE, (M_VIGOUR_ADD),
"Verschiedene Naturgeistern sind im Boden der Region gebunden und " "Verschiedene Naturgeistern sind im Boden der Region gebunden und "
"beschützen diese vor dem der dunklen Magie des lebenden Todes.", "beschützen diese vor dem der dunklen Magie des lebenden Todes.",
cinfo_simple cinfo_simple

View file

@ -142,7 +142,7 @@ magicanalyse_region(region *r, unit *mage, double force)
found = true; found = true;
if (chance(probability)) { /* Analyse geglückt */ if (chance(probability)) { /* Analyse geglückt */
if (c->flag & CURSE_NOAGE) { if (c_flags(c) & CURSE_NOAGE) {
ADDMSG(&mage->faction->msgs, msg_message( ADDMSG(&mage->faction->msgs, msg_message(
"analyse_region_noage", "mage region curse", "analyse_region_noage", "mage region curse",
mage, r, LOC(lang, mkname("spell", c->type->cname)))); mage, r, LOC(lang, mkname("spell", c->type->cname))));
@ -183,7 +183,7 @@ magicanalyse_unit(unit *u, unit *mage, double force)
mon = max(1,mon); mon = max(1,mon);
if (chance(probability)) { /* Analyse geglückt */ if (chance(probability)) { /* Analyse geglückt */
if (c->flag & CURSE_NOAGE) { if (c_flags(c) & CURSE_NOAGE) {
ADDMSG(&mage->faction->msgs, msg_message( ADDMSG(&mage->faction->msgs, msg_message(
"analyse_unit_noage", "mage unit curse", "analyse_unit_noage", "mage unit curse",
mage, u, LOC(lang, mkname("spell", c->type->cname)))); mage, u, LOC(lang, mkname("spell", c->type->cname))));
@ -225,7 +225,7 @@ magicanalyse_building(building *b, unit *mage, double force)
mon = max(1,mon); mon = max(1,mon);
if (chance(probability)) { /* Analyse geglückt */ if (chance(probability)) { /* Analyse geglückt */
if (c->flag & CURSE_NOAGE) { if (c_flags(c) & CURSE_NOAGE) {
ADDMSG(&mage->faction->msgs, msg_message( ADDMSG(&mage->faction->msgs, msg_message(
"analyse_building_age", "mage building curse", "analyse_building_age", "mage building curse",
mage, b, LOC(lang, mkname("spell", c->type->cname)))); mage, b, LOC(lang, mkname("spell", c->type->cname))));
@ -267,7 +267,7 @@ magicanalyse_ship(ship *sh, unit *mage, double force)
mon = max(1,mon); mon = max(1,mon);
if (chance(probability)) { /* Analyse geglückt */ if (chance(probability)) { /* Analyse geglückt */
if (c->flag & CURSE_NOAGE) { if (c_flags(c) & CURSE_NOAGE) {
ADDMSG(&mage->faction->msgs, msg_message( ADDMSG(&mage->faction->msgs, msg_message(
"analyse_ship_noage", "mage ship curse", "analyse_ship_noage", "mage ship curse",
mage, sh, LOC(lang, mkname("spell", c->type->cname)))); mage, sh, LOC(lang, mkname("spell", c->type->cname))));
@ -345,7 +345,7 @@ break_curse(attrib **alist, int cast_level, double force, curse * c)
c1 = (curse*)a->data.v; c1 = (curse*)a->data.v;
/* Immunität prüfen */ /* Immunität prüfen */
if (c1->flag & CURSE_IMMUNE) { if (c_flags(c1) & CURSE_IMMUNE) {
do { ap = &(*ap)->next; } while (*ap && a->type==(*ap)->type); do { ap = &(*ap)->next; } while (*ap && a->type==(*ap)->type);
continue; continue;
} }
@ -999,7 +999,6 @@ sp_maelstrom(castorder *co)
* (Max(Dauer), Max(Stärke))*/ * (Max(Dauer), Max(Stärke))*/
effect.i = (int)power; effect.i = (int)power;
c = create_curse(mage, &r->attribs, ct_find("maelstrom"), power, duration, effect, 0); c = create_curse(mage, &r->attribs, ct_find("maelstrom"), power, duration, effect, 0);
curse_setflag(c, CURSE_ISNEW);
/* melden, 1x pro Partei */ /* melden, 1x pro Partei */
{ {
@ -1975,6 +1974,7 @@ sp_treewalkexit(castorder *co)
static int static int
sp_holyground(castorder *co) sp_holyground(castorder *co)
{ {
static const curse_type * ctype = NULL;
region *r = co->rt; region *r = co->rt;
unit *mage = co->magician.u; unit *mage = co->magician.u;
int cast_level = co->level; int cast_level = co->level;
@ -1983,10 +1983,8 @@ sp_holyground(castorder *co)
message * msg = r_addmessage(r, mage->faction, msg_message("holyground", "mage", mage)); message * msg = r_addmessage(r, mage->faction, msg_message("holyground", "mage", mage));
msg_release(msg); msg_release(msg);
c = create_curse(mage, &r->attribs, ct_find("holyground"), if (!ctype) ctype = ct_find("holyground");
power*power, 1, zero_effect, 0); c = create_curse(mage, &r->attribs, ctype, power*power, 1, zero_effect, 0);
curse_setflag(c, CURSE_NOAGE);
a_removeall(&r->attribs, &at_deathcount); a_removeall(&r->attribs, &at_deathcount);
@ -2029,13 +2027,13 @@ sp_homestone(castorder *co)
cmistake(mage, co->order, 206, MSG_MAGIC); cmistake(mage, co->order, 206, MSG_MAGIC);
return 0; return 0;
} }
curse_setflag(c, CURSE_NOAGE|CURSE_ONLYONE); c_setflag(c, CURSE_NOAGE|CURSE_ONLYONE);
/* Magieresistenz der Burg erhöht sich um 50% */ /* Magieresistenz der Burg erhöht sich um 50% */
effect.i = 50; effect.i = 50;
c = create_curse(mage, &mage->building->attribs, c = create_curse(mage, &mage->building->attribs,
ct_find("magicresistance"), force*force, 1, effect, 0); ct_find("magicresistance"), force*force, 1, effect, 0);
curse_setflag(c, CURSE_NOAGE); c_setflag(c, CURSE_NOAGE);
/* melden, 1x pro Partei in der Burg */ /* melden, 1x pro Partei in der Burg */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH); for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
@ -2153,12 +2151,14 @@ sp_fog_of_confusion(castorder *co)
rl = all_in_range(r, (short)range, NULL); rl = all_in_range(r, (short)range, NULL);
for (rl2 = rl; rl2; rl2 = rl2->next) { for (rl2 = rl; rl2; rl2 = rl2->next) {
static const curse_type * ctype = NULL;
region * r2 = rl2->data;
curse * c; curse * c;
variant effect; variant effect;
message * m = NULL; message * m = NULL;
if (!fval(rl2->data->terrain, SEA_REGION) if (!fval(r2->terrain, SEA_REGION)
&& !r_isforest(rl2->data)) continue; && !r_isforest(r2)) continue;
/* Magieresistenz jeder Region prüfen */ /* Magieresistenz jeder Region prüfen */
if (target_resists_magic(mage, r, TYP_REGION, 0)) { if (target_resists_magic(mage, r, TYP_REGION, 0)) {
@ -2167,13 +2167,11 @@ sp_fog_of_confusion(castorder *co)
} }
effect.i = cast_level*5; effect.i = cast_level*5;
c = create_curse(mage, &rl2->data->attribs, if (!ctype) ctype = ct_find("disorientationzone");
ct_find("disorientationzone"), power, duration, effect, 0); c = create_curse(mage, &r2->attribs, ctype, power, duration, effect, 0);
/* Soll der schon in der Zauberrunde wirken? */
curse_setflag(c, CURSE_ISNEW);
for (u = rl2->data->units; u; u = u->next) freset(u->faction, FL_DH); for (u = r2->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = rl2->data->units; u; u = u->next ) { for (u = r2->units; u; u = u->next ) {
if (!fval(u->faction, FL_DH) ) { if (!fval(u->faction, FL_DH) ) {
fset(u->faction, FL_DH); fset(u->faction, FL_DH);
if (!m) m = msg_message("confusion_result", "mage", mage); if (!m) m = msg_message("confusion_result", "mage", mage);
@ -2596,7 +2594,6 @@ sp_fumblecurse(castorder *co)
return 0; return 0;
} }
curse_setflag(c, CURSE_ONLYONE);
ADDMSG(&target->faction->msgs, msg_message( ADDMSG(&target->faction->msgs, msg_message(
"fumblecurse", "unit region", target, target->region)); "fumblecurse", "unit region", target, target->region));
@ -2620,7 +2617,6 @@ patzer_fumblecurse(castorder *co)
ADDMSG(&mage->faction->msgs, msg_message( ADDMSG(&mage->faction->msgs, msg_message(
"magic_fumble", "unit region command", "magic_fumble", "unit region command",
mage, mage->region, co->order)); mage, mage->region, co->order));
curse_setflag(c, CURSE_ONLYONE);
} }
return; return;
} }
@ -2694,7 +2690,8 @@ sp_summondragon(castorder *co)
rl = all_in_range(r, (short)power, NULL); rl = all_in_range(r, (short)power, NULL);
for(rl2 = rl; rl2; rl2 = rl2->next) { for(rl2 = rl; rl2; rl2 = rl2->next) {
for(u = rl2->data->units; u; u = u->next) { region * r2 = rl2->data;
for(u = r2->units; u; u = u->next) {
if (u->race == new_race[RC_WYRM] || u->race == new_race[RC_DRAGON]) { if (u->race == new_race[RC_WYRM] || u->race == new_race[RC_DRAGON]) {
attrib * a = a_find(u->attribs, &at_targetregion); attrib * a = a_find(u->attribs, &at_targetregion);
if (!a) { if (!a) {
@ -2702,7 +2699,7 @@ sp_summondragon(castorder *co)
} else { } else {
a->data.v = co->rt; a->data.v = co->rt;
} }
sprintf(buf, "Kommt aus: %s, Will nach: %s", regionname(rl2->data, u->faction), regionname(co->rt, u->faction)); sprintf(buf, "Kommt aus: %s, Will nach: %s", regionname(r2, u->faction), regionname(co->rt, u->faction));
usetprivate(u, buf); usetprivate(u, buf);
} }
} }
@ -3565,8 +3562,6 @@ sp_magicboost(castorder *co)
effect.i = 6; effect.i = 6;
c = create_curse(mage, &mage->attribs, ct_magicboost, power, 10, effect, 1); c = create_curse(mage, &mage->attribs, ct_magicboost, power, 10, effect, 1);
/* kann nicht durch Antimagie beeinflusst werden */
curse_setflag(c, CURSE_IMMUNE);
/* one aura boost with 200% aura now: */ /* one aura boost with 200% aura now: */
effect.i = 200; effect.i = 200;
@ -4702,8 +4697,6 @@ sp_calm_monster(castorder *co)
report_failure(mage, co->order); report_failure(mage, co->order);
return 0; return 0;
} }
/* Nur ein Beherrschungszauber pro Unit */
curse_setflag(c, CURSE_ONLYONE);
sprintf(buf, "%s besänftigt %s.", unitname(mage), unitname(target)); sprintf(buf, "%s besänftigt %s.", unitname(mage), unitname(target));
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO); addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO);
@ -4893,7 +4886,8 @@ sp_dragonsong(castorder *co)
rl = all_in_range(r, (int)power); rl = all_in_range(r, (int)power);
for(rl2 = rl; rl2; rl2 = rl2->next) { for(rl2 = rl; rl2; rl2 = rl2->next) {
for(u = rl2->data->units; u; u = u->next) { region * r2 = rl2->data;
for(u = r2->units; u; u = u->next) {
if (u->race->flags & RCF_DRAGON) { if (u->race->flags & RCF_DRAGON) {
attrib * a = a_find(u->attribs, &at_targetregion); attrib * a = a_find(u->attribs, &at_targetregion);
if (!a) { if (!a) {
@ -4901,7 +4895,7 @@ sp_dragonsong(castorder *co)
} else { } else {
a->data.v = r; a->data.v = r;
} }
sprintf(buf, "Kommt aus: %s, Will nach: %s", regionname(rl2->data, u->faction), regionname(r, u->faction)); sprintf(buf, "Kommt aus: %s, Will nach: %s", regionname(r2, u->faction), regionname(r, u->faction));
usetprivate(u, buf); usetprivate(u, buf);
} }
} }
@ -5231,7 +5225,6 @@ sp_baddreams(castorder *co)
/* Nichts machen als ein entsprechendes Attribut in die Region legen. */ /* Nichts machen als ein entsprechendes Attribut in die Region legen. */
effect.i = -1; effect.i = -1;
c = create_curse(mage, &r->attribs, ct_find("gbdream"), power, duration, effect, 0); c = create_curse(mage, &r->attribs, ct_find("gbdream"), power, duration, effect, 0);
curse_setflag(c, CURSE_ISNEW);
/* Erfolg melden*/ /* Erfolg melden*/
ADDMSG(&mage->faction->msgs, msg_message( ADDMSG(&mage->faction->msgs, msg_message(
@ -5270,7 +5263,6 @@ sp_gooddreams(castorder *co)
duration = 2 + rng_int()%duration; duration = 2 + rng_int()%duration;
effect.i = 1; effect.i = 1;
c = create_curse(mage, &r->attribs, ct_find("gbdream"), power, duration, effect, 0); c = create_curse(mage, &r->attribs, ct_find("gbdream"), power, duration, effect, 0);
curse_setflag(c, CURSE_ISNEW);
/* Erfolg melden*/ /* Erfolg melden*/
ADDMSG(&mage->faction->msgs, msg_message( ADDMSG(&mage->faction->msgs, msg_message(
@ -5402,7 +5394,6 @@ sp_sweetdreams(castorder *co)
/* Nichts machen als ein entsprechendes Attribut an die Einheit legen. */ /* Nichts machen als ein entsprechendes Attribut an die Einheit legen. */
effect.i = 5; effect.i = 5;
c = create_curse(mage,&u->attribs, ct_find("orcish"), power, duration, effect, men); c = create_curse(mage,&u->attribs, ct_find("orcish"), power, duration, effect, men);
curse_setflag(c, CURSE_ISNEW);
sprintf(buf, "%s verschafft %s ein interessanteres Nachtleben.", sprintf(buf, "%s verschafft %s ein interessanteres Nachtleben.",
unitname(mage), unitname(u)); unitname(mage), unitname(u));
@ -5425,7 +5416,6 @@ sp_disturbingdreams(castorder *co)
effect.i = 10; effect.i = 10;
c = create_curse(mage, &r->attribs, ct_find("badlearn"), power, duration, effect, 0); c = create_curse(mage, &r->attribs, ct_find("badlearn"), power, duration, effect, 0);
curse_setflag(c, CURSE_ISNEW);
sprintf(buf, "%s sorgt für schlechten Schlaf in %s.", sprintf(buf, "%s sorgt für schlechten Schlaf in %s.",
unitname(mage), regionname(r, mage->faction)); unitname(mage), regionname(r, mage->faction));
@ -5463,8 +5453,6 @@ sp_dream_of_confusion(castorder *co)
effect.i = cast_level*5; effect.i = cast_level*5;
c = create_curse(mage, &r2->attribs, c = create_curse(mage, &r2->attribs,
ct_find("disorientationzone"), power, duration, effect, 0); ct_find("disorientationzone"), power, duration, effect, 0);
/* soll der Zauber schon in der Zauberrunde wirken? */
curse_setflag(c, CURSE_ISNEW);
for (u = r2->units; u; u = u->next) freset(u->faction, FL_DH); for (u = r2->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r2->units; u; u = u->next ) { for (u = r2->units; u; u = u->next ) {
@ -6159,9 +6147,10 @@ sp_showastral(castorder *co)
/* Erst Einheiten zählen, für die Grammatik. */ /* Erst Einheiten zählen, für die Grammatik. */
for(rl2=rl; rl2; rl2=rl2->next) { for (rl2=rl; rl2; rl2=rl2->next) {
if (!is_cursed(rl2->data->attribs, C_ASTRALBLOCK, 0)) { region * r2 = rl2->data;
for(u = rl2->data->units; u; u=u->next) { if (!is_cursed(r2->attribs, C_ASTRALBLOCK, 0)) {
for(u = r2->units; u; u=u->next) {
if (u->race != new_race[RC_SPECIAL] && u->race != new_race[RC_SPELL]) n++; if (u->race != new_race[RC_SPECIAL] && u->race != new_race[RC_SPELL]) n++;
} }
} }
@ -6382,7 +6371,7 @@ sp_eternizewall(castorder *co)
if (pa->param[0]->flag == TARGET_NOTFOUND) return 0; if (pa->param[0]->flag == TARGET_NOTFOUND) return 0;
b = pa->param[0]->data.b; b = pa->param[0]->data.b;
c = create_curse(mage, &b->attribs, ct_find("nocost"), c = create_curse(mage, &b->attribs, ct_find("nocostbuilding"),
power*power, 1, zero_effect, 0); power*power, 1, zero_effect, 0);
if (c==NULL) { /* ist bereits verzaubert */ if (c==NULL) { /* ist bereits verzaubert */
@ -6390,8 +6379,6 @@ sp_eternizewall(castorder *co)
return 0; return 0;
} }
curse_setflag(c, CURSE_NOAGE|CURSE_ONLYONE);
/* melden, 1x pro Partei in der Burg */ /* melden, 1x pro Partei in der Burg */
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH); for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
@ -6557,6 +6544,11 @@ sp_movecastle(castorder *co)
return cast_level; return cast_level;
} }
boolean
shipcurse_flyingship(ship* sh, int power, int duration)
{
return false;
}
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Name: Luftschiff /* Name: Luftschiff
* Stufe: 6 * Stufe: 6

View file

@ -69,10 +69,11 @@ static struct curse_type ct_auraboost = {
"benutzt werden.", "benutzt werden.",
cinfo_auraboost cinfo_auraboost
}; };
/* Magic Boost - Gabe des Chaos */ /* Magic Boost - Gabe des Chaos */
static struct curse_type ct_magicboost = { static struct curse_type ct_magicboost = {
"magicboost", "magicboost",
CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, CURSETYP_UNIT, CURSE_SPREADMODULO|CURSE_IMMUNE, M_MEN,
"", "",
NULL NULL
}; };
@ -125,8 +126,10 @@ cinfo_calm(const void * obj, typ_t typ, const curse *c, int self)
} }
return NULL; return NULL;
} }
static struct curse_type ct_calmmonster = { "calmmonster",
CURSETYP_NORM, CURSE_SPREADNEVER, NO_MERGE, static struct curse_type ct_calmmonster = {
"calmmonster",
CURSETYP_NORM, CURSE_SPREADNEVER|CURSE_ONLYONE, NO_MERGE,
"Dieser Beeinflussungszauber scheint die Einheit einem ganz " "Dieser Beeinflussungszauber scheint die Einheit einem ganz "
"bestimmten Volk wohlgesonnen zu machen.", "bestimmten Volk wohlgesonnen zu machen.",
cinfo_calm cinfo_calm
@ -282,7 +285,7 @@ static struct curse_type ct_strength = { "strength",
*/ */
static struct curse_type ct_worse = { static struct curse_type ct_worse = {
"worse", "worse",
CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, CURSETYP_UNIT, CURSE_SPREADMODULO|CURSE_NOAGE, M_MEN,
"", "",
cinfo_unit cinfo_unit
}; };
@ -302,7 +305,7 @@ static struct curse_type ct_itemcloak = {
static struct curse_type ct_fumble = { static struct curse_type ct_fumble = {
"fumble", "fumble",
CURSETYP_NORM, CURSE_SPREADNEVER, NO_MERGE, CURSETYP_NORM, CURSE_SPREADNEVER|CURSE_ONLYONE, NO_MERGE,
"Eine Wolke negativer Energie umgibt die Einheit.", "Eine Wolke negativer Energie umgibt die Einheit.",
cinfo_unit cinfo_unit
}; };

View file

@ -175,7 +175,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="luabind.lib lua50.lib libxml2.lib mysqlclient.lib zlib.lib" AdditionalDependencies="luabind.lib lua50.lib libxml2.lib"
OutputFile=".\Debug/eressea-lua.exe" OutputFile=".\Debug/eressea-lua.exe"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"

View file

@ -120,7 +120,6 @@ curse_emptiness(void)
curse * c; curse * c;
effect.i = 0; effect.i = 0;
c = create_curse(NULL, &r->attribs, ct, 100, 100, effect, 0); c = create_curse(NULL, &r->attribs, ct, 100, 100, effect, 0);
curse_setflag(c, CURSE_ISNEW|CURSE_IMMUNE);
} }
freset(r, FL_MARK); freset(r, FL_MARK);
} }