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) {
let stat
if (this.type == "character" && statKey == 'mr') {
stat = duplicate(this.system.mr);
stat = duplicate(this.system.mr)
} else {
stat = duplicate(this.system.statistics[statKey]);
stat = duplicate(this.system.statistics[statKey])
}
stat.dice = PegasusUtility.getDiceFromLevel(stat.value || stat.level);
return stat;
if ( stat.currentlevel) {
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)
if (rollData.stat.value != undefined) {
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
if (vehicle) {
rollData.vehicle = duplicate(vehicle)
@ -2009,7 +2017,7 @@ export class PegasusActor extends Actor {
/*-------------------------------------------- */
rollStat(statKey) {
let stat = this.getStat(statKey);
let stat = this.getStat(statKey)
if (stat) {
let rollData = this.getCommonRollData(statKey)
rollData.mode = "stat"