Jump to content

Curing/stopping ongoing effects


CamDawg

Recommended Posts

This started as a simple dive into the spinny head animations not going away when the underlying effect went away, e.g. Remove Paralysis would cure a character from hold, but the animation would continue. As I went along I found and fixed other issues and expanded the scope of the fix to handle any 'cure' stopping any associated effects--such as expiration sounds, visuals (the aforementioned spinny head animations), or other stuff that wasn't removed by the 'cure' directly. To be specific, effects which have 'cures' that are covered by this fix are: berserk, blindness, confusion, deafness, disease, fear, feeblemind, hold/paralyze (these are separate effects but cured by the same opcode), intoxication, invisibility, level drain, non-detection, pause (making a character stand in place; easiest example is Burning Hands forcing the caster to stand still for two seconds), poison, silence, sleep, and stun.

Since the original thread has devolved into a stream-of-consciousness crossed with a disorganized dev diary, I thought I'd reset and try to make everything as clear as I can.

The broad strokes of the fix

The spinny head animation is used by numerous effects: hold, fear, stun, feeblemind, and some psionics. Behind the scenes, some of these were different resources, so you could tailor them, e.g. if you were immune to fear you could block the fear-specific animation while still allowing the hold-specific animation to play if you were held. Originally there were only unique animations for psionics and hold, BG2FP added one for fear, and now EEFP is adding them for stun and feeblemind. This allows us to target specific animations for immunities and cures, e.g. curing feeblemind will remove the feeblemind-specific animation but not one playing from a stun.

While the visuals were the most obvious part of the problem, there was a host of other issues that emerged as you looked closer. We had already fixed one example, but there were all sorts of effects tied in. If you were hit by the cleric Poison spell, the poison would be cured by drinking an antidote but you would still get the normal expiration sound and a color glow on your character until the spell would normally expire. So the basic idea is that, rather than just curing poison (using the dedicated cure poison opcode) it would be paired with other effects that would explicitly remove everything from items or spells with these kinds of lingering effects.

This, in turn, presents a new problem: many spells and items have multiple effects that are independent of one another. Take the attack of a ghast as an example: when struck by a ghast, the target can be paralyzed (save vs. death or paralyzed for 42 seconds) and nauseated (save vs. breath or get a -2 to-hit penalty for 200 seconds). Using Remove Paralysis on the target of a ghast should remove the paralyzation, but not the effects of the nausea. This, in turn, necessitated a deep dive into a lot of effects to try and sort out what is related and what's not--I've used my judgment on the first pass of these, but I expect we should discuss them in detail. I'll delineate changes below.

I'll go ahead and stipulate up front that some of this is purely academic: no level drain effect has a lingering effect that needs to be explicitly removed, and there are few (if any) spells that actually cure things like pause or nondetection. Nonetheless the framework is built for all of these effects to provide a consistent approach for future developments and mods.

Fixes along the way

During this deep dive i inevitably found other issues. I'm just going to list them here--while I think these are pretty straightforward fixes, like all things in EEFP, we welcome an objection or discussion if you disagree:

  • [bg, bg2, iwd] Several creatures and items immune to confusion could still play the confusion animation. Similar issues existed for fear and hold. Also found a few instances of the reverse (hold animation blocked even though the creature can be held)--in this case the animation should play and the blocking effect is removed.
  • [bg, bg2, iwd] Several permanent effects had durations set. This is fixed, though this is not a bug visible to players.
  • [bg2] Two Anti-Paladins were supposed to be immune to fear, but an error was preventing it
  • [bg2] The Blackmist halberd played two sounds immediately when he blind ability was used, but one of those sounds is supposed to be the expiration sound
  • [bg2] Some sirines had an attack that dropped the target's intelligence to 3 and used the feeblemind portrait icon. However, the effect is not strictly a feeblemind and cannot be cured by the normal feeblemind cures. To clarify this for players, it now uses a more generic 'ability score drained' icon.
  • [bg2] A different sirine attack caused actual feebelmind, but also had a redundant effect to set intelligence to 3. This could result in the player curing the feeblemind but still having 3 INT. As such the INT effect is removed.
  • [bg2] The Harp of Discord causes confusion but displayed an intoxication portrait icon.
  • [bg2] The (unused) Slayer Fear had the wrong duration for its fear portrait icon.
  • [bg2, iwd] The drunk outcome from Wish included an intoxication icon, but it expires well before the actual intoxication.
  • [bg2] The Wand of Glitterdust now casts the spell directly
  • [bg, bg2, iwd] Nalmissra's attack only charmed on 50% of hits but would display the charmed icon on all of them
  • [bg] Cutscene spells for fear and sleep had several mismatched durations
  • [bg, bg2] Creatures who used disease to slow their target (otyughs primarily) now use the disease opcode directly to display the slow icon. This allows spells which cure disease to remove the slow icon.
  • [bg, bg2, iwd] Elixirs of Health were setting the intoxication level to zero instead of formally curing it
  • [iwd] The durations of the disease icon and actual disease from Chaos Dagger +3 didn't match
  • [iwd] Siren's Yearning bard song used the spinny head animation for its stun, but altered it to a color glow like other IWD stun effects
  • [iwd] The durations of the poison icon and actual poison from the cleric Poison spell didn't match
  • [iwd] Petrification and feeblemind from Prismatic Spray are permanent, but the associated portrait icons could (theoretically) expire

