Fix #160 - Add new values...

This commit is contained in:
2022-11-27 18:54:52 +01:00
parent 7d46699c62
commit cb896c9813
7 changed files with 116 additions and 39 deletions

View File

@@ -134,7 +134,14 @@ export class PegasusActor extends Actor {
super._preUpdate(changed, options, user);
}
/* -------------------------------------------- */
getMT() {
return PegasusUtility.getDiceValue(this.system.statistics.mnd.value) + this.system.statistics.mnd.mod + PegasusUtility.getDiceValue(this.system.statistics.mnd.bonuseffect)
}
/* -------------------------------------------- */
getKBV() {
return this.system.statistics.phy.value + this.system.statistics.phy.mod + this.system.statistics.phy.bonuseffect
}
/* -------------------------------------------- */
getEncumbranceCapacity() {
return this.system.statistics.str.value * 25
@@ -489,7 +496,10 @@ export class PegasusActor extends Actor {
increaseRoleAbility() {
}
/* -------------------------------------------- */
setBonusInformation( info) {
this.update( {'system.biodata.bonusselection': info})
}
/* -------------------------------------------- */
addCDP( value) {
let cdp = this.system.biodata.cdp
@@ -500,7 +510,8 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
addPPP(value) {
let ppp = duplicate(this.system.ppp)
ppp.availablePPP += value
console.log("PPP", ppp)
ppp.availablePPP += Number(value)
this.update({ 'system.ppp': ppp })
}
@@ -1457,9 +1468,11 @@ export class PegasusActor extends Actor {
}
if (!this.isToken) {
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality < 0) {
console.log("CHAR", this)
ChatMessage.create({ content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!" })
}
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality == 0) {
ChatMessage.create({ content: "This character can no longer spend CDP until their Morality has reached 1 or higher" })
}
if (this.warnMorality != this.system.biodata.morality) {
this.warnMorality = this.system.biodata.morality
}
@@ -1645,6 +1658,9 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
async applyAbility(ability, updates = [], directUpdate = false) {
// manage stat bonus
if (!ability.system) {
ability.system = ability.data
}
if (ability.system.affectedstat != "notapplicable") {
let stat = duplicate(this.system.statistics[ability.system.affectedstat])
stat.mod += Number(ability.system.statmodifier)
@@ -1775,9 +1791,9 @@ export class PegasusActor extends Actor {
if (overCapacity > 0) {
effectsList.push({ label: "Encumbrance Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: overCapacity })
}
if (this.system.biodata.morality <= 0) {
/* Remove as per ticket #159if (this.system.biodata.morality <= 0) {
effectsList.push({ label: "Morality Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 3 })
}
}*/
let effects = this.items.filter(item => item.type == 'effect')
for (let effect of effects) {
effect = duplicate(effect)
@@ -1842,7 +1858,23 @@ export class PegasusActor extends Actor {
if (isPowerDmg && effect.system.stataffected == "powerdmgroll") {
this.pushEffect(rollData, effect)
}
}
}
/* -------------------------------------------- */
addRoleBonus(rollData, statKey, subKey) {
let role = this.getRole()
if (role.name.toLowerCase() == "ranged" && subKey == "ranged-dmg") {
rollData.effectsList.push({ label: "Ranged Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0, "Ranged Role Bonus"))
}
if (role.name.toLowerCase() == "defender" && subKey == "defence") {
rollData.effectsList.push({ label: "Defender Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0,"Defender Role Bonus"))
}
if (role.name.toLowerCase() == "scrapper" && statKey == "com") {
rollData.effectsList.push({ label: "Scrapper Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0,"Scrapper Role Bonus"))
}
}
@@ -2026,6 +2058,7 @@ export class PegasusActor extends Actor {
this.addArmorsShields(rollData, statKey, useShield, subKey)
this.addWeapons(rollData, statKey, useShield)
this.addEquipments(rollData, statKey)
this.addRoleBonus(rollData, statKey, subKey)
this.processVehicleTargetMessage(rollData)
console.log("ROLLDATA", rollData)