Advertisement
Guest User

PZ Thick/Thin Skinned bug?

a guest
Aug 1st, 2021
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.86 KB | None | 0 0
  1. // Looks to me like the BodyDamage.class has a bug that makes ThickSkinned increase the chance of you getting hurt
  2. // and ThinSkinned decrease the chance of you getting hurt!
  3. // Here is a snip of the code.  It looks to me like the variable n5 (renamed because of the compiler) is the chance that
  4. // you AVOID getting hurt.  This number is divided by 1.3 if you have Thick Skin, and multiplied by 1.3 if you have Thin
  5. // skin
  6. // if you renamed n5 as "chanceToBeHit" then the ThickSkinned and ThinSkinned modifications make sense, but
  7. // the Rand.Next(100) > chanceToBeHit line wouldn't make sense
  8. // if you renamed n5 as "chanceToAvoidHit" then the ThickSkinned and ThinSkinned modifications do reverse of what they
  9. // should, but the Rand.Next(100) > chanceToAvoidHit line makes sense
  10. // So probably either swap the ThickSkinned and ThinSkinned modifications
  11. // Or change the line to Rand.Next(100) <= n5 (but this would require double checking all the other code that modifies n5)
  12.  
  13.         final int max = Math.max(this.getParentChar().getSurroundingAttackingZombies(), 1);
  14.         int n5 = n2 - (max - 1) * 10;
  15.         int n6 = n3 - (max - 1) * 30;
  16.         int n7 = n4 - (max - 1) * 15;
  17.         int n8 = 3;
  18.         if (SandboxOptions.instance.Lore.Strength.getValue() == 1) {
  19.             n8 = 2;
  20.         }
  21.         if (SandboxOptions.instance.Lore.Strength.getValue() == 3) {
  22.             n8 = 6;
  23.         }
  24.         if (this.ParentChar.Traits.ThickSkinned.isSet()) {
  25.             n5 /= (int)1.3;
  26.         }
  27.         if (this.ParentChar.Traits.ThinSkinned.isSet()) {
  28.             n5 *= (int)1.3;
  29.         }
  30.  
  31. // Stuff happens in between, then if a random 100 roll is > n5, you are hit
  32.  
  33.         if (Rand.Next(100) > n5) {
  34.             boolean b2 = true;
  35.             boolean b3 = false;
  36.  
  37. // Then b2=true runs some code that shows that you've been scratched
  38.  
  39.             if (b2) {
  40.                 final Float value = this.getParentChar().getBodyPartClothingDefense(Integer.valueOf(i), false, false);
  41.                 if (this.getHealth() > 0.0f) {
  42.                     this.getParentChar().getEmitter().playSound("ZombieScratch");
  43.                 }
  44.                 if (Rand.Next(100) < value) {
  45.                     return false;
  46.                 }
  47.                 if (!addHoleFromZombieAttacks) {
  48.                     this.getParentChar().addHole(BloodBodyPartType.FromIndex(i));
  49.                 }
  50.                 this.AddDamage(i, n11);
  51.                 this.SetScratched(i, true);
  52.                 this.getParentChar().addBlood(BloodBodyPartType.FromIndex(i), true, false, true);
  53.                 n = 1;
  54.                 if (GameServer.bServer && this.ParentChar instanceof IsoPlayer) {
  55.                     DebugLog.log(DebugType.Combat, invokedynamic(makeConcatWithConstants:(Ljava/lang/String;)Ljava/lang/String;, ((IsoPlayer)this.ParentChar).username));
  56.                 }
  57.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement