Fix #101 current level for rolls

This commit is contained in:
sladecraven 2022-10-06 12:22:29 +02:00
parent 45332702dc
commit f4a8aa7927

View File

@ -912,12 +912,16 @@ export class PegasusActor extends Actor {
getStat(statKey) { getStat(statKey) {
let stat let stat
if (this.type == "character" && statKey == 'mr') { if (this.type == "character" && statKey == 'mr') {
stat = duplicate(this.system.mr); stat = duplicate(this.system.mr)
} else { } else {
stat = duplicate(this.system.statistics[statKey]); stat = duplicate(this.system.statistics[statKey])
} }
stat.dice = PegasusUtility.getDiceFromLevel(stat.value || stat.level); if ( stat.currentlevel) {
return stat; stat.dice = PegasusUtility.getDiceFromLevel(stat.currentlevel)
} else {
stat.dice = PegasusUtility.getDiceFromLevel(stat.value || stat.level)
}
return stat
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -1828,8 +1832,12 @@ export class PegasusActor extends Actor {
rollData.stat = this.getStat(statKey) rollData.stat = this.getStat(statKey)
if (rollData.stat.value != undefined) { if (rollData.stat.value != undefined) {
rollData.stat.level = rollData.stat.value // Normalize rollData.stat.level = rollData.stat.value // Normalize
rollData.statDicesLevel = rollData.stat.level + rollData.stat.bonuseffect
}
if (rollData.stat.currentlevel) {
rollData.stat.level = rollData.stat.currentlevel
rollData.statDicesLevel = rollData.stat.currentlevel
} }
rollData.statDicesLevel = rollData.stat.level + rollData.stat.bonuseffect
rollData.statMod = rollData.stat.mod rollData.statMod = rollData.stat.mod
if (vehicle) { if (vehicle) {
rollData.vehicle = duplicate(vehicle) rollData.vehicle = duplicate(vehicle)
@ -2009,7 +2017,7 @@ export class PegasusActor extends Actor {
/*-------------------------------------------- */ /*-------------------------------------------- */
rollStat(statKey) { rollStat(statKey) {
let stat = this.getStat(statKey); let stat = this.getStat(statKey)
if (stat) { if (stat) {
let rollData = this.getCommonRollData(statKey) let rollData = this.getCommonRollData(statKey)
rollData.mode = "stat" rollData.mode = "stat"