Passage en v12 + preparation module officiel BoL

This commit is contained in:
2024-04-26 18:00:56 +02:00
parent ae43c7c920
commit 7ed9265a26
190 changed files with 767 additions and 1743 deletions

View File

@ -60,6 +60,7 @@ export class BoLRoll {
armorInitMalus: actor.getArmorInitMalus(),
horoscopeBonusList: actor.getHoroscopesBonus(),
horoscopeMalusList: actor.getHoroscopesMalus(),
config: game.bol.config,
adv: "0",
mod: 0,
modRanged: 0,
@ -182,7 +183,7 @@ export class BoLRoll {
ui.notifications.warn("Unable to find weapon !")
return
}
weapon = duplicate(weapon)
weapon = foundry.utils.duplicate(weapon)
return this.weaponCheckWithWeapon(actor, weapon)
}
@ -194,7 +195,7 @@ export class BoLRoll {
ui.notifications.warn("Unable to find Alchemy !");
return;
}
alchemy = duplicate(alchemy)
alchemy = foundry.utils.duplicate(alchemy)
let alchemyData = alchemy.system
if (alchemyData.properties.pccurrent < alchemyData.properties.pccost) {
ui.notifications.warn("Pas assez de Points de Création investis dans la Préparation !")
@ -268,7 +269,7 @@ export class BoLRoll {
ui.notifications.warn("Impossible de trouver ce sort !")
return
}
spell = duplicate(spell)
spell = foundry.utils.duplicate(spell)
return this.spellCheckWithSpell(actor, spell)
}
@ -401,7 +402,7 @@ export class BoLRoll {
html.find('#attr').change((event) => {
let attrKey = event.currentTarget.value
let actor = BoLUtility.getActorFromRollData(this.rollData)
this.rollData.attribute = duplicate(actor.system.attributes[attrKey])
this.rollData.attribute = foundry.utils.duplicate(actor.system.attributes[attrKey])
this.rollData.attrValue = actor.system.attributes[attrKey].value
this.rollData.bolApplicableEffects = this.updateApplicableEffects(this.rollData)
this.updateTotalDice()
@ -409,7 +410,7 @@ export class BoLRoll {
html.find('#apt').change((event) => {
let aptKey = event.currentTarget.value
let actor = BoLUtility.getActorFromRollData(this.rollData)
this.rollData.aptitude = duplicate(actor.system.aptitudes[aptKey])
this.rollData.aptitude = foundry.utils.duplicate(actor.system.aptitudes[aptKey])
this.rollData.aptValue = actor.system.aptitudes[aptKey].value
this.rollData.bolApplicableEffects = this.updateApplicableEffects(this.rollData)
this.updateTotalDice()
@ -452,7 +453,7 @@ export class BoLRoll {
html.find('#horoscope-bonus-applied').change((event) => {
this.rollData.selectedHoroscope = []
for (let option of event.currentTarget.selectedOptions) {
this.rollData.selectedHoroscope.push(duplicate(this.rollData.horoscopeBonusList[Number(option.index)]))
this.rollData.selectedHoroscope.push(foundry.utils.duplicate(this.rollData.horoscopeBonusList[Number(option.index)]))
}
let horoscopes = $('#horoscope-bonus-applied').val()
this.rollData.horoscopeBonus = (!horoscopes || horoscopes.length == 0) ? 0 : horoscopes.length
@ -462,7 +463,7 @@ export class BoLRoll {
html.find('#horoscope-malus-applied').change((event) => {
this.rollData.selectedHoroscope = []
for (let option of event.currentTarget.selectedOptions) {
this.rollData.selectedHoroscope.push(duplicate(this.rollData.horoscopeBonusList[Number(option.index)]))
this.rollData.selectedHoroscope.push(foundry.utils.duplicate(this.rollData.horoscopeBonusList[Number(option.index)]))
}
let horoscopes = $('#horoscope-malus-applied').val()
this.rollData.horoscopeMalus = (!horoscopes || horoscopes.length == 0) ? 0 : horoscopes.length
@ -530,7 +531,7 @@ export class BoLRoll {
rollData.careerBonus = rollData.careerBonus ?? 0
rollData.modRanged = rollData.modRanged ?? 0
rollData.mod = rollData.mod ?? 0
rollData.id = randomID(16)
rollData.id = foundry.utils.randomID(16)
rollData.weaponModifier = 0
rollData.attackBonusDice = false
rollData.armorMalus = 0
@ -616,16 +617,15 @@ export class BoLDefaultRoll {
if (this.rollData.applyId) {
BoLUtility.cleanupButtons(this.rollData.applyId)
}
this.rollData.optionsId = randomID(16)
this.rollData.applyId = randomID(16)
this.rollData.optionsId = foundry.utils.randomID(16)
this.rollData.applyId = foundry.utils.randomID(16)
}
/* -------------------------------------------- */
async roll() {
const r = new Roll(this.rollData.formula)
//console.log("Roll formula", this.rollData.formula)
await r.roll({ "async": false })
await r.roll()
let diceData = BoLUtility.getDiceData()
//console.log("DICEDATA", diceData)
@ -688,7 +688,7 @@ export class BoLDefaultRoll {
flavor: msgFlavor,
speaker: ChatMessage.getSpeaker({ actor: actor }),
})
this.rollData.roll = duplicate(this.rollData.roll) // Remove object, keep data (v111 ready)
this.rollData.roll = foundry.utils.duplicate(this.rollData.roll) // Remove object, keep data (v111 ready)
msg.setFlag("world", "bol-roll-data", this.rollData)
})
}
@ -741,7 +741,7 @@ export class BoLDefaultRoll {
speaker: ChatMessage.getSpeaker({ actor: actor }),
flags: { msgType: "default" }
})
this.rollData.damageRoll = duplicate(this.rollData.damageRoll)
this.rollData.damageRoll = foundry.utils.duplicate(this.rollData.damageRoll)
this.rollData.actor = undefined // Cleanup
msg.setFlag("world", "bol-roll-data", this.rollData)
})