From 4dabf90f7fe99e51eb89525c2acf97482adeec85 Mon Sep 17 00:00:00 2001 From: Brett Nash Date: Mon, 2 Dec 2024 22:29:54 -0800 Subject: [PATCH] RolemasterUnified Official: Initiative improvements and creature fixes. - Initiative modified by maneuver penalty - Update rolltemplate for initiative to show penalty if present. - Add tests and validations for creatures. - All creature weapons now have a size (usually 0) - Display a message when an injury takes a character to negative hits. --- .../rolemasterunified.html | 95 ++++++++++--------- RolemasterUnified_Official/sheet.json | 2 +- RolemasterUnified_Official/updates.md | 8 ++ 3 files changed, 58 insertions(+), 47 deletions(-) diff --git a/RolemasterUnified_Official/rolemasterunified.html b/RolemasterUnified_Official/rolemasterunified.html index bc5027dd292..e6619ee55e1 100644 --- a/RolemasterUnified_Official/rolemasterunified.html +++ b/RolemasterUnified_Official/rolemasterunified.html @@ -52,6 +52,9 @@
{{actor}} rolls Initialive:
{{total}} = {{bonus}} + {{roll}} + {{#rollLess() maneuver 0}} + + {{maneuver}} [Maneuver Penalty / 10] + {{/rollLess() maneuver 0}}
@@ -3075,27 +3078,27 @@

RRs

y0 channelingin -
y
+
y
y0 essenceem
-
y
+
y
y0 mentalismpr
-
y
+
y
y0 physicalco
-
y
+
y
y0 fearsd
-
y
+
y
@@ -5355,7 +5358,7 @@

Custom Spell List


-Revision f76517429e54b66f2c2fb1d2c55efefa3c8eb665 +Revision 0e32e4dbcd10426972eb1499037242f2c1e9fae3
@@ -14104,9 +14107,12 @@

Custom Spell List

}); onCheck("clicked:rollinitiative", () => { - startRoll('&{template:rmuinit} [[ [[ 2d10 ]] + @{initiative} &{tracker}]] ' + + // roll20 treats floor as round to negative infinity, so ceil since they should be neagtive + startRoll('&{template:rmuinit} [[ [[ 2d10 ]] + @{initiative} + [[ceil(@{maneuver_penalty} / 10)]] &{tracker}]] ' + '{\{actor=@{character_name} }} ' + - '{\{bonus=@{initiative} }} {\{total=$[[1]]}} {\{roll=$[[0]]}}', + '{\{bonus=@{initiative} }} ' + + '{\{total=$[[2]]}} {\{roll=$[[0]]}} ' + + '{\{maneuver=$[[1]] }}', (roll) => { finishRoll(roll.rollId, {}); }); @@ -14137,34 +14143,35 @@

Custom Spell List

// Sorted alphabetically // Weapon (we) and ranged weapon are special (rw) -weaponcodes = { - be: "Beak", - bi: "Bite", - cl: "Claw", - cr: "Crush", - gr: "Grapple", - ho: "Horn", - ra: "Ram", - sw: "Unarmed Sweeps", - un: "Unarmed Strike", - si: "Stinger", - tr: "Trample", +// Require table and size for each. +creature.weaponcodes = { + be: { table: "Beak", size: 0 }, + bi: { table: "Bite", size: 0 }, + cl: { table: "Claw", size: 0 }, + cr: { table: "Crush", size: 0 }, + gr: { table: "Grapple", size: 0 }, + ho: { table: "Horn", size: 0 }, + ra: { table: "Ram", size: 0 }, + sw: { table: "Unarmed Sweeps", size: 0 }, + un: { table: "Unarmed Strike", size: 0 }, + si: { table: "Stinger", size: 0 }, + tr: { table: "Trample", size: 0 }, // FXIME: Hacky - we: "Arming Sword", - da: "Dagger", - rp: "Rapier", - as: "Arming Sword", - bs: "Broadsword", - sc: "Scimitar", - fa: "Falchion", - ma: "Mace", - cu: "Club", + we: { table: "Arming Sword", size: 0 }, + da: { table: "Dagger", size: 0 }, + rp: { table: "Rapier", size: 0 }, + as: { table: "Arming Sword", size: 0 }, + bs: { table: "Broadsword", size: 0 }, + sc: { table: "Scimitar", size: 0 }, + fa: { table: "Falchion", size: 0 }, + ma: { table: "Mace", size: 0 }, + cu: { table: "Club", size: 0 }, lc: { table: "Club", size: 1 }, - sb: "Bow, Short", - lb: "Bow, Long", + sb: { table: "Bow, Short", size: 0 }, + lb: { table: "Bow, Long", size: 0 }, ss: { table: "Arming Sword", size: -1 }, ls: { table: "Arming Sword", size: 1 }, - fa: "Falchion", + fa: { table: "Falchion", size: 0 }, @@ -14313,21 +14320,15 @@

Custom Spell List

updates[`${prefix}_attacksize`] = size; updates[`${prefix}_attackersize`] = cdata.size; - if (weaponcodes[type]) { - console.log("Look up", weaponcodes[type]); - const wc = weaponcodes[type]; - let table; - let sizemod = 0; - if (typeof(wc == 'string')) { - table = wc; - } else { - table = wc.table; - table = wc.sizemod; - } + if (creature.weaponcodes[type]) { + console.log("Look up", creature.weaponcodes[type]); + const wc = creature.weaponcodes[type]; + let table = wc.table; + let sizemode = wc.sizemod; getCompendiumPage(`AttackTable:${table}`, cdata => { let nu = {}; // FIXME: Handle errors in size slookup gracefully. - nu[`${prefix}_attackname`] = creature.getLongSize(size) + " " + weaponcodes[type]; + nu[`${prefix}_attackname`] = creature.getLongSize(size) + " " + table; nu[`${prefix}_attacksize`] = size + wc.sizemod; nu[`${prefix}_attackbasefumble`] = 1; // FIXMEitems.attackaddfumble; nu[`${prefix}_attacktable`] = table; @@ -14656,11 +14657,13 @@

Custom Spell List

break; } } - if (reported) { sendMessage(`${cdata.character_name} has an injury`); addSpecificInjury(injurydata); - } + } + if (updates.hp < 0) { + sendMessage(`${cdata.character_name} is down`); + } sendMessage(`${cdata.character_name} has ${numerics} applied`); VrmuSetAttrs(updates); diff --git a/RolemasterUnified_Official/sheet.json b/RolemasterUnified_Official/sheet.json index f8d81c52428..8971e7fd878 100644 --- a/RolemasterUnified_Official/sheet.json +++ b/RolemasterUnified_Official/sheet.json @@ -8,5 +8,5 @@ "legacy": false, "printable": true, "compendium": "RMU", - "version": "1732661284" + "version": "1733207371" } diff --git a/RolemasterUnified_Official/updates.md b/RolemasterUnified_Official/updates.md index 4df07b1492f..d964a847fe3 100644 --- a/RolemasterUnified_Official/updates.md +++ b/RolemasterUnified_Official/updates.md @@ -1,3 +1,11 @@ +# 2024-12-3 + +- Initiative modified by maneuver penalty +- Update rolltemplate for initiative to show penalty if present. +- Add tests and validations for creatures. +- All creature weapons now have a size (usually 0) +- Display a message when an injury takes a character to negative hits. + # 2024-11-26 - Handle the knockback results when they have a ' in them.