Jump to content

Luck spell missing thieving skill bonuses


Recommended Posts

In the unmodded game, the Luck spell doesn't work as per its description. It merely provides a luck bonus. Here's the original description:

 

The recipient of this spell is lucky in everything that he does for the next 3 rounds. He receives a 5% bonus to any of his actions. This includes saving throws, to hit chances, thieving skills, etc.

 

Currently, the fixpack restores the bonus to saving throws but doesn't do anything about thieving skills. If we decide to fix that, the revised code would look like this:

 

// luck not providing saving throw and thieving skill bonuses; duration incorrect
COPY_EXISTING ~spwi209.spl~ ~override~
 READ_LONG  0x64 "abil_off"
 READ_SHORT 0x68 "abil_num"
 READ_LONG  0x6a "fx_off"
 SET "fx_delta" = 0
 FOR (index = 0 ; index < abil_num ; index = index + 1 ) BEGIN // cycle thru abilities
   READ_SHORT  ("%abil_off%" + 0x1e + (0x28 * "%index%")) "abil_fx_num"
   READ_SHORT  ("%abil_off%" + 0x20 + (0x28 * "%index%")) "abil_fx_idx"
   SET "abil_fx_idx" = ("%abil_fx_idx%" + "%fx_delta%")
   WRITE_SHORT ("%abil_off%" + 0x20 + (0x28 * "%index%")) "%abil_fx_idx%"
   // first fix duration while we're here
   FOR (index2 = 0 ; index2 < abil_fx_num ; index2 = index2 + 1) BEGIN
     READ_SHORT ("%fx_off%" +        (0x30 * ("%index2%" + "%abil_fx_idx%"))) "opcode"
     READ_LONG  ("%fx_off%" + 0x0e + (0x30 * ("%index2%" + "%abil_fx_idx%"))) "duration"
     READ_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%index2%" + "%abil_fx_idx%"))) "resref"
     PATCH_IF ("%duration%" = 20) BEGIN
       WRITE_LONG  ("%fx_off%" + 0x0e + (0x30 * ("%index2%" + "%abil_fx_idx%"))) 18
     END
     PATCH_IF (("%opcode%" = 174) AND ("%resref%" STRING_EQUAL_CASE "EFF_M05")) BEGIN
       WRITE_LONG  ("%fx_off%" + 0x0e + (0x30 * ("%index2%" + "%abil_fx_idx%"))) 1 // fix invalid sound effect duration
     END
     PATCH_IF ("%opcode%" = 133) BEGIN
       READ_ASCII ("%fx_off%" +        (0x30 * ("%index2%" + "%abil_fx_idx%"))) "clone" (0x30)
       FOR (index3 = 33 ; index3 < 38 ; index3 = index3 + 1) BEGIN
         INSERT_BYTES   ("%fx_off%" +        (0x30 * ("%index2%" + "%abil_fx_idx%"))) 0x30 // new effect
           WRITE_ASCIIE ("%fx_off%" +        (0x30 * ("%index2%" + "%abil_fx_idx%"))) "%clone%"
           WRITE_SHORT  ("%fx_off%" +        (0x30 * ("%index2%" + "%abil_fx_idx%"))) "%index3%" // opcode: one of them thar saves
       END
       PATCH_FOR_EACH ~thskill~ IN ~59~ ~90~ ~91~ ~92~ ~275~ ~276~ ~277~ BEGIN                   // all 7 thieving skill opcodes
       INSERT_BYTES            ("%fx_off%" +        ("%index2%" + "%abil_fx_idx%")) 0x30         // new effect
         WRITE_EVALUATED_ASCII ("%fx_off%" +        ("%index2%" + "%abil_fx_idx%")) "%clone%"    // cloned effect
         WRITE_SHORT           ("%fx_off%" +        ("%index2%" + "%abil_fx_idx%")) "%thskill%"  // opcode
         WRITE_LONG            ("%fx_off%" + 0x04 + ("%index2%" + "%abil_fx_idx%")) 5            // param1: 5 (5% bonus)
         WRITE_LONG            ("%fx_off%" + 0x08 + ("%index2%" + "%abil_fx_idx%")) 0            // param2: 0 (cumulative bonus type)
       END
       SET "fx_delta" = ("%fx_delta%" + 12)
       SET "index2" = ("%index2%" + 12)
       SET "abil_fx_num" = ("%abil_fx_num%" + 12)
     END
   END
   WRITE_SHORT  ("%abil_off%" + 0x1e + (0x28 * "%index%")) "%abil_fx_num%"
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

