From bd4322360de4c457532d9e4fa44cdc25a2fa677e Mon Sep 17 00:00:00 2001
From: Evil Eye <malusluminis@hotmail.com>
Date: Sat, 3 Sep 2022 22:43:29 +0200
Subject: [PATCH] Always create touch explosions for non-actors

---
 CHANGELOG.md                     | 1 +
 apps/openmw/mwworld/worldimp.cpp | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index adf69f7a47..4b8066b4d7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
     Bug #4816: GetWeaponDrawn returns 1 before weapon is attached
     Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses
     Bug #5129: Stuttering animation on Centurion Archer
+    Bug #5714: Touch spells cast using ExplodeSpell don't always explode
     Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load
     Bug #6937: Divided by Nix Hounds quest is broken
     Bug #6939: OpenMW-CS: ID columns are too short
diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp
index 3af60c3420..e1618b4b72 100644
--- a/apps/openmw/mwworld/worldimp.cpp
+++ b/apps/openmw/mwworld/worldimp.cpp
@@ -3746,8 +3746,9 @@ namespace MWWorld
             if (fromProjectile && effectInfo.mArea <= 0)
                 continue; // Don't play explosion for projectiles with 0-area effects
 
-            if (!fromProjectile && effectInfo.mRange == ESM::RT_Touch && !ignore.isEmpty() && !ignore.getClass().isActor() && !ignore.getClass().hasToolTip(ignore))
-                continue; // Don't play explosion for touch spells on non-activatable objects except when spell is from the projectile enchantment
+            if (!fromProjectile && effectInfo.mRange == ESM::RT_Touch && !ignore.isEmpty() && !ignore.getClass().isActor() && !ignore.getClass().hasToolTip(ignore)
+                && (caster.isEmpty() || caster.getClass().isActor()))
+                continue; // Don't play explosion for touch spells on non-activatable objects except when spell is from a projectile enchantment or ExplodeSpell
 
             // Spawn the explosion orb effect
             const ESM::Static* areaStatic;