This commit is contained in:
sladecraven 2022-09-27 16:45:07 +02:00
parent 9fac687030
commit c0c6231b4c
2 changed files with 52 additions and 26 deletions

View File

@ -20,11 +20,14 @@ const __statBuild = [
{ modules: ["propulsionmodule"], field: "ad", itemfield: "ad" },
{ modules: ["combatmodule"], field: "fc", itemfield: "fc" },
]
const __LocationsArmour = ["front", "rear", "bottom", "left", "right", "bottom"]
const __isVehicleUnique = { vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, propulsionmodule: 1, combatmodule: 1 }
const __speed2Num = { fullstop: 0, crawling: 1, slow: 2, average: 3, fast: 4, extfast: 5 }
const __num2speed = ["fullstop", "crawling", "slow", "average", "fast", "extfast"]
const __isVehicle = { vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, combatmodule: 1,
propulsionmodule: 1, vehiclemodule: 1, vehicleweaponmodule: 1, effect: 1, cargo: 1 }
const __isVehicle = {
vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, combatmodule: 1,
propulsionmodule: 1, vehiclemodule: 1, vehicleweaponmodule: 1, effect: 1, cargo: 1
}
const __isVehicleCargo = { cargo: 1 }
const __bonusEffect = {
name: "Crawling MAN Bonus", type: "effect", img: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp",
@ -2009,6 +2012,7 @@ export class PegasusActor extends Actor {
if (this.system.statistics.hr.currentlevel == 0) {
ChatMessage.create({ content: `The vehicle ${this.name} has been destroyed !` })
}
}
}
@ -2054,6 +2058,7 @@ export class PegasusActor extends Actor {
return false
}
}
// Cargo management
if (__isVehicleCargo[item.type]) {
let capacity = this.getCurrentCargoCapacity()
if (item.type == "cargo") {
@ -2068,6 +2073,27 @@ export class PegasusActor extends Actor {
return false
}
}
// Armour management
if (item.type == "vehiclemodule" && item.system.category == "armor") {
let armorsList = this.items.filter(item => item.type == "vehiclemodule" && item.system.category == "armor") || []
armorsList.push(item)
let arcKey = item.system.location + "arc"
let arc = duplicate(this.system.arcs[arcKey])
let level = 0
for (let armour of armorsList) {
if (armour.system.armourdicevalue > 0) {
level += Number(armour.system.armourdicevalue)
}
}
//console.log(">>>> AMROR, ", level, arc.armourlevel)
if (level != Number(arc.armourlevel)) {
arc.armourlevel = level
setTimeout(500, this.update({ [`system.arcs.${arcKey}`]: arc }))
}
}
return true
}

View File

@ -995,7 +995,7 @@ export class PegasusUtility {
icon: '<i class="fas fa-check"></i>',
label: "Yes, remove it",
callback: () => {
actorSheet.actor.deleteEmbeddedDocuments("Item", [itemId]);
actorSheet.actor.deleteEmbeddedDocuments("Item", [itemId])
li.slideUp(200, () => actorSheet.render(false));
}
},