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

View File

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

View File

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

View File

@ -180,9 +180,9 @@
"styles": [ "styles": [
"styles/simple.css" "styles/simple.css"
], ],
"templateVersion": 88, "templateVersion": 89,
"title": "Pegasus RPG", "title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-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" "background" : "./images/ui/pegasus_welcome_page.webp"
} }

View File

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

View File

@ -107,6 +107,10 @@
</li> </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 class="flexrow"><label class="generic-label">Attacks Gained</label>
<li> <li>
<ul class="ul-level1"> <ul class="ul-level1">