Skip to content

feat(SmartAoE): Enhances 2024 sheet support and updates help - #2359

Open
steverobertsuk wants to merge 10 commits into
Roll20:masterfrom
steverobertsuk:sr/smartaoe-v1-0-1
Open

steverobertsuk wants to merge 10 commits into
Roll20:masterfrom
steverobertsuk:sr/smartaoe-v1-0-1

Conversation

@steverobertsuk

Copy link
Copy Markdown
Contributor

This update brings improved compatibility with D&D 2024 (Beacon) sheets and comprehensive documentation enhancements.

Added

  • Introduces a "Grid rules by game system" section to the help handout and README, offering guidance on --minGridArea, --minTokArea, and shape settings for various game systems.
  • Visually enhances the help handout, presenting code snippets and parameters as distinct "code chips" for improved readability.

Changed

  • The resource management for D&D 2024 sheets now automatically interprets lvlN_slots_expended to count upwards towards lvlN_slots_total when --resource is used without an explicit limit.
  • Corrects the help handout's tip regarding 2024 (Beacon) sheets, providing updated advice on Sandbox v1.5, spell slots, and Magic Resistance detection.

Fixed

  • Resolves an issue where empty legacy attribute objects on 2024 (Beacon) characters could inadvertently hide valid sheet values for attributes such as resistances, vulnerabilities, immunities, --ignore, and --resource. SmartAoE now correctly prioritises non-empty legacy attributes or sheet values.
  • Prevents a crash when !smarttrigger is executed on an AoE before its control token has been moved. SmartAoE now whispers a prompt to reposition the control token, ensuring the area is defined before triggering.

No Breaking Changes.

Signed-off-by: Steve Roberts steve@shadowcomputers.co.uk

Version 1.0.0 has been merged into the Roll20 repository, so the
follow-up fixes for D&D 2024 (Beacon) sheets go into a new patch
release.

- Set the script, header and script.json to 1.0.1, and add 1.0.0 to
  previousversions.
- Describe 1.0.1 in the script.json description.
- Add the 1.0.1/ snapshot, matching the root script.
- Add the 1.0.1 changelog section and expect v1.0.1 in TESTING.md.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
A 2024 (Beacon) character can carry legacy attribute objects with the
same names as its sheet values, for example after a 2014 character is
moved to the 2024 sheet or when another mod creates them. SmartAoE
used such an attribute even when it was empty, so an empty
npc_immunities hid the sheet's "Fire" and a Fire Giant took full fire
damage, although a chat roll showed the immunity (forum report).

An empty legacy attribute is now skipped and the sheet's value is
read instead. This applies to --resistAttr, --vulnerableAttr,
--immunityAttr, --ignore and --resource. A legacy attribute with a
value is still used, so 2014-sheet games behave as before.

Documented in the README's 2024 sheet section, with a TESTING.md step
that adds an empty npc_immunities to the Fire Giant.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
On the 2024 sheet, lvlN_slots_expended holds the slots used, but
without a limit --resource counted it down. With no slots used it
always said there weren't enough, and casting after using a slot took
the count back to 0 (forum report).

When the resource is a 2024-sheet lvlN_slots_expended and no limit is
given, SmartAoE now uses lvlN_slots_total as the limit, so existing
macros such as --resource|lvl3_slots_expended work unchanged. An
explicit limit still takes precedence. 2014 sheets, where the
attribute is a legacy object holding the slots left, still count down.

The help handout, README and TESTING.md describe the default.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Running !smarttrigger before the control token had been moved stopped
with "Cannot read properties of undefined (reading 'x')", because the
AoE has no squares or bounding box until the control token moves.

Such an AoE is now skipped with a whisper asking the GM to move the
control token first. Found while testing the forum report in a live
game; TESTING.md has a matching step.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
The tip still said the 5eSTR to 5eCHA shortcuts only work on the 2014
sheet and that the 2024 sheet needs a custom --saveFormula and --dc.
That stopped being true when 1.0.0 learned to read Beacon sheets.

The tip now says to use the Mod Script Sandbox v1.5, that saves,
damage-type attributes, --ignore and --resource read the 2024 sheet,
that spell slots count up to the slot total, and that Magic
Resistance is only detected on 2014 sheets.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
DMs asked whether SmartAoE follows the 2014 or the 2024 D&D rule for
which squares an area hits. It follows neither by default:
--minGridArea and --minTokArea decide it, and they default to almost
any overlap.

Add a "Grid rules by game system" section to the README and the help
handout. It gives the settings that match:
- D&D 5e 2024 (half a square);
- D&D 5e 2014 (DMG and Xanathar's template method);
- Pathfinder 1e, D&D 3.5 and Starfinder 1e (far-edge rule);
- Pathfinder 2e and Starfinder 2e;
- systems where any touch counts or only a square's centre counts.

The section also notes that the drawn squares are the ruling, and that
a creature in a counted square is hit however small its token, which
was checked with a Tiny token in a live game.

The README's feature list and Pathfinder tip link to the new section,
and TESTING.md lists it among the handout's sections.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Inline code in the help handout was only set in a monospace font, so
settings such as --minGridArea|0.5 were hard to tell apart from the
text around them.

- Inline code now has a light tint, a thin outline and rounded
  corners. The semi-transparent colours read in both Roll20 light and
  dark mode.
- The grid rules settings and the tips mark their code with
  backticks. A new handoutText helper shows those parts as code chips
  that don't wrap, so a parameter such as --forceIntersection|1 no
  longer breaks after its "--".

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Magic Resistance was only detected on 2014 sheets. SmartAoE searches
each attribute's text for "magic resist", but a 2024 (Beacon) sheet
keeps its features in a single "store" attribute that holds an object,
and that object's text is "[object Object]". A Yuan-ti on the 2024
sheet therefore rolled its saves once.

- A new hasBeaconMagicResistance helper looks through the store's
  features for an enabled one whose name includes "Magic Resistance".
  The save is then rolled twice and shown as A, as on the 2014 sheet.
- Only feature names are checked. The store also holds item and spell
  text, and a whole-store search matched a 2024 shop character that
  only sells items mentioning magic resistance.
- The 2014 check is unchanged.

Tested in a live game: a 2024 Yuan-ti Infiltrator rolled two saves and
kept the higher; creatures without the trait rolled once.

The README, the help handout's 2024 tip, the changelog, script.json and
TESTING.md no longer say Magic Resistance is 2014-only.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
The damage-type check is a plain text search of the target's
resistance, vulnerability and immunity attributes. A 2014 stat block's
"bludgeoning, piercing, and slashing from nonmagical attacks" (a
Gargoyle, many devils and lycanthropes) contains "bludgeoning", so a
bludgeoning AoE was halved or cancelled even though AoEs are magical.

A new removeNonmagicalDamage helper drops these groups from each value
before the check, in both the "... from nonmagical attacks" and the
"nonmagical bludgeoning, ..." wordings, up to the next semicolon. Other
damage types on the same line still apply, so "cold; bludgeoning, ...
from nonmagical attacks" still resists cold. AoEs count as magical,
which SmartAoE already assumes for Magic Resistance.

2024 stat blocks no longer have nonmagical resistances, so only 2014
creatures were affected. Tested in a live game with a temporary
resistance attribute: bludgeoning was no longer resisted, cold still
was, and the existing resistances, vulnerabilities and immunities were
unchanged.

The README's --resistAttr row, the changelog, script.json and
TESTING.md describe the change.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
The previous commit made SmartAoE ignore damage types that are only
resisted from nonmagical attacks, and the README's --resistAttr row
explains this. The help handout's row still only said "attributes
listing the target's defences", so a GM reading the handout wouldn't
know why a Gargoyle's bludgeoning resistance no longer applies.

The handout's --resistAttr / --vulnerableAttr / --immunityAttr row now
says that AoEs count as magical, so those damage types are ignored.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant