Fix #90 MR management with vehicles
This commit is contained in:
parent
5a062cc94e
commit
c2831e4ccd
@ -1868,6 +1868,28 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( statKey == "mr" ) {
|
||||||
|
if ( this.type == "character") {
|
||||||
|
rollData.mrVehicle = PegasusUtility.checkIsVehicleCrew(this.id)
|
||||||
|
if (rollData.mrVehicle) {
|
||||||
|
rollData.effectsList.push({
|
||||||
|
label: `Vehicle ${rollData.mrVehicle.name} MR Bonus`,
|
||||||
|
type: "effect", applied: false, isdynamic: true, value: rollData.mrVehicle.system.statistics.mr.currentlevel
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( this.type == "vehicle") {
|
||||||
|
for(let member of this.system.crew) {
|
||||||
|
let actor = game.actors.get( member.id )
|
||||||
|
let specList = actor.getRelevantSpec("mr")
|
||||||
|
rollData.effectsList.push({
|
||||||
|
label: `Crew ${actor.name} MR Bonus`,
|
||||||
|
type: "effect", applied: false, isdynamic: true, value: actor.system.mr.value + actor.system.mr.bonuseffect, specList: specList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.processSizeBonus(rollData)
|
this.processSizeBonus(rollData)
|
||||||
this.addEffects(rollData, isInit, isPower, subKey == "power-dmg")
|
this.addEffects(rollData, isInit, isPower, subKey == "power-dmg")
|
||||||
this.addArmorsShields(rollData, statKey, useShield, subKey)
|
this.addArmorsShields(rollData, statKey, useShield, subKey)
|
||||||
@ -2025,13 +2047,6 @@ export class PegasusActor extends Actor {
|
|||||||
console.log("MR ROLL", rollData)
|
console.log("MR ROLL", rollData)
|
||||||
if (isInit) {
|
if (isInit) {
|
||||||
rollData.title = "MR / Initiative"
|
rollData.title = "MR / Initiative"
|
||||||
rollData.mrVehicle = PegasusUtility.checkIsVehicleCrew(this.id)
|
|
||||||
if (rollData.mrVehicle) {
|
|
||||||
rollData.effectsList.push({
|
|
||||||
label: `Vehicle ${rollData.mrVehicle.name} MR Bonus`,
|
|
||||||
type: "effect", applied: false, isdynamic: true, value: rollData.mrVehicle.system.mr.currentlevel
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.startRoll(rollData);
|
this.startRoll(rollData);
|
||||||
} else {
|
} else {
|
||||||
|
@ -90,6 +90,9 @@ export class PegasusRollDialog extends Dialog {
|
|||||||
PegasusUtility.updateDamageDicePool(this.rollData)
|
PegasusUtility.updateDamageDicePool(this.rollData)
|
||||||
PegasusUtility.updateEffectsBonusDice(this.rollData)
|
PegasusUtility.updateEffectsBonusDice(this.rollData)
|
||||||
PegasusUtility.updateHindranceBonusDice(this.rollData)
|
PegasusUtility.updateHindranceBonusDice(this.rollData)
|
||||||
|
if ( effect.specList) {
|
||||||
|
this.rollData.specList = duplicate(effect.specList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -1074,8 +1074,9 @@ export class PegasusUtility {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static checkIsVehicleCrew(actorId) {
|
static checkIsVehicleCrew(actorId) {
|
||||||
let vehicles = game.actors.filter( actor=> actor.type =="vehicle") || []
|
let vehicles = game.actors.filter( actor=> actor.type == "vehicle") || []
|
||||||
for(let vehicle of vehicles) {
|
for(let vehicle of vehicles) {
|
||||||
|
console.log("Checking", vehicle.name)
|
||||||
if ( vehicle.inCrew(actorId) ) {
|
if ( vehicle.inCrew(actorId) ) {
|
||||||
return vehicle
|
return vehicle
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user