mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-23 16:03:39 +02:00
Changed from 'area' to 'areas'
This commit is contained in:
parent
06535b0e91
commit
6d355e342e
14 changed files with 27 additions and 29 deletions
|
|
@ -28,7 +28,7 @@ export default class DHActionConfig extends DHActionBaseConfig {
|
||||||
game.system.api.data.activeEffects.BaseEffect.getDefaultObject({ transfer: false })
|
game.system.api.data.activeEffects.BaseEffect.getDefaultObject({ transfer: false })
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (areaIndex !== undefined) data.area[areaIndex].effects.push(created[0]._id);
|
if (areaIndex !== undefined) data.areas[areaIndex].effects.push(created[0]._id);
|
||||||
else data.effects.push({ _id: created[0]._id });
|
else data.effects.push({ _id: created[0]._id });
|
||||||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||||
this.action.item.effects.get(created[0]._id).sheet.render(true);
|
this.action.item.effects.get(created[0]._id).sheet.render(true);
|
||||||
|
|
@ -58,9 +58,9 @@ export default class DHActionConfig extends DHActionBaseConfig {
|
||||||
const { areaIndex, index } = button.dataset;
|
const { areaIndex, index } = button.dataset;
|
||||||
let effectId = null;
|
let effectId = null;
|
||||||
if (areaIndex !== undefined) {
|
if (areaIndex !== undefined) {
|
||||||
effectId = this.action.area[areaIndex].effects[index];
|
effectId = this.action.areas[areaIndex].effects[index];
|
||||||
const data = this.action.toObject();
|
const data = this.action.toObject();
|
||||||
data.area[areaIndex].effects.splice(index, 1);
|
data.areas[areaIndex].effects.splice(index, 1);
|
||||||
this.constructor.updateForm.call(this, null, null, { object: foundry.utils.flattenObject(data) });
|
this.constructor.updateForm.call(this, null, null, { object: foundry.utils.flattenObject(data) });
|
||||||
} else {
|
} else {
|
||||||
effectId = this.action.effects[index]._id;
|
effectId = this.action.effects[index]._id;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ export default class DHActionSettingsConfig extends DHActionBaseConfig {
|
||||||
this.sheetUpdate(data, effectData);
|
this.sheetUpdate(data, effectData);
|
||||||
this.effects = [...this.effects, effectData];
|
this.effects = [...this.effects, effectData];
|
||||||
|
|
||||||
if (areaIndex !== undefined) data.area[areaIndex].effects.push(effectData.id);
|
if (areaIndex !== undefined) data.areas[areaIndex].effects.push(effectData.id);
|
||||||
else data.effects.push({ _id: effectData.id });
|
else data.effects.push({ _id: effectData.id });
|
||||||
|
|
||||||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||||
|
|
@ -51,9 +51,9 @@ export default class DHActionSettingsConfig extends DHActionBaseConfig {
|
||||||
const { areaIndex, index } = button.dataset;
|
const { areaIndex, index } = button.dataset;
|
||||||
let effectId = null;
|
let effectId = null;
|
||||||
if (areaIndex !== undefined) {
|
if (areaIndex !== undefined) {
|
||||||
effectId = this.action.area[areaIndex].effects[index];
|
effectId = this.action.areas[areaIndex].effects[index];
|
||||||
const data = this.action.toObject();
|
const data = this.action.toObject();
|
||||||
data.area[areaIndex].effects.splice(index, 1);
|
data.areas[areaIndex].effects.splice(index, 1);
|
||||||
this.constructor.updateForm.call(this, null, null, { object: foundry.utils.flattenObject(data) });
|
this.constructor.updateForm.call(this, null, null, { object: foundry.utils.flattenObject(data) });
|
||||||
} else {
|
} else {
|
||||||
effectId = this.action.effects[index]._id;
|
effectId = this.action.effects[index]._id;
|
||||||
|
|
|
||||||
|
|
@ -107,17 +107,16 @@ export default class DhRegionLayer extends foundry.canvas.layers.RegionLayer {
|
||||||
|
|
||||||
const settings = canvas.scene?.rangeSettings;
|
const settings = canvas.scene?.rangeSettings;
|
||||||
const rangeNumber = Number(range);
|
const rangeNumber = Number(range);
|
||||||
const length =
|
const length = (!Number.isNaN(rangeNumber) ? rangeNumber : settings ? settings[range] : 0) * dimensionConstant;
|
||||||
(!Number.isNaN(rangeNumber) ? rangeNumber : settings ? settings[range] : 0) * dimensionConstant;
|
|
||||||
/*----*/
|
/*----*/
|
||||||
|
|
||||||
const shapeData = {
|
const shapeData = {
|
||||||
...canvas.mousePosition,
|
...canvas.mousePosition,
|
||||||
type: type,
|
type: type,
|
||||||
direction: direction ?? 0,
|
direction: direction ?? 0
|
||||||
};
|
};
|
||||||
|
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case rectangle.id:
|
case rectangle.id:
|
||||||
shapeData.width = length;
|
shapeData.width = length;
|
||||||
shapeData.height = length;
|
shapeData.height = length;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ const fields = foundry.data.fields;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel) {
|
export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel) {
|
||||||
static extraSchemas = ['area', 'cost', 'uses', 'range'];
|
static extraSchemas = ['areas', 'cost', 'uses', 'range'];
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export { default as AreaField } from './areaField.mjs';
|
export { default as AreasField } from './areasField.mjs';
|
||||||
export { default as CostField } from './costField.mjs';
|
export { default as CostField } from './costField.mjs';
|
||||||
export { default as CountdownField } from './countdownField.mjs';
|
export { default as CountdownField } from './countdownField.mjs';
|
||||||
export { default as UsesField } from './usesField.mjs';
|
export { default as UsesField } from './usesField.mjs';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
export default class AreaField extends fields.ArrayField {
|
export default class AreasField extends fields.ArrayField {
|
||||||
/**
|
/**
|
||||||
* Action Workflow order
|
* Action Workflow order
|
||||||
*/
|
*/
|
||||||
|
|
@ -281,7 +281,7 @@ export function ActionMixin(Base) {
|
||||||
name: this.name,
|
name: this.name,
|
||||||
img: this.baseAction ? this.parent.parent.img : this.img,
|
img: this.baseAction ? this.parent.parent.img : this.img,
|
||||||
tags: this.tags ? this.tags : ['Spell', 'Arcana', 'Lv 10'],
|
tags: this.tags ? this.tags : ['Spell', 'Arcana', 'Lv 10'],
|
||||||
area: this.area,
|
areas: this.areas,
|
||||||
summon: this.summon
|
summon: this.summon
|
||||||
},
|
},
|
||||||
source: {
|
source: {
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ export default class DHRoll extends Roll {
|
||||||
roll: this,
|
roll: this,
|
||||||
parent: chatData.parent,
|
parent: chatData.parent,
|
||||||
targetMode: chatData.targetMode,
|
targetMode: chatData.targetMode,
|
||||||
areas: chatData.action?.area,
|
areas: chatData.action?.areas,
|
||||||
metagamingSettings
|
metagamingSettings
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,14 +282,14 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.system.action.area.length === 1) createArea(this.system.action.area[0]);
|
if (this.system.action.areas.length === 1) createArea(this.system.action.areas[0]);
|
||||||
else if (this.system.action.area.length > 1) {
|
else if (this.system.action.areas.length > 1) {
|
||||||
new foundry.applications.ux.ContextMenu.implementation(
|
new foundry.applications.ux.ContextMenu.implementation(
|
||||||
event.target,
|
event.target,
|
||||||
'.action-areas',
|
'.action-areas',
|
||||||
this.system.action.area.map((area, index) => ({
|
this.system.action.areas.map(area => ({
|
||||||
label: area.name,
|
label: area.name,
|
||||||
onClick: () => createArea(this.system.action.area[index])
|
onClick: () => createArea(area)
|
||||||
})),
|
})),
|
||||||
{
|
{
|
||||||
jQuery: false,
|
jQuery: false,
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ export const preloadHandlebarsTemplates = async function () {
|
||||||
'systems/daggerheart/templates/actionTypes/uses.hbs',
|
'systems/daggerheart/templates/actionTypes/uses.hbs',
|
||||||
'systems/daggerheart/templates/actionTypes/roll.hbs',
|
'systems/daggerheart/templates/actionTypes/roll.hbs',
|
||||||
'systems/daggerheart/templates/actionTypes/save.hbs',
|
'systems/daggerheart/templates/actionTypes/save.hbs',
|
||||||
'systems/daggerheart/templates/actionTypes/area.hbs',
|
'systems/daggerheart/templates/actionTypes/areas.hbs',
|
||||||
'systems/daggerheart/templates/actionTypes/cost.hbs',
|
'systems/daggerheart/templates/actionTypes/cost.hbs',
|
||||||
'systems/daggerheart/templates/actionTypes/range-target.hbs',
|
'systems/daggerheart/templates/actionTypes/range-target.hbs',
|
||||||
'systems/daggerheart/templates/actionTypes/effect.hbs',
|
'systems/daggerheart/templates/actionTypes/effect.hbs',
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<fieldset class="one-column" data-key="area">
|
<fieldset class="one-column" data-key="areas">
|
||||||
<legend>
|
<legend>
|
||||||
{{localize "DAGGERHEART.ACTIONS.Config.area.sectionTitle"}}
|
{{localize "DAGGERHEART.ACTIONS.Config.area.sectionTitle"}}
|
||||||
<a><i class="fa-solid fa-plus icon-button" data-action="addElement"></i></a>
|
<a><i class="fa-solid fa-plus icon-button" data-action="addElement"></i></a>
|
||||||
|
|
@ -7,13 +7,13 @@
|
||||||
{{#each source as |area index|}}
|
{{#each source as |area index|}}
|
||||||
{{#unless @first}}<line-div></line-div>{{/unless}}
|
{{#unless @first}}<line-div></line-div>{{/unless}}
|
||||||
<div class="nest-inputs">
|
<div class="nest-inputs">
|
||||||
{{formField ../fields.name value=area.name name=(concat "area." index ".name") localize=true}}
|
{{formField ../fields.name value=area.name name=(concat "areas." index ".name") localize=true}}
|
||||||
<a class="btn" data-tooltip="{{localize "CONTROLS.CommonDelete"}}" data-action="removeElement" data-index="{{index}}"><i class="fas fa-trash"></i></a>
|
<a class="btn" data-tooltip="{{localize "CONTROLS.CommonDelete"}}" data-action="removeElement" data-index="{{index}}"><i class="fas fa-trash"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="nest-inputs">
|
<div class="nest-inputs">
|
||||||
{{formField ../fields.type value=area.type name=(concat "area." index ".type") localize=true}}
|
{{formField ../fields.type value=area.type name=(concat "areas." index ".type") localize=true}}
|
||||||
{{formField ../fields.shape value=area.shape name=(concat "area." index ".shape") localize=true}}
|
{{formField ../fields.shape value=area.shape name=(concat "areas." index ".shape") localize=true}}
|
||||||
{{formField ../fields.size value=area.size name=(concat "area." index ".size") localize=true}}
|
{{formField ../fields.size value=area.size name=(concat "areas." index ".size") localize=true}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sub-section-header">
|
<div class="sub-section-header">
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="two-columns even" style="width: 100%;">
|
<div class="two-columns even" style="width: 100%;">
|
||||||
{{#each area.effects as |effectId index|}}
|
{{#each area.effects as |effectId index|}}
|
||||||
<input type="hidden" name={{concat "area." @../key ".effects." index}} value="{{effectId}}">
|
<input type="hidden" name={{concat "areas." @../key ".effects." index}} value="{{effectId}}">
|
||||||
|
|
||||||
<div class="inventory-item single-img bordered" data-effect-id="{{effectId}}" data-area-index="{{index}}" data-action="editEffect">
|
<div class="inventory-item single-img bordered" data-effect-id="{{effectId}}" data-area-index="{{index}}" data-action="editEffect">
|
||||||
<div class="inventory-item-header">
|
<div class="inventory-item-header">
|
||||||
|
|
@ -6,5 +6,5 @@
|
||||||
{{> 'systems/daggerheart/templates/actionTypes/uses.hbs' fields=fields.uses.fields source=source.uses}}
|
{{> 'systems/daggerheart/templates/actionTypes/uses.hbs' fields=fields.uses.fields source=source.uses}}
|
||||||
{{> 'systems/daggerheart/templates/actionTypes/cost.hbs' fields=fields.cost.element.fields source=source.cost costOptions=costOptions}}
|
{{> 'systems/daggerheart/templates/actionTypes/cost.hbs' fields=fields.cost.element.fields source=source.cost costOptions=costOptions}}
|
||||||
{{> 'systems/daggerheart/templates/actionTypes/range-target.hbs' fields=(object range=fields.range target=fields.target.fields) source=(object target=source.target range=source.range)}}
|
{{> 'systems/daggerheart/templates/actionTypes/range-target.hbs' fields=(object range=fields.range target=fields.target.fields) source=(object target=source.target range=source.range)}}
|
||||||
{{> 'systems/daggerheart/templates/actionTypes/area.hbs' fields=fields.area.element.fields source=source.area}}
|
{{> 'systems/daggerheart/templates/actionTypes/areas.hbs' fields=fields.areas.element.fields source=source.areas}}
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
<span>{{localize "DAGGERHEART.GENERAL.damage"}}</span>
|
<span>{{localize "DAGGERHEART.GENERAL.damage"}}</span>
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{!-- {{#if action.cost.value}}<div class="ability-card-action-cost">{{action.cost.value}} {{action.cost.type}}</div>{{/if}} --}}
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
{{#if action.area.length}}
|
{{#if action.areas.length}}
|
||||||
<div class="roll-buttons action-roll-buttons">
|
<div class="roll-buttons action-roll-buttons">
|
||||||
<button class="action-areas end-button"><i class="fa-solid fa-crosshairs"></i></button>
|
<button class="action-areas end-button"><i class="fa-solid fa-crosshairs"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue