diff --git a/data/json/flags.json b/data/json/flags.json index 4782a1a3ee211..d61ab7c6c3ea1 100644 --- a/data/json/flags.json +++ b/data/json/flags.json @@ -666,6 +666,12 @@ "context": [ "SPELL" ], "//": "Chooses a spell at random to cast from extra_effects. See MAGIC.md for details" }, + { + "id": "PAIN_NORESIST", + "type": "json_flag", + "context": [ "SPELL" ], + "//": "pain altering spells can't be resisted (like with the deadened trait)" + }, { "id": "NON_THRESH", "type": "json_flag", diff --git a/data/mods/Magiclysm/Spells/animist.json b/data/mods/Magiclysm/Spells/animist.json index 59a496a6208a0..cb25a76bded04 100644 --- a/data/mods/Magiclysm/Spells/animist.json +++ b/data/mods/Magiclysm/Spells/animist.json @@ -57,7 +57,7 @@ "base_casting_time": 50000, "base_energy_cost": 5000, "energy_increment": 500, - "flags": [ "SOMATIC", "VERBAL" ], + "flags": [ "SOMATIC", "VERBAL", "PAIN_NORESIST" ], "final_energy_cost": 10000 }, { diff --git a/src/magic.cpp b/src/magic.cpp index 19d0a5ace96dc..16bad5b8fbdc2 100644 --- a/src/magic.cpp +++ b/src/magic.cpp @@ -103,6 +103,7 @@ std::string enum_to_string( spell_flag data ) case spell_flag::RANDOM_DURATION: return "RANDOM_DURATION"; case spell_flag::RANDOM_TARGET: return "RANDOM_TARGET"; case spell_flag::MUTATE_TRAIT: return "MUTATE_TRAIT"; + case spell_flag::PAIN_NORESIST: return "PAIN_NORESIST"; case spell_flag::WONDER: return "WONDER"; case spell_flag::LAST: break; } diff --git a/src/magic.h b/src/magic.h index 35d28d6e08526..f8e3b5dcc4ecc 100644 --- a/src/magic.h +++ b/src/magic.h @@ -51,6 +51,7 @@ enum spell_flag { RANDOM_TARGET, // picks a random valid target within your range instead of normal behavior. MUTATE_TRAIT, // overrides the mutate spell_effect to use a specific trait_id instead of a category WONDER, // instead of casting each of the extra_spells, it picks N of them and casts them (where N is std::min( damage(), number_of_spells )) + PAIN_NORESIST, // pain altering spells can't be resisted (like with the deadened trait) LAST }; diff --git a/src/magic_spell_effect.cpp b/src/magic_spell_effect.cpp index 23168b0037f72..496190e6e67bb 100644 --- a/src/magic_spell_effect.cpp +++ b/src/magic_spell_effect.cpp @@ -698,7 +698,11 @@ void spell_effect::recover_energy( const spell &sp, Creature &caster, const trip } } else if( energy_source == "PAIN" ) { // pain is backwards - p->mod_pain_noresist( -healing ); + if( sp.has_flag( PAIN_NORESIST ) ) { + p->mod_pain_noresist( -healing ); + } else { + p->mod_pain( -healing ); + } } else if( energy_source == "HEALTH" ) { p->mod_healthy( healing ); } else {