diff --git a/src/common/gamecode/items.c b/src/common/gamecode/items.c index d7732e70c..9bd4add3b 100644 --- a/src/common/gamecode/items.c +++ b/src/common/gamecode/items.c @@ -81,7 +81,7 @@ use_speedsail(struct unit * u, const struct item_type * itype, int amount, struc effect.i = SPEEDSAIL_EFFECT; 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)); 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; /* 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); continue; } @@ -143,7 +143,7 @@ use_antimagiccrystal(unit * u, const struct item_type * itype, int amount, struc if(*ap) ap = &(*ap)->next; } - if(force > 0) { + if (force > 0) { variant var ; var.i = effect; create_curse(u, &r->attribs, ct_find("antimagiczone"), force, duration, var, 0); diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 1da846350..4d626e332 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -3116,7 +3116,7 @@ ageing(void) if (is_cursed(u->attribs, C_OLDRACE, 0)){ 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->irace = new_race[curse_geteffect(c)]; } diff --git a/src/common/gamecode/monster.c b/src/common/gamecode/monster.c index ce28dcf85..e257015e6 100644 --- a/src/common/gamecode/monster.c +++ b/src/common/gamecode/monster.c @@ -1131,8 +1131,10 @@ spawn_undead(void) for (r = regions; r; r = r->next) { 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 */ if (r->land && unburied > r->land->peasants / 20 && rng_int() % 10000 < (100 + 100 * chaosfactor(r))) { diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index ff0c99e69..a11325dff 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -1204,7 +1204,7 @@ buildingmaintenance(const building * b, const resource_type * rtype) int c, cost=0; static boolean init = false; 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))) { return 0; } diff --git a/src/common/items/artrewards.c b/src/common/items/artrewards.c index f9dd326f4..3eb02c6c6 100644 --- a/src/common/items/artrewards.c +++ b/src/common/items/artrewards.c @@ -122,7 +122,7 @@ useonother_trappedairelemental(struct unit * u, int shipId, effect.i = SPEEDUP; 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", "unit region command ship", u, u->region, ord, sh)); diff --git a/src/common/kernel/curse.c b/src/common/kernel/curse.c index 90886bbe4..5c47ea9d5 100644 --- a/src/common/kernel/curse.c +++ b/src/common/kernel/curse.c @@ -112,7 +112,7 @@ curse_age(attrib * a) } if (result!=0) { c->duration = 0; - } else if (c->flag & CURSE_NOAGE) { + } else if (c_flags(c) & CURSE_NOAGE) { c->duration = 1; } else if (c->duration!=INT_MAX) { c->duration = max(0, c->duration-1); @@ -145,19 +145,26 @@ curse_read(attrib * a, FILE * f) { const curse_type * ct; char cursename[64]; + unsigned int flags; - if(global.data_version >= CURSEVIGOURISFLOAT_VERSION) { - fscanf(f, "%d %s %d %d %lf %d %d ", &c->no, cursename, &c->flag, + if (global.data_version >= CURSEVIGOURISFLOAT_VERSION) { + fscanf(f, "%d %s %u %d %lf %d %d ", &c->no, cursename, &flags, &c->duration, &c->vigour, &mageid.i, &c->effect.i); } else { 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->vigour = vigour; } ct = ct_find(cursename); - assert(ct!=NULL); + c->type = ct; + + if (global.data_version < CURSEFLAGS_VERSION) { + c_setflag(c, flags); + } else { + c->flags = flags; + } #ifdef CONVERT_DBLINK if (global.data_versiontype = ct; /* beim Einlesen sind noch nicht alle units da, muss also * zwischengespeichert werden. */ @@ -195,12 +201,12 @@ curse_read(attrib * a, FILE * f) { void curse_write(const attrib * a, FILE * f) { - int flag; + unsigned int flags; int mage_no; curse * c = (curse*)a->data.v; const curse_type * ct = c->type; - flag = (c->flag & ~(CURSE_ISNEW)); + flags = (c->flags & ~(CURSE_ISNEW)); if (c->magician){ mage_no = c->magician->no; @@ -208,7 +214,7 @@ curse_write(const attrib * a, FILE * f) { 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); if (c->type->write) c->type->write(f, c); @@ -436,9 +442,10 @@ set_cursedmen(curse *c, int cursedmen) /* ------------------------------------------------------------- */ 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. */ 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) { curse *c; @@ -457,7 +464,7 @@ set_curse(unit *mage, attrib **ap, const curse_type *ct, double vigour, c = (curse*)a->data.v; c->type = ct; - c->flag = 0; + c->flags = CURSE_ISNEW; c->vigour = vigour; c->duration = duration; c->effect = effect; @@ -497,7 +504,7 @@ create_curse(unit *magician, attrib **ap, const curse_type *ct, double vigour, c = get_curse(*ap, ct); - if(c && (c->flag & CURSE_ONLYONE)){ + if (c && (c_flags(c) & CURSE_ONLYONE)){ return NULL; } 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); } else { - c = set_curse(magician, ap, ct, vigour, duration, effect, men); + c = make_curse(magician, ap, ct, vigour, duration, effect, men); } return c; } @@ -545,7 +552,6 @@ create_curse(unit *magician, attrib **ap, const curse_type *ct, double vigour, static void do_transfer_curse(curse *c, unit * u, unit * u2, int n) { - int flag = c->flag; int cursedmen = 0; int men = 0; boolean dogive = false; @@ -562,7 +568,7 @@ do_transfer_curse(curse *c, unit * u, unit * u2, int n) cursedmen = u->number; } - switch (ct->spread){ + switch ((ct->flags | c->flags) & CURSE_SPREADMASK) { case CURSE_SPREADALWAYS: dogive = true; men = u2->number + n; @@ -593,9 +599,9 @@ do_transfer_curse(curse *c, unit * u, unit * u2, int n) } 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); - curse_setflag(cnew, flag); + cnew->flags = c->flags; if (ct->typ == CURSETYP_UNIT) set_cursedmen(cnew, men); } @@ -620,7 +626,7 @@ boolean curse_active(const curse *c) { 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; return true; @@ -706,14 +712,7 @@ static const char * oldnames[MAXCURSE] = { "fumble", "riotzone", "nocostbuilding", - "holyground", "godcursezone", - "", - "", - "", - "", - "", - "", "speed", "orcish", "magicboost", @@ -723,9 +722,6 @@ static const char * oldnames[MAXCURSE] = { "magicresistance", "itemcloak", "sparkle", - "", - "", - "", "skillmod" }; diff --git a/src/common/kernel/curse.h b/src/common/kernel/curse.h index 979aec80c..0488e3265 100644 --- a/src/common/kernel/curse.h +++ b/src/common/kernel/curse.h @@ -123,14 +123,7 @@ enum { C_FUMBLE, C_RIOT, /*region in Aufruhr */ C_NOCOST, - C_HOLYGROUND, 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: */ C_SPEED, /* Beschleunigt */ C_ORC, @@ -141,9 +134,6 @@ enum { C_MAGICRESISTANCE, /* 44 - verändert Magieresistenz */ C_ITEMCLOAK, C_SPARKLE, - C_FREE_22, - C_FREE_23, - C_FREE_24, /* struct's vom untertyp curse_skill: */ C_SKILL, MAXCURSE @@ -152,19 +142,23 @@ enum { /* ------------------------------------------------------------- */ /* 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 */ typedef enum { - CURSE_SPREADNEVER, /* wird nie mit übertragen */ - CURSE_SPREADALWAYS, /* wird immer mit übertragen */ - CURSE_SPREADMODULO, /* personenweise weitergabe */ - CURSE_SPREADCHANCE /* Ansteckungschance je nach Mengenverhältnis*/ -} spread_t; + CURSE_ISNEW = 0x01, /* wirkt in der zauberrunde nicht (default)*/ + CURSE_NOAGE = 0x02, /* wirkt ewig */ + CURSE_IMMUNE = 0x04, /* ignoriert Antimagie */ + CURSE_ONLYONE = 0x08, /* Verhindert, das ein weiterer Zauber dieser Art auf das Objekt gezaubert wird */ + + /* 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 */ enum { @@ -195,7 +189,7 @@ typedef struct curse { struct curse *nexthash; int no; /* 'Einheitennummer' dieses Curse */ 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 */ double vigour; /* Stärke der Verzauberung, Widerstand gegen Antimagie */ 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*/ } curse; +#define c_flags(c) ((c)->type->flags ^ (c)->flags) + /* Die Unterattribute curse->data: */ /* Einheitenzauber: * auf Einzelpersonen in einer Einheit bezogene Zauber. Für Zauber, die @@ -218,7 +214,7 @@ typedef struct curse_unit { typedef struct curse_type { const char *cname; /* Name der Zauberwirkung, Identifizierung des curse */ int typ; - spread_t spread; + unsigned int flags; unsigned int mergeflags; const char *info_str; /* Wirkung des curse, wird bei einer gelungenen Zauberanalyse angezeigt */ @@ -280,7 +276,7 @@ extern int get_cursedmen(struct unit *u, struct curse *c); /* gibt bei Personenbeschränkten Verzauberungen die Anzahl der * 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') */ void transfer_curse(struct unit * u, struct unit * u2, int n); diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 318394cf2..f3a4f29d6 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -176,6 +176,7 @@ struct building_type; #define TERRAIN_VERSION 322 /* terrains are a full type and saved by name */ #define REGIONITEMS_VERSION 323 /* regions have items */ #define ATTRIBREAD_VERSION 324 /* remove a_readint */ +#define CURSEFLAGS_VERSION 325 /* remove a_readint */ #define MIN_VERSION CURSETYPE_VERSION #define REGIONOWNERS_VERSION 400 @@ -183,7 +184,7 @@ struct building_type; #ifdef ENEMIES # define RELEASE_VERSION ENEMIES_VERSION #else -# define RELEASE_VERSION ATTRIBREAD_VERSION +# define RELEASE_VERSION CURSEFLAGS_VERSION #endif #define RESOURCE_CONVERSION diff --git a/src/common/kernel/region.c b/src/common/kernel/region.c index c1e8665f6..ff44e6864 100644 --- a/src/common/kernel/region.c +++ b/src/common/kernel/region.c @@ -144,9 +144,11 @@ void deathcounts (region * r, int fallen) { attrib * a; + static const curse_type * ctype = NULL; 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); if (!a) a = a_add(&r->attribs, a_new(&at_deathcount)); diff --git a/src/common/kernel/unit.c b/src/common/kernel/unit.c index 7c03b6ae2..7b3710c67 100644 --- a/src/common/kernel/unit.c +++ b/src/common/kernel/unit.c @@ -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, FLY_INTO) && (u->race->flags & RCF_FLY))) { + static const curse_type * ctype = NULL; if (get_item(u, I_HORSE) && !fval(r->terrain, WALK_INTO)) 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 true; diff --git a/src/common/spells/alp.c b/src/common/spells/alp.c index d33da68db..b2c85bb59 100644 --- a/src/common/spells/alp.c +++ b/src/common/spells/alp.c @@ -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); /* solange es noch keine spezielle alp-Antimagie gibt, reagiert der * auch auf normale */ - /* set_curseflag(opfer->attribs, C_ALLSKILLS, 0, CURSE_NOAGE+CURSE_IMMUN); */ - curse_setflag(c, CURSE_NOAGE); destroy_unit(alp); { diff --git a/src/common/spells/buildingcurse.c b/src/common/spells/buildingcurse.c index 286a6bd33..627a79776 100644 --- a/src/common/spells/buildingcurse.c +++ b/src/common/spells/buildingcurse.c @@ -95,7 +95,7 @@ static struct curse_type ct_strongwall = { "strongwall", /* Ewige Mauern-Zauber */ 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 " "gebunden. Unbeeindruck vom Zahn der Zeit wird dieses Gebäude wohl " "auf Ewig stehen.", diff --git a/src/common/spells/regioncurse.c b/src/common/spells/regioncurse.c index 34711d054..406dd0fc2 100644 --- a/src/common/spells/regioncurse.c +++ b/src/common/spells/regioncurse.c @@ -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 = { "godcursezone", - CURSETYP_NORM, 0, (NO_MERGE), + CURSETYP_NORM, CURSE_IMMUNE, (NO_MERGE), "Diese Region wurde von den Göttern verflucht. Stinkende Nebel ziehen " "ü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 " @@ -305,7 +305,7 @@ static struct curse_type ct_riotzone = { }; static struct curse_type ct_holyground = { "holyground", - CURSETYP_NORM, 0, (M_VIGOUR_ADD), + CURSETYP_NORM, CURSE_NOAGE, (M_VIGOUR_ADD), "Verschiedene Naturgeistern sind im Boden der Region gebunden und " "beschützen diese vor dem der dunklen Magie des lebenden Todes.", cinfo_simple diff --git a/src/common/spells/spells.c b/src/common/spells/spells.c index fb3b05454..bb9b4c465 100644 --- a/src/common/spells/spells.c +++ b/src/common/spells/spells.c @@ -142,7 +142,7 @@ magicanalyse_region(region *r, unit *mage, double force) found = true; if (chance(probability)) { /* Analyse geglückt */ - if (c->flag & CURSE_NOAGE) { + if (c_flags(c) & CURSE_NOAGE) { ADDMSG(&mage->faction->msgs, msg_message( "analyse_region_noage", "mage region curse", 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); if (chance(probability)) { /* Analyse geglückt */ - if (c->flag & CURSE_NOAGE) { + if (c_flags(c) & CURSE_NOAGE) { ADDMSG(&mage->faction->msgs, msg_message( "analyse_unit_noage", "mage unit curse", 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); if (chance(probability)) { /* Analyse geglückt */ - if (c->flag & CURSE_NOAGE) { + if (c_flags(c) & CURSE_NOAGE) { ADDMSG(&mage->faction->msgs, msg_message( "analyse_building_age", "mage building curse", 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); if (chance(probability)) { /* Analyse geglückt */ - if (c->flag & CURSE_NOAGE) { + if (c_flags(c) & CURSE_NOAGE) { ADDMSG(&mage->faction->msgs, msg_message( "analyse_ship_noage", "mage ship curse", 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; /* 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); continue; } @@ -999,7 +999,6 @@ sp_maelstrom(castorder *co) * (Max(Dauer), Max(Stärke))*/ effect.i = (int)power; c = create_curse(mage, &r->attribs, ct_find("maelstrom"), power, duration, effect, 0); - curse_setflag(c, CURSE_ISNEW); /* melden, 1x pro Partei */ { @@ -1975,6 +1974,7 @@ sp_treewalkexit(castorder *co) static int sp_holyground(castorder *co) { + static const curse_type * ctype = NULL; region *r = co->rt; unit *mage = co->magician.u; 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)); msg_release(msg); - c = create_curse(mage, &r->attribs, ct_find("holyground"), - power*power, 1, zero_effect, 0); - - curse_setflag(c, CURSE_NOAGE); + if (!ctype) ctype = ct_find("holyground"); + c = create_curse(mage, &r->attribs, ctype, power*power, 1, zero_effect, 0); a_removeall(&r->attribs, &at_deathcount); @@ -2029,13 +2027,13 @@ sp_homestone(castorder *co) cmistake(mage, co->order, 206, MSG_MAGIC); return 0; } - curse_setflag(c, CURSE_NOAGE|CURSE_ONLYONE); + c_setflag(c, CURSE_NOAGE|CURSE_ONLYONE); /* Magieresistenz der Burg erhöht sich um 50% */ effect.i = 50; c = create_curse(mage, &mage->building->attribs, 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 */ 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); for (rl2 = rl; rl2; rl2 = rl2->next) { + static const curse_type * ctype = NULL; + region * r2 = rl2->data; curse * c; variant effect; message * m = NULL; - if (!fval(rl2->data->terrain, SEA_REGION) - && !r_isforest(rl2->data)) continue; + if (!fval(r2->terrain, SEA_REGION) + && !r_isforest(r2)) continue; /* Magieresistenz jeder Region prüfen */ if (target_resists_magic(mage, r, TYP_REGION, 0)) { @@ -2167,13 +2167,11 @@ sp_fog_of_confusion(castorder *co) } effect.i = cast_level*5; - c = create_curse(mage, &rl2->data->attribs, - ct_find("disorientationzone"), power, duration, effect, 0); - /* Soll der schon in der Zauberrunde wirken? */ - curse_setflag(c, CURSE_ISNEW); + if (!ctype) ctype = ct_find("disorientationzone"); + c = create_curse(mage, &r2->attribs, ctype, power, duration, effect, 0); - for (u = rl2->data->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) freset(u->faction, FL_DH); + for (u = r2->units; u; u = u->next ) { if (!fval(u->faction, FL_DH) ) { fset(u->faction, FL_DH); if (!m) m = msg_message("confusion_result", "mage", mage); @@ -2596,7 +2594,6 @@ sp_fumblecurse(castorder *co) return 0; } - curse_setflag(c, CURSE_ONLYONE); ADDMSG(&target->faction->msgs, msg_message( "fumblecurse", "unit region", target, target->region)); @@ -2620,7 +2617,6 @@ patzer_fumblecurse(castorder *co) ADDMSG(&mage->faction->msgs, msg_message( "magic_fumble", "unit region command", mage, mage->region, co->order)); - curse_setflag(c, CURSE_ONLYONE); } return; } @@ -2694,7 +2690,8 @@ sp_summondragon(castorder *co) rl = all_in_range(r, (short)power, NULL); 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]) { attrib * a = a_find(u->attribs, &at_targetregion); if (!a) { @@ -2702,7 +2699,7 @@ sp_summondragon(castorder *co) } else { 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); } } @@ -3565,8 +3562,6 @@ sp_magicboost(castorder *co) effect.i = 6; 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: */ effect.i = 200; @@ -4702,8 +4697,6 @@ sp_calm_monster(castorder *co) report_failure(mage, co->order); return 0; } - /* Nur ein Beherrschungszauber pro Unit */ - curse_setflag(c, CURSE_ONLYONE); sprintf(buf, "%s besänftigt %s.", unitname(mage), unitname(target)); addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO); @@ -4893,7 +4886,8 @@ sp_dragonsong(castorder *co) rl = all_in_range(r, (int)power); 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) { attrib * a = a_find(u->attribs, &at_targetregion); if (!a) { @@ -4901,7 +4895,7 @@ sp_dragonsong(castorder *co) } else { 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); } } @@ -5231,7 +5225,6 @@ sp_baddreams(castorder *co) /* Nichts machen als ein entsprechendes Attribut in die Region legen. */ effect.i = -1; c = create_curse(mage, &r->attribs, ct_find("gbdream"), power, duration, effect, 0); - curse_setflag(c, CURSE_ISNEW); /* Erfolg melden*/ ADDMSG(&mage->faction->msgs, msg_message( @@ -5270,7 +5263,6 @@ sp_gooddreams(castorder *co) duration = 2 + rng_int()%duration; effect.i = 1; c = create_curse(mage, &r->attribs, ct_find("gbdream"), power, duration, effect, 0); - curse_setflag(c, CURSE_ISNEW); /* Erfolg melden*/ ADDMSG(&mage->faction->msgs, msg_message( @@ -5402,7 +5394,6 @@ sp_sweetdreams(castorder *co) /* Nichts machen als ein entsprechendes Attribut an die Einheit legen. */ effect.i = 5; 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.", unitname(mage), unitname(u)); @@ -5425,7 +5416,6 @@ sp_disturbingdreams(castorder *co) effect.i = 10; 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.", unitname(mage), regionname(r, mage->faction)); @@ -5463,8 +5453,6 @@ sp_dream_of_confusion(castorder *co) effect.i = cast_level*5; c = create_curse(mage, &r2->attribs, 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 ) { @@ -6159,9 +6147,10 @@ sp_showastral(castorder *co) /* Erst Einheiten zählen, für die Grammatik. */ - for(rl2=rl; rl2; rl2=rl2->next) { - if (!is_cursed(rl2->data->attribs, C_ASTRALBLOCK, 0)) { - for(u = rl2->data->units; u; u=u->next) { + for (rl2=rl; rl2; rl2=rl2->next) { + region * r2 = rl2->data; + 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++; } } @@ -6382,7 +6371,7 @@ sp_eternizewall(castorder *co) if (pa->param[0]->flag == TARGET_NOTFOUND) return 0; 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); if (c==NULL) { /* ist bereits verzaubert */ @@ -6390,8 +6379,6 @@ sp_eternizewall(castorder *co) return 0; } - curse_setflag(c, CURSE_NOAGE|CURSE_ONLYONE); - /* 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) { @@ -6557,6 +6544,11 @@ sp_movecastle(castorder *co) return cast_level; } +boolean +shipcurse_flyingship(ship* sh, int power, int duration) +{ + return false; +} /* ------------------------------------------------------------- */ /* Name: Luftschiff * Stufe: 6 diff --git a/src/common/spells/unitcurse.c b/src/common/spells/unitcurse.c index 75555a049..dc3cd7454 100644 --- a/src/common/spells/unitcurse.c +++ b/src/common/spells/unitcurse.c @@ -69,10 +69,11 @@ static struct curse_type ct_auraboost = { "benutzt werden.", cinfo_auraboost }; + /* Magic Boost - Gabe des Chaos */ static struct curse_type ct_magicboost = { "magicboost", - CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, + CURSETYP_UNIT, CURSE_SPREADMODULO|CURSE_IMMUNE, M_MEN, "", NULL }; @@ -125,8 +126,10 @@ cinfo_calm(const void * obj, typ_t typ, const curse *c, int self) } 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 " "bestimmten Volk wohlgesonnen zu machen.", cinfo_calm @@ -282,7 +285,7 @@ static struct curse_type ct_strength = { "strength", */ static struct curse_type ct_worse = { "worse", - CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, + CURSETYP_UNIT, CURSE_SPREADMODULO|CURSE_NOAGE, M_MEN, "", cinfo_unit }; @@ -302,7 +305,7 @@ static struct curse_type ct_itemcloak = { static struct curse_type ct_fumble = { "fumble", - CURSETYP_NORM, CURSE_SPREADNEVER, NO_MERGE, + CURSETYP_NORM, CURSE_SPREADNEVER|CURSE_ONLYONE, NO_MERGE, "Eine Wolke negativer Energie umgibt die Einheit.", cinfo_unit }; diff --git a/src/eressea/eressea-lua.vcproj b/src/eressea/eressea-lua.vcproj index 88b8287b1..1b3f78483 100644 --- a/src/eressea/eressea-lua.vcproj +++ b/src/eressea/eressea-lua.vcproj @@ -175,7 +175,7 @@ attribs, ct, 100, 100, effect, 0); - curse_setflag(c, CURSE_ISNEW|CURSE_IMMUNE); } freset(r, FL_MARK); }