Merge pull request #872 from ennorehling/develop

bug 2603: when familiars cast spells, use their name in messages.
This commit is contained in:
Enno Rehling 2019-09-01 04:10:08 +02:00 committed by GitHub
commit 7e4d7bf286
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1335,8 +1335,8 @@ static void do_fumble(castorder * co)
static int rc_cache; static int rc_cache;
fumble_f fun; fumble_f fun;
ADDMSG(&mage->faction->msgs, ADDMSG(&caster->faction->msgs,
msg_message("patzer", "unit region spell", mage, r, sp)); msg_message("patzer", "unit region spell", caster, r, sp));
switch (rng_int() % 10) { switch (rng_int() % 10) {
case 0: case 0:
/* wenn vorhanden spezieller Patzer, ansonsten nix */ /* wenn vorhanden spezieller Patzer, ansonsten nix */
@ -1385,14 +1385,14 @@ static void do_fumble(castorder * co)
c = create_curse(mage, &mage->attribs, &ct_skillmod, level, c = create_curse(mage, &mage->attribs, &ct_skillmod, level,
duration, effect, 1); duration, effect, 1);
c->data.i = SK_MAGIC; c->data.i = SK_MAGIC;
ADDMSG(&mage->faction->msgs, msg_message("patzer2", "unit region", mage, r)); ADDMSG(&caster->faction->msgs, msg_message("patzer2", "unit region", caster, r));
break; break;
case 3: case 3:
case 4: case 4:
/* Spruch schlaegt fehl, alle Magiepunkte weg */ /* Spruch schlaegt fehl, alle Magiepunkte weg */
set_spellpoints(mage, 0); set_spellpoints(mage, 0);
ADDMSG(&mage->faction->msgs, msg_message("patzer3", "unit region spell", ADDMSG(&caster->faction->msgs, msg_message("patzer3", "unit region spell",
mage, r, sp)); caster, r, sp));
break; break;
case 5: case 5:
@ -1400,8 +1400,8 @@ static void do_fumble(castorder * co)
/* Spruch gelingt, aber alle Magiepunkte weg */ /* Spruch gelingt, aber alle Magiepunkte weg */
co->level = cast_spell(co); co->level = cast_spell(co);
set_spellpoints(mage, 0); set_spellpoints(mage, 0);
ADDMSG(&mage->faction->msgs, msg_message("patzer4", "unit region spell", ADDMSG(&caster->faction->msgs, msg_message("patzer4", "unit region spell",
mage, r, sp)); caster, r, sp));
break; break;
case 7: case 7:
@ -1410,8 +1410,8 @@ static void do_fumble(castorder * co)
default: default:
/* Spruch gelingt, alle nachfolgenden Sprueche werden 2^4 so teuer */ /* Spruch gelingt, alle nachfolgenden Sprueche werden 2^4 so teuer */
co->level = cast_spell(co); co->level = cast_spell(co);
ADDMSG(&mage->faction->msgs, msg_message("patzer5", "unit region spell", ADDMSG(&caster->faction->msgs, msg_message("patzer5", "unit region spell",
mage, r, sp)); caster, r, sp));
countspells(caster, 3); countspells(caster, 3);
} }
} }
@ -1626,7 +1626,7 @@ verify_unit(region * r, unit * mage, const spell * sp, spllprm * spobj,
static void static void
verify_targets(castorder * co, int *invalid, int *resist, int *success) verify_targets(castorder * co, int *invalid, int *resist, int *success)
{ {
unit *mage = co_get_magician(co); unit *caster = co_get_caster(co);
const spell *sp = co->sp; const spell *sp = co->sp;
region *target_r = co_get_region(co); region *target_r = co_get_region(co);
spellparameter *sa = co->par; spellparameter *sa = co->par;
@ -1647,15 +1647,15 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
switch (spobj->typ) { switch (spobj->typ) {
case SPP_TEMP: case SPP_TEMP:
case SPP_UNIT: case SPP_UNIT:
if (!verify_unit(target_r, mage, sp, spobj, co->order)) if (!verify_unit(target_r, caster, sp, spobj, co->order))
++ * invalid; ++ * invalid;
break; break;
case SPP_BUILDING: case SPP_BUILDING:
if (!verify_building(target_r, mage, sp, spobj, co->order)) if (!verify_building(target_r, caster, sp, spobj, co->order))
++ * invalid; ++ * invalid;
break; break;
case SPP_SHIP: case SPP_SHIP:
if (!verify_ship(target_r, mage, sp, spobj, co->order)) if (!verify_ship(target_r, caster, sp, spobj, co->order))
++ * invalid; ++ * invalid;
break; break;
default: default:
@ -1679,13 +1679,13 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
u = spobj->data.u; u = spobj->data.u;
if ((sp->sptyp & TESTRESISTANCE) if ((sp->sptyp & TESTRESISTANCE)
&& target_resists_magic(mage, u, TYP_UNIT, 0)) { && target_resists_magic(caster, u, TYP_UNIT, 0)) {
/* Fehlermeldung */ /* Fehlermeldung */
spobj->data.i = u->no; spobj->data.i = u->no;
spobj->flag = TARGET_RESISTS; spobj->flag = TARGET_RESISTS;
++*resist; ++*resist;
ADDMSG(&mage->faction->msgs, msg_message("spellunitresists", ADDMSG(&caster->faction->msgs, msg_message("spellunitresists",
"unit region command target", mage, mage->region, co->order, u)); "unit region command target", caster, caster->region, co->order, u));
break; break;
} }
@ -1696,13 +1696,13 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
b = spobj->data.b; b = spobj->data.b;
if ((sp->sptyp & TESTRESISTANCE) if ((sp->sptyp & TESTRESISTANCE)
&& target_resists_magic(mage, b, TYP_BUILDING, 0)) { /* Fehlermeldung */ && target_resists_magic(caster, b, TYP_BUILDING, 0)) { /* Fehlermeldung */
spobj->data.i = b->no; spobj->data.i = b->no;
spobj->flag = TARGET_RESISTS; spobj->flag = TARGET_RESISTS;
++*resist; ++*resist;
ADDMSG(&mage->faction->msgs, msg_message("spellbuildingresists", ADDMSG(&caster->faction->msgs, msg_message("spellbuildingresists",
"unit region command id", "unit region command id",
mage, mage->region, co->order, spobj->data.i)); caster, caster->region, co->order, spobj->data.i));
break; break;
} }
++*success; ++*success;
@ -1711,11 +1711,11 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
sh = spobj->data.sh; sh = spobj->data.sh;
if ((sp->sptyp & TESTRESISTANCE) if ((sp->sptyp & TESTRESISTANCE)
&& target_resists_magic(mage, sh, TYP_SHIP, 0)) { /* Fehlermeldung */ && target_resists_magic(caster, sh, TYP_SHIP, 0)) { /* Fehlermeldung */
spobj->data.i = sh->no; spobj->data.i = sh->no;
spobj->flag = TARGET_RESISTS; spobj->flag = TARGET_RESISTS;
++*resist; ++*resist;
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, ADDMSG(&caster->faction->msgs, msg_feedback(caster, co->order,
"spellshipresists", "ship", sh)); "spellshipresists", "ship", sh));
break; break;
} }
@ -1728,11 +1728,11 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
tr = spobj->data.r; tr = spobj->data.r;
if ((sp->sptyp & TESTRESISTANCE) if ((sp->sptyp & TESTRESISTANCE)
&& target_resists_magic(mage, tr, TYP_REGION, 0)) { /* Fehlermeldung */ && target_resists_magic(caster, tr, TYP_REGION, 0)) { /* Fehlermeldung */
spobj->flag = TARGET_RESISTS; spobj->flag = TARGET_RESISTS;
++*resist; ++*resist;
ADDMSG(&mage->faction->msgs, msg_message("spellregionresists", ADDMSG(&caster->faction->msgs, msg_message("spellregionresists",
"unit region command", mage, mage->region, co->order)); "unit region command", caster, caster->region, co->order));
break; break;
} }
++*success; ++*success;
@ -1767,10 +1767,10 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
co->par = sa; co->par = sa;
if ((sp->sptyp & TESTRESISTANCE)) { if ((sp->sptyp & TESTRESISTANCE)) {
if (target_resists_magic(mage, target_r, TYP_REGION, 0)) { if (target_resists_magic(caster, target_r, TYP_REGION, 0)) {
/* Fehlermeldung */ /* Fehlermeldung */
ADDMSG(&mage->faction->msgs, msg_message("spellregionresists", ADDMSG(&caster->faction->msgs, msg_message("spellregionresists",
"unit region command", mage, mage->region, co->order)); "unit region command", caster, caster->region, co->order));
spobj->flag = TARGET_RESISTS; spobj->flag = TARGET_RESISTS;
++*resist; ++*resist;
} }
@ -2848,8 +2848,8 @@ void magic(void)
/* Sprueche mit Fixkosten werden immer auf Stufe des Spruchs /* Sprueche mit Fixkosten werden immer auf Stufe des Spruchs
* gezaubert, co->level ist aber defaultmaessig Stufe des Magiers */ * gezaubert, co->level ist aber defaultmaessig Stufe des Magiers */
if (spl_costtyp(sp) != SPC_FIX) { if (spl_costtyp(sp) != SPC_FIX) {
ADDMSG(&mage->faction->msgs, msg_message("missing_components", ADDMSG(&caster->faction->msgs, msg_message("missing_components",
"unit spell level", mage, sp, cast_level)); "unit spell level", caster, sp, cast_level));
} }
} }
@ -2864,8 +2864,8 @@ void magic(void)
/* die Staerke kann durch Antimagie auf 0 sinken */ /* die Staerke kann durch Antimagie auf 0 sinken */
if (co->force <= 0) { if (co->force <= 0) {
co->force = 0; co->force = 0;
ADDMSG(&mage->faction->msgs, msg_message("missing_force", ADDMSG(&caster->faction->msgs, msg_message("missing_force",
"unit spell level", mage, sp, co->level)); "unit spell level", caster, sp, co->level));
} }
/* Ziele auf Existenz pruefen und Magieresistenz feststellen. Wurde /* Ziele auf Existenz pruefen und Magieresistenz feststellen. Wurde
@ -2885,8 +2885,8 @@ void magic(void)
co->force = 0; co->force = 0;
/* zwar wurde mindestens ein Ziel gefunden, das widerstand /* zwar wurde mindestens ein Ziel gefunden, das widerstand
* jedoch dem Zauber. Kosten abziehen und abbrechen. */ * jedoch dem Zauber. Kosten abziehen und abbrechen. */
ADDMSG(&mage->faction->msgs, msg_message("spell_resist", ADDMSG(&caster->faction->msgs, msg_message("spell_resist",
"unit region spell", mage, r, sp)); "unit region spell", caster, r, sp));
} }
} }