diff --git a/src/common/kernel/magic.c b/src/common/kernel/magic.c index d540d9b0c..1ff3dfd81 100644 --- a/src/common/kernel/magic.c +++ b/src/common/kernel/magic.c @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.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->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 */ add_trigger(&mage->attribs, "destroy", trigger_killunit(familiar)); @@ -2461,6 +2493,7 @@ set_familiar(unit * mage, unit * familiar) } + static void * resolve_familiar(void * data) { diff --git a/src/common/kernel/magic.h b/src/common/kernel/magic.h index b90274c66..c727ee403 100644 --- a/src/common/kernel/magic.h +++ b/src/common/kernel/magic.h @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.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_familiarmage; 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, const char *desc, const char *keyword); diff --git a/src/common/kernel/spell.c b/src/common/kernel/spell.c index 1d6db13c6..d1f99f0aa 100644 --- a/src/common/kernel/spell.c +++ b/src/common/kernel/spell.c @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -633,7 +633,7 @@ make_familiar(unit *familiar, unit *mage) break; } #ifdef NEW_TRIGGER - set_familiar(mage, familiar); + create_newfamiliar(mage, familiar); #else { old_trigger *trig1, *trig2; diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index 2ad991d83..bc5cf669a 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -179,49 +179,49 @@ fix_vertrautenmagie(void) switch(u->race) { case RC_PSEUDODRAGON: - addspell(u, SPL_FLEE); - addspell(u, SPL_SLEEP); - addspell(u, SPL_FRIGHTEN); + if(!getspell(u, SPL_FLEE)) addspell(u, SPL_FLEE); + if(!getspell(u, SPL_SLEEP)) addspell(u, SPL_SLEEP); + if(!getspell(u, SPL_FRIGHTEN)) addspell(u, SPL_FRIGHTEN); break; case RC_NYMPH: - addspell(u, SPL_SEDUCE); - addspell(u, SPL_CALM_MONSTER); - addspell(u, SPL_SONG_OF_CONFUSION); - addspell(u, SPL_DENYATTACK); + if(!getspell(u, SPL_SEDUCE)) addspell(u, SPL_SEDUCE); + if(!getspell(u, SPL_CALM_MONSTER)) addspell(u, SPL_CALM_MONSTER); + if(!getspell(u, SPL_SONG_OF_CONFUSION)) addspell(u, SPL_SONG_OF_CONFUSION); + if(!getspell(u, SPL_DENYATTACK)) addspell(u, SPL_DENYATTACK); break; case RC_UNICORN: - addspell(u, SPL_RESISTMAGICBONUS); - addspell(u, SPL_SONG_OF_PEACE); - addspell(u, SPL_CALM_MONSTER); - addspell(u, SPL_HERO); - addspell(u, SPL_HEALINGSONG); - addspell(u, SPL_DENYATTACK); + if(!getspell(u, SPL_RESISTMAGICBONUS)) addspell(u, SPL_RESISTMAGICBONUS); + if(!getspell(u, SPL_SONG_OF_PEACE)) addspell(u, SPL_SONG_OF_PEACE); + if(!getspell(u, SPL_CALM_MONSTER)) addspell(u, SPL_CALM_MONSTER); + if(!getspell(u, SPL_HERO)) addspell(u, SPL_HERO); + if(!getspell(u, SPL_HEALINGSONG)) addspell(u, SPL_HEALINGSONG); + if(!getspell(u, SPL_DENYATTACK)) addspell(u, SPL_DENYATTACK); break; case RC_WRAITH: - addspell(u, SPL_STEALAURA); - addspell(u, SPL_FRIGHTEN); - addspell(u, SPL_SUMMONUNDEAD); + if(!getspell(u, SPL_STEALAURA)) addspell(u, SPL_STEALAURA); + if(!getspell(u, SPL_FRIGHTEN)) addspell(u, SPL_FRIGHTEN); + if(!getspell(u, SPL_SUMMONUNDEAD)) addspell(u, SPL_SUMMONUNDEAD); break; case RC_IMP: - addspell(u, SPL_STEALAURA); + if(!getspell(u, SPL_STEALAURA)) addspell(u, SPL_STEALAURA); break; case RC_DREAMCAT: - addspell(u, SPL_ILL_SHAPESHIFT); - addspell(u, SPL_TRANSFERAURA_TRAUM); + if(!getspell(u, SPL_ILL_SHAPESHIFT)) addspell(u, SPL_ILL_SHAPESHIFT); + if(!getspell(u, SPL_TRANSFERAURA_TRAUM)) addspell(u, SPL_TRANSFERAURA_TRAUM); break; case RC_FEY: - addspell(u, SPL_DENYATTACK); - addspell(u, SPL_CALM_MONSTER); - addspell(u, SPL_SEDUCE); + if(!getspell(u, SPL_DENYATTACK)) addspell(u, SPL_DENYATTACK); + if(!getspell(u, SPL_CALM_MONSTER)) addspell(u, SPL_CALM_MONSTER); + if(!getspell(u, SPL_SEDUCE)) addspell(u, SPL_SEDUCE); break; /* kein break, ein Wyrm hat alle Drachensprüche */ case RC_WYRM: - addspell(u, SPL_WYRMODEM); + if(!getspell(u, SPL_WYRMODEM)) addspell(u, SPL_WYRMODEM); case RC_DRAGON: - addspell(u, SPL_DRAGONODEM); + if(!getspell(u, SPL_DRAGONODEM)) addspell(u, SPL_DRAGONODEM); case RC_FIREDRAGON: case RC_SEASERPENT: - addspell(u, SPL_FIREDRAGONODEM); + if(!getspell(u, SPL_FIREDRAGONODEM)) addspell(u, SPL_FIREDRAGONODEM); break; } }