Sunday, August 15, 2021

41.53 - Don't Take Thick Skinned! (Fixed in 41.54)

Edit 2021-09-16:  This has been fixed in Build 41.54

I mentioned this in my video on the Resilient, Prone To Illness, Thick Skinned, and Thin Skinned traits, but since that was a video I'll reiterate here:  Don't take Thick Skinned because it is currently (41.53) bugged.  Thick Skinned makes you easier to hit, and Thin Skinned makes you harder to hit.

(Maybe I'm wrong, feel free to correct me if I am)

The video goes into more detail, but briefly:

Here is some code I decompiled with the CFR decompiler.  This is from BodyDamage.class:

        int n4 = 15 + this.getParentChar().getMeleeCombatMod();
        int n5 = 85;
        int n6 = 65;
        String string2 = this.getParentChar().testDotSide(isoZombie);
        boolean bl2 = string2.equals(behindStr);
        boolean bl3 = string2.equals(leftStr) || string2.equals(rightStr);
        int n7 = this.getParentChar().getSurroundingAttackingZombies();
        n7 = Math.max(n7, 1);
        n4 -= (n7 - 1) * 10;
        n5 -= (n7 - 1) * 30;
        n6 -= (n7 - 1) * 15;
        int n8 = 3;
        if (SandboxOptions.instance.Lore.Strength.getValue() == 1) {
            n8 = 2;
        }
        if (SandboxOptions.instance.Lore.Strength.getValue() == 3) {
            n8 = 6;
        }
        if (this.ParentChar.Traits.ThickSkinned.isSet()) {
            n4 = (int)((double)n4 / 1.3);
        }
        if (this.ParentChar.Traits.ThinSkinned.isSet()) {
            n4 = (int)((double)n4 * 1.3);
        }

As always, variable names aren't great once they've gone through the compiler/decompiler.

Keep track of n4.  It starts out as 15 + some combat modifier.  It gets reduced based on the surrounding zombies.

Then, if you have ThickSkinned, it gets divided by 1.3.  That reduces n4.

In the code n4 gets added to and subtracted from a few times, and then finally gets to where it is used:

        if (Rand.Next(100) > n4) {

And if the random d100 roll is greater than n4, it goes into the code that resolves what happens when you are hit (whether armor protects, whether it is a scratch/laceration/bite).

So since Thick Skinned lowers n4, it makes it easier for your character to get hit.  And Thin Skinned makes it harder for your character to get hit.  The opposite of what it should be.

I filed a bug with Indie Stone, but it hasn't been fixed yet.  So don't take Thick Skinned for now.  I suppose it you take it, once it gets fixed you'll be fine, but it will make it harder for you to survive until it is fixed.

I suppose taking Thin Skinned may be good right now!  It gives you free points and protects you.  But once this bug gets fixed, you'll lose the advantage.  This is the kind of bug that will incorporate into all saved games once it is fixed.

Edit 2021-08-19: ThickSkinned does not affect the severity of the wound, only whether or not a wound is going to occur.  Getting hit because of ThickSkinned doesn't make it less likely the survivor will be bitten - it makes it more likely.  (I am having difficulty getting comments to work the way I want)

2 comments:

  1. Without having looked at the code:

    A greater chance of being scratched is a benefit if the code structure is such that the alternative is a bite.

    ReplyDelete
  2. thank you for useful bug reporting!! :)

    I just curios about the 'this.getParentChar().getMeleeCombatMod()'
    how did number exactly is calculated?
    is that matter with player equipment like helmet or player combat skill like axe?

    ReplyDelete

Do Gloves Protect You From Broken Glass?

Yes, gloves protect you from handling broken glass - any pair of gloves.  But gloves are not needed when removing broken glass from a smashe...