From 3f85a9fd7833c6fda0c8e2e21b080cc8e6da9332 Mon Sep 17 00:00:00 2001 From: Brett Nash Date: Wed, 9 Jul 2025 17:55:29 -0700 Subject: [PATCH] RolemassterUnified Official: DB, Attacks and Token Actions It's the rare Thursday RMU update. Enable token actions for attacks and fix a few little bugs. Thank you all for the bug reports. - Fix old 'condole.log' problem with ranged weapons (alpinecowboy) - Fix ranged weapon penalties applying to everything (!) - Fix partial block not being set (Major Havoc & others) - Enable Primary/Secondary attack token actions - Enable End Turn token action --- .../rolemasterunified.html | 109 +++++++++++++----- RolemasterUnified_Official/sheet.json | 2 +- RolemasterUnified_Official/updates.md | 11 ++ 3 files changed, 91 insertions(+), 31 deletions(-) diff --git a/RolemasterUnified_Official/rolemasterunified.html b/RolemasterUnified_Official/rolemasterunified.html index c12b0617e9..680f6d65c3 100644 --- a/RolemasterUnified_Official/rolemasterunified.html +++ b/RolemasterUnified_Official/rolemasterunified.html @@ -2423,17 +2423,8 @@ Lists Selected / 6 - - - @@ -2536,7 +2527,7 @@ Lists Selected / 6
Round
- + @@ -6205,6 +6196,12 @@ This is not for usual use.

--> + + + + + + @@ -6247,7 +6244,7 @@ Sheet Version:
-Revision acd0e34adcbb952f6e623e5d45aed18c59d9cfce +Revision 198656348dc73954323d65dc4fc9136e6754f129
@@ -7585,6 +7582,18 @@ function getSectionIDsPending(section, func) { }); } +function getSectionIDsOrdered(sectionName, callback) { + 'use strict'; + getAttrs([`_reporder_${sectionName}`], function (v) { + getSectionIDs(sectionName, function (idArray) { + let reporderArray = v[`_reporder_${sectionName}`] ? v[`_reporder_${sectionName}`].toLowerCase().split(',') : [], + ids = [...new Set(reporderArray.filter(x => idArray.includes(x)).concat(idArray))]; + callback(ids); + }); + }); +}; + + function addRepeatingSectionPending(a, b, c, func) { if (!func) { rmuerror("addRepeatingSectionPending needs a function:", a, b, c, func); @@ -13191,6 +13200,8 @@ frontpage.updateDB = function () { const sb2 = Math.floor(shield_bonus / 2); updates.db_partialblock = basedb + shielddb + runningranks + Math.round(Math.max(0, sb2) / 2) + passivedodgebonus; + console.log("Partial block", updates.db_partialblock, basedb, shielddb, runningranks, + Math.round(Math.max(0, sb2) / 2), passivedodgebonus); updates.db_partialblock_info = "Partial Block\n" + `${F(basedb)} Base DB\n` + `${F(runningranks)} Passive dodge\n` + @@ -15224,9 +15235,7 @@ function sizeFromNumeric(value) { attackmod -= cdata.parrymod; } - console.log("ranged penalty", cdata.ranged_penalty); - if (cdata.ranged_penalty && cdata.ranged_penalty != 0) { - condole.log("applying"); + if (cdata.attacktype == 'ranged' && cdata.ranged_penalty && cdata.ranged_penalty != 0) { // If it exists, it's a penalty. Maybe positive. Maybe negative let rp = cdata.ranged_penalty; if (rp > 0) rp = -rp; @@ -15292,6 +15301,9 @@ function sizeFromNumeric(value) { } onCheck('clicked:repeating_attack:rmuattackroll', (ev) => { + attacks.doAttack(ev); + }); + attacks.doAttack = function (ev) { const basename = ev.sourceAttribute.replace("_rmuattackroll", ""); getAttrs(['character_name', `${basename}_attackstr`, `${basename}_attackmin`, `${basename}_attackmax`, `${basename}_attackdata`, @@ -15351,7 +15363,7 @@ function sizeFromNumeric(value) { cdata.actionselect = values.actionselect || 'nothing'; attacks.startAttack(cdata); }); - }); + } attacks.datarollregex = /^0\[(.*)\]\s*$/; attacks.getDataFromRoll = function (str) { return str.match(attacks.datarollregex)[1] @@ -15730,8 +15742,6 @@ function sizeFromNumeric(value) { }); })(); - - // vim: set sw=4 sts=4 syn=javascript : @@ -16227,7 +16237,7 @@ onCheck("change:activedefense change:parrymod change:parrytype", (_) => { } if (ev.activedefense == 'partialblock') { - update.activedb = `${db_partialblock}` + update.activedb = `${ev.db_partialblock}` update.db = db + ev.db_partialblock; } else if (ev.activedefense == 'partialdodge') { let melee = db + ev.db_partialdodge; @@ -16937,7 +16947,10 @@ creature.newCreature = function(name, jdata) { console.log(attacks); updates.attacklist = attacks.join(','); for (attack of attacks) { - creature.parseAttack(attack, cdata, updates) + console.log(attack); + let up = {} + creature.parseAttack(attack, cdata, up) + setAttrs(up); } { @@ -18094,11 +18107,11 @@ console.log("Tracker sheet loaded"); /**/ const actionCalls = [ - /*'attack primary_action', 'attack secondary_action', */ + 'attack primary_action', 'attack secondary_action', 'ap➙melee_action', 'ap➙missile_action', 'ap➙clear_action', 'ap➙spell_action', 'ap➙perception_action', 'ap➙concentration_action', 'ap➙free_action', - 'ap➙status_action', 'end turn']; + 'ap➙status_action', 'end turn_action']; onCheck("sheet:opened change:character_name", (_) => { getAttrs(['character_name',...actionCalls],(attributes) => { const setObj = actionCalls.reduce((m,attr) => { @@ -18113,12 +18126,48 @@ onCheck("sheet:opened change:character_name", (_) => { +function apactionAttackSelect(prefix, ids, attackindex, handler) { + console.log(ids); + + if (!ids[attackindex]) { + rmuerror("We don't have an index of ", attackindex, ids, prefix, "apactionAttackSelect"); + return; + } -onCheck("clicked:attack secondary-action", (ev) => { - console.log(ev); -}); -onCheck("clicked:attack primary-action", (ev) => { - console.log(ev); + // So get the right prefix + const id = prefix + '_' + ids[attackindex]; + console.log(id); + console.log(handler); + // Fake up an event + handler({ sourceAttribute : id }); +} + +onCheck("clicked:attack primary-action clicked:attack secondary-action", (ev) => { + console.log(ev); + let attackindex = 0; + if (ev.triggerName.includes('secondary')) { + attackindex = 1; + } + + + // So we need to find out what sort of sheet + getAttrs(['sheetselect'], (sheet) => { + console.log(sheet); + if (sheet.sheetselect == 'playersheet') { + getSectionIDs('repeating_attack', (attacklist) => { + apactionAttackSelect('repeating_attack', attacklist, attackindex, attacks.doAttack); + }); + + } else if (sheet.sheetselect == 'creaturesheet') { + console.log("creature attack", sheet); + getSectionIDs('repeating_creatureattack', (attacks) => { + console.log("attacks rodered", attacks); + apactionAttackSelect('repeating_creatureattack', attacks, attackindex, creature.doAttack); + }); + } else { + rmuerror("Tokenactions: Primary attack: Unknown sheet:", sheet.sheetselect); + } + }); }); @@ -18135,11 +18184,11 @@ onCheck("clicked:ap➙concentration-action", (ev) => { actionConcentration(ev); onCheck("clicked:ap➙status-action", (ev) => { actionStatus(ev); }); onCheck("clicked:ap➙clear-action", (ev) => { actionClear(); }); -onCheck("ckicked:end turn-action", (ev) => { - console.log("end turn0"); +onCheck("clicked:end turn-action", (ev) => { + doTurn(); }); -// vim: set sw=4 sts=4 syn=javascript : +// vim: set sw=2 sts=2 syn=javascript : diff --git a/RolemasterUnified_Official/sheet.json b/RolemasterUnified_Official/sheet.json index 3f5fe57174..18a6383a3f 100644 --- a/RolemasterUnified_Official/sheet.json +++ b/RolemasterUnified_Official/sheet.json @@ -19,5 +19,5 @@ "descriptiontranslationkey": "DefaultCurrency" } ], - "version": "1751986455" + "version": "1752108906" } diff --git a/RolemasterUnified_Official/updates.md b/RolemasterUnified_Official/updates.md index 7fd3127666..ac9553d82a 100644 --- a/RolemasterUnified_Official/updates.md +++ b/RolemasterUnified_Official/updates.md @@ -1,3 +1,14 @@ +# 2025-07-10 + +The Thursday little bug edition + +- Fix old 'condole.log' problem with ranged weapons (alpinecowboy) +- Fix ranged weapon penalties applying to everything (!) +- Fix partial block not being set (Major Havoc & others) +- Enable Primary/Secondary attack token actions +- Enable End Turn token action + + # 2025-07-08 - Use ISO 8601 for dates.