mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Fixing and cleaning up
This commit is contained in:
parent
2cf68b7f17
commit
ece1c7e6c1
8 changed files with 14 additions and 26 deletions
|
|
@ -17,6 +17,3 @@ export { default as DhpAdversaryRoll } from './adversaryRoll.mjs';
|
|||
export { default as DhpDamageRoll } from './damageRoll.mjs';
|
||||
export { default as DhpAbilityUse } from './abilityUse.mjs';
|
||||
export { default as DhpEnvironment } from './environment.mjs';
|
||||
|
||||
export * as items from './item/_module.mjs';
|
||||
export * as messages from './chat-message/_modules.mjs';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
export default class DhCombat extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {
|
||||
actions: new fields.NumberField({ initial: 0, integer: true }),
|
||||
started: new fields.BooleanField({ required: true, initial: false })
|
||||
};
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ export default class DhCombatant extends foundry.abstract.TypeDataModel {
|
|||
const fields = foundry.data.fields;
|
||||
return {
|
||||
spotlight: new fields.SchemaField({
|
||||
requesting: new fields.BooleanField({ required: true, initial: false }),
|
||||
active: new fields.BooleanField({ required: true, initial: false })
|
||||
requesting: new fields.BooleanField({ required: true, initial: false })
|
||||
}),
|
||||
actionTokens: new fields.NumberField({ required: true, integer: true, initial: 3 })
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
export default class DhpCombat extends Combat {
|
||||
get combatant() {
|
||||
return this.combatants.contents.find(x => x.system.spotlight.active) ?? null;
|
||||
}
|
||||
|
||||
async startCombat() {
|
||||
this._playCombatSound('startEncounter');
|
||||
const updateData = { 'system.started': true };
|
||||
const updateData = { round: 1, turn: null };
|
||||
Hooks.callAll('combatStart', this, updateData);
|
||||
await this.update(updateData);
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -71,16 +71,15 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
|
|||
|
||||
static async toggleSpotlight(_, target) {
|
||||
const { combatantId } = target.closest('[data-combatant-id]')?.dataset ?? {};
|
||||
for (var combatant of this.viewed.combatants) {
|
||||
const giveSpotlight = combatant.id === combatantId;
|
||||
const combatant = this.viewed.combatants.get(combatantId);
|
||||
|
||||
await combatant.update({
|
||||
'system.spotlight': {
|
||||
requesting: giveSpotlight ? false : combatant.system.spotlight.requesting,
|
||||
active: giveSpotlight ? !combatant.system.spotlight.active : false
|
||||
}
|
||||
});
|
||||
}
|
||||
const toggleTurn = this.viewed.combatants.contents
|
||||
.sort(this.viewed._sortCombatants)
|
||||
.map(x => x.id)
|
||||
.indexOf(combatantId);
|
||||
|
||||
await this.viewed.update({ turn: this.viewed.turn === toggleTurn ? null : toggleTurn });
|
||||
await combatant.update({ 'system.spotlight.requesting': false });
|
||||
}
|
||||
|
||||
static async setActionTokens(_, target) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if ../combat.system.started}}
|
||||
{{#if ../combat.round}}
|
||||
<div class="token-actions">
|
||||
{{#if isOwner}}
|
||||
{{#if (and (not isNPC) ../actionTokens.enabled)}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<nav class="combat-controls" data-tooltip-direction="UP">
|
||||
{{~#if hasCombat~}}
|
||||
{{#if user.isGM}}
|
||||
{{#if combat.system.started}}
|
||||
{{#if combat.round}}
|
||||
<button type="button" class="combat-control combat-control-lg" data-action="endCombat">
|
||||
<i class="fa-solid fa-xmark" inert></i>
|
||||
<span>{{ localize "COMBAT.End" }}</span>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
{{!-- Combat Status --}}
|
||||
<strong class="encounter-title">
|
||||
{{#if combats.length}}
|
||||
{{#if combat.system.started}}
|
||||
{{#if combat.round}}
|
||||
{{ localize "DAGGERHEART.Combat.combatStarted" }}
|
||||
{{else}}
|
||||
{{ localize "COMBAT.NotStarted" }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue