Skip to content

(BG1) Physical attack and damage negative penalty items end up wrapping to bonuses (0815)

BhryaenBhryaen Member Posts: 2,874
edited September 2012 in Fixed
This bugfix derives from the thread by Boaster on the public Bugs forum here:
http://forum.baldursgate.com/discussion/1427/bug-subtracting-thac0-via-missile-thac0-bonus-167
(Ardanis and Technophobe contributed to expanding the extent of the fix parameters beyond Missile THACO alone.)


OBSERVED:
An item which reduces Missile THACO (using Effect 167) using Timing Mode 1 instead adds a huge amount to Missile Attack Bonus. The formula supplied by Boaster was this for a -4 Missile THACO item:
BASE THACO - 255 (to which -4 wraps)
So the amount you need to hit is abysmally low- i.e., an auto-hit. Using a -5 Missile THACO item I saw an improvement from +8 AB to + 263 AB in the To-Hit combat feedback for missile weapons only.

EXPECTED:
The penalty should apply directly to THACO as an addition to THACO.

As Boaster's formula continued:
BASE THACO + 4, thus raising the THAC0 value to make it more difficult to hit
NOTES:
This same negative wrapping of penalties into excessive bonuses applies also to these effects from ITMs using Timing Mode 1 (Instant/Permanent):
73-  Attack damage bonus- negative wrap to +140s for all damage- melee, missile, fist
284- THACO bonus (with an "O", not a zero)- melee or fist only
285- Melee weapon damage bonus- melee or fist only
286- Missile weapon damage bonus- missile only
288- Fist thac0 bonus- fist only
289- Fist damage bonus- fist only
305- Offhand (melee) thac0 bonus- fist only (tested by @Tanthalas)
306- Main hand (melee) thac0 bonus (though this effect is listed in NI as "Unknown")- melee only
I confirmed them all to make sure of the same negative wrapping issue by creating items with each one at -5 penalty and all of them giving an excessive bonus.

There's also 178 - THAC0 v Type, 179 - dam v Type which I'm assuming are very relevant to rangers as an effect- though not in the negative- but I couldn't figure out how to make an item with it properly with Near Infinity.

I also tested the following and found them completely ineffective at a -5 penalty/value (not just a normal -5 penalty but no difference at all):
54-  thac0 bonus
219- attack roll penalty
278- thac0 bonus
Then I tested all of the above including the original Effect 167 using an .ITM which instead used Timing Mode 2 (Instant/While Equipped) with exactly the same results.

Also note that many of these may be existing ToBEx fixes, particularly given the familiar "negative wrapping" issue.

And after all that, everyone had better start wearing attack and damage penalty items to make that time well spent. :-P
Post edited by Bhryaen on

