From 1eaa6a9ec4e14c2cbe82b5972e5da6ed3ccb83cd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 7 Jul 2020 19:45:41 +0200 Subject: [PATCH] Bug 2680: shapeshift spell cannot be cast twice. Add a message and don't pay for the failed spell. --- res/core/messages.xml | 8 ++++++++ res/translations/messages.de.po | 3 +++ res/translations/messages.en.po | 3 +++ src/spells.c | 13 ++++++++----- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/res/core/messages.xml b/res/core/messages.xml index 1fd1c106f..13383cd0a 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -1299,6 +1299,14 @@ + + + + + + + + diff --git a/res/translations/messages.de.po b/res/translations/messages.de.po index ae0f13dd4..22c080f98 100644 --- a/res/translations/messages.de.po +++ b/res/translations/messages.de.po @@ -1250,6 +1250,9 @@ msgstr "\"$unit($unit) verdient in $region($region) $int($amount) Silber durch U msgid "error180" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Zauber schlägt fehl.\"" +msgid "sp_shapeshift_twice" +msgstr "\"$unit($unit) in $region($region): '$order($command)' - $unit($target) ist bereits verzaubert.\"" + msgid "sp_shapeshift_fail" msgstr "\"$unit($unit) in $region($region): '$order($command)' - $unit($target) kann nicht $race($race,1) werden.\"" diff --git a/res/translations/messages.en.po b/res/translations/messages.en.po index b140f1690..c65cb788d 100644 --- a/res/translations/messages.en.po +++ b/res/translations/messages.en.po @@ -1253,6 +1253,9 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - The spell fails msgid "sp_shapeshift_fail" msgstr "\"$unit($unit) in $region($region): '$order($command)' - $unit($target) cannot take the form of $race($race,1).\"" +msgid "sp_shapeshift_twice" +msgstr "\"$unit($unit) in $region($region): '$order($command)' - $unit($target) is already under this spell.\"" + msgid "error290" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Eine Einheit kann nur in einem Verband Mitglied sein.\"" diff --git a/src/spells.c b/src/spells.c index de2036225..910e3fe26 100644 --- a/src/spells.c +++ b/src/spells.c @@ -4512,13 +4512,16 @@ int sp_illusionary_shapeshift(castorder * co) return 0; } irace = u_irace(u); - if (irace == u_race(u)) { - trigger *trestore = trigger_changerace(u, NULL, irace); - add_trigger(&u->attribs, "timer", trigger_timeout((int)power + 3, - trestore)); - u->irace = rc; + if (irace != u_race(u)) { + ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, + "sp_shapeshift_twice", "target", u)); + return 0; } + add_trigger(&u->attribs, "timer", trigger_timeout((int)power + 3, + trigger_changerace(u, NULL, irace))); + u->irace = rc; + ADDMSG(&mage->faction->msgs, msg_message("shapeshift_effect", "mage target race", mage, u, rc));