Immunity touchups

A character who's immune to poison would block a direct poison effect, but may still get visuals and expiration sounds. (Half-)Elves had effects to block charm and sleep effects stretching back to the original BG2FP, and this was done a little more systematically with other effects starting in EE patch 2.5. The upshot is that the EEs use targeted immunities to prevent many of the same issues we're addressing with the cures--in the above example, these extra visuals and expiration sounds would be blocked directly by first checking the target's poison immunity. In a handful of cases, these were applied incorrectly. I've also included a few cases where I've expanded David's immunity code.

Since this section includes a number of judgement calls, feel free to discuss.

  • [bg, bg2, iwd] Related effects of Vampire Fear, Dragon Fear, fear from the Hell Trial (thac0 penalty) should be blocked for creatures immune to fear
  • [bg, bg2, iwd] Elven charm immunity could block non-charm effects (specifically level drain) from Nalmissra's attack
  • [bg, bg2] Poison immunity was blocking the choking noises and CON penalty from drinking the Vial of Mysterious Liquid (the ore poison)
  • [bg] Poison immunity was blocking Belhifet's dispel-on-hit
  • [bg] Poison immunity was blocking the 'gulp' string when using Viper's Venom
  • [bg] Poison immunity was blocking several unrelated effects on the (unused) Viper's Edge
  • [bg, iwd] Related effects from Great Roar (strength penalty), Ghost Fear (STR/CON penalties) and the unused Deathsong (attack... bonus?) should be blocked for creatures immune to fear
  • [bg, bg2] Fear immunity was blocking the insect animation and spell failure icon from Insect Plague
  • [bg] Related effects of ghoul paralyzation (expiration sound) should be blocked by the natural elven immunity to ghoul paralyzation
  • [iwd] Poison immunity was blocking the slow effect from a mustard jelly attack
  • [bg, bg2, iwd] Feeblemind immunity was blocking the 'gulp' string from the cursed Oil of Speed
  • [iwd] Related effects of Hammer Arrows +1 (color glow) and Mournful Wail (expiration sound) should be blocked for creatures immune to stun
  • [iwd] Related effects from Retribution (color glow) and jackalwere gaze (stacking prevention) should be blocked for creatures immune to sleep
  • [iwd] Related effects from Symbol, Hopelessness and Emotion, Hopelessness (expiration sound, hopelessness icon) should be blocked for creatures immune to stun
  • [iwd] Poison immunity was blocking the hold effect from a dart trap
  • [iwd] Poison immunity was blocking the confusion effect from a different dart trap
  • [bg2] Related effects from Wand of Whips (animation) should be blocked for creatures immune to hold
  • [bg2] Related effects from Harp of Pandemonium (animation) should be blocked for creatures immune to confusion

Finally, the actual cures

So after a brief 1000 words or so, here we are at last. In general, a spell needs to be explicitly removed if it a) has a long-term effect (e.g. one round or more) that b) isn't cleaned up by the cure opcode directly and c) isn't the normal portrait icon associated with the effect. So something that poisons a target and uses a poison icon doesn't need special treatment, but something that poisons and has an expiration sound needs to be removed explicitly.

In the list below, when a spell is removed, it means entirely--all of its bonuses and penalties--unless otherwise noted. I've omitted anything I consider routine, e.g. abilities with an expiration sound or an animation, to focus the discussion on the decision points1.

  • [bg, bg2] Minsc's berserk (spin117.spl) is removed if berserk is cured. It was removed since it has several bonuses tied to the berserk.
  • [bg] (unused) The attack of Brood Gibberlings (bdgibbbr.itm) is removed if disease is cured. It was removed since it has a sleep effect that goes into effect (permanently) after the disease expires (same save).
  • [bg] The fear part of Dragon Fear (bddragg2.spl > bddraggf.spl) is removed if fear is cured. It was removed since the fear effect includes a thac0 penalty (same save, duration). There are also fatigue effects, but they have a different save and duration and are not removed by curing fear.
  • [bg] Ghost Fear (bdgfear.spl) is removed if fear is cured. It was removed since it has a CON and STR penalty tied to the fear (same save, duration).
  • [bg, bg2] Vampire Fear (spin882.spl), Demon Fear (spin890.spl), Dragon Fear (spin895.spl), Lich Fear (spin536.spl), and fear from the Hell Trial (spin772.spl) are removed if fear is cured. They were removed since the fear effect includes a thac0 penalty (same save, duration).
  • [bg, bg2, iwd] The unused Deathsong (spin921.spl) is removed if fear is cured. It was removed since it has a school protection and damage bonus.
  • [bg, bg2, iwd] The cursed Oil of Speed (potn23.itm) is removed if feeblemind is cured. It was removed since it uses a confusion icon with the feeblemind (the confusion icon seems correct as the potion provides 'you have been cursed with confusion' as feedback).
  • [bg, bg2, iwd] The Conjure (Lesser) Elemental spells (spwi516.spl, spwi520.spl, spwi521.spl, spwi620.spl, spwi621.spl, spwi622.spl) are removed if pause is cured. They are removed since they have an accompanying Mortal Kombat Mental Combat icon.
  • [bg, bg2] Various abilities--green slime attacks (jellgr1.itm), Cursed Scroll of Ailment (scrl17.itm), vortex spider attack (spidvo01.itm), unused acidooz4.itm and senspi.itm--are removed if poison is cured. They are removed since they also have an instant-kill effect related to the poison.
  • [bg] Venom Spit (bdvenoms.spl) is removed if poison is cured. It was removed since it has blindness tied to the poison (same save, duration).
  • [bg, bg2, iwd] Dolorous Decay (sppr611.spl) is removed if poison is cured. It was removed since it has a slow effect.
  • [bg, bg2] Blizzard troll attacks (icetrl.itm) cause stun and a DEX penalty. The DEX penalty is not affected if you cure stun as it uses a separate save and duration.
  • [bg2] Wand of Whips (ohnwand1.spl) is removed if hold is cured. It was removed since it has a whole bunch of other effects used to make it continue to try and re-apply the hold effect.
  • [bg2] The unused Dark Taint (bhaal2b.spl) is removed if poison is cured. It was removed since it has a slow effect.
  • [bg2] Ixil's Spike +6 (sper12.itm) is removed if sleep is cured. The item uses sleep as its 'pinned' effect, which also means you receive extra damage--it didn't seem to make sense to me that you'd receive damage if you were up and about instead of pinned. (Alternatively we could pair this with a zero-movement effect like the Bigby spells, or something else entirely.)
  • [iwd] Blood Rage (sppr422.spl) and Animal Rage (sppr522.spl, sppr522b.spl) are removed if berserk is cured. They were removed since there are several bonuses tied to the berserk.
  • [iwd] Great Roar (spin119.spl) is removed if fear is cured. It was removed since it has an attached STR penalty (same save, duration).
  • [iwd] Symbol, Hopelessness (sppr716.spl) and Emotion, Hopelessness (spwi411.spl) are removed if stun is cured. They were removed since they use a Hopelessness portrait icon.
  • Various short-term sleep-related effects are not removed by curing sleep, primarily when they were coupled with a knockback such as a wing buffet or earthquake. The 'sleep' itself (usually only a few seconds) is still cured.

