Jump to content

[Bug] ToB weapons: Foebane +5 can drain undead, Staff of the Ram +6 can knock out giants


jmerry

Recommended Posts

I noticed this in my session just yesterday. BG2EE, obviously.

First, Foebane +5. It directly casts SPIN104A (the payload of innate LMD SPIN104) on the target it hits, with no filter whatsoever. That's four points of magic damage, draining to the wielder's maximum health. Subject to magic resistance.

The problem is that the "doesn't work on constructs and undead" 324 filter is in SPIN104. That's an important part of the spell, and really should be there in this on-hit version.  The sword should either cast SPIN104, or have that 324 filter. Since the LMD effect is the last one, it's already in the right order to just slip that filter in before it.

Second, Staff of the Ram +6. The description (in English) states "large creatures such as a dragons or giants will not be knocked back or stunned".

The way this actually works is that when the chance procs, the staff applies a Wing Buffet (235) effect and an unconsciousness (39) effect along with an appropriate portrait icon. Wing Buffet is blocked for sufficiently large creatures, but sleep/unconsciousness isn't. You can knock out giants just fine; they merely won't be sent skidding across the room.

In this case, the description (#66367) certainly needs an edit, at least in English. If nothing else, the grammatical number mismatch "a dragons or giants" should be fixed by deleting that "a". As for the unconsciousness effect, that's trickier. The animation-based large creature buffet immunity isn't any sort of stat that can easily be targeted, and race-based protection could do weird things (Yaga-Shura is a dwarf!). It might be that the best option is to simply edit the description to match the actual effect.

Link to comment
On 7/18/2022 at 12:05 PM, jmerry said:

The problem is that the "doesn't work on constructs and undead" 324 filter is in SPIN104. That's an important part of the spell, and really should be there in this on-hit version.  The sword should either cast SPIN104, or have that 324 filter. Since the LMD effect is the last one, it's already in the right order to just slip that filter in before it.

Why not just put the filters in SPIN104A? That way anything that wants to apply an LMD effect could use it and get reliable results.

Link to comment

I'm pretty sure that the drain spells are built that way so the right names will show up in the message. After all, the subspells SPIN104A and SPWI119A are unnamed. And here ... actually, do we want it to say "Unaffected by effects from Larloch's Minor Drain" or "Unaffected by effects from Foebane +5"? Because putting the filter in the weapon's ability gives us the second, and putting it in the spell it casts gives us the first.

On targeting by circle size ... OK, that's an option for a 324 effect. There are presets for "greater than 3" or "less than 4". Though I don't actually know enough about how the game works here. IESDP says selection circle radius is the "ellipse" parameter in the animation's INI. Which generally comes in multiples of eight; humanoids are 2*8, wyverns and oozes are 3*8, basilisks and earth elementals and beholders and giants are 4*8, adult dragons are 9*8. Does that preset draw the line between wyverns and giants, or does it draw the line somewhere else? And as for what it takes to block a wing buffet, the IESDP is even less helpful. "Note: Some animations are immune to this effect".

Link to comment
1 hour ago, jmerry said:

On targeting by circle size ... OK, that's an option for a 324 effect. There are presets for "greater than 3" or "less than 4". Though I don't actually know enough about how the game works here.

SPLPROT.2DA => STAT == 0x102 checks against the animation INI field "personal_space", or whatever value the creature currently has it set to.

1 hour ago, jmerry said:

And as for what it takes to block a wing buffet, the IESDP is even less helpful. "Note: Some animations are immune to this effect".

The following animations are hardcoded to be immune to op235, (given that the target isn't a party member, I.E has a portrait slot):

Spoiler
0x1100 TANARRI
0x1200 DRAGON_RED
0x1201 DRAGON_BLACK
0x1202 DRAGON_SILVER
0x1203 DRAGON_GREEN
0x1204 DRAGON_AQUA
0x1205 DRAGON_BLUE
0x1206 DRAGON_BROWN
0x1207 DRAGON_MULTICOLOR
0x1208 DRAGON_PURPLE
0x1300 DEMOGORGON
0x7300 ELEMENTAL_EARTH
0x7302 SHAMBLING_MOUND
0x7310 ELEMENTAL_FIRE
0x7312 ELEMENTAL_FIRE_PURPLE
0x7314 BURNING_MAN
0x7320 ELEMENTAL_AIR
0x7F2E RAVER
0x7F32 SLAYER
0x7F3B SOLAR
0x7F3C DEVA_MONADIC
0x7F3D MELISSAN
0x7F3E GIANT_FIRE
0x7F3F GIANT_YAGA-SHURA
0xE0F0 GOLEM_ICE

The opcode also has this weird block:

if (this->m_sourceRes.startsWith("SP")) {
    this->m_effectAmount = (100 - pSprite->m_derivedStats.m_nResistMagic) / 100 * (float)this->m_effectAmount;
    if (this->m_effectAmount == 0) {
        return 0; // Terminate
    }
}

It's attempting to dampen the knockback speed with the target's magic resistance, but it fails at casting the first division to a float. If the spell resref starts with "SP" any positive magic resistance will make the speed parameter 0, causing the opcode to immediately terminate.

Edited by Bubb
Link to comment

Hardcoded. Just great.

This list is, of course, not a match to the personal_space stat we can test against. Most of the entries of that list are at 5 or more, but there are a number of animations that are that high that aren't on the list - e.g. dragon_white, fiend_blue, static_spider_woman. And some of the entries on that list (ELEMENTAL_FIRE, SOLAR, MELISSAN, etc.) only have the humanoid standard of 3.

I'd put personal_space > 4 as the best approximation to what should be immune to the knockback and unconsciousness. Which would require a new entry in SPLPROT.2DA. Or we could use the existing entry #13 (PERSONALSPACE>3), let more things be immune, and call it good enough.

Link to comment
9 hours ago, Bubb said:

The opcode also has this weird block:

if (this->m_sourceRes.startsWith("SP")) {
    this->m_effectAmount = (100 - pSprite->m_derivedStats.m_nResistMagic) / 100 * (float)this->m_effectAmount;
    if (this->m_effectAmount == 0) {
        return 0; // Terminate
    }
}

It's attempting to dampen the knockback speed with the target's magic resistance, but it fails at casting the first division to a float. If the spell resref starts with "SP" any positive magic resistance will make the speed parameter 0, causing the opcode to immediately terminate.

That's definitely not the case on the original BG2 engine, must be an EE thing. I just made a wand that casts SPIN695 (vanilla wing buffet) and tested it on some magic resistant skeleton warriors, they were sent flying back (although ofc not unconscious because they've got the undead immunity item RING95).

Such a bug would also seem to allow the player to completely protect themself from the knockback of dragon wing buffets (which as I've said the game treats as a spell beginning with an SP reference) by carrying any item that grants a positive MR bonus (amulets of Kaligun/Seldarine/Power... Shield of the Lost, Sword of Balduran, any Archmagi robe etc. Hindo's Doom, Enkidu's plate... plus paladin specific swords, wizard slayer kit and monk obviously).

Are you sure any degree of MR grants immunity to repulsion (opcode 235) on your game?

Link to comment

Wow, why would they add this stuff? If the 235 repulsion opcode is supposed to be an actual magical effect respecting magic resistance, it would already have the normal % chance to fail. If it derives from an ability that is conceptually non-magical but treated as a .spl file for convenience purposes (like dragon wing buffets) then MR should be ignored entirely, as it was in vanilla.

I mean, it's like twiddling with opcode 12 when type is 524288 to ensure fire damage from any source is multiplied by (100 - magic resistance %)/100, so that a fireball has a 30% to damage a 70% MR resistant creature (as always), but if it does work will anyway do only 30% damage... thus redundantly overpowered, and erroneously applied to non-magical fire sources like lava.

At least this introduced bug - and not really a bug, but looking at the code block a deliberate design choice - is relatively easy to work around by giving nonmagical sources of 235 a different prefix than 'SP' (like a modder prefix).

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...