From 0313c51625f3f55016cdad43d2c7f7296d27949c Mon Sep 17 00:00:00 2001 From: Daniel Scharrer Date: Fri, 14 Jan 2022 16:01:15 +0100 Subject: [PATCH] ScriptedNPC: Add workaround for broken ratman backflip in intro Fixes: issue #93 --- src/game/magic/Spell.h | 3 ++- src/graphics/effects/Lightning.cpp | 2 +- src/script/ScriptedNPC.cpp | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/game/magic/Spell.h b/src/game/magic/Spell.h index 5937166bf0..ef2327e7f5 100644 --- a/src/game/magic/Spell.h +++ b/src/game/magic/Spell.h @@ -119,7 +119,8 @@ enum SpellcastFlag { SPELLCAST_FLAG_NOCHECKCANCAST = 1 << 5, SPELLCAST_FLAG_NOSOUND = 1 << 6, SPELLCAST_FLAG_RESTORE = 1 << 7, - SPELLCAST_FLAG_ORPHAN = 1 << 8 + SPELLCAST_FLAG_ORPHAN = 1 << 8, + SPELLCAST_FLAG_NODAMAGE = 1 << 9, }; DECLARE_FLAGS(SpellcastFlag, SpellcastFlags) DECLARE_FLAGS_OPERATORS(SpellcastFlags) diff --git a/src/graphics/effects/Lightning.cpp b/src/graphics/effects/Lightning.cpp index 86e42f65a2..4235cc3c69 100644 --- a/src/graphics/effects/Lightning.cpp +++ b/src/graphics/effects/Lightning.cpp @@ -339,7 +339,7 @@ void CLightning::Render() a += ePos; } - if(i % 4 == 0) { + if(i % 4 == 0 && !(m_spell->m_flags & SPELLCAST_FLAG_NODAMAGE)) { Sphere sphere; sphere.origin = a; sphere.radius = std::min(node.size, 50.f); diff --git a/src/script/ScriptedNPC.cpp b/src/script/ScriptedNPC.cpp index 59c558c2be..55409001b6 100644 --- a/src/script/ScriptedNPC.cpp +++ b/src/script/ScriptedNPC.cpp @@ -249,6 +249,11 @@ class SpellcastCommand : public Command { spflags |= SPELLCAST_FLAG_NOCHECKCANCAST; } + if(spellid == SPELL_LIGHTNING_STRIKE && context.getEntity()->idString() == "intro_draw_0001") { + // TODO(patch-scripts) Workaround for http://arx.vg/93 + spflags |= SPELLCAST_FLAG_NODAMAGE; + } + DebugScript(' ' << spellname << ' ' << level << ' ' << target << ' ' << spflags << ' ' << std::chrono::milliseconds(duration).count());