mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-25 00:43:38 +02:00
Compare commits
No commits in common. "58b855389d8f5a5450e32f2935ea54b55c0eb31f" and "e920f009573d54ae36bf300dc49c011a9c3e8728" have entirely different histories.
58b855389d
...
e920f00957
10 changed files with 25 additions and 53 deletions
|
|
@ -25,7 +25,7 @@ export default class DHActionConfig extends DHActionBaseConfig {
|
||||||
const data = this.action.toObject();
|
const data = this.action.toObject();
|
||||||
|
|
||||||
const created = await this.action.item.createEmbeddedDocuments('ActiveEffect', [
|
const created = await this.action.item.createEmbeddedDocuments('ActiveEffect', [
|
||||||
game.system.api.data.activeEffects.BaseEffect.getDefaultObject({ transfer: false })
|
game.system.api.data.activeEffects.BaseEffect.getDefaultObject()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (areaIndex !== undefined)
|
if (areaIndex !== undefined)
|
||||||
|
|
|
||||||
|
|
@ -31,38 +31,21 @@ export default class DHActionSettingsConfig extends DHActionBaseConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
static async addEffect(_event) {
|
static async addEffect(_event) {
|
||||||
const { areaIndex } = event.target.dataset;
|
|
||||||
if (!this.action.effects) return;
|
if (!this.action.effects) return;
|
||||||
|
const effectData = game.system.api.data.activeEffects.BaseEffect.getDefaultObject();
|
||||||
const effectData = game.system.api.data.activeEffects.BaseEffect.getDefaultObject({ transfer: false });
|
|
||||||
const data = this.action.toObject();
|
const data = this.action.toObject();
|
||||||
|
|
||||||
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);
|
|
||||||
else
|
|
||||||
data.effects.push({ _id: effectData.id });
|
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) });
|
||||||
}
|
}
|
||||||
|
|
||||||
static removeEffect(event, button) {
|
static removeEffect(event, button) {
|
||||||
if (!this.action.effects) return;
|
if (!this.action.effects) return;
|
||||||
const { areaIndex, index } = button.dataset;
|
const index = button.dataset.index,
|
||||||
let effectId = null;
|
|
||||||
if (areaIndex !== undefined) {
|
|
||||||
effectId = this.action.area[areaIndex].effects[index];
|
|
||||||
const data = this.action.toObject();
|
|
||||||
data.area[areaIndex].effects.splice(index, 1);
|
|
||||||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
|
||||||
} else {
|
|
||||||
effectId = this.action.effects[index]._id;
|
effectId = this.action.effects[index]._id;
|
||||||
this.constructor.removeElement.bind(this)(event, button);
|
this.constructor.removeElement.bind(this)(event, button);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.sheetUpdate(
|
this.sheetUpdate(
|
||||||
this.action.toObject(),
|
this.action.toObject(),
|
||||||
this.effects.find(x => x.id === effectId),
|
this.effects.find(x => x.id === effectId),
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ export default class DHAttackAction extends DHDamageAction {
|
||||||
async use(event, options) {
|
async use(event, options) {
|
||||||
const result = await super.use(event, options);
|
const result = await super.use(event, options);
|
||||||
|
|
||||||
if (result?.message?.system.action.roll?.type === 'attack') {
|
if (result.message?.system.action.roll?.type === 'attack') {
|
||||||
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
|
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
|
||||||
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.characterAttack.id);
|
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.characterAttack.id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,14 +134,13 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
|
||||||
return armorChange.getArmorData();
|
return armorChange.getArmorData();
|
||||||
}
|
}
|
||||||
|
|
||||||
static getDefaultObject(options = { transfer: true }) {
|
static getDefaultObject() {
|
||||||
return {
|
return {
|
||||||
name: 'New Effect',
|
name: 'New Effect',
|
||||||
id: foundry.utils.randomID(),
|
id: foundry.utils.randomID(),
|
||||||
disabled: false,
|
disabled: false,
|
||||||
img: 'icons/magic/life/heart-cross-blue.webp',
|
img: 'icons/magic/life/heart-cross-blue.webp',
|
||||||
description: '',
|
description: '',
|
||||||
transfer: options.transfer,
|
|
||||||
statuses: [],
|
statuses: [],
|
||||||
changes: [],
|
changes: [],
|
||||||
system: {
|
system: {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
export default class DhApplyActiveEffect extends CONFIG.RegionBehavior.dataModels.applyActiveEffect {
|
export default class DhApplyActiveEffect extends CONFIG.RegionBehavior.dataModels.applyActiveEffect {
|
||||||
static async #getApplicableEffects(token) {
|
static async #getApplicableEffects(token) {
|
||||||
const effects = await Promise.all(this.effects.map(foundry.utils.fromUuid));
|
const effects = await Promise.all(this.effects.map(fromUuid));
|
||||||
return effects.filter(effect => !effect.system.targetDispositions.size || effect.system.targetDispositions.has(token.disposition));
|
return (effects).filter(effect => !effect.system.targetDispositions.size || effect.system.targetDispositions.has(token.disposition));
|
||||||
}
|
}
|
||||||
|
|
||||||
static async #onTokenEnter(event) {
|
static async #onTokenEnter(event) {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ export default class RegisterHandlebarsHelpers {
|
||||||
pluralize: this.pluralize,
|
pluralize: this.pluralize,
|
||||||
positive: this.positive,
|
positive: this.positive,
|
||||||
isNullish: this.isNullish,
|
isNullish: this.isNullish,
|
||||||
|
debug: this.debug,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static add(a, b) {
|
static add(a, b) {
|
||||||
|
|
@ -92,4 +93,9 @@ export default class RegisterHandlebarsHelpers {
|
||||||
static isNullish(a) {
|
static isNullish(a) {
|
||||||
return a === null || a === undefined;
|
return a === null || a === undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static debug(a) {
|
||||||
|
console.log(a);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,6 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
|
||||||
&.bordered {
|
|
||||||
border: 1px solid;
|
|
||||||
border-radius: 6px;
|
|
||||||
|
|
||||||
.inventory-item-header .img-portait img.item-img {
|
|
||||||
border-radius: 6px 0 0 6px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:not(.single-img) {
|
&:not(.single-img) {
|
||||||
.img-portait:has(.roll-img):hover {
|
.img-portait:has(.roll-img):hover {
|
||||||
.roll-img {
|
.roll-img {
|
||||||
|
|
|
||||||
|
|
@ -147,10 +147,4 @@
|
||||||
padding-bottom: 7px;
|
padding-bottom: 7px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub-section-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,23 +5,21 @@
|
||||||
</legend>
|
</legend>
|
||||||
|
|
||||||
{{#each source as |area index|}}
|
{{#each source as |area index|}}
|
||||||
{{#unless @first}}<line-div></line-div>{{/unless}}
|
|
||||||
<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 "area." 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 "area." 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 "area." index ".size") 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="flexcol">
|
||||||
<div class="sub-section-header">
|
<div class="flexrow">
|
||||||
<span>{{localize "DAGGERHEART.GENERAL.Effect.plural"}}</span>
|
<span>{{localize "DAGGERHEART.GENERAL.Effect.plural"}}</span>
|
||||||
<a><i class="fa-solid fa-plus icon-button" data-action="addEffect" data-area-index="{{index}}"></i></a>
|
<a><i class="fa-solid fa-plus icon-button" data-action="addEffect" data-area-index="{{index}}"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<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 "area." @../key ".effects." index "._id"}} value="{{effect._id}}">
|
||||||
|
|
||||||
<div class="inventory-item single-img bordered" data-effect-id="{{effectId}}" data-area-index="{{index}}" data-action="editEffect">
|
<div class="inventory-item single-img" data-effect-id="{{effectId}}" data-area-index="{{index}}" data-action="editEffect">
|
||||||
<div class="inventory-item-header">
|
<div class="inventory-item-header">
|
||||||
{{#with (@root.getEffectDetails effectId) as | details |}}
|
{{#with (@root.getEffectDetails effectId) as | details |}}
|
||||||
<div class="img-portait">
|
<div class="img-portait">
|
||||||
|
|
@ -31,8 +29,9 @@
|
||||||
<div class="item-name">{{name}}</div>
|
<div class="item-name">{{name}}</div>
|
||||||
</div>
|
</div>
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
<input type="hidden" name="effects.{{index}}._id" value="{{effectId}}">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<a data-tooltip="{{localize "CONTROLS.CommonDelete"}}" data-action="removeEffect" data-area-index="{{@../key}}" data-index="{{index}}"><i class="fas fa-trash"></i></a>
|
<a data-tooltip="{{localize "CONTROLS.CommonDelete"}}" data-action="removeEffect" data-index="{{@../key}}" data-area-index="{{index}}"><i class="fas fa-trash"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
<div class="settings-items">
|
<div class="settings-items">
|
||||||
{{#each move.actions as |action|}}
|
{{#each move.actions as |action|}}
|
||||||
{{> "systems/daggerheart/templates/settings/components/settings-item-line.hbs" id=action.id type="action" }}
|
{{> "systems/daggerheart/templates/settings/components/settings-item-line.hbs" id=action.id }}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue