Add Initiative token action

This commit is contained in:
Brett Nash
2025-07-09 22:06:36 -07:00
parent 3f85a9fd78
commit 6af5bc67b1
3 changed files with 16 additions and 6 deletions
@@ -6229,6 +6229,9 @@ This is not for usual use. </p>
<button type="roll" class='tokenaction' name="roll_End Turn" value="@{End Turn_action}">End Turn</button>
<input type="hidden" name="attr_End Turn_action">
<button type="action" style="-toby-display:none;" name="act_End Turn-action">End Turn</button>
<button type="roll" class='tokenaction' name="roll_initiative" value="@{initiative_action}">initiative</button>
<input type="hidden" name="attr_initiative_action">
<button type="action" style="-toby-display:none;" name="act_initiative-action">initiative</button>
@@ -6244,7 +6247,7 @@ Sheet Version: <span name='attr_version'></span>
<br>
Revision 198656348dc73954323d65dc4fc9136e6754f129
Revision 1ab67984127d8e78c5d286b8fc001471553df408
<hr>
@@ -16593,7 +16596,11 @@ onCheck("clicked:statusrest", (_) => {
});
onCheck("clicked:rollinitiative", () => {
// roll20 treats floor as round to negative infinity, so ceil since they should be neagtive
doRollInitiative();
});
function doRollInitiative() {
// roll20 treats floor as round to negative infinity, so ceil since they should be negative
startRoll('@{whispertype} &{template:rmuinit} [[ [[ 2d10 ]] + @{initiative} + [[ceil(@{statuspenalty} / 10)]] &{tracker}]] ' +
'{\{actor=@{character_name} }} ' +
'{\{bonus=@{initiative} }} ' +
@@ -16602,7 +16609,7 @@ onCheck("clicked:rollinitiative", () => {
(roll) => {
finishRoll(roll.rollId, {});
});
});
}
@@ -18111,7 +18118,7 @@ const actionCalls = [
'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_action'];
'ap➙status_action', 'end turn_action', "initiative_action"];
onCheck("sheet:opened change:character_name", (_) => {
getAttrs(['character_name',...actionCalls],(attributes) => {
const setObj = actionCalls.reduce((m,attr) => {
@@ -18188,6 +18195,10 @@ onCheck("clicked:end turn-action", (ev) => {
doTurn();
});
onCheck("clicked:initiative-action", (ev) => {
doRollInitiative();
});
// vim: set sw=2 sts=2 syn=javascript :
+1 -1
View File
@@ -19,5 +19,5 @@
"descriptiontranslationkey": "DefaultCurrency"
}
],
"version": "1752108906"
"version": "1752123949"
}
-1
View File
@@ -8,7 +8,6 @@ The Thursday little bug edition
- Enable Primary/Secondary attack token actions
- Enable End Turn token action
# 2025-07-08
- Use ISO 8601 for dates.