This commit is contained in:
sladecraven 2022-09-28 13:43:36 +02:00
parent ffaa9e4c19
commit 01a2fd9ff8
2 changed files with 31 additions and 38 deletions

View File

@ -154,7 +154,7 @@ export class PegasusActor extends Actor {
let comp = duplicate(this.items.filter(item => item.type == 'perk') || []) let comp = duplicate(this.items.filter(item => item.type == 'perk') || [])
for (let perk of comp) { for (let perk of comp) {
if (perk.system.features.range.flag) { if (perk.system.features.range.flag) {
perk.rangeText = PegasusUtility.getRangeText( perk.system.features.range.value) perk.rangeText = PegasusUtility.getRangeText(perk.system.features.range.value)
} }
} }
return comp; return comp;
@ -366,15 +366,13 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
updatePPP() { updatePPP() {
let ppp = 0 let ppp = 0
for(let power of this.items) { for (let power of this.items) {
if (power.type == "power") { if (power.type == "power") {
ppp += Number(power.system.powerlevelcost) ppp += Number(power.system.powerlevelcost)
} }
} }
console.log("PPP update", ppp) if (ppp != this.system.ppp.spentPPP) {
if ( ppp != this.system.ppp.spentPPP) { this.update({ 'system.ppp.spentPPP': ppp })
console.log("PPP update2", ppp)
this.update( { 'system.ppp.spentPPP': ppp} )
} }
} }
@ -1689,7 +1687,7 @@ export class PegasusActor extends Actor {
rollData.statVehicle = vehicle.system.statistics.man rollData.statVehicle = vehicle.system.statistics.man
rollData.vehicleKey = "man" rollData.vehicleKey = "man"
} }
vehicle.addVehicleShields( rollData) vehicle.addVehicleShields(rollData)
} }
vehicle.addEffects(rollData, false, false, false) vehicle.addEffects(rollData, false, false, false)
//this.addVehiculeHindrances(rollData.effectsList, vehicle) //this.addVehiculeHindrances(rollData.effectsList, vehicle)
@ -2114,29 +2112,6 @@ export class PegasusActor extends Actor {
} }
} }
// Shield management
if (item.type == "vehiclemodule" && item.system.category == "shield") {
let shieldsList = this.items.filter(item => item.type == "vehiclemodule" && item.system.category == "shield") || []
shieldsList.push(item)
let level = 0
for (let armour of shieldsList) {
if (armour.system.shielddicevalue > 0) {
level += Number(armour.system.shielddicevalue)
}
}
let shift = 500
for( let loc of __LocationsArmour) {
let arcKey = loc + "arc"
let arc = duplicate(this.system.arcs[arcKey])
if (level != Number(arc.shieldlevel)) {
arc.shieldlevel = level
setTimeout(shift, this.update({ [`system.arcs.${arcKey}`]: arc }))
shift += 200
}
}
}
return true return true
} }
@ -2224,7 +2199,7 @@ export class PegasusActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
addVehicleArmors( rollData) { addVehicleArmors(rollData) {
for (let arcKey in this.system.arcs) { for (let arcKey in this.system.arcs) {
let arc = this.system.arcs[arcKey] let arc = this.system.arcs[arcKey]
if (arc.armourlevel > 0) { if (arc.armourlevel > 0) {
@ -2249,7 +2224,7 @@ export class PegasusActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
activateVehicleModule(itemId) { async activateVehicleModule(itemId) {
let mod = this.items.get(itemId) let mod = this.items.get(itemId)
if (mod) { if (mod) {
if (mod.system.nrg && mod.system.nrg > 0) { if (mod.system.nrg && mod.system.nrg > 0) {
@ -2259,7 +2234,7 @@ export class PegasusActor extends Actor {
ChatMessage.create({ content: `The Vehicle ${this.name} does not have enough Energy to Activate this module at this time.` }) ChatMessage.create({ content: `The Vehicle ${this.name} does not have enough Energy to Activate this module at this time.` })
return return
} }
this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }]) await this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
pc.actnrg += Number(mod.system.nrg) pc.actnrg += Number(mod.system.nrg)
pc.maxnrg -= Number(mod.system.nrg) pc.maxnrg -= Number(mod.system.nrg)
pc.curnrg -= Number(mod.system.nrg) pc.curnrg -= Number(mod.system.nrg)
@ -2268,10 +2243,28 @@ export class PegasusActor extends Actor {
pc.actnrg -= Number(mod.system.nrg) pc.actnrg -= Number(mod.system.nrg)
pc.maxnrg += Number(mod.system.nrg) pc.maxnrg += Number(mod.system.nrg)
this.update({ 'system.statistics.pc': pc }) this.update({ 'system.statistics.pc': pc })
this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }]) await this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
} }
} else { } else {
this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }]) await this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
}
}
// Shield management
let shieldsList = this.items.filter(item => item.type == "vehiclemodule" && item.system.category == "shield" && item.system.activated) || []
let level = 0
for (let armour of shieldsList) {
if (armour.system.shielddicevalue > 0) {
level += Number(armour.system.shielddicevalue)
}
}
let shift = 500
for (let loc of __LocationsArmour) {
let arcKey = loc + "arc"
let arc = duplicate(this.system.arcs[arcKey])
if (level != Number(arc.shieldlevel)) {
arc.shieldlevel = level
setTimeout(shift, this.update({ [`system.arcs.${arcKey}`]: arc }))
shift += 200
} }
} }
} }

View File

@ -115,8 +115,8 @@
<option value="none0">==== Combat Arcs</option> <option value="none0">==== Combat Arcs</option>
<option value="d4">Combat Arc Flank (Grey) d4</option> <option value="d4">Combat Arc Flank (Grey) d4</option>
<option value="d6">Combat Arc Blind Spot (Red) d6</option> <option value="d6">Combat Arc Blind Spot (Red) d6</option>
<option value="d6">Slight cover d4</option>
<option value="none1">===== Cover defence</option> <option value="none1">===== Cover defence</option>
<option value="d4">Slight cover d4</option>
<option value="d8">Half cover d8</option> <option value="d8">Half cover d8</option>
<option value="d12">Full cover d12</option> <option value="d12">Full cover d12</option>
<option value="d12">Full cover d12</option> <option value="d12">Full cover d12</option>