As far as I know, the default bard song raises/restores the party's morale in the original game and does nothing else. But that's just what I got from in-game testing back in the day.

 

Frankly, I don't think the default bard song effects have ever been properly documented. You can try asking Ascension64 to look into it since that would probably require checking the .exe.

Link to comment

Good thinking Sir!

The reason I was wondering if this would affect Bard song btw, was because of the BG2 manual:

While the song is playing, the party morale and luck is higher. The better the bard (higher level), the larger the morale and luck improvement for the party. (Luck decreases attack rolls and damage caused by enemies).

 

EDIT: The description doesn't even match what Luck should really do...

Link to comment

are you sure the bonus isn't part of the consequences of the luck stat internally?

 

Pretty sure, I've tested it a while ago and there was no indication that thieving skill bonuses are integrated into the luck opcode. For my tests I had Yoshimo with an Open Locks skill of 65% try to pick the lock of Container 2 in AR0312 (lock difficulty 90). Then, I had Nalia cast a modified Luck spell on him granting him +10 to Luck. And on the final attempt I had him equip the Ring of Lockpicks. The results were as follows:

 

1) Yoshimo @ 65%: 10 attempts 10 failures

2) Yoshimo @ 65% +10 Luck (modified spell): 10 attempts 10 failures

3) Yoshimo @ 90% (after equipping the Ring of Lockpicks): 10 attempts 10 successes

 

I think that's pretty conclusive.

Link to comment

Seriously? When did we do that?

 

I guess since we already do it, it makes sense to extend it out the the thief skills (we're making it noncumulative, right?), although I'm inclined to believe that the description is just being overly-generous on the types of rolls the game makes (luck is somewhere way down in the roll calculation IIRC; does open lock even initiate a roll? isn't it just a >= b?).

 

Perhaps it's just a motivational bonus. The little 5% that could. :-)

Link to comment

I guess since we already do it, it makes sense to extend it out the the thief skills (we're making it noncumulative, right?)

 

We are now. :) I'll add spwi209.spl to the non-stacking batch.

 

luck is somewhere way down in the roll calculation IIRC

 

I think luck may have some influence on the 1% chance to fail at pickpocketing/stealing that's usually always there, regardless of the actual skill level. Didn't Taimon find out something like that recently?

Link to comment

If it rolls, I'd suppose so. I don't remember any special checks, but there probably are. Now that you mention it, it sounds familiar, but I don't remember if it was an exception or if it just works because of the way it changes the results.

 

The 5% in the description is probably just because it gives a +1 d20 roll bonus, and then they listed stuff that rolls (but if it doesn't do a dice roll, then it doesn't do anything).

 

What are we doing for saving throws BTW? Wouldn't luck already influence them, and how the hell do you add 5% to values so small anyway? It sounds suspiciously like we may just be making stuff up here.

Link to comment

What are we doing for saving throws BTW? Wouldn't luck already influence them, and how the hell do you add 5% to values so small anyway?

 

Nope, the luck opcode doesn't affect saving throws on its own. It gives a bonus to hit and minimum damage and also reduces enemy spell damage, remember?

 

I think the +5% to saving throws was coded as a flat +1 bonus since a d20 is rolled whenever a saving throw is attempted and 20 * 0.05 = 1.

Link to comment

still, it also sets the luck stat which is used in certain rolls. From what we know, that includes saving throws, so gemrb uses a "lucky roll" for that.

 

That doesn't seem to be the case in unmodded BG2:ToB.

 

You can test this on a custom character if you set all of his saves to 20 and give him a bonus of +25 to luck via opcode #133. Despite the luck bonus and being under STATE_LUCK, he will always fail each of his saving throws against save or else spells such as Blindness and Hold Person.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...