From d14e20e0eba5479411008b8ebeba74c10bacad17 Mon Sep 17 00:00:00 2001 From: cadowtin Date: Mon, 7 Aug 2023 18:04:14 -0500 Subject: [PATCH] clamped font scale when generating pop up text --- scripts/module.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/module.js b/scripts/module.js index 6bb4b54..ef41fbe 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -106,7 +106,8 @@ export function extractDamageInfoCombined(rolls) { } export function getFontScale(scaleType, dmg, tok) { - let scale = game.settings.get("pf2e-rpg-numbers", 'max-font-scale') - 1; + const maxFontScale = game.settings.get("pf2e-rpg-numbers", 'max-font-scale'); + let scale = maxFontScale - 1; if (scaleType === "percentMaxHealth") { scale *= (dmg / (tok.actor.system.attributes.hp.max + tok.actor.system.attributes.hp.temp)); } @@ -116,5 +117,5 @@ export function getFontScale(scaleType, dmg, tok) { if (scaleType === "none") { return 1; } - return scale + 1; + return max(1, min(scale + 1, maxFontScale)) } \ No newline at end of file