SalieriC / SWIM

A collection of macros for the SWADE system on Foundry with a focus on immersion (i.e. by using sound effects)
GNU General Public License v3.0
10 stars 12 forks source link

[BUG] Ignore Shape Change Size Rule not working #92

Closed jdavasligil closed 2 years ago

jdavasligil commented 2 years ago

Describe the bug The setting "ignoreShapeChangeSizeRule" is ineffective and does not work for players.

To Reproduce Steps to reproduce the behavior:

  1. Create player character with no advances.
  2. Add large creature (Size >= 0) to [SWIM] Shape Changing folder and set as observer for player.
  3. Ensure SWIM macro setting Ignore Shape Change Size Rule is enabled.
  4. Use the Shape Changer macro as player and see error. The creature is not added to the list.

Expected behavior The large creature should be in the shape changer list.

Desktop (please complete the following information):

Potential Error Source SWADE-Immersive-Macros/swim/scripts/swim_modules/shape_changer.js Possible logic error on lines 55-71 function main():

if (actor.data.data.advances?.value < 4) { maxSize = -1 } else if (actor.data.data.advances?.value < 8) { maxSize = 0 } <-- LOGIC BLOCK EXITED BEFORE SETTING EXECUTION else if (actor.data.data.advances?.value < 12) { maxSize = 2 } else if (actor.data.data.advances?.value < 16) { maxSize = 4 } else if (actor.data.data.advances?.value >= 16) { maxSize = 10 } else if (game.settings.get("swim", "ignoreShapeChangeSizeRule") === true) { maxSize = 999 } <-- NEVER REACHED

Potential Solution Change line 66 to: if (game.settings.get("swim", "ignoreShapeChangeSizeRule") === true) { maxSize = 999 }

SalieriC commented 2 years ago

What an embarrassing oversight. Thanks for the very detailed report, I'll change it in the next release.

jdavasligil commented 2 years ago

What an embarrassing oversight. Thanks for the very detailed report, I'll change it in the next release.

No worries, it happens to the best of us! Logic errors are sneaky like that. Loving the macros, thanks for the hard work!

SalieriC commented 2 years ago

Fixed in the v10 branch. Thanks for the report. =)