From f3b7975fde5eb91906879397d0ec9cdceb66016c Mon Sep 17 00:00:00 2001
From: Apewall <1915182+apewall@users.noreply.github.com>
Date: Wed, 22 May 2024 13:21:58 -0500
Subject: [PATCH 1/3] Update attack results to always provide success when no
target is selected
---
src/module/helpers-dice.js | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/module/helpers-dice.js b/src/module/helpers-dice.js
index effb09b0..a3bb5a7e 100644
--- a/src/module/helpers-dice.js
+++ b/src/module/helpers-dice.js
@@ -158,7 +158,7 @@ const OseDice = {
break;
}
- default : {
+ default: {
result.isSuccess = false;
result.isFailure = false;
@@ -214,7 +214,7 @@ const OseDice = {
if (game.settings.get(game.system.id, "ascendingAC")) {
const attackBonus = 19 - data.roll.thac0;
- if (this.attackIsSuccess(roll, targetAac, attackBonus)) {
+ if (this.attackIsSuccess(roll, targetAac, attackBonus) || result.victim == null) {
result.details = game.i18n.format(
"OSE.messages.AttackAscendingSuccess",
{
@@ -231,9 +231,9 @@ const OseDice = {
);
result.isFailure = true;
}
- } else if (this.attackIsSuccess(roll, result.target, targetAc)) {
- // Answer is bounded betweewn AC -3 and 9 (unarmored) and is shown in chat card
- const value = Math.clamped(result.target - roll.total, -3, 9);
+ } else if (this.attackIsSuccess(roll, result.target, targetAc) || result.victim == null) {
+ // Show result in chat card
+ const value = result.target - roll.total;
result.details = game.i18n.format("OSE.messages.AttackSuccess", {
result: value,
bonus: result.target,
@@ -420,16 +420,15 @@ const OseDice = {
rolled = true;
rollData.form = html[0].querySelector("form");
rollData.parts.push(`${rollData.data.roll.magic}`);
- rollData.title += ` ${game.i18n.localize("OSE.saves.magic.short")} (${
- rollData.data.roll.magic
- })`;
+ rollData.title += ` ${game.i18n.localize("OSE.saves.magic.short")} (${rollData.data.roll.magic
+ })`;
roll = OseDice.sendRoll(rollData);
},
},
cancel: {
icon: '',
label: game.i18n.localize("OSE.Cancel"),
- callback: (html) => {},
+ callback: (html) => { },
},
};
@@ -500,7 +499,7 @@ const OseDice = {
cancel: {
icon: '',
label: game.i18n.localize("OSE.Cancel"),
- callback: (html) => {},
+ callback: (html) => { },
},
};
From f17b7b2afdf7c4923beb856d6720411a05a8a37e Mon Sep 17 00:00:00 2001
From: Apewall <1915182+apewall@users.noreply.github.com>
Date: Wed, 22 May 2024 13:51:16 -0500
Subject: [PATCH 2/3] Update default target ac and aac values
---
src/module/helpers-dice.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/module/helpers-dice.js b/src/module/helpers-dice.js
index a3bb5a7e..7f9c1d71 100644
--- a/src/module/helpers-dice.js
+++ b/src/module/helpers-dice.js
@@ -208,8 +208,8 @@ const OseDice = {
result.target = data.roll.thac0;
const targetActorData = data.roll.target?.actor?.system || null;
- const targetAc = data.roll.target ? targetActorData.ac.value : 20;
- const targetAac = data.roll.target ? targetActorData.aac.value : -20;
+ const targetAc = data.roll.target ? targetActorData.ac.value : 9;
+ const targetAac = data.roll.target ? targetActorData.aac.value : 10;
result.victim = data.roll.target || null;
if (game.settings.get(game.system.id, "ascendingAC")) {
From 7ed9572225baa8948e0d799ad809b5ecd16119bf Mon Sep 17 00:00:00 2001
From: Apewall <1915182+apewall@users.noreply.github.com>
Date: Wed, 3 Jul 2024 13:32:00 -0500
Subject: [PATCH 3/3] Clean spacing from merge
---
src/module/helpers-dice.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/module/helpers-dice.js b/src/module/helpers-dice.js
index e2767461..c56e4779 100644
--- a/src/module/helpers-dice.js
+++ b/src/module/helpers-dice.js
@@ -235,7 +235,6 @@ const OseDice = {
} else if (this.attackIsSuccess(roll, result.target, targetAc) || result.victim == null) {
// Show result in chat card
const value = result.target - roll.total;
-
result.details = game.i18n.format("OSE.messages.AttackSuccess", {
result: value,
bonus: result.target,