SalieriC / SWIM

A collection of macros for the SWADE system on Foundry with a focus on immersion (i.e. by using sound effects)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Ignore Shape Change Size Rule not working

jdavasligil opened this issue · comments

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):

  • OS: Linux Mint 20.3 Una
  • Browser: N/A Electron App.
  • FVTT Version: 9 Build 269
  • SWADE System Version: 1.2.2
  • SWIM Version: 0.18.5
  • Other Modules enabled?: No. Unit tested in isolation.

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 }

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

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!

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