Minor fixes

This commit is contained in:
2022-01-25 10:37:28 +01:00
parent 0ef282dd93
commit a203163b12
8 changed files with 24 additions and 16 deletions

View File

@@ -107,13 +107,13 @@ export class PegasusActorSheet extends ActorSheet {
this.actor.delSubActor(actorId);
});
html.find('.equipement-moins').click(event => {
html.find('.quantity-minus').click(event => {
const li = $(event.currentTarget).parents(".item");
this.actor.decrementeQuantite( li.data("item-id") );
this.actor.incDecQuantity( li.data("item-id"), -1 );
} );
html.find('.equipement-plus').click(event => {
html.find('.quantity-plus').click(event => {
const li = $(event.currentTarget).parents(".item");
this.actor.incrementeQuantite( li.data("item-id") );
this.actor.incDecQuantity( li.data("item-id"), +1 );
} );
html.find('.unarmed-attack').click((event) => {

View File

@@ -630,7 +630,7 @@ export class PegasusActor extends Actor {
updates['data.combat.stunthreshold'] = nrgValue
}
let momentum = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod
let momentum = this.data.data.statistics.foc.value + this.data.data.statistics.foc.mod
if (momentum != this.data.data.momentum.max) {
updates['data.momentum.value'] = 0
updates['data.momentum.max'] = momentum
@@ -685,6 +685,15 @@ export class PegasusActor extends Actor {
}
}
/* -------------------------------------------- */
async incDecQuantity( objetId, incDec = 0 ) {
let objetQ = this.data.items.get(objetId )
if (objetQ) {
let newQ = objetQ.data.data.quantity + incDec;
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'data.quantity': newQ }]); // pdates one EmbeddedEntity
}
}
/* -------------------------------------------- */
applyAbility(ability, updates = []) {
if (ability.data.affectedstat != "notapplicable") {

View File

@@ -4,7 +4,7 @@ import { PegasusActorCreate } from "./pegasus-create-char.js";
/* -------------------------------------------- */
const __level2Dice = [ "d0", "d4", "d6", "d8", "d10", "d12" ];
const __name2DiceValue = { "d0": 0, "d4": 4, "d6": 6, "d8": 8, "d10" : 10, "d12": 12 }
const __name2DiceValue = { "0": 0, "d0": 0, "d4": 4, "d6": 6, "d8": 8, "d10" : 10, "d12": 12 }
/* -------------------------------------------- */
export class PegasusUtility {