Minor fixes

This commit is contained in:
2022-07-26 22:38:04 +02:00
parent e7f5a17096
commit 40a8406761
8 changed files with 37 additions and 12 deletions

View File

@@ -203,12 +203,18 @@ export class PegasusActorSheet extends ActorSheet {
html.find('.quantity-minus').click(event => {
const li = $(event.currentTarget).parents(".item");
this.actor.incDecQuantity( li.data("item-id"), -1 );
} );
} )
html.find('.quantity-plus').click(event => {
const li = $(event.currentTarget).parents(".item");
this.actor.incDecQuantity( li.data("item-id"), +1 );
} );
} )
html.find('.current-nrg-minus').click(event => {
this.actor.incDecNRG( -1 );
} )
html.find('.current-nrg-plus').click(event => {
this.actor.incDecNRG( 1 );
} )
html.find('.ammo-minus').click(event => {
const li = $(event.currentTarget).parents(".item")
this.actor.incDecAmmo( li.data("item-id"), -1 );

View File

@@ -820,6 +820,15 @@ export class PegasusActor extends Actor {
}
}
/* -------------------------------------------- */
incDecNRG( value) {
let nrg = duplicate(this.data.data.nrg)
nrg.value += value
if (nrg.value >= 0 && nrg.value <= nrg.max) {
this.update({ 'data.nrg': nrg })
}
}
/* -------------------------------------------- */
async updatePerkStatus(itemId, status) {
let item = this.items.get(itemId)
@@ -871,8 +880,7 @@ export class PegasusActor extends Actor {
this.disableWeaverPerk(item)
PegasusUtility.createChatWithRollMode(item.name, {
content: await renderTemplate(`systems/fvtt-pegasus-rpg/templates/chat-perk-ready.html`, { name: this.name, perk: item })
});
})
}
if (status == "activated") {
// Add effects linked to the perk
@@ -916,6 +924,9 @@ export class PegasusActor extends Actor {
nrg.max += Number(item.data.data.features.bonusnrg.value) || 0
await this.update({ 'data.nrg': nrg })
}
PegasusUtility.createChatWithRollMode(item.name, {
content: await renderTemplate(`systems/fvtt-pegasus-rpg/templates/chat-perk-activated.html`, { name: this.name, perk: item })
})
this.enableWeaverPerk(item)
}
if (updateOK) {
@@ -1029,8 +1040,7 @@ export class PegasusActor extends Actor {
}
let moralitythreshold = Number(PegasusUtility.getDiceValue(this.data.data.statistics.foc.value)) + Number(this.data.data.statistics.foc.mod)
moralitythreshold = (moralitythreshold < 1) ? 1 : moralitythreshold;
let moralitythreshold = - (Number(PegasusUtility.getDiceValue(this.data.data.statistics.foc.value)) + Number(this.data.data.statistics.foc.mod) )
if (moralitythreshold != this.data.data.biodata.moralitythreshold) {
updates['data.biodata.moralitythreshold'] = moralitythreshold
}