Foundryv14 migration
All checks were successful
Release Creation / build (release) Successful in 47s

This commit is contained in:
2026-04-01 21:57:26 +02:00
parent 55d7e401c1
commit a816380679
22 changed files with 82 additions and 70 deletions

View File

@@ -15,8 +15,8 @@ export class MaleficesActor extends Actor {
/**
* Override the create() function to provide additional SoS functionality.
*
* This overrided create() function adds initial items
* Namely: Basic skills, money,
* This overrided create() function adds initial items
* Namely: Basic skills, money,
*
* @param {Object} data Barebones actor data which this function adds onto.
* @param {Object} options (Unused) Additional options which customize the creation workflow.
@@ -43,10 +43,6 @@ export class MaleficesActor extends Actor {
return super.create(data, options);
}
/* -------------------------------------------- */
prepareBaseData() {
}
/* -------------------------------------------- */
async prepareData() {
@@ -92,7 +88,7 @@ export class MaleficesActor extends Actor {
return comp;
}
getArchetype() {
let comp = foundry.utils.duplicate(this.items.find(item => item.type == 'archetype') || {name: "Pas d'archetype"})
let comp = foundry.utils.duplicate(this.items.find(item => item.type == 'archetype') || { name: "Pas d'archetype" })
if (comp && comp.system) {
comp.tarot = MaleficesUtility.getTarot(comp.system.lametutelaire)
}
@@ -224,13 +220,13 @@ export class MaleficesActor extends Actor {
}
/* -------------------------------------------- */
clearInitiative(){
clearInitiative() {
this.getFlag("world", "initiative", -1)
}
/* -------------------------------------------- */
getInitiativeScore(combatId, combatantId) {
let init = Math.floor( (this.system.attributs.physique.value+this.system.attributs.habilite.value) / 2)
let subvalue = new Roll("1d20").roll({async: false})
let init = Math.floor((this.system.attributs.physique.value + this.system.attributs.habilite.value) / 2)
let subvalue = new Roll("1d20").roll({ async: false })
return init + (subvalue.total / 100)
}
@@ -275,25 +271,25 @@ export class MaleficesActor extends Actor {
/* -------------------------------------------- */
incDecFluide(value) {
let fluide = this.system.fluide + value
this.update( {'system.fluide': fluide} )
this.update({ 'system.fluide': fluide })
}
incDecDestin(value) {
let destin = this.system.pointdestin + value
this.update( {'system.pointdestin': destin} )
this.update({ 'system.pointdestin': destin })
}
incDecMPMB(value) {
let mpmb = this.system.mpmb + value
this.update( {'system.mpmb': mpmb} )
this.update({ 'system.mpmb': mpmb })
}
incDecMPMN(value) {
let mpmn = this.system.mpmn + value
this.update( {'system.mpmn': mpmn} )
this.update({ 'system.mpmn': mpmn })
}
/* -------------------------------------------- */
incDecAttr(attrKey, value) {
let attr = foundry.utils.duplicate(this.system.attributs[attrKey])
attr.value += value
this.update( { [`system.attributs.${attrKey}`]: attr})
this.update({ [`system.attributs.${attrKey}`]: attr })
}
/* -------------------------------------------- */
async incDecQuantity(objetId, incDec = 0) {
@@ -317,16 +313,16 @@ export class MaleficesActor extends Actor {
}
/* -------------------------------------------- */
getAtttributImage( attrKey) {
getAtttributImage(attrKey) {
return `systems/fvtt-malefices/images/icons/${attrKey}.webp`
}
/* -------------------------------------------- */
incDecDestin( value) {
let newValue = Math.max( this.system.pointdestin + value, 0)
this.update( {'system.pointdestin': newValue})
incDecDestin(value) {
let newValue = Math.max(this.system.pointdestin + value, 0)
this.update({ 'system.pointdestin': newValue })
}
/* -------------------------------------------- */
getCommonRollData() {
@@ -349,7 +345,7 @@ export class MaleficesActor extends Actor {
}
/* -------------------------------------------- */
getPhysiqueMalus() {
if ( this.system.attributs.constitution.value <= 8) {
if (this.system.attributs.constitution.value <= 8) {
return -(9 - this.system.attributs.constitution.value)
}
return 0
@@ -361,7 +357,7 @@ export class MaleficesActor extends Actor {
let rollData = this.getCommonRollData()
rollData.attr = foundry.utils.duplicate(attr)
rollData.mode = "attribut"
rollData.title = attr.label
rollData.title = attr.label
rollData.img = this.getAtttributImage(attrKey)
this.startRoll(rollData)
}
@@ -373,7 +369,7 @@ export class MaleficesActor extends Actor {
arme = foundry.utils.duplicate(arme)
let rollData = this.getCommonRollData()
if (arme.system.armetype == "mainsnues" || arme.system.armetype == "epee") {
rollData.attr = { label: "(Physique+Habilité)/2", value: Math.floor( (this.getPhysiqueMalus()+this.system.attributs.physique.value+this.system.attributs.habilite.value) / 2) }
rollData.attr = { label: "(Physique+Habilité)/2", value: Math.floor((this.getPhysiqueMalus() + this.system.attributs.physique.value + this.system.attributs.habilite.value) / 2) }
} else {
rollData.attr = foundry.utils.duplicate(this.system.attributs.habilite)
}
@@ -386,7 +382,7 @@ export class MaleficesActor extends Actor {
ui.notifications.warn("Impossible de trouver l'arme concernée ")
}
}
/* -------------------------------------------- */
async startRoll(rollData) {
await MaleficesRollDialog.create(this, rollData)