Fix spec dice

This commit is contained in:
sladecraven 2022-03-14 14:09:26 +01:00
parent 27f81e2e9d
commit 2353912e91
6 changed files with 27 additions and 19 deletions

View File

@ -301,8 +301,8 @@ export class PegasusActor extends Actor {
for(let key of statThreatLevel) { // Init with concerned stats
tl += PegasusUtility.getDiceValue( this.data.data.statistics[key].value )
}
let powers = this.getPowers()
if ( powers && powers.length > 0 ) { // Then add some mental ones of powers
let powers = duplicate( this.getPowers() || [])
if ( powers.length > 0 ) { // Then add some mental ones of powers
tl += PegasusUtility.getDiceValue( this.data.data.statistics.foc.value )
tl += PegasusUtility.getDiceValue( this.data.data.statistics.mnd.value )
}
@ -326,7 +326,10 @@ export class PegasusActor extends Actor {
for(let shield of shields) {
tl += PegasusUtility.getDiceValue(shield.data.level)
}
let abilities = duplicate(this.getAbilities())
for (let ability of abilities) {
tl += ability.data.threatlevel
}
let equipments = this.getEquipmentsOnly()
for (let equip of equipments) {
tl += equip.data.threatlevel
@ -1133,7 +1136,7 @@ export class PegasusActor extends Actor {
rollData.actorId = this.id
rollData.img = this.img
rollData.activePerks = duplicate(this.getActivePerks())
if (statKey) {
rollData.statKey = statKey
rollData.stat = this.getStat(statKey)

View File

@ -187,9 +187,9 @@ export class PegasusRollDialog extends Dialog {
this.rollData.selectedSpec = event.currentTarget.value
let spec = this.rollData.specList.find(item => item._id == this.rollData.selectedSpec)
if ( spec) {
this.rollData.specDiceLevel = spec.data.level
this.rollData.specDicesLevel = spec.data.level
this.rollData.specName = spec.name
$('#specDicesLevel').val(this.rollData.specDiceLevel)
$('#specDicesLevel').val(this.rollData.specDicesLevel)
} else {
this.rollData.specName = undefined
$('#specDicesLevel').val(0)

View File

@ -334,7 +334,7 @@ export class PegasusUtility {
/* -------------------------------------------- */
static async updateDefenseState(defenderId, rollId) {
this.defenderStore[defenderId] = rollId;
this.defenderStore[defenderId] = rollId
if (game.user.character && game.user.character.id == defenderId) {
let defender = game.actors.get(defenderId);
let chatData = {
@ -470,30 +470,30 @@ export class PegasusUtility {
let dicePool = [{ name: "stat", level: 0, statmod: 0 }, { name: "spec", level: 0 }, { name: "bonus", level: 0 }, { name: "hindrance", level: 0 }, { name: "other", level: 0 }];
if (rollData.stat) {
dicePool[0].level += Number(rollData.stat.value);
dicePool[0].statmod = Number(rollData.stat.mod);
dicePool[0].level += Number(rollData.stat.value)
dicePool[0].statmod = Number(rollData.stat.mod)
}
if (rollData.statDicesLevel) {
dicePool[0].level = rollData.statDicesLevel;
dicePool[0].level = rollData.statDicesLevel
}
if (rollData.selectedSpec && rollData.selectedSpec != "0") {
rollData.spec = rollData.specList.find(item => item._id == rollData.selectedSpec);
rollData.spec.data.dice = PegasusUtility.getDiceFromLevel(rollData.spec.data.level);
rollData.spec = rollData.specList.find(item => item._id == rollData.selectedSpec)
rollData.spec.data.dice = PegasusUtility.getDiceFromLevel(rollData.spec.data.level)
}
if (rollData.spec) {
dicePool[1].level += Number(rollData.spec.data.level);
dicePool[1].level += Number(rollData.spec.data.level)
}
if (rollData.specDicesLevel) {
dicePool[1].level = rollData.specDicesLevel;
dicePool[1].level = rollData.specDicesLevel
}
if (rollData.bonusDicesLevel) {
dicePool[2].level += Number(rollData.bonusDicesLevel);
dicePool[2].level += Number(rollData.bonusDicesLevel)
}
if (rollData.hindranceDicesLevel) {
dicePool[3].level += Number(rollData.hindranceDicesLevel);
dicePool[3].level += Number(rollData.hindranceDicesLevel)
}
if (rollData.otherDicesLevel) {
dicePool[4].level += Number(rollData.otherDicesLevel);
dicePool[4].level += Number(rollData.otherDicesLevel)
}
let diceFormulaTab = [];

View File

@ -180,9 +180,9 @@
"styles": [
"styles/simple.css"
],
"templateVersion": 88,
"templateVersion": 89,
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "0.5.7",
"version": "0.5.9",
"background" : "./images/ui/pegasus_welcome_page.webp"
}

View File

@ -260,6 +260,7 @@
"opponenthindrance": 0,
"attackgained": [],
"armorgained": [],
"threatlevel": 0,
"description": ""
},
"specialisation": {

View File

@ -107,6 +107,10 @@
</li>
-->
<li class="flexrow"><label class="generic-label">Threat Level Value</label>
<input type="text" class="input-numeric-short padd-right" name="data.threatlevel" value="{{data.threatlevel}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">Attacks Gained</label>
<li>
<ul class="ul-level1">