Mass Cure spell bug

Discussion in 'The Temple of Elemental Evil' started by Sitra Achara, Mar 7, 2015.

Remove all ads!
  1. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    I think I found the place that defines whether a spell is considered a hostile action or not

    Code:
    .text:100769F0 ; int __cdecl Spell__Is_Spell_Harmful_To_Target(_SpellIdx, ObjHndl, ObjHndl)
    .text:100769F0 Spell__Is_Spell_Harmful_To_Target proc near ; CODE XREF: sub_10057DC0+21p
    .text:100769F0                                         ; sub_1008AD10+115p ...
    .text:100769F0
    .text:100769F0 nSpellIdx       = dword ptr  8
    .text:100769F0 ObjHnd_Caster   = ObjHndl ptr  0Ch
    .text:100769F0 ObjHnd_Target   = ObjHndl ptr  14h
    There's a hard coded table there (10076E18) for 729 spells, where it seems it is defined whether the spell is:
    0 always benign,
    1 always harmful,
    2 harmful to undead only
    3 benign to undead only
    4 benign to friendly npcs only

    The mass cure spells are set to type 4 so it would seem that's the cause of the problem (whereas the normal cure spells are type 2).
    Friendly NPCs btw is pretty much party members, "stranger" NPCs aren't considered "friendly" for that purpose.

    Mainly making a mental note so I can test it later, but if someone wants to participate in testing / say something go ahead.
     
  2. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,654
    Likes Received:
    352
    But were people using Mass Cure spells on Berla? That seems unlikely... is that the sort of bug you are thinking of?
     
  3. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    Not necessarily, it's just something I stumbled upon and it's on the Atari buglist.
     
  4. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    Alright, I can confirm the bug and the fix: casting the Cure X Wounds, Mass spells on non-party NPCs is currently considered a hostile action and will initiate combat.

    Fix: Changing the following bytes in the DLL to 02 fixes the issue

    Cure Light Wounds, Mass - Offset 0x76EF4
    Mass Heal - Offset 0x76F42
    Cure Moderate Wounds, Mass - Offset 0x77058
    Cure Serious Wounds, Mass - Offset 0x77059
    Cure Critical Wounds, Mass - Offset 0x7705A

    That's Atari buglist # 294, can finally be crossed off :yes:
     
    Last edited: Mar 16, 2015
  5. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,029
    Likes Received:
    42
    Only 499 to go. ;)

    Good job. I hope you're keeping track of your .dll fixes.
     
Our Host!