Added ability to switch between stance/prepared on mouse clic (left/right).

This commit is contained in:
Vlyan
2022-01-30 10:54:56 +01:00
parent 5305fb394e
commit cfc7e1504a
3 changed files with 38 additions and 3 deletions

View File

@@ -274,6 +274,15 @@ export class GmMonitor extends FormApplication {
// Mouse bt : middle = 0, left +1, right -1
const add = event.which === 2 ? -999 : event.which === 1 ? 1 : -1;
// Stance
let stanceIdx =
CONFIG.l5r5e.stances.findIndex((s) => s === actor.data.data.stance) + (event.which === 1 ? 1 : -1);
if (stanceIdx < 0) {
stanceIdx = CONFIG.l5r5e.stances.length - 1;
} else if (stanceIdx > CONFIG.l5r5e.stances.length - 1) {
stanceIdx = 0;
}
switch (type) {
// *** Characters ***
case "fatigue":
@@ -309,6 +318,22 @@ export class GmMonitor extends FormApplication {
});
break;
case "stance":
await actor.update({
data: {
stance: CONFIG.l5r5e.stances[stanceIdx],
},
});
break;
case "prepared":
await actor.update({
data: {
prepared: !actor.data.data.prepared,
},
});
break;
// *** Armies ***
case "casualties":
await actor.update({