forked from github/server
familiar crap.
This commit is contained in:
parent
722e66be41
commit
d8a89d7630
|
@ -2172,31 +2172,26 @@ remove_familiar(unit *mage)
|
||||||
boolean
|
boolean
|
||||||
create_newfamiliar(unit * mage, unit * familiar)
|
create_newfamiliar(unit * mage, unit * familiar)
|
||||||
{
|
{
|
||||||
/* if the skill modifier for the mage does not yet exist, add it */
|
/* if the skill modifier for the mage does not yet exist, add it */
|
||||||
attrib *a;
|
attrib *a;
|
||||||
attrib *afam = a_find(mage->attribs, &at_familiar);
|
attrib *afam = a_find(mage->attribs, &at_familiar);
|
||||||
attrib *amage = a_find(familiar->attribs, &at_familiarmage);
|
attrib *amage = a_find(familiar->attribs, &at_familiarmage);
|
||||||
|
|
||||||
if ((afam==NULL || afam->data.v==NULL) && (amage==NULL || amage->data.v==NULL)) {
|
if (afam==NULL) {
|
||||||
afam = a_add(&mage->attribs, a_new(&at_familiar));
|
afam = a_add(&mage->attribs, a_new(&at_familiar));
|
||||||
afam->data.v = familiar;
|
|
||||||
|
|
||||||
amage = a_add(&familiar->attribs, a_new(&at_familiarmage));
|
|
||||||
amage->data.v = mage;
|
|
||||||
} else {
|
|
||||||
assert(afam->data.v == familiar);
|
|
||||||
assert(amage->data.v == mage);
|
|
||||||
if (afam->data.v != familiar || amage->data.v != mage) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
afam->data.v = familiar;
|
||||||
|
if (amage==NULL) {
|
||||||
|
amage = a_add(&familiar->attribs, a_new(&at_familiarmage));
|
||||||
|
}
|
||||||
|
amage->data.v = mage;
|
||||||
|
|
||||||
/* TODO: Diese Attribute beim Tod des Familiars entfernen: */
|
/* TODO: Diese Attribute beim Tod des Familiars entfernen: */
|
||||||
/* 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));
|
||||||
/* Wenn der Vertraute stirbt, dann bekommt der Magier einen Schock */
|
/* Wenn der Vertraute stirbt, dann bekommt der Magier einen Schock */
|
||||||
add_trigger(&familiar->attribs, "destroy", trigger_shock(mage));
|
add_trigger(&familiar->attribs, "destroy", trigger_shock(mage));
|
||||||
|
|
||||||
a = a_find(mage->attribs, &at_skillmod);
|
a = a_find(mage->attribs, &at_skillmod);
|
||||||
while (a && a->type==&at_skillmod) {
|
while (a && a->type==&at_skillmod) {
|
||||||
skillmod_data * smd = (skillmod_data *)a->data.v;
|
skillmod_data * smd = (skillmod_data *)a->data.v;
|
||||||
|
|
Loading…
Reference in New Issue