diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index a3ad121..55d70c2 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -2057,7 +2057,7 @@ export class PegasusActor extends Actor { if (statKey == 'phy' && subKey == "dmg-res") { let armors = this.getArmors() for (let armor of armors) { - rollData.armorsList.push({ label: `Armor ${armor.name}`, type: "armor", applied: false, value: armor.system.resistance }) + rollData.armorsList.push({ label: `Armor ${armor.name}`, type: "armor", applied: false, value: armor.system.resistance, adrl:armor.system.adrl }) } } if (useShield) { diff --git a/modules/pegasus-combat.js b/modules/pegasus-combat.js index 392f8c1..c69deb7 100644 --- a/modules/pegasus-combat.js +++ b/modules/pegasus-combat.js @@ -19,6 +19,11 @@ export class PegasusCombatTracker extends CombatTracker { let combatantId = $(ev.currentTarget).data("combatant-id") game.combat.revealTIC(ticNum, combatantId) }) + + html.find('.reset-npc-initiative').click(ev => { + game.combat.resetNPCInitiative() + }) + } } @@ -39,18 +44,27 @@ export class PegasusCombat extends Combat { return this; } + /* -------------------------------------------- */ + async resetNPCInitiative() { + for(let c of this.combatants) { + if (c.actor && c.actor.type == "npc") { + await this.updateEmbeddedDocuments("Combatant", [{ _id: c.id, initiative: -1 }]); + } + } + } + /* -------------------------------------------- */ isCharacter(combatantId) { const combatant = game.combat.combatants.get(combatantId) if (combatant) { return combatant.actor.type == "character" - } + } return false } /* -------------------------------------------- */ async setTic(combatantId, rollData) { - if ( !combatantId) { + if (!combatantId) { return } const combatant = game.combat.combatants.get(combatantId) @@ -62,25 +76,35 @@ export class PegasusCombat extends Combat { /* -------------------------------------------- */ getTIC(num, combatantId) { - if ( !combatantId) { + if (!combatantId) { return "" } const combatant = game.combat.combatants.get(combatantId) if (combatant) { let ticData = combatant.getFlag("world", "tic" + num) if (ticData) { - let ticText = "TIC" + num + ":" + ticData.text + let ticText = "ACTED" /* returns if revealed or if GM and NPC or if player and owner */ - if (ticData.revealed || (game.user.isGM && combatant.isNPC) || (!game.user.isGM && combatant.isOwner)) { + if (ticData.revealed && !ticData.displayed) { + ticData.displayed = true + combatant.setFlag("world", "tic" + num, ticData ) + let chatData = { + user: game.user.id, + alias: combatant.actor.name, + rollMode: game.settings.get("core", "rollMode"), + whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')), + content: `