Comments

  • BoasterBoaster Member Posts: 622
    edited May 2012
    In modding (BG TuTu), I have attempted to create items that benefit Characters who are either melee or ranged units. For example, Bracers of Marksmanship to provide +3 damage and +3 Thac0 for only Ranged Attacks.

    There is a certain combination of (all) Thac0 penalty combined with Missile Thac0 bonus that will cause a bug that makes the Ranged character's thac0 to to drop to -250 or some extravagantly low thac0.

    It's been awhile since I've had to deal with it. I did find a work-around on it. I thought it would be worth mentioning though.
  • BoasterBoaster Member Posts: 622
    edited September 2012
    Using Effect "Missile THAC0 bonus (167)".

    Actual Behavior:
    When you insert a negative value (i.e. -4)... it wraps to -255 +4 + (13) BASE THAC0.
    -255 - (-4) +13 = -238

    Expected behavior:
    13 (Base THAC0) minus -4 to equal 17 THAC0, thus raising the THAC0 value to make it more difficult to hit.
    13 - (-4) = 17.


    The same case may also be applied with Melee Attack Bonus and Missile Attack Bonus, where in some cases will cause damage to wrap around backwards.
    Post edited by Bhryaen on
  • ArdanisArdanis Member Posts: 1,736
    It does indeed happen with damage.
  • BoasterBoaster Member Posts: 622
    Also the question begs to be asked, why wasn't there a "Melee THAC0 bonus" stat?
  • technophobetechnophobe Member Posts: 68
    Stat or effect?

    278 - thac0 bonus
    284 - melee thac0 bonus
    288 - fist thac0 bonus
    305 - offhand (melee) thac0 bonus
    306 - main hand (melee) thac0 bonus
  • BoasterBoaster Member Posts: 622
    Effect.
  • BoasterBoaster Member Posts: 622
    edited July 2012
    "284 - melee thac0 bonus" never appears in the stat list, at least for Near Infinity v1.32. Am I using an out of date editor?

    It does however appear as "THACO bonus (284)."
  • technophobetechnophobe Member Posts: 68
    I've had 1.33 beta 20 for at least a year, and apparently there's forks of it while keeping the same version number, some of which bring new bugs depending on OS. http://www.shsforums.net/topic/45358-nearinfinity I use the 7-12-2011 release with XP and W7.
  • SethDavisSethDavis Member Posts: 1,812
    edited July 2012
    They seem to be deliberately casting the effect amount from a long to a byte so they can modify a short... which is horrifying.
  • SethDavisSethDavis Member Posts: 1,812
    What modifier type did you/they use? There's set, add and scale.
  • SethDavisSethDavis Member Posts: 1,812
    edited August 2012
    73 looks fixed - a -10 gives consistent 1 damage while +10 give a fresh coating of gibberling to nearby walls

    [EDIT] lost power on Friday :( - I think they're all fixed now. I tested each one with a 10/-10.
    Post edited by SethDavis on
  • BhryaenBhryaen Member Posts: 2,874
    Wow, totally missed the fixing on this one. @Ascension64 do you recognize any of these from ToBEx? They sound similar to ToBEx fixes with the issue of negative wrapping.
  • Ascension64Ascension64 Member Posts: 560
    In fact, no. I haven't done anything to the THAC0 modifying effects.
  • TanthalasTanthalas Member Posts: 6,738
    Can anyone make some items to test these effects?
  • BhryaenBhryaen Member Posts: 2,874
    @Tanthalas
    I'll have to make some for my own test, so if no one else helps I'll just attach what I make and flag you
  • BhryaenBhryaen Member Posts: 2,874
    edited August 2012
    Confirmed Fixed... except for a couple (which, to be fair, I had ignored in the OP):

    OK, didn't have the items from the last test, so I created a new slew, all Power 0, affect Self, Timing Mode 1 (instant, permanent), 0 duration, 100% probabilty, and increment a -11 this time (since @SethDavis mentioned testing with a +/-10). I used a half-elf fighter w/ 15 STR, 18 DEX wielding a simple longsword (with a dagger for the off-hand) and shortbow to test how melee and ranged THAC0 and Dam were affected (if at all). Note that I had no pips in Two Weapon so a -4/ -8 was expected. Then I used a human monk w/ 15 STR, 18 DEX to test Fist THAC0 and Dam. I also tested by starting a new game every item given that the Timing Mode = 1 effects are permanent. I was going to test Timing Mode = 2 (while equipped) since that's the mode presumably most will use it on... but no...
    OPCODE:                             MISSILE:         MELEE:           FIST:       
    THAC0 Dam THAC0 Dam THAC0 Dam
    None No bonus +2 6,3 +0 1,8 +0 4,2,6
    -4/-8 1,3,1
    054 Base THAC0 +2 3,4 +0 5,3 +0 5,2,3
    073 Attack Dam Bonus +2 1,1,1 +0 1,1,1 +0 1,1,1
    167 Missile THAC0 Bonus -9 5,6,6 +0 7,6,3 +0 1,6,1
    219 Attack Roll Penalty +2 4,2,6 +0 4,6,4 +0 6,1,5
    278 THAC0 Bonus -9 4,2,4 -11 6,4,3 -11 6,5,6
    284 Melee THAC0 Bonus +2 4,2,5 -11 1,4,5 -11 6,6,4
    285 Melee Weapon Dam Bonus +2 2,1,6 +0 1,1,1 +0 1,1,1
    286 Missile Weapon Dam Bonus +2 1,1,1 +0 3,3,1 +0 4,6,2
    288 Fist THAC0 Bonus +2 3,4,4 +0 5,6,2 -11 6,4,2
    289 Fist Dam Bonus +2 3,3,5 +0 7,4,1 +0 1,1,1
    305 Off-hand THAC0 Bonus +2 1,4,1 -4/-19 1,2,4 +0 6,4,5
    +0 6,6,4
    306 Main-hand THAC0 Bonus +2 1,3,1 -15/-8 1,2,7 -11 2,6,6
    -11 8,5,8
    So most everything functioned as expected, including 305 and 306 which I erringly tested as not working when I first made the above chart. X-/

    But Opcodes 54, 219 are still useless. I just checked to see if the former two are used in-game:

    - 219: SHLD06P, SHLD07P... But then for those two ITMs- "No hits found." So not a problem... I suppose...

    - 54: Affects the following ITMs... much (but not all) of which are monster ITMs but, well, used in-game...
    BRAC08
    BRAC09
    BRAC10
    BRAC11
    BRAC21
    BRAC25
    CHILLT
    DRUEAR
    DRUFIR
    FLIND1
    GHAST1
    HELM07
    PARAGHAS
    PLAT22
    PLAT23
    POTN09
    POTN41
    PTION41 (?)
    RSBRAC
    SW1H69
    SW1H69C
    WAND19

    By the way- not sure if it's new, but I like the addition of "(Left)" to indicate it's the off-hand strike. Very helpful... However, I think "(Off-hand)" would be better... Adding that to GTU thread...

    Also noting the oddball way that Opcode1 works: APR bonus. Apparently it does nothing until the first hit- at which point it takes off. So you can swing indefinitely with your APR unaffected, but the moment you get your first hit- voom in comes Opcode 1. Separate report for that too...

    @Tanthalas
    Attaching the slew of rings- all named for the opcode they're using with a ".RNG" prefix... I'm adding the weapons I used: essentially SW1H04, DAGG01, BOW05 except I gave them the max APR so the test would go faster- and I renamed them .SWRDXX, .DAGGXX, and .BOWXX... Also a copy of the Green 999HP Megaxvart (.xvartx) since he's got +25 THAC0 and does little dam in case he's useful for your tests. Keep in mind you'll have to do a new game for each one because the Timing Mode = 1 boosts the stats permanently (or is supposed to anyway).
    Post edited by Bhryaen on
  • BhryaenBhryaen Member Posts: 2,874
    @Tanthalas
    Sorry- I had to fix .DAGGXX. Everything else is the same...
  • TanthalasTanthalas Member Posts: 6,738
    I just received Charon's Claw in the mail. I make no promises about testing this today.
  • SethDavisSethDavis Member Posts: 1,812
    @Bhryaen - Opcode 219 is actually labeled as CGAMEEEFECT_PROTECTION_CIRCLE in the code, and has a comment saying "Not implemented yet". So there is some crazyness there implying that the desired effect has been lost/overwritten.

    Opcode 54 seems to be working for me. My test character has a THAC0 and base THAC0 of 16 listed in the character sheet. Equipping the item giving the effects raises/lowers the listings properly and testing against Gibberlings results in a fairly prompt smacking or an inability to hit the broad side of a barn.
  • BhryaenBhryaen Member Posts: 2,874
    @SethDavis
    I'm now not at home but will verify later- could very well have setup the ring wrong or maybe I did something sloppy in the first part of the tests...
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    #219 is not implemented??? Haha, that would be ... odd.
  • BhryaenBhryaen Member Posts: 2,874
    @SethDavis
    I was really hoping to be wrong so as to move forward, but... Can you check the .RNG054 I made? I've septuply examined it- same stats as everything else, just using Opcode54. I also thought maybe I'd just confused my results, but I just got the same ones repeatedly- no THAC0 bonus (normal dam) with the Opcode54 ring on. Just in case I added it as an effect to the dagger, but that didn't show up either. I also tried switching to the range you were using- -9 rather than -11: still no THAC0 effect. I even tried starting a completely new CHARNAME with regular weapons, +1 Field Plate, nothing I made, then loaded him with .RNG054... nothing. I'll attach a save game in case there's reason for this otherwise.

    @Avenger_teambg
    You're good at spotting modder mistakes. ;-) Can you see what I did wrong with .RNG054 in the .zip above- or if I did something wrong?
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    @Bhryaen: what do you use for editing?
    This isn't a problem itself, though, just my lister gets confused.

    00h Signature ITM V1
    08h UnID name 00004389
    0ch ID name 0000438a
    10h Used up
    18h Attributes 0000006c
    1ch Itemtype 000a
    1eh Usability 00000000
    22h Animation 2020
    24h MinLevel 00
    25h UNKNOWN 00
    26h MinStr 00
    27h UNKNOWN 00
    28h MinStrBonus 00
    29h Kit 1 00
    2ah MinInt 00
    2bh Kit 2 00
    2ch MinDex 00
    2dh Kit 3 00
    2eh MinWis 00
    2fh Kit 4 00
    30h MinCon 00
    31h Proficiency 00
    32h MinCha 00
    33h UNKNOWN 00
    34h Price 0000000a
    38h Stack 0001
    3ah Inventory IMISC72
    42h Lore to ID 0000
    44h Ground GDAGG01
    4ch Weight 00000001
    50h UnID desc 00002e47
    54h ID desc 00002e48
    58h Desc icon CMISC72
    60h Magiclevel 00000000
    64h Ext. offset 000000a2
    68h Ext. count 0000
    6ah Feat. offset 00000072
    6eh Equip offset 0000
    70h Equip count 0001
    72h **Error**

    You use a permanent timing for an equipping effect. That means, when you remove the ring, the effect will remain. I don't see other problems.
    It changed my base thac0 to 25 (worst possible), and it remained there.

    If you want to see something really weird, try timing mode 9. And reequip the ring a few times.
    It kept changing base thac0 until 255!
  • SethDavisSethDavis Member Posts: 1,812
    edited August 2012
    @Bhryaen - Ah, I'll try your items then. Thank you for you thoroughness.

    Ok, so using your ring also works for me, and creating a duplicate with a negative effect lets me play with the THAC0 between 0 and 25. Perhaps it's just a matter of doing a fresh install with the next build?

    I'll attach the item I'm using as well, just in case something wild and magical is happening because it can only be worn by thieves or something.
    Post edited by SethDavis on
  • SethDavisSethDavis Member Posts: 1,812
    Turns out you cannot add attachments through edit....
  • BhryaenBhryaen Member Posts: 2,874
    edited August 2012
    @SethDavis
    Just tested your item- had to create a thief to use it- and also made a rework of it with the lore down and class restrictions gone... same result for me- no THAC0 bonus. The only difference between yours and mine is that yours is Power = 1, but that doesn't affect things anyway.

    @Avenger_teambg
    So my Opcode54 item worked in your game! (It gives a THAC0 -11 penalty.) So that means something's off in my game itself.

    I've been making the items using NI. Yeah, I was making all my test items Timing Mode = 2 (while equipped) but during ToBEx tests @Wisp mentioned that only Timing Mode = 1 really counts (maybe just for those ToBEx's), so ever since I use Timing Mode = 1... unless I'm actually making an item to use, of course.
  • BhryaenBhryaen Member Posts: 2,874
    edited August 2012
    Confirmed fixed on Opcode54. Although I'm still seeing + 0 in attacks, now I noticed that what it does is affect your BaseTHAC0, not your battle log stats, and that change was obvious in inventory the moment I donned the ring.

    Since Seth did so much of his own testing and @Avenger_teambg confirmed 054, I'll just send this one on then...
  • BhryaenBhryaen Member Posts: 2,874
    The Bugs thread by @Boaster was merged into this one.
Sign In or Register to comment.