Add v12 support

This commit is contained in:
2024-05-23 11:36:03 +02:00
parent a716a3b3d1
commit bddf772c99
157 changed files with 568 additions and 511 deletions

View File

@@ -50,10 +50,10 @@ export class WastelandActor extends Actor {
/* -------------------------------------------- */
prepareArme(arme) {
arme = duplicate(arme)
arme = foundry.utils.duplicate(arme)
let combat = this.getCombatValues()
if (arme.system.typearme == "contact" || arme.system.typearme == "contactjet") {
arme.system.competence = duplicate(this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "mêlée"))
arme.system.competence = foundry.utils.duplicate(this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "mêlée"))
arme.system.attrKey = "pui"
arme.system.totalDegats = arme.system.degats + "+" + combat.bonusDegatsTotal
arme.system.totalOffensif = this.system.attributs.pui.value + arme.system.competence.system.niveau + arme.system.bonusmaniementoff
@@ -62,7 +62,7 @@ export class WastelandActor extends Actor {
}
}
if (arme.system.typearme == "jet" || arme.system.typearme == "tir") {
arme.system.competence = duplicate(this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "armes à distance"))
arme.system.competence = foundry.utils.duplicate(this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "armes à distance"))
arme.system.attrKey = "adr"
arme.system.totalOffensif = this.system.attributs.adr.value + arme.system.competence.system.niveau + arme.system.bonusmaniementoff
arme.system.totalDegats = arme.system.degats
@@ -74,9 +74,9 @@ export class WastelandActor extends Actor {
}
/* -------------------------------------------- */
prepareBouclier(bouclier) {
bouclier = duplicate(bouclier)
bouclier = foundry.utils.duplicate(bouclier)
let combat = this.getCombatValues()
bouclier.system.competence = duplicate(this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "mêlée"))
bouclier.system.competence = foundry.utils.duplicate(this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "mêlée"))
bouclier.system.attrKey = "pui"
bouclier.system.totalDegats = bouclier.system.degats + "+" + combat.bonusDegatsTotal
bouclier.system.totalOffensif = this.system.attributs.pui.value + bouclier.system.competence.system.niveau
@@ -160,7 +160,7 @@ export class WastelandActor extends Actor {
getSkills() {
let comp = []
for (let item of this.items) {
item = duplicate(item)
item = foundry.utils.duplicate(item)
if (item.type == "competence") {
item.system.attribut1total = item.system.niveau + (this.system.attributs[item.system.attribut1]?.value || 0)
item.system.attribut2total = item.system.niveau + (this.system.attributs[item.system.attribut2]?.value || 0)
@@ -238,7 +238,7 @@ export class WastelandActor extends Actor {
}
/* -------------------------------------------- */
incDecSante(value) {
let sante = duplicate(this.system.sante)
let sante = foundry.utils.duplicate(this.system.sante)
sante.letaux += value
this.update({ 'system.sante': sante })
}
@@ -246,7 +246,7 @@ export class WastelandActor extends Actor {
getItemById(id) {
let item = this.items.find(item => item.id == id);
if (item) {
item = duplicate(item)
item = foundry.utils.duplicate(item)
}
return item;
}
@@ -301,7 +301,7 @@ export class WastelandActor extends Actor {
/* -------------------------------------------- */
subPointsPsyche(value) {
let psyche = duplicate(this.system.psyche)
let psyche = foundry.utils.duplicate(this.system.psyche)
psyche.currentmax -= value
this.update( {'system.psyche': psyche})
}
@@ -340,13 +340,13 @@ export class WastelandActor extends Actor {
getSubActors() {
let subActors = [];
for (let id of this.system.subactors) {
subActors.push(duplicate(game.actors.get(id)));
subActors.push(foundry.utils.duplicate(game.actors.get(id)));
}
return subActors;
}
/* -------------------------------------------- */
async addSubActor(subActorId) {
let subActors = duplicate(this.system.subactors);
let subActors = foundry.utils.duplicate(this.system.subactors);
subActors.push(subActorId);
await this.update({ 'system.subactors': subActors });
}
@@ -377,7 +377,7 @@ export class WastelandActor extends Actor {
/* -------------------------------------------- */
async setPredilectionUsed(compId, predIdx) {
let comp = this.items.get(compId)
let pred = duplicate(comp.system.predilections)
let pred = foundry.utils.duplicate(comp.system.predilections)
pred[predIdx].used = true
await this.updateEmbeddedDocuments('Item', [{ _id: compId, 'system.predilections': pred }])
}
@@ -400,7 +400,7 @@ export class WastelandActor extends Actor {
}
if ( arme.system.totalDefensif > maxDef) {
maxDef = arme.system.totalDefensif
bestArme = duplicate(arme)
bestArme = foundry.utils.duplicate(arme)
}
}
return bestArme
@@ -417,21 +417,21 @@ export class WastelandActor extends Actor {
rollData.canEclatDoubleD20 = true // Always true in Wastelan
rollData.doubleD20 = false
rollData.attributs = WastelandUtility.getAttributs()
rollData.config = duplicate(game.system.wasteland.config)
rollData.config = foundry.utils.duplicate(game.system.wasteland.config)
if (attrKey) {
rollData.attrKey = attrKey
if (attrKey != "tochoose") {
rollData.actionImg = "systems/fvtt-wasteland/assets/icons/" + this.system.attributs[attrKey].labelnorm + ".webp"
rollData.attr = duplicate(this.system.attributs[attrKey])
rollData.attr = foundry.utils.duplicate(this.system.attributs[attrKey])
}
}
if (compId) {
rollData.competence = duplicate(this.items.get(compId) || {})
rollData.competence = foundry.utils.duplicate(this.items.get(compId) || {})
rollData.actionImg = rollData.competence?.img
}
if (compName) {
rollData.competence = duplicate(this.items.find( item => item.name.toLowerCase() == compName.toLowerCase()) || {})
rollData.competence = foundry.utils.duplicate(this.items.find( item => item.name.toLowerCase() == compName.toLowerCase()) || {})
rollData.actionImg = rollData.competence?.img
}
return rollData
@@ -459,13 +459,13 @@ export class WastelandActor extends Actor {
/* -------------------------------------------- */
async rollCharme(charmeId) {
let rollData = this.getCommonRollData("cla")
rollData.charme = duplicate(this.items.get(charmeId) || {})
rollData.charme = foundry.utils.duplicate(this.items.get(charmeId) || {})
rollData.charmeDice = "1d4"
this.launchRoll(rollData)
}
/* -------------------------------------------- */
async rollPouvoir(pouvoirId) {
let pouvoir = duplicate(this.items.get(pouvoirId) || {})
let pouvoir = foundry.utils.duplicate(this.items.get(pouvoirId) || {})
if (pouvoir?.system) {
let rollData = this.getCommonRollData(pouvoir.system.attribut, undefined, pouvoir.system.competence)
if (!rollData.competence) {