Improve init for monsters and some fixwes around shields
Release Creation / build (release) Successful in 48s
Release Creation / build (release) Successful in 48s
This commit is contained in:
@@ -18,6 +18,7 @@ export class LethalFantasyCombatTracker extends foundry.applications.sidebar.tab
|
||||
actions: {
|
||||
initiativePlus: LethalFantasyCombatTracker.#initiativePlus,
|
||||
initiativeMinus: LethalFantasyCombatTracker.#initiativeMinus,
|
||||
rollMonsterProgression: LethalFantasyCombatTracker.#rollMonsterProgression,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -49,6 +50,15 @@ export class LethalFantasyCombatTracker extends foundry.applications.sidebar.tab
|
||||
c.update({ 'initiative': newInit });
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll progression dice for all monster combatants that are eligible this round.
|
||||
* @param {Event} ev Click event.
|
||||
*/
|
||||
static async #rollMonsterProgression(ev) {
|
||||
ev.preventDefault();
|
||||
await game.combat.rollMonsterProgression();
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
// Display Combat settings
|
||||
@@ -130,6 +140,17 @@ export class LethalFantasyCombat extends Combat {
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Roll progression dice for all eligible monster combatants this round. Called manually by the GM. */
|
||||
async rollMonsterProgression() {
|
||||
const currentRound = this.round;
|
||||
for (let c of this.combatants) {
|
||||
if (c.actor.type !== "monster") continue;
|
||||
if (c.initiative !== null && currentRound >= c.initiative) {
|
||||
await c.actor.system.rollProgressionDice(this.id, c.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resetProgression(cId) {
|
||||
let c = this.combatants.get(cId);
|
||||
c.update({ 'system.progressionCount': 0 });
|
||||
@@ -203,6 +224,7 @@ export class LethalFantasyCombat extends Combat {
|
||||
|
||||
for (let c of this.combatants) {
|
||||
if (nextRound >= c.initiative) {
|
||||
if (c.actor.type === "monster") continue; // Monsters roll manually via the "Roll Monsters" button
|
||||
const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id);
|
||||
if (game.user.isGM && playerOwner) {
|
||||
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollProgressionDice", userId: playerOwner.id, progressionCount: c.system.progressionCount + 1, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
|
||||
|
||||
@@ -147,6 +147,6 @@ export async function rollFreeDie(dieType, count = 1, explode = false) {
|
||||
content,
|
||||
sound: CONFIG.sounds.dice,
|
||||
}
|
||||
ChatMessage.applyRollMode(msgData, rollMode)
|
||||
ChatMessage.applyMode(msgData, rollMode)
|
||||
await ChatMessage.create(msgData)
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
|
||||
})
|
||||
if (!roll) return null
|
||||
|
||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
||||
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||
}
|
||||
|
||||
static async #onRollInitiative(event, target) {
|
||||
|
||||
@@ -111,7 +111,7 @@ export default class LethalFantasyMonsterSheet extends LethalFantasyActorSheet {
|
||||
})
|
||||
if (!roll) return null
|
||||
|
||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
||||
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||
}
|
||||
|
||||
static async #onRollInitiative(event, target) {
|
||||
|
||||
Reference in New Issue
Block a user