"Todeswolke läßt sich nicht bannen"

at_deathcloud kann weg. curse_type kriegt eine age() funktion, so dass der effekt von deathclouds mit normalen "curse" attributen gemacht werden kann.
This commit is contained in:
Enno Rehling 2006-07-28 11:41:57 +00:00
parent 41af35a411
commit a421c1a31d
4 changed files with 25 additions and 33 deletions

View File

@ -109,13 +109,19 @@ int
curse_age(attrib * a)
{
curse * c = (curse*)a->data.v;
int result = 0;
if (c->flag & CURSE_NOAGE) {
if (c->type->age) {
result = c->type->age(c);
}
if (result!=0) {
c->duration = 0;
} else if (c->flag & CURSE_NOAGE) {
c->duration = 1;
} else {
c->duration = max(0, c->duration-1);
}
return (c->duration);
return c->duration;
}
void

View File

@ -227,6 +227,7 @@ typedef struct curse_type {
int (*read)(FILE * F, curse * c);
int (*write)(FILE * F, const curse * c);
int (*cansee)(const struct faction*, const void*, typ_t, curse *, int);
int (*age)(curse *);
} curse_type;

View File

@ -226,7 +226,6 @@ void magic(void);
void regeneration_magiepunkte(void);
extern attrib_type at_deathcloud;
extern attrib_type at_seenspell;
extern attrib_type at_mage;
extern attrib_type at_familiarmage;

View File

@ -3182,35 +3182,10 @@ sp_unholypower(castorder *co)
* (FARCASTING | REGIONSPELL | TESTRESISTANCE)
*/
static struct curse_type ct_deathcloud = {
"deathcloud", CURSETYP_REGION, 0, NO_MERGE, NULL, cinfo_region,
};
static curse *
mk_deathcloud(unit * mage, region * r, double force, int duration)
{
variant effect;
curse * c;
effect.f = (float)force/2;
c = create_curse(mage, &r->attribs, &ct_deathcloud, force, duration, effect, 0);
c->data.v = r;
return c;
}
static void
dc_finalize(struct attrib * a)
{
curse * c = (curse*)a->data.v;
c->data.v = NULL;
destroy_curse(c);
}
static int
dc_age(struct attrib * a)
dc_age(struct curse * c)
/* age returns 0 if the attribute needs to be removed, !=0 otherwise */
{
curse * c = (curse*)a->data.v;
region * r = (region*)c->data.v;
unit ** up = &r->units;
unit * mage = c->magician;
@ -3251,14 +3226,25 @@ dc_age(struct attrib * a)
"mage region", mage, r));
}
return --c->duration;
return 0;
}
attrib_type at_deathcloud = {
"curse_dc", curse_init, curse_done, dc_age, curse_write, curse_read, ATF_CURSE
static struct curse_type ct_deathcloud = {
"deathcloud", CURSETYP_REGION, 0, NO_MERGE, NULL, cinfo_region, NULL, NULL, NULL, NULL, dc_age
};
static curse *
mk_deathcloud(unit * mage, region * r, double force, int duration)
{
variant effect;
curse * c;
effect.f = (float)force/2;
c = create_curse(mage, &r->attribs, &ct_deathcloud, force, duration, effect, 0);
c->data.v = r;
return c;
}
#define COMPAT_DEATHCLOUD
#ifdef COMPAT_DEATHCLOUD
static int