Technical wankery

This section is technical wankery; I'm writing it now to save time when I have to write documentation for EEFP as a whole and documentation for modders tapping into the new system. Players are welcome to skip this.

The end result is fairly simple: for abilities which cure something, you insert a spell cast of the relevant cure spell instead of using the cure opcode directly, e.g. cast #curepsn.spl via opcode 146 instead of using opcode 11. If you have an ability with non-standard effects--for example a poison that also kills its target--then you add a 321 for it to the cure spell. If it's a normal poison (poison opcode and icon) then these are handled already and nothing needs to be added. All 'cure' spells are named #cureXXX with the following variants: ber (cure berserk, op 4), bld (cure blind, op 75), con (cure confusion, op 242), def (cure deaf, op 81), dis (cure disease, op 79), drk (cure drunk, op 164), fer (cure fear, op 161), fbm (cure feeblemind, op 77), hol (cure hold and paralyze, op 162), inv (cure invisibility, op 47 or 116), ldr (cure level drain, op 224), ndt (cure nondetection, op 70), pse (cure pause, op 270), psn (cure poison, op 11), sil (cure silence, op 48), slp (cure sleep, op 2), and stn (cure stun, op 46).

The following items and spells were broken into subspells so that they could be blocked/cured by the relevant effects. This was only done when a) the effect being cured had other long-term effects--animation or expiration sound, but not the normal portrait icon since those were removed via opcode 240--and b) had unrelated effects which should not be removed, e.g. a confusion cure shouldn't affect an unrelated poison effect.

  • [bg, bg2, iwd] Insanity Gaze (insanity.spl) is broken into a confusion (insanitc) subspell and a feeblemind (insanitf) subspell
  • [bg, bg2, iwd] The hold part of bounty hunter special snares (spcl415.spl) is broken out into a new subspell (spcl415h).
  • [bg] Piercing Shriek (bdshriek.spl) was broken into subspells for confusion (bdshriec), deafness (bdshried), and stun (bdshries)
  • [bg, bg2, iwd] Chromatic Orb (spdr101.spl, spwi118.spl), with its plethora of level-specific effects, is broken into multiple subspells. The exact number depends on the game, and the filename of the subspell depends on which header of the original Orb its from (level 1 blind is spwi118a, level 4 blind is spwi118d.spl).
  • [bg, bg2, iwd] The bits of Moondog Howl (spin891.spl) that target evil characters have been broken into a subspell (spin891a). The associated effs (moondog, moondX) are no longer needed.
  • [bg, bg2, iwd] The paralysis from various undead attacks (ghast1.itm, ghoullor.itm, lacedo.itm, lacedo.itm) are moved into subspells (ghoullop.spl for ghoullor.itm, ghast1p.spl for the rest due to differing durations).
  • [bg, bg2, iwd] The sleep (bg, bg2) or stun (iwd) effects from Emotion, Hopelessness are moved to a subspell (spwi411b).
  • [bg, bg2, iwd] Blizzard troll attacks (icetrl.itm) use a subspell (icetrlst) for their stun.
  • [bg] The fear part (including thac0 penalty) of Dragon Fear (bddragg2.spl) is moved to a subspell (bddraggf) to separate it from the unrelated fatigue effects
  • [iwd] Cornugon attacks (sflail.itm) use a subspell (sflailst) for their stun.
  • [iwd] A dart trap (spwi028.spl) uses a subspell for its hold effect (spwi028h)
  • [iwd] A different dart trap (spwi029.spl) uses a subspell for its confusion effect (spwi029c)
  • [iwd] Great Shout was already broken up into three subspells for its deaf (dwfpgs01), stun (dwfpgs02), and kill (dwfpgs03) effects

 

1All of the 'routine' removals are available by looking in the code in eefixpack/files/tph/tbd_vfx_removal_[game].tph, for example this is the removal line for the divine Poison spell, which has an expiration sound and an ongoing color pulse.

Link to comment

You don’t need to remove Conjure Elemental on IWD, since it doesn’t use Mental Combat. 
 

(I actually think it’s a bug that Mental Combat’s stun effect is removable by anti stun effects at all, but it’s a bit of an edge case.)

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...