This commit is contained in:
@@ -24,30 +24,29 @@ export class LethalFantasyCombatTracker extends foundry.applications.sidebar.tab
|
||||
|
||||
async _prepareContext(options) {
|
||||
let data = await super._prepareContext(options);
|
||||
console?.log("Combat Tracker Data", data);
|
||||
log("Combat Tracker Data", data);
|
||||
/*for (let u of data.turns) {
|
||||
let c = game.combat.combatants.get(u.id);
|
||||
u.progressionCount = c.system.progressionCount
|
||||
u.isMonster = c.actor.type === "monster"
|
||||
}
|
||||
console.log("Combat Data", data);*/
|
||||
log("Combat Data", data);*/
|
||||
return data;
|
||||
}
|
||||
|
||||
static #initiativePlus(ev) {
|
||||
static async #initiativePlus(ev) {
|
||||
ev.preventDefault();
|
||||
let cId = ev.target.closest(".combatant").dataset.combatantId;
|
||||
let c = game.combat.combatants.get(cId);
|
||||
c.update({ 'initiative': c.initiative + 1 });
|
||||
console.log("Initiative Plus");
|
||||
await c.update({ 'initiative': c.initiative + 1 });
|
||||
}
|
||||
|
||||
static #initiativeMinus(ev) {
|
||||
static async #initiativeMinus(ev) {
|
||||
ev.preventDefault();
|
||||
let cId = ev.target.closest(".combatant").dataset.combatantId;
|
||||
let c = game.combat.combatants.get(cId);
|
||||
let newInit = Math.max(c.initiative - 1, 0);
|
||||
c.update({ 'initiative': newInit });
|
||||
await c.update({ 'initiative': newInit });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,33 +57,6 @@ export class LethalFantasyCombatTracker extends foundry.applications.sidebar.tab
|
||||
ev.preventDefault();
|
||||
await game.combat.rollMonsterProgression();
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
// Display Combat settings
|
||||
html.find(".initiative-plus").click(ev => {
|
||||
ev.preventDefault();
|
||||
let cId = ev.currentTarget.closest(".combatant").dataset.combatantId;
|
||||
let c = game.combat.combatants.get(cId);
|
||||
c.update({ 'initiative': c.initiative + 1 });
|
||||
});
|
||||
|
||||
html.find(".initiative-minus").click(ev => {
|
||||
ev.preventDefault();
|
||||
let cId = ev.currentTarget.closest(".combatant").dataset.combatantId;
|
||||
let c = game.combat.combatants.get(cId);
|
||||
c.update({ 'initiative': c.initiative - 1 });
|
||||
console.log("Initiative Minus");
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static get defaultOptions() {
|
||||
let path = "systems/fvtt-lethal-fantasy/templates/combat-tracker.hbs";
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
template: path,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class LethalFantasyCombat extends Combat {
|
||||
@@ -94,7 +66,7 @@ export class LethalFantasyCombat extends Combat {
|
||||
* @returns {Combatant[]}
|
||||
*/
|
||||
setupTurns() {
|
||||
console?.log("Setup Turns....");
|
||||
log("Setup Turns....");
|
||||
this.turns ||= [];
|
||||
|
||||
// Determine the turn order and the current turn
|
||||
@@ -164,19 +136,19 @@ export class LethalFantasyCombat extends Combat {
|
||||
}
|
||||
}
|
||||
|
||||
resetProgression(cId) {
|
||||
async resetProgression(cId) {
|
||||
let c = this.combatants.get(cId);
|
||||
c.update({ 'system.progressionCount': 0 });
|
||||
await c.update({ 'system.progressionCount': 0 });
|
||||
}
|
||||
|
||||
setCasting(cId) {
|
||||
async setCasting(cId) {
|
||||
let c = this.combatants.get(cId);
|
||||
c.setFlag(SYSTEM.id, "casting", true);
|
||||
await c.setFlag(SYSTEM.id, "casting", true);
|
||||
}
|
||||
|
||||
resetCasting(cId) {
|
||||
async resetCasting(cId) {
|
||||
let c = this.combatants.get(cId);
|
||||
c.setFlag(SYSTEM.id, "casting", false);
|
||||
await c.setFlag(SYSTEM.id, "casting", false);
|
||||
}
|
||||
|
||||
isCasting(cId) {
|
||||
|
||||
Reference in New Issue
Block a user