Fix glitches

This commit is contained in:
2022-01-22 21:49:34 +01:00
parent 0d144ef2a9
commit 35b78c8127
9 changed files with 181 additions and 76 deletions

View File

@@ -55,6 +55,7 @@ export class PegasusActorSheet extends ActorSheet {
race: duplicate(this.actor.getRace()),
role: duplicate(this.actor.getRole()),
effects: duplicate(this.actor.getEffects()),
moneys: duplicate(this.actor.getMoneys()),
options: this.options,
owner: this.document.isOwner,
editScore: this.options.editScore,
@@ -119,22 +120,22 @@ export class PegasusActorSheet extends ActorSheet {
this.actor.rollUnarmedAttack();
});
html.find('.attack-melee').click((event) => {
this.actor.rollPool( 'com', true);
this.actor.rollPool( 'com');
});
html.find('.attack-ranged').click((event) => {
this.actor.rollPool( 'agi', true);
this.actor.rollPool( 'agi');
});
html.find('.defense-roll').click((event) => {
this.actor.rollPool( 'def', true);
});
html.find('.damage-melee').click((event) => {
this.actor.rollPool( 'str', true);
this.actor.rollPool( 'str');
});
html.find('.damage-ranged').click((event) => {
this.actor.rollPool( 'per', true);
this.actor.rollPool( 'per');
});
html.find('.damage-resistance').click((event) => {
this.actor.rollPool( 'phy', true);
this.actor.rollPool( 'phy');
});
html.find('.roll-stat').click((event) => {

View File

@@ -110,6 +110,11 @@ export class PegasusActor extends Actor {
return comp;
}
/* -------------------------------------------- */
getMoneys() {
let comp = this.data.items.filter(item => item.type == 'money');
return comp;
}
/* -------------------------------------------- */
getArmors() {
let comp = duplicate(this.data.items.filter(item => item.type == 'armor') || []);
return comp;
@@ -481,9 +486,18 @@ export class PegasusActor extends Actor {
rollDialog.render(true);
}
/* -------------------------------------------- */
getShieldDice() {
let shields = this.data.items.filter( item => item.type == "shield" && item.data.data.equipped)
let def = 0
for ( let sh of shields) {
def += sh.data.data.level
}
return def
}
/* -------------------------------------------- */
rollPool(statKey, useSPec) {
rollPool(statKey, useShield=false) {
let stat = this.getStat(statKey);
if (stat) {
let rollData = this.getCommonRollData()
@@ -491,7 +505,10 @@ export class PegasusActor extends Actor {
rollData.specList = this.getRelevantSpec(statKey)
rollData.selectedSpec = "0"
rollData.stat = stat;
if (useShield) {
rollData.otherDicesLevel = this.getShieldDice()
}
this.startRoll(rollData);
} else {
ui.notifications.warn("Statistic not found !");
@@ -608,14 +625,15 @@ export class PegasusActor extends Actor {
updates['data.nrg.max'] = nrgValue
updates['data.nrg.value'] = nrgValue
}
nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod;
if (nrgValue != this.data.data.combat.stunthreshold) {
updates['data.combat.stunthreshold'] = nrgValue
}
let mrLevel = (this.data.data.statistics.agi.value + this.data.data.statistics.str.value) - this.data.data.statistics.phy.value
mrLevel = (mrLevel < 1) ? 1 : mrLevel;
if (mrLevel != this.data.data.mr.value) {
updates['data.mr.value'] = mrLevel
let momentum = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod
if (momentum != this.data.data.momentum.max) {
updates['data.momentum.value'] = momentum
updates['data.momentum.max'] = momentum
}
let race = this.getRace()

View File

@@ -4,7 +4,7 @@ export const defaultItemImg = {
specialisation: "systems/fvtt-pegasus-rpg/images/icons/icon_spec.webp",
perk: "systems/fvtt-pegasus-rpg/images/icons/icon_perk.webp",
ability: "systems/fvtt-pegasus-rpg/images/icons/icon_raceability.webp",
armor: "systems/fvtt-pegasus-rpg/images/icons/icon_armor.webp",
armor: "systems/fvtt-pegasus-rpg/images/icons/icon_armour.webp",
weapon: "systems/fvtt-pegasus-rpg/images/icons/icon_weapon.webp",
equipment: "systems/fvtt-pegasus-rpg/images/icons/icon_equipment.webp",
effect: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp",