mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
PR fixes
This commit is contained in:
parent
9850d5f6e8
commit
094acbc65f
7 changed files with 26 additions and 31 deletions
|
|
@ -51,31 +51,27 @@ export default class DhCompanionSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async onPartnerChange(event) {
|
async onPartnerChange(event) {
|
||||||
const partner = game.actors.find(a => a.uuid === event.target.value);
|
const partnerDocument = event.target.value
|
||||||
if (event.target.value) {
|
? await foundry.utils.fromUuid(event.target.value)
|
||||||
await partner.update({ 'system.companion': this.document.uuid });
|
: this.document.system.partner;
|
||||||
|
const partnerUpdate = { 'system.companion': event.target.value ? this.document.uuid : null };
|
||||||
|
|
||||||
|
if (!partnerDocument.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)) {
|
||||||
|
await game.socket.emit(`system.${SYSTEM.id}`, {
|
||||||
|
action: socketEvent.GMUpdate,
|
||||||
|
data: {
|
||||||
|
action: GMUpdateEvent.UpdateDocument,
|
||||||
|
uuid: partnerDocument.uuid,
|
||||||
|
update: update
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
const update = { 'system.companion': null };
|
await partnerDocument.update(partnerUpdate);
|
||||||
if (
|
|
||||||
this.document.system.partner.ownership.default !== 3 &&
|
|
||||||
this.document.system.partner.ownership[game.user.id] !== 3
|
|
||||||
) {
|
|
||||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
|
||||||
action: socketEvent.GMUpdate,
|
|
||||||
data: {
|
|
||||||
action: GMUpdateEvent.UpdateDocument,
|
|
||||||
uuid: this.document.system.partner.uuid,
|
|
||||||
update: update
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await this.document.system.partner.update(update);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.document.update({ 'system.partner': event.target.value });
|
await this.document.update({ 'system.partner': event.target.value });
|
||||||
|
|
||||||
if (!partner) {
|
if (!event.target.value) {
|
||||||
await this.document.updateLevel(1);
|
await this.document.updateLevel(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,12 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get deathMoveViable() {
|
||||||
|
return (
|
||||||
|
this.resources.hitPoints.maxTotal > 0 && this.resources.hitPoints.value >= this.resources.hitPoints.maxTotal
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
static async unequipBeforeEquip(itemToEquip) {
|
static async unequipBeforeEquip(itemToEquip) {
|
||||||
const primary = this.primaryWeapon,
|
const primary = this.primaryWeapon,
|
||||||
secondary = this.secondaryWeapon;
|
secondary = this.secondaryWeapon;
|
||||||
|
|
|
||||||
|
|
@ -131,13 +131,6 @@ export default class DhCompanion extends BaseDataActor {
|
||||||
this.evasion.total = this.evasion.value + this.evasion.bonus;
|
this.evasion.total = this.evasion.value + this.evasion.bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRollData() {
|
|
||||||
const data = super.getRollData();
|
|
||||||
return {
|
|
||||||
...data
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async _preDelete() {
|
async _preDelete() {
|
||||||
if (this.partner) {
|
if (this.partner) {
|
||||||
await this.partner.update({ 'system.companion': null });
|
await this.partner.update({ 'system.companion': null });
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export default class DhLevelData extends foundry.abstract.DataModel {
|
||||||
amount: new fields.NumberField({ integer: true }),
|
amount: new fields.NumberField({ integer: true }),
|
||||||
data: new fields.ArrayField(new fields.StringField({ required: true })),
|
data: new fields.ArrayField(new fields.StringField({ required: true })),
|
||||||
secondaryData: new fields.TypedObjectField(new fields.StringField({ required: true })),
|
secondaryData: new fields.TypedObjectField(new fields.StringField({ required: true })),
|
||||||
itemUuid: new fields.StringField({ required: true }),
|
itemUuid: new fields.DocumentUUIDField({ required: true }),
|
||||||
featureIds: new fields.ArrayField(new fields.StringField())
|
featureIds: new fields.ArrayField(new fields.StringField())
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<aside class="character-sidebar-sheet">
|
<aside class="character-sidebar-sheet">
|
||||||
<div class="portrait {{#if (gte document.system.resources.hitPoints.value document.system.resources.hitPoints.maxTotal)}}death-roll{{/if}}">
|
<div class="portrait {{#if document.system.deathMoveViable}}death-roll{{/if}}">
|
||||||
<img src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
<img src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
||||||
<a class="death-roll-btn" data-tooltip="{{localize "DAGGERHEART.Sheets.PC.Health.DeathMoveTooltip"}}" data-action="makeDeathMove"><i class="fas fa-skull death-save" ></i></a>
|
<a class="death-roll-btn" data-tooltip="{{localize "DAGGERHEART.Sheets.PC.Health.DeathMoveTooltip"}}" data-action="makeDeathMove"><i class="fas fa-skull death-save" ></i></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<i class="fa-solid fa-caret-left"></i>
|
<i class="fa-solid fa-caret-left"></i>
|
||||||
<div class="health-category">{{localize "DAGGERHEART.Sheets.PC.Health.Severe"}}</div>
|
<div class="health-category">{{localize "DAGGERHEART.Sheets.PC.Health.Severe"}}</div>
|
||||||
</div>
|
</div>
|
||||||
<i data-action="makeDeathMove" class="fas fa-skull death-save {{#if (lt resources.hitPoints.value document.system.resources.hitPoints.maxTotal)}}disabled{{/if}}" title="{{localize "DAGGERHEART.Sheets.PC.Health.DeathMoveTooltip"}}"></i>
|
<i data-action="makeDeathMove" class="fas fa-skull death-save {{#if document.system.deathMoveViable}}disabled{{/if}}" title="{{localize "DAGGERHEART.Sheets.PC.Health.DeathMoveTooltip"}}"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="flexrow" style="flex-wrap: nowrap; align-items: center;">
|
<div class="flexrow" style="flex-wrap: nowrap; align-items: center;">
|
||||||
<div class="flexcol flex0">
|
<div class="flexcol flex0">
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#each this.advancements.simple}}
|
{{#each this.advancements.simple}}
|
||||||
<div class="summary-selection-container">
|
<div class="summary-selection-container">
|
||||||
<div class="summary-selection-container">{{localize "DAGGERHEART.Application.LevelUp.summary.simpleFeature" feature=this}}</div>
|
<div class="summary-selection">{{localize "DAGGERHEART.Application.LevelUp.summary.simpleFeature" feature=this}}</div>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue