mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 20:21:06 +01:00
Fix conflict
This commit is contained in:
commit
22fa89b395
102 changed files with 5478 additions and 2183 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { actionsTypes } from '../data/_module.mjs';
|
||||
|
||||
export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLog {
|
||||
constructor() {
|
||||
super();
|
||||
|
|
@ -44,6 +46,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
html.querySelectorAll('.ability-use-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.abilityUseButton.bind(this)(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.action-use-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.actionUseButton.bind(this)(event, data.message))
|
||||
);
|
||||
};
|
||||
|
||||
setupHooks() {
|
||||
|
|
@ -173,4 +178,16 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
const actor = game.actors.get(message.system.source.actor);
|
||||
await actor.useAction(action);
|
||||
};
|
||||
|
||||
actionUseButton = async (_, message) => {
|
||||
const parent = await foundry.utils.fromUuid(message.system.actor);
|
||||
const testAction = Object.values(message.system.moves)[0].actions[0];
|
||||
const cls = actionsTypes[testAction.type];
|
||||
const action = new cls(
|
||||
{ ...testAction, _id: foundry.utils.randomID(), name: game.i18n.localize(testAction.name) },
|
||||
{ parent: parent }
|
||||
);
|
||||
|
||||
action.use();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
import { EncounterCountdowns } from '../applications/countdowns.mjs';
|
||||
|
||||
export default class DhCombatTracker extends foundry.applications.sidebar.tabs.CombatTracker {
|
||||
static DEFAULT_OPTIONS = {
|
||||
actions: {
|
||||
requestSpotlight: this.requestSpotlight,
|
||||
toggleSpotlight: this.toggleSpotlight,
|
||||
setActionTokens: this.setActionTokens
|
||||
setActionTokens: this.setActionTokens,
|
||||
openCountdowns: this.openCountdowns
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -83,6 +86,8 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
|
|||
.map(x => x.id)
|
||||
.indexOf(combatantId);
|
||||
|
||||
if (this.viewed.turn !== toggleTurn) Hooks.callAll(SYSTEM.HOOKS.spotlight, {});
|
||||
|
||||
await this.viewed.update({ turn: this.viewed.turn === toggleTurn ? null : toggleTurn });
|
||||
await combatant.update({ 'system.spotlight.requesting': false });
|
||||
}
|
||||
|
|
@ -97,4 +102,8 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
|
|||
await combatant.update({ 'system.actionTokens': newIndex });
|
||||
this.render();
|
||||
}
|
||||
|
||||
static openCountdowns() {
|
||||
new EncounterCountdowns().open();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,18 @@
|
|||
import DhMeasuredTemplate from '../placeables/measuredTemplate.mjs';
|
||||
|
||||
export default class DhpRuler extends foundry.canvas.interaction.Ruler {
|
||||
_getWaypointLabelContext(waypoint, state) {
|
||||
const context = super._getWaypointLabelContext(waypoint, state);
|
||||
if (!context) return;
|
||||
|
||||
const range = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.General.RangeMeasurement);
|
||||
const range = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.RangeMeasurement);
|
||||
|
||||
if (range.enabled) {
|
||||
const distance = this.#getRangeLabel(waypoint.measurement.distance.toNearest(0.01), range);
|
||||
const distance = DhMeasuredTemplate.getDistanceLabel(waypoint.measurement.distance.toNearest(0.01), range);
|
||||
context.cost = { total: distance, units: null };
|
||||
context.distance = { total: distance, units: null };
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
#getRangeLabel(distance, settings) {
|
||||
if (distance <= settings.melee) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.Melee.Name');
|
||||
}
|
||||
if (distance <= settings.veryClose) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.VeryClose.Name');
|
||||
}
|
||||
if (distance <= settings.close) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.Close.Name');
|
||||
}
|
||||
if (distance <= settings.far) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.Far.Name');
|
||||
}
|
||||
if (distance <= settings.veryFar) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.VeryFar.Name');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,18 @@
|
|||
import DhMeasuredTemplate from '../placeables/measuredTemplate.mjs';
|
||||
|
||||
export default class DhpTokenRuler extends foundry.canvas.placeables.tokens.TokenRuler {
|
||||
_getWaypointLabelContext(waypoint, state) {
|
||||
const context = super._getWaypointLabelContext(waypoint, state);
|
||||
if (!context) return;
|
||||
|
||||
const range = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.General.RangeMeasurement);
|
||||
const range = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.RangeMeasurement);
|
||||
|
||||
if (range.enabled) {
|
||||
const distance = this.#getRangeLabel(waypoint.measurement.distance.toNearest(0.01), range);
|
||||
const distance = DhMeasuredTemplate.getDistanceLabel(waypoint.measurement.distance.toNearest(0.01), range);
|
||||
context.cost = { total: distance, units: null };
|
||||
context.distance = { total: distance, units: null };
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
#getRangeLabel(distance, settings) {
|
||||
if (distance <= settings.melee) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.Melee.Name');
|
||||
}
|
||||
if (distance <= settings.veryClose) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.VeryClose.Name');
|
||||
}
|
||||
if (distance <= settings.close) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.Close.Name');
|
||||
}
|
||||
if (distance <= settings.far) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.Far.Name');
|
||||
}
|
||||
if (distance <= settings.veryFar) {
|
||||
return game.i18n.localize('DAGGERHEART.Range.VeryFar.Name');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue