Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Axis & Allies 1942 Online is now available in Early Access! Buy it on Steam. The FAQ is available.
New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Luck: What it is and how it works

12357

Comments

  • ProbablyNotANumberProbablyNotANumber Member Posts: 26
    edited October 2018
    You made me stop awkwardly for a minute. Did I really waste such a wall of text ? That would be hilarious.


    And it is.



    I have no idea how I could let this slip through the cracks of my awareness even though I use it to estimate spell damage. For some reason, I didn't apply Luck the same way the game does. The results are correct for negative Luck, since they went through the test of reality, but I expressed them using a different algorithm. If AC ≤ Thac0 -2, use Thac0 + Luck - AC = MinimumRollToHit. Otherwise, use Thaco - AC = MinimumRollToHit. Then we're back into familiar territory and know what to do with that minimum roll requirement.

    The reason I couldn't click with the real game algorithm is probably because I bumped into the issue from an unexpected angle. As I was hit 100% by Yaga Shura despite a massive -17 Luck penalty, I cast Improved invisibility, and all of a sudden he turned into a kitten failing to catch a laser. WTF ? It didn't connect that with the game's algorithm the Luck penalty would be unlocked all at once with even a mere +1 AC bonus (Let's say from -9 to -10 against a -8 thac0 drunkard): I would have expected a progressive entrance of the penalty, so I put assumptions on the side and tried to find what was up from data. But I should have thought about it twice to save a lot of time, since a progressive entrance means something nonsensical: That as the to-hit tipping point (Thac0 - AC) shifts away from 1 and closer to 20, Luck's potential for reducing accuracy increases. It's clearly the opposite: Luck's penalty potential is largest when the tipping point is close to 1 and misses are otherwise rare; at -17, Luck can make use of all those points, turning a lot of hits into misses. Then as the to-hit border shifts towards 20 from an improving AC or a worsening thac0, -17 Luck becomes no more useful than -5 Luck, and ultimately 0 Luck. So the Luck penalty does a full entrance right when the to-hit tipping point enters the [1-20] range from the left, and withdraws progressively as the natural AC becomes protective enough (or the thac0 less accurate), moving the tipping point to the right.


    Now I'd like to understand how the combat log computes its numbers for a non-zero Luck attacker, but I think I spent a little too much time on this Luck thing already :*

    Post edited by ProbablyNotANumber on
    lolienAerakar
  • Luke93Luke93 Member, Mobile Tester Posts: 1,232
    edited November 2018

    @Alonso: I'll rephrase. Let's say "the creature affected" is the creature who is under the effects of a luck spell or song or item.

    Luck does NOT affect:

    4. Critical hit and critical miss chances (unconfirmed) OF the creature affected

    I think you can safely remove that unconfirmed (see the attached screenshot for further details.....).

    I think it's reasonable to assume that the same holds for a Critical hit.....

    StummvonBordwehrlolien
  • semiticgodsemiticgod Member, Moderator Posts: 13,663
    I've seen negative luck increase the rate of critical misses, but only in IWD and IWD2. The BG games don't seem to have that.

    AerakarGrond0
  • Luke93Luke93 Member, Mobile Tester Posts: 1,232
    Grond0 said:

    In order to conclude that there is no impact on the chance of a critical miss though you would need to show a roll something like:
    - die roll 2 / 3 / 4 / 5
    - luck -1 / -2 / -3 / -4
    and show that would not be recorded as a critical miss (which it wouldn't).

    Here it is (again, my current Luck is "-4")

  • Grond0Grond0 Member Posts: 5,367
    @luke93 I'm confused now what you're trying to say. The screenshot you posted looks like it's suggesting that luck can reduce a die roll greater than 1 in order to produce a critical miss. However, as I said earlier, that's not the case - at least in BG. Here's a full screenshot demonstrating that.

  • Luke93Luke93 Member, Mobile Tester Posts: 1,232
    edited November 2018
    @Grond0

    Yeah, sorry, I forgot to say that I modified my critical miss chance via opcode #362 (in order to see if Luck can affect it......)

    In any case, (negative) Luck cannot reduce a roll below 1 ( even in case of critical misses....)

  • QuickbladeQuickblade Member Posts: 863
    edited December 2018
    Bubb said:

    I was poking around in the engine internals, and I found that several opcodes directly reference luck.

    The most interesting case has to do with Mirror Image. A character's luck value directly affects whether or not Opcode #12 (Damage) will bypass the images or not.

    If luck is greater than 0 -> Damage will NEVER bypass mirror images.

    • A mage with 1 luck and 8 images will never be hit through the images.
    • A mage with 0 luck and 8 images will be hit through the images some of the time.

    If negative luck is less than images amount, (or luck is 0) -> Chance to bypass is (luck + 1) / (images + 1)
    • A mage with -5 luck and 8 images will be hit through the images (5 + 1) / (8 + 1) = 66.6% of the time.
    • A mage with 0 luck and 8 images will be hit through the images (0 + 1) / (8 + 1) = 11.1% of the time.

    If negative luck is greater than or equal to images amount -> Damage will ALWAYS bypass mirror images.
    • A mage with -8 luck and 8 images will always be hit through the images.
    • A mage with -5 luck and 8 images will be hit through the images some of the time.
    Does that apply whether you do the standard Mirror Image Opcode (random number of images), or the set specific number of mirror images Opcode, or both?

    Because I edited Mirror Image to personal taste to act as it does in (at least 3E) PnP, which requires combining both a random and a set number (1d4+level/3, max of 8). Actually, I think I got around it by doing % probability with setting specific numbers of images, necessary because at 15th and 18th, it's d2 and d3, not d4, I'd have to dig it up.

  • kjeronkjeron Member Posts: 2,038

    Does that apply whether you do the standard Mirror Image Opcode (random number of images), or the set specific number of mirror images Opcode, or both?

    The first Mirror Image opcode (#119) just applies other Mirror Image opcode #159 with a parameter1 value equal to:
    2 + (Caster Level / 3), rounded down, maximum of 8
    So it doesn't matter which one you use.

    lolien
  • QuickbladeQuickblade Member Posts: 863
    kjeron said:

    Does that apply whether you do the standard Mirror Image Opcode (random number of images), or the set specific number of mirror images Opcode, or both?

    The first Mirror Image opcode (#119) just applies other Mirror Image opcode #159 with a parameter1 value equal to:
    2 + (Caster Level / 3), rounded down, maximum of 8
    So it doesn't matter which one you use.
    Hrm, I was using DLTCEP, which says for #119 "Applies the mirror image effect to the targetted creature(s), creating mirror images up to the 'Maximum Images' value."

    IESDP doesn't really say much about it.

    What I meant is, adding mirror images is cumulative because I had it when I tested. Vanilla mirror image is 119 for 5 images max.

    Is there a difference to the luck vs. images between a spell adding 4 images 1 time, compared to a spell adding 1 image 4 times?

  • BubbBubb Member Posts: 677
    @Quickblade: Nope, there isn't any difference - the engine only cares about the total number of images a mage has up.

  • kjeronkjeron Member Posts: 2,038
    edited December 2018
    @Bubb Keep it coming. :)
    Bubb said:

    #18 (0x12) - Hide()

    - Rolls a 1d100 in order to test for critical failure, (this being a roll of 100). Any amount of positive luck will remove the chance of critical failure. Negative luck will "shift" the probabilities slightly out of your favor. For example:

    It's not just the Critical Failure roll, enough luck will guarantee hiding success.

    Sadly no amount of luck will help someone with zero skill for hiding/set traps. Otherwise the +5% granted by the Luck Spell could be removed for these skills. Doesn't help that the game also suppresses racial and dexterity skill modifiers for classes that don't normally have access to these skills.

    A Paladin with 255 luck, (0 HiS/MS), +5 MS from Dex/Race will always fail to hide.
    A Paladin with 255 luck, (0 HiS/MS), +5 MS from Race, and the luck spell (+5% HiS/MS) will always succeed.
    A Monk with 255 luck, (0 HiS/MS), +5 MS from Dex/Race will always succeed.

    BubblolienCrevsDaak
  • ZaghoulZaghoul Member, Moderator Posts: 3,956
    edited December 2018
    @Bubb Nice B) . So would the following add up in chances of success with Alora as an example?
    Rabbit foot
    Luck spell on Alora
    Bard song active on Alora

    I think this explains why Alora has never failed a PP or steal attempt in BG with a high PP score for me.

    Bubb
  • Grond0Grond0 Member Posts: 5,367
    edited December 2018
    Bubb said:

    #252 (0xFC) Spell Effect: Set Trap

    - Engine rolls a 1d100, and if the roll is less than the character's Set Traps skill it fails succeeds. Each point of luck will "shift" the probabilities slightly in your favor. For example:

    Luck 20 Probabilities:
    1 => 0%
    2 => 0%
    3 => 0%
    98 => 1%
    99 => 1%
    100 => 21%


    Negative luck has the same effect, but in reverse.
    @Bubb thanks for more great analysis. Just on set traps, you've amended your post to say that setting a trap succeeds if the roll is less than your score. However, the table you've posted shows luck operating to give you an increased chance of a higher number. Is that actually an error in the game engine, or is the table you posted the one for negative luck?

    Bubblolien
  • BubbBubb Member Posts: 677
    @kjeron: So it does! I incorrectly believed the engine overrode the relevant register after the critical fail check, but it actually stores it away in a local variable to reuse it later :)

    (don't ask me about the actual stealth check, though. It doesn't use a usual dice roll - something really wacky is used to calculate the roll).

    @Zaghoul: The program I built to scrub all Actions / Opcodes for certain stat accesses doesn't show that Pick Pockets ever accesses the character's luck value. I've had to iron out some problems with it already, so it very well could be missing something.

    Those Luck sources do stack, though. So if Luck does actually affect Pick Pockets, it very well could help. As they say, more research is needed.

    @Grond0: Good eye! The engine negated the luck value before throwing it into the random function, and I accidentally plugged in the raw value when I constructed the Set Traps probability table. I've fixed it - the engine is right, I'm wrong. :D

    ZaghoullolienCrevsDaak
  • AlonsoAlonso Member Posts: 745
    edited March 15
    I'm updating the article in the first post with all the extra info you have provided, and I have some questions.

    @semiticgod:
    • What are the two options of the Wish spell that affect luck?
    • Does the game UI display the luck of a character anywhere?
    Grond0 wrote: »
    rede9 wrote: »
    https://forums.beamdog.com/discussion/comment/190513/#Comment_190513
    This user explains he summoned 5 bard clones in BG2 vanilla and 6 Enhanced Song stacked: +20 AC, +20 THAC0, +20 damages, +25 magic res, etc.
    Does it work in BG2ee?
    No - this was one of the exploits closed by the EE.
    What was closed, bard songs stacking with each other, only Enhanced Songs, something else...?
    Loldrup wrote: »
    Alonso wrote: »
    Bard Song (unkitted): +1 luck at level 1, +2 at level 15, +3 at level 20.
    Huh, I thought it gave immunity to fear. When did that change?
    It hasn't changed. But the effects of the bard songs are too complex to list here, so I only included the luck effects.

    @ProbablyNotANumber: I'm sorry, I can't understand your posts. Maybe you can summarize a bit?

    @Firecrow: Thank you for your feedback. I've updated the article with the info you provided.

    @Luke93 and @Grond0: How do you get that super detailed log? Is it a mod?

    Post edited by Alonso on
  • Grond0Grond0 Member Posts: 5,367
    Alonso wrote: »
    Grond0 wrote: »
    rede9 wrote: »
    https://forums.beamdog.com/discussion/comment/190513/#Comment_190513
    This user explains he summoned 5 bard clones in BG2 vanilla and 6 Enhanced Song stacked: +20 AC, +20 THAC0, +20 damages, +25 magic res, etc.
    Does it work in BG2ee?
    No - this was one of the exploits closed by the EE.
    What was closed, bard songs stacking with each other, only Enhanced Songs, something else...?
    The same bard song used to stack - allowing you to have bard clones singing to multiply effects. That no longer works, but you can still have different bard songs operating together, e.g. a skald and a bard could both sing.

    @Luke93 and @Grond0: How do you get that super detailed log? Is it a mod?
    It's part of the unmodded game, but you can only get the more detailed information by amending the LUA file - you need the following in that:
    SetPrivateProfileString('Game Options','Extra Combat Info','1')
    (you may already have the line, but with a 0 rather than 1).

    StummvonBordwehrgorgonzolalolien
  • gorgonzolagorgonzola Member Posts: 2,839
    thank you @Grond0 for that information that i find very useful. i almost don't use other programs to check the game files, but i try to obtain all the information i can from the log

    Grond0
  • AlonsoAlonso Member Posts: 745
    semiticgod wrote: »
    The Record screen and character portrait can both display Luck, Bad Luck, Intoxication, and Fatigue icons
    I guess you mean they can display that info with a mod, right? I imagine luck is not displayed anywhere in vanilla.

  • Grond0Grond0 Member Posts: 5,367
    The unmodded game displays just the icons, i.e. the little pictures that show an effect is active - those are on both the record screen and the portrait on the main screen. If you want to see the exact effect you would need a mod.

    semiticgodAlonsololien
  • StromaelStromael Member Posts: 167
    Bubb wrote: »
    A mage with 1 luck and 8 images will never be hit through the images.

    That's incredible. Does that seriously boost Mirror Image back to its vanilla BG1 power (Stoneskin + Area of Effect damage prevention)? That would open a whole new F/M tanking tactic: Minor Sequencer of Luck plus Mirror Image, keep a second Luck memorised to rebuff after 3 rounds.

    StummvonBordwehrgorgonzolalolien
  • gorgonzolagorgonzola Member Posts: 2,839
    compared to most of the modern games infinity engine games have a complexity that is amazing.
    a proper manual, that gives a detailed explanation of every characteristic and feature of the game would probably be a big 900 pages tome, something you can also use as ranged weapon if some goblin attacks you in the deep of the night as you are studying it :)

    Grond0BubbAlonsololien
  • Grond0Grond0 Member Posts: 5,367
    Bubb wrote: »
    Ok, the bump of this thread made me double check if I found all of the luck applications. I found one more, and it is just kinda weird. Apparently, there is intentionally a random wait time between when a creature attempts to move to another creature, and when they will actually start pathing. Luck helps with this...
    Wait Time = 0, when roll = 0
    Wait Time = (8 - roll), when roll != 0
    

    The natural roll range is [0, 7], but like many other rolls luck alters this slightly. For every point in luck the highest bound of the roll is converted into the lower bound.

    So with 1 Luck the roll becomes [0, 6], with 0 having a probability of 25% instead of 12.5%. Negative luck works the same, but in reverse.

    The oddity comes from the fact that 1 is the worst roll you can get, and yet it is neither of the extremes. So, -1 Luck is bad because it prevents you from bypassing the wait time, (rolling a 0), but if Luck must be negative, the lower the better.

    Luck -1: Worst roll possible is a 1, you will be waiting for 7 updates.
    Luck -7: Worst roll possible is a 7, you will be waiting for 1 updates!!

    Positive luck will always increase the likelihood of instantaneous pathing.

    Note that this wait time is only applied to creature-to-creature pathing, and never to on-the-ground destinations.
    Worst roll (1):
    mor5kjlxm92w.gif
    Best roll (0):
    bhx2fa9s43ed.gif

    @Bubb that delay isn't actually implemented in the game though. Can you see why in the engine - does it look like the idea was deliberately abandoned or just not coded properly?

Sign In or Register to comment.