|
|
|
@ -15,7 +15,7 @@ const __statBuild = [
|
|
|
|
|
//{ modules: ["vehiclehull"], field: "pc", itemfield: "vms", subfield: "avgnrg" },
|
|
|
|
|
//{ modules: ["powercoremodule"], field: "pc", itemfield: "nrg", subfield: "avgnrg" },
|
|
|
|
|
{ modules: ["vehiclehull", "mobilitymodule"], itemfield: "man", field: "man", additionnal1: "turningarc45" },
|
|
|
|
|
{ modules: ["powercoremodule"], field: "pc", itemfield: "pc", additionnal1: "curnrg", additionnal2: "maxnrg" },
|
|
|
|
|
{ modules: ["powercoremodule"], field: "pc", itemfield: "pc" },
|
|
|
|
|
{ modules: ["mobilitymodule"], field: "mr", itemfield: "mr" },
|
|
|
|
|
{ modules: ["propulsionmodule"], field: "ad", itemfield: "ad" },
|
|
|
|
|
{ modules: ["combatmodule"], field: "fc", itemfield: "fc" },
|
|
|
|
@ -194,8 +194,13 @@ export class PegasusActor extends Actor {
|
|
|
|
|
let comp = this.items.filter(item => item.type == 'vehiclemodule');
|
|
|
|
|
return comp;
|
|
|
|
|
}
|
|
|
|
|
getVehicleWeaponModules() {
|
|
|
|
|
let comp = this.items.filter(item => item.type == 'vehicleweaponmodule' && item.system.activated);
|
|
|
|
|
getVehicleWeaponModules( activated = false ) {
|
|
|
|
|
let comp = []
|
|
|
|
|
if (activated ) {
|
|
|
|
|
comp = this.items.filter(item => item.type == 'vehicleweaponmodule' && item.system.activated)
|
|
|
|
|
} else {
|
|
|
|
|
comp = this.items.filter(item => item.type == 'vehicleweaponmodule' )
|
|
|
|
|
}
|
|
|
|
|
return comp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1454,17 +1459,27 @@ export class PegasusActor extends Actor {
|
|
|
|
|
if (this.system.biodata.noautobonus) { // If we are in "no-bonus mode
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
|
|
|
|
|
let effectsPlus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
|
|
|
|
|
let effectsMinus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "negative" && effect.system.reducedicevalue)
|
|
|
|
|
for (let statKey in this.system.statistics) {
|
|
|
|
|
let stat = duplicate(this.system.statistics[statKey])
|
|
|
|
|
let bonus = 0
|
|
|
|
|
for (let effect of effects) {
|
|
|
|
|
for (let effect of effectsPlus) {
|
|
|
|
|
if (effect.system.stataffected == statKey) {
|
|
|
|
|
bonus += Number(effect.system.effectlevel)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (let effect of effectsMinus) {
|
|
|
|
|
if (effect.system.stataffected == statKey) {
|
|
|
|
|
bonus -= Number(effect.system.effectlevel)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (bonus != stat.bonuseffect) {
|
|
|
|
|
stat.bonuseffect = bonus
|
|
|
|
|
if ( stat.bonuseffect + stat.value < 1) {
|
|
|
|
|
stat.value = 1
|
|
|
|
|
stat.bonuseffect = 0
|
|
|
|
|
}
|
|
|
|
|
this.update({ [`system.statistics.${statKey}`]: stat })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1739,7 +1754,7 @@ export class PegasusActor extends Actor {
|
|
|
|
|
let effects = this.items.filter(item => item.type == 'effect')
|
|
|
|
|
for (let effect of effects) {
|
|
|
|
|
effect = duplicate(effect)
|
|
|
|
|
if (!effect.system.hindrance && !effect.system.statdice
|
|
|
|
|
if (!effect.system.hindrance && !effect.system.statdice && !effect.system.reducedicevalue
|
|
|
|
|
&& (effect.system.stataffected != "notapplicable" || effect.system.specaffected.length > 0)
|
|
|
|
|
&& effect.system.stataffected != "special"
|
|
|
|
|
&& effect.system.stataffected != "powerroll"
|
|
|
|
@ -1801,7 +1816,7 @@ export class PegasusActor extends Actor {
|
|
|
|
|
}
|
|
|
|
|
addVehicleWeapons(rollData, vehicle) {
|
|
|
|
|
if (vehicle) {
|
|
|
|
|
let modules = vehicle.items.filter(vehicle => vehicle.type == "vehicleweaponmodule")
|
|
|
|
|
let modules = vehicle.items.filter(item => item.type == "vehicleweaponmodule" && item.system.activated)
|
|
|
|
|
if (modules && modules.length > 0) {
|
|
|
|
|
for (let module of modules) {
|
|
|
|
|
rollData.vehicleWeapons.push({ label: `Weapon ${module.name}`, type: "item", applied: false, weapon: module, value: module.system.damagedicevalue })
|
|
|
|
@ -2209,17 +2224,30 @@ export class PegasusActor extends Actor {
|
|
|
|
|
}
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
processVehicleStatEffects() {
|
|
|
|
|
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
|
|
|
|
|
let effectsPlus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
|
|
|
|
|
let effectsMinus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "negative" && effect.system.reducedicevalue)
|
|
|
|
|
for (let statKey in this.system.statistics) {
|
|
|
|
|
let stat = duplicate(this.system.statistics[statKey])
|
|
|
|
|
let bonus = 0
|
|
|
|
|
for (let effect of effects) {
|
|
|
|
|
for (let effect of effectsPlus) {
|
|
|
|
|
if (effect.system.stataffected == statKey) {
|
|
|
|
|
bonus += Number(effect.system.effectlevel)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (let effect of effectsMinus) {
|
|
|
|
|
if (effect.system.stataffected == statKey) {
|
|
|
|
|
bonus -= Number(effect.system.effectlevel)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (bonus != stat.bonuseffect) {
|
|
|
|
|
stat.bonuseffect = bonus
|
|
|
|
|
if ( stat.bonuseffect + stat.level < 1) {
|
|
|
|
|
stat.level = 1
|
|
|
|
|
stat.bonuseffect = 0
|
|
|
|
|
}
|
|
|
|
|
if (stat.currentlevel > stat.bonuseffect+stat.level) {
|
|
|
|
|
stat.currentlevel = stat.bonuseffect+stat.level
|
|
|
|
|
}
|
|
|
|
|
this.update({ [`system.statistics.${statKey}`]: stat })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2364,6 +2392,13 @@ export class PegasusActor extends Actor {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// NRG max management
|
|
|
|
|
if (item.type == "powercoremodule" ) {
|
|
|
|
|
if (this.system.statistics.pc.maxnrg != item.system.nrg ) {
|
|
|
|
|
this.update( {'system.statistics.pc.maxnrg': item.system.nrg })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cargo management
|
|
|
|
|
if (__isVehicleCargo[item.type]) {
|
|
|
|
|
let capacity = this.getCurrentCargoCapacity()
|
|
|
|
|