fix mehrfachtrigger - neue funktion create_newfamiliar

fix mehrfachzauber bei vertrauten
This commit is contained in:
Katja Zedel 2001-02-18 09:21:11 +00:00
parent 96d6cc03a5
commit 2854c15075
4 changed files with 64 additions and 30 deletions

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: magic.c,v 1.9 2001/02/17 15:02:49 enno Exp $ * $Id: magic.c,v 1.10 2001/02/18 09:21:11 katze Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -2453,6 +2453,38 @@ set_familiar(unit * mage, unit * familiar)
a = a_add(&familiar->attribs, a_new(&at_familiarmage)); a = a_add(&familiar->attribs, a_new(&at_familiarmage));
a->data.v = mage; a->data.v = mage;
} else assert(!a->data.v || a->data.v == mage); } else assert(!a->data.v || a->data.v == mage);
}
void
create_newfamiliar(unit * mage, unit * familiar)
{
/* if the skill modifier for the mage does not yet exist, add it */
attrib * a = a_find(mage->attribs, &at_skillmod);
while (a) {
skillmod_data * smd = (skillmod_data *)a->data.v;
if (smd->special==sm_familiar) break;
a = a->nexttype;
}
if (a==NULL) {
attrib * an = a_add(&mage->attribs, a_new(&at_skillmod));
skillmod_data * smd = (skillmod_data *)an->data.v;
smd->special = sm_familiar;
smd->skill=NOSKILL;
}
a = a_find(mage->attribs, &at_familiar);
if (a==NULL) {
a = a_add(&mage->attribs, a_new(&at_familiar));
a->data.v = familiar;
} else assert(!a->data.v || a->data.v == familiar);
/* TODO: Diese Attribute beim Tod des Familiars entfernen: */
a = a_find(familiar->attribs, &at_familiarmage);
if (a==NULL) {
a = a_add(&familiar->attribs, a_new(&at_familiarmage));
a->data.v = mage;
} else assert(!a->data.v || a->data.v == mage);
/* Wenn der Magier stirbt, dann auch der Vertraute */ /* Wenn der Magier stirbt, dann auch der Vertraute */
add_trigger(&mage->attribs, "destroy", trigger_killunit(familiar)); add_trigger(&mage->attribs, "destroy", trigger_killunit(familiar));
@ -2461,6 +2493,7 @@ set_familiar(unit * mage, unit * familiar)
} }
static void * static void *
resolve_familiar(void * data) resolve_familiar(void * data)
{ {

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: magic.h,v 1.2 2001/01/26 16:19:40 enno Exp $ * $Id: magic.h,v 1.3 2001/02/18 09:21:11 katze Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -388,6 +388,7 @@ extern struct unit * get_familiar_mage(const struct unit *u);
extern struct attrib_type at_familiar; extern struct attrib_type at_familiar;
extern struct attrib_type at_familiarmage; extern struct attrib_type at_familiarmage;
extern void set_familiar(struct unit * mage, struct unit * familiar); extern void set_familiar(struct unit * mage, struct unit * familiar);
extern void create_newfamiliar(struct unit * mage, struct unit * familiar);
extern struct attrib *create_special_direction(struct region *r, int x, int y, int duration, extern struct attrib *create_special_direction(struct region *r, int x, int y, int duration,
const char *desc, const char *keyword); const char *desc, const char *keyword);

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: spell.c,v 1.10 2001/02/13 18:43:54 katze Exp $ * $Id: spell.c,v 1.11 2001/02/18 09:21:11 katze Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -633,7 +633,7 @@ make_familiar(unit *familiar, unit *mage)
break; break;
} }
#ifdef NEW_TRIGGER #ifdef NEW_TRIGGER
set_familiar(mage, familiar); create_newfamiliar(mage, familiar);
#else #else
{ {
old_trigger *trig1, *trig2; old_trigger *trig1, *trig2;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: korrektur.c,v 1.26 2001/02/17 16:07:03 enno Exp $ * $Id: korrektur.c,v 1.27 2001/02/18 09:21:11 katze Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -179,49 +179,49 @@ fix_vertrautenmagie(void)
switch(u->race) { switch(u->race) {
case RC_PSEUDODRAGON: case RC_PSEUDODRAGON:
addspell(u, SPL_FLEE); if(!getspell(u, SPL_FLEE)) addspell(u, SPL_FLEE);
addspell(u, SPL_SLEEP); if(!getspell(u, SPL_SLEEP)) addspell(u, SPL_SLEEP);
addspell(u, SPL_FRIGHTEN); if(!getspell(u, SPL_FRIGHTEN)) addspell(u, SPL_FRIGHTEN);
break; break;
case RC_NYMPH: case RC_NYMPH:
addspell(u, SPL_SEDUCE); if(!getspell(u, SPL_SEDUCE)) addspell(u, SPL_SEDUCE);
addspell(u, SPL_CALM_MONSTER); if(!getspell(u, SPL_CALM_MONSTER)) addspell(u, SPL_CALM_MONSTER);
addspell(u, SPL_SONG_OF_CONFUSION); if(!getspell(u, SPL_SONG_OF_CONFUSION)) addspell(u, SPL_SONG_OF_CONFUSION);
addspell(u, SPL_DENYATTACK); if(!getspell(u, SPL_DENYATTACK)) addspell(u, SPL_DENYATTACK);
break; break;
case RC_UNICORN: case RC_UNICORN:
addspell(u, SPL_RESISTMAGICBONUS); if(!getspell(u, SPL_RESISTMAGICBONUS)) addspell(u, SPL_RESISTMAGICBONUS);
addspell(u, SPL_SONG_OF_PEACE); if(!getspell(u, SPL_SONG_OF_PEACE)) addspell(u, SPL_SONG_OF_PEACE);
addspell(u, SPL_CALM_MONSTER); if(!getspell(u, SPL_CALM_MONSTER)) addspell(u, SPL_CALM_MONSTER);
addspell(u, SPL_HERO); if(!getspell(u, SPL_HERO)) addspell(u, SPL_HERO);
addspell(u, SPL_HEALINGSONG); if(!getspell(u, SPL_HEALINGSONG)) addspell(u, SPL_HEALINGSONG);
addspell(u, SPL_DENYATTACK); if(!getspell(u, SPL_DENYATTACK)) addspell(u, SPL_DENYATTACK);
break; break;
case RC_WRAITH: case RC_WRAITH:
addspell(u, SPL_STEALAURA); if(!getspell(u, SPL_STEALAURA)) addspell(u, SPL_STEALAURA);
addspell(u, SPL_FRIGHTEN); if(!getspell(u, SPL_FRIGHTEN)) addspell(u, SPL_FRIGHTEN);
addspell(u, SPL_SUMMONUNDEAD); if(!getspell(u, SPL_SUMMONUNDEAD)) addspell(u, SPL_SUMMONUNDEAD);
break; break;
case RC_IMP: case RC_IMP:
addspell(u, SPL_STEALAURA); if(!getspell(u, SPL_STEALAURA)) addspell(u, SPL_STEALAURA);
break; break;
case RC_DREAMCAT: case RC_DREAMCAT:
addspell(u, SPL_ILL_SHAPESHIFT); if(!getspell(u, SPL_ILL_SHAPESHIFT)) addspell(u, SPL_ILL_SHAPESHIFT);
addspell(u, SPL_TRANSFERAURA_TRAUM); if(!getspell(u, SPL_TRANSFERAURA_TRAUM)) addspell(u, SPL_TRANSFERAURA_TRAUM);
break; break;
case RC_FEY: case RC_FEY:
addspell(u, SPL_DENYATTACK); if(!getspell(u, SPL_DENYATTACK)) addspell(u, SPL_DENYATTACK);
addspell(u, SPL_CALM_MONSTER); if(!getspell(u, SPL_CALM_MONSTER)) addspell(u, SPL_CALM_MONSTER);
addspell(u, SPL_SEDUCE); if(!getspell(u, SPL_SEDUCE)) addspell(u, SPL_SEDUCE);
break; break;
/* kein break, ein Wyrm hat alle Drachensprüche */ /* kein break, ein Wyrm hat alle Drachensprüche */
case RC_WYRM: case RC_WYRM:
addspell(u, SPL_WYRMODEM); if(!getspell(u, SPL_WYRMODEM)) addspell(u, SPL_WYRMODEM);
case RC_DRAGON: case RC_DRAGON:
addspell(u, SPL_DRAGONODEM); if(!getspell(u, SPL_DRAGONODEM)) addspell(u, SPL_DRAGONODEM);
case RC_FIREDRAGON: case RC_FIREDRAGON:
case RC_SEASERPENT: case RC_SEASERPENT:
addspell(u, SPL_FIREDRAGONODEM); if(!getspell(u, SPL_FIREDRAGONODEM)) addspell(u, SPL_FIREDRAGONODEM);
break; break;
} }
} }