Compatibilité v11/v12
This commit is contained in:
@@ -12,7 +12,7 @@ export class MournbladeActorSheet extends ActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-mournblade", "sheet", "actor"],
|
||||
template: "systems/fvtt-mournblade/templates/actor-sheet.html",
|
||||
width: 640,
|
||||
@@ -25,7 +25,7 @@ export class MournbladeActorSheet extends ActorSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const objectData = duplicate(this.object)
|
||||
const objectData = foundry.utils.duplicate(this.object)
|
||||
let actorData = objectData
|
||||
|
||||
let formData = {
|
||||
@@ -40,24 +40,24 @@ export class MournbladeActorSheet extends ActorSheet {
|
||||
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
|
||||
limited: this.object.limited,
|
||||
skills: this.actor.getSkills(),
|
||||
armes: duplicate(this.actor.getWeapons()),
|
||||
protections: duplicate(this.actor.getArmors()),
|
||||
dons: duplicate(this.actor.getDons()),
|
||||
armes: foundry.utils.duplicate(this.actor.getWeapons()),
|
||||
protections: foundry.utils.duplicate(this.actor.getArmors()),
|
||||
dons: foundry.utils.duplicate(this.actor.getDons()),
|
||||
alignement: this.actor.getAlignement(),
|
||||
aspect: this.actor.getAspect(),
|
||||
marge: this.actor.getMarge(),
|
||||
tendances:duplicate(this.actor.getTendances()),
|
||||
runes:duplicate(this.actor.getRunes()),
|
||||
traitsChaotiques:duplicate(this.actor.getTraitsChaotiques()),
|
||||
traitsEspeces: duplicate(this.actor.getTraitsEspeces()),
|
||||
origine: duplicate(this.actor.getOrigine() || {}),
|
||||
heritage: duplicate(this.actor.getHeritage() || {}),
|
||||
metier: duplicate(this.actor.getMetier() || {}),
|
||||
tendances:foundry.utils.duplicate(this.actor.getTendances()),
|
||||
runes:foundry.utils.duplicate(this.actor.getRunes()),
|
||||
traitsChaotiques:foundry.utils.duplicate(this.actor.getTraitsChaotiques()),
|
||||
traitsEspeces: foundry.utils.duplicate(this.actor.getTraitsEspeces()),
|
||||
origine: foundry.utils.duplicate(this.actor.getOrigine() || {}),
|
||||
heritage: foundry.utils.duplicate(this.actor.getHeritage() || {}),
|
||||
metier: foundry.utils.duplicate(this.actor.getMetier() || {}),
|
||||
combat: this.actor.getCombatValues(),
|
||||
equipements: duplicate(this.actor.getEquipments()),
|
||||
modifiers: duplicate(this.actor.getModifiers()),
|
||||
monnaies: duplicate(this.actor.getMonnaies()),
|
||||
runeEffects: duplicate(this.actor.getRuneEffects()),
|
||||
equipements: foundry.utils.duplicate(this.actor.getEquipments()),
|
||||
modifiers: foundry.utils.duplicate(this.actor.getModifiers()),
|
||||
monnaies: foundry.utils.duplicate(this.actor.getMonnaies()),
|
||||
runeEffects: foundry.utils.duplicate(this.actor.getRuneEffects()),
|
||||
config: game.system.mournblade.config,
|
||||
protectionTotal: this.actor.getProtectionTotal(),
|
||||
santeMalus: this.actor.getStatusMalus(),
|
||||
|
@@ -31,7 +31,7 @@ export class MournbladeActor extends Actor {
|
||||
if (data instanceof Array) {
|
||||
return super.create(data, options);
|
||||
}
|
||||
// If the created actor has items (only applicable to duplicated actors) bypass the new actor creation logic
|
||||
// If the created actor has items (only applicable to foundry.utils.duplicated actors) bypass the new actor creation logic
|
||||
if (data.items) {
|
||||
let actor = super.create(data, options);
|
||||
return actor;
|
||||
@@ -60,11 +60,11 @@ export class MournbladeActor 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.isMelee = true
|
||||
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 + combat.attaqueModifier
|
||||
@@ -74,7 +74,7 @@ export class MournbladeActor extends Actor {
|
||||
}
|
||||
if (arme.system.typearme == "jet" || arme.system.typearme == "tir") {
|
||||
arme.system.isDistance = true
|
||||
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 + combat.attaqueModifier
|
||||
arme.system.totalDegats = arme.system.degats
|
||||
@@ -86,9 +86,9 @@ export class MournbladeActor 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
|
||||
@@ -176,7 +176,7 @@ export class MournbladeActor 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)
|
||||
@@ -286,7 +286,7 @@ export class MournbladeActor 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;
|
||||
}
|
||||
@@ -361,7 +361,7 @@ export class MournbladeActor extends Actor {
|
||||
value = Math.max(0, Number(value))
|
||||
}
|
||||
if (value) {
|
||||
let newSante = duplicate(this.system.sante)
|
||||
let newSante = foundry.utils.duplicate(this.system.sante)
|
||||
newSante[type] += Number(value)
|
||||
newSante[type] = Math.max(0, newSante[type])
|
||||
if (newSante[type] > this.system.sante.base) {
|
||||
@@ -382,7 +382,7 @@ export class MournbladeActor extends Actor {
|
||||
incDecAme(value) {
|
||||
value = Number(value)
|
||||
if (value) {
|
||||
let newAme = duplicate(this.system.ame)
|
||||
let newAme = foundry.utils.duplicate(this.system.ame)
|
||||
newAme.value += Number(value)
|
||||
newAme.value = Math.max(0, newAme.value)
|
||||
newAme.value = Math.min(newAme.value, newAme.currentmax)
|
||||
@@ -420,7 +420,7 @@ export class MournbladeActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
subPointsAme(runeMode, value) {
|
||||
let ame = duplicate(this.system.ame)
|
||||
let ame = foundry.utils.duplicate(this.system.ame)
|
||||
if (runeMode == "prononcer") {
|
||||
ame.value += value
|
||||
} else {
|
||||
@@ -466,13 +466,13 @@ export class MournbladeActor 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 });
|
||||
}
|
||||
@@ -503,7 +503,7 @@ export class MournbladeActor 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 }])
|
||||
}
|
||||
@@ -526,7 +526,7 @@ export class MournbladeActor extends Actor {
|
||||
}
|
||||
if (arme.system.totalDefensif > maxDef) {
|
||||
maxDef = arme.system.totalDefensif
|
||||
bestArme = duplicate(arme)
|
||||
bestArme = foundry.utils.duplicate(arme)
|
||||
}
|
||||
}
|
||||
return bestArme
|
||||
@@ -535,7 +535,7 @@ export class MournbladeActor extends Actor {
|
||||
depenseRessources(arme) {
|
||||
if (arme.system.nbressources && Number(arme.system.nbressources) > 0) {
|
||||
if (this.type == "creature") {
|
||||
let ressources = duplicate(this.system.ressources)
|
||||
let ressources = foundry.utils.duplicate(this.system.ressources)
|
||||
if (Number(ressources.value) >= Number(arme.system.nbressources)) {
|
||||
ressources.value -= arme.system.nbressources
|
||||
this.update({ 'system.ressources': ressources })
|
||||
@@ -578,15 +578,15 @@ export class MournbladeActor extends Actor {
|
||||
rollData.attrKey = attrKey
|
||||
if (attrKey != "tochoose") {
|
||||
rollData.actionImg = "systems/fvtt-mournblade/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
|
||||
@@ -615,7 +615,7 @@ export class MournbladeActor extends Actor {
|
||||
return
|
||||
}
|
||||
let rollData = this.getCommonRollData("cla", undefined, "Savoir : Runes")
|
||||
rollData.rune = duplicate(this.items.get(runeId) || {})
|
||||
rollData.rune = foundry.utils.duplicate(this.items.get(runeId) || {})
|
||||
rollData.difficulte = rollData.rune?.system?.seuil || 0
|
||||
rollData.runemode = "prononcer"
|
||||
rollData.runeame = 1
|
||||
|
@@ -1,6 +1,6 @@
|
||||
export const MOURNBLADE_CONFIG = {
|
||||
|
||||
attaques:{
|
||||
|
||||
attaques: {
|
||||
assaut: "Assaut",
|
||||
precise: "Attaque Précise",
|
||||
feinte: "Feinte",
|
||||
@@ -9,17 +9,63 @@ export const MOURNBLADE_CONFIG = {
|
||||
contenir: "Contenir l'adversaire",
|
||||
desarmer: "Désarmer"
|
||||
},
|
||||
couverts:{
|
||||
aucun: {name: "Aucun", value: 0},
|
||||
rondache: {name: "Rondache ou léger (-2)", value: -2},
|
||||
pavois: { name: "Pavois ou à moitié (-5)", value: -5},
|
||||
complet: {name:"Quasi complet (-10)", value: -10},
|
||||
},
|
||||
couverts: {
|
||||
aucun: { name: "Aucun", value: 0 },
|
||||
rondache: { name: "Rondache ou léger (-2)", value: -2 },
|
||||
pavois: { name: "Pavois ou à moitié (-5)", value: -5 },
|
||||
complet: { name: "Quasi complet (-10)", value: -10 },
|
||||
},
|
||||
modifierTypes: {
|
||||
aucun: {name: "Aucun", value: 0},
|
||||
roll: {name: "Jet", value: 0},
|
||||
degats: {name: "Dégats", value: 0},
|
||||
defense: {name: "Capacité défensive", value: 0},
|
||||
attaque: {name: "Capacité offensive", value: 0},
|
||||
}
|
||||
aucun: { name: "Aucun", value: 0 },
|
||||
roll: { name: "Jet", value: 0 },
|
||||
degats: { name: "Dégats", value: 0 },
|
||||
defense: { name: "Capacité défensive", value: 0 },
|
||||
attaque: { name: "Capacité offensive", value: 0 },
|
||||
},
|
||||
listeNiveau: {
|
||||
},
|
||||
listeNiveauCreature: {
|
||||
},
|
||||
listePortees: {
|
||||
"10": "Moins que courte (10)",
|
||||
"15": "Courte et + (15)",
|
||||
"20": "Moyenne et + (20)",
|
||||
"25": "Longue et + (25)"
|
||||
},
|
||||
modificateurOptions: {},
|
||||
pointsAmeOptions: {},
|
||||
difficulteOptions: {
|
||||
"0": "Aucune/Inconnue",
|
||||
"5": "Facile (5)",
|
||||
"10": "Moyenne (10)",
|
||||
"15": "Ardue (15)",
|
||||
"20": "Hasardeuse (20)",
|
||||
"25": "Insensée (25)",
|
||||
"30": "Pure Folie (30)"
|
||||
},
|
||||
attributs: {
|
||||
adr: "Adresse", pui: "Puissance", cla: "Clairvoyance", pre: "Présence", tre: "Trempe"
|
||||
},
|
||||
lancementRuneOptions: {
|
||||
prononcer: "Prononcer la rune",
|
||||
inscrire: "Inscrire la rune"
|
||||
},
|
||||
effetRuneOptions: {
|
||||
prononcee: "Prononcée",
|
||||
inscrite: "Inscrite"
|
||||
},
|
||||
typeArmeOptions: {
|
||||
contact: "Arme de contact",
|
||||
contactjet: "Arme de contact et de Jet",
|
||||
jet: "Arme de Jet",
|
||||
tir: "Arme de Tir",
|
||||
special: "Spécial (capacité/don)"
|
||||
},
|
||||
allegeanceOptions: {
|
||||
tous: "Tous",
|
||||
chaos: "Chaos",
|
||||
loi: "Loi",
|
||||
betes: "Seigneurs des Bêtes",
|
||||
elementaires: "Seigneurs Elementaires"
|
||||
},
|
||||
};
|
@@ -12,7 +12,7 @@ export class MournbladeCreatureSheet extends MournbladeActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-mournblade", "sheet", "actor"],
|
||||
template: "systems/fvtt-mournblade/templates/creature-sheet.html",
|
||||
width: 640,
|
||||
|
@@ -9,7 +9,7 @@ export class MournbladeItemSheet extends ItemSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-mournblade", "sheet", "item"],
|
||||
template: "systems/fvtt-mournblade/templates/item-sheet.html",
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }],
|
||||
@@ -48,7 +48,7 @@ export class MournbladeItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const objectData = duplicate(this.object)
|
||||
const objectData = foundry.utils.duplicate(this.object)
|
||||
let itemData = objectData
|
||||
let formData = {
|
||||
title: this.title,
|
||||
@@ -91,7 +91,7 @@ export class MournbladeItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
postItem() {
|
||||
let chatData = duplicate(MournbladeUtility.data(this.item));
|
||||
let chatData = foundry.utils.duplicate(MournbladeUtility.data(this.item));
|
||||
if (this.actor) {
|
||||
chatData.actor = { id: this.actor.id };
|
||||
}
|
||||
@@ -134,26 +134,26 @@ export class MournbladeItemSheet extends ItemSheet {
|
||||
html.find('.edit-prediction').change(ev => {
|
||||
const li = $(ev.currentTarget).parents(".prediction-item")
|
||||
let index = li.data("prediction-index")
|
||||
let pred = duplicate(this.object.system.predilections)
|
||||
let pred = foundry.utils.duplicate(this.object.system.predilections)
|
||||
pred[index].name = ev.currentTarget.value
|
||||
this.object.update( { 'system.predilections': pred })
|
||||
})
|
||||
html.find('.delete-prediction').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".prediction-item")
|
||||
let index = li.data("prediction-index")
|
||||
let pred = duplicate(this.object.system.predilections)
|
||||
let pred = foundry.utils.duplicate(this.object.system.predilections)
|
||||
pred.splice(index,1)
|
||||
this.object.update( { 'system.predilections': pred })
|
||||
})
|
||||
html.find('.use-prediction').change(ev => {
|
||||
const li = $(ev.currentTarget).parents(".prediction-item")
|
||||
let index = li.data("prediction-index")
|
||||
let pred = duplicate(this.object.system.predilections)
|
||||
let pred = foundry.utils.duplicate(this.object.system.predilections)
|
||||
pred[index].used = ev.currentTarget.checked
|
||||
this.object.update( { 'system.predilections': pred })
|
||||
})
|
||||
html.find('#add-predilection').click(ev => {
|
||||
let pred = duplicate(this.object.system.predilections)
|
||||
let pred = foundry.utils.duplicate(this.object.system.predilections)
|
||||
pred.push( { name: "Nouvelle prédilection", id: randomID(), used: false })
|
||||
this.object.update( { 'system.predilections': pred })
|
||||
})
|
||||
|
@@ -59,15 +59,6 @@ export class MournbladeUtility {
|
||||
return actor
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getModificateurOptions() {
|
||||
let opt = []
|
||||
for (let i = -15; i <= 15; i++) {
|
||||
opt.push(`<option value="${i}">${i}</option>`)
|
||||
}
|
||||
return opt.concat("\n")
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static sortArrayObjectsByName(myArray) {
|
||||
myArray.sort((a, b) => {
|
||||
@@ -75,18 +66,9 @@ export class MournbladeUtility {
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getPointAmeOptions() {
|
||||
let opt = []
|
||||
for (let i = 1; i <= 20; i++) {
|
||||
opt.push(`<option value="${i}">${i}</option>`)
|
||||
}
|
||||
return opt.concat("\n")
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getAttributs() {
|
||||
return { adr: "Adresse", pui: "Puissance", cla: "Clairvoyance", pre: "Présence", tre: "Trempe" }
|
||||
return game.system.mournblade.config.attributs
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static pushInitiativeOptions(html, options) {
|
||||
@@ -101,6 +83,11 @@ export class MournbladeUtility {
|
||||
static async ready() {
|
||||
const skills = await MournbladeUtility.loadCompendium("fvtt-mournblade.skills")
|
||||
this.skills = skills.map(i => i.toObject())
|
||||
|
||||
game.system.mournblade.config.listeNiveauSkill = MournbladeUtility.createDirectOptionList(0, 10)
|
||||
game.system.mournblade.config.listeNiveauCreature = MournbladeUtility.createDirectOptionList(0, 35)
|
||||
game.system.mournblade.config.modificateurOptions = MournbladeUtility.createArrayOptionList(-15, 15)
|
||||
game.system.mournblade.config.pointsAmeOptions = MournbladeUtility.createDirectOptionList(0, 20)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -122,8 +109,8 @@ export class MournbladeUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getPredilection(comp, predIdx) {
|
||||
let pred = duplicate(comp.system.predilections)
|
||||
return duplicate(pred[predIdx] || { name: "Error!" })
|
||||
let pred = foundry.utils.duplicate(comp.system.predilections)
|
||||
return foundry.utils.duplicate(pred[predIdx] || { name: "Error!" })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -150,7 +137,7 @@ export class MournbladeUtility {
|
||||
let rollData = message.getFlag("world", "mournblade-roll")
|
||||
let actor = MournbladeUtility.getActorFromRollData(rollData)
|
||||
await actor.setPredilectionUsed(rollData.competence._id, predIdx)
|
||||
rollData.competence = duplicate(actor.getCompetence(rollData.competence._id))
|
||||
rollData.competence = foundry.utils.duplicate(actor.getCompetence(rollData.competence._id))
|
||||
rollData.predilectionUsed = MournbladeUtility.getPredilection(rollData.competence, predIdx)
|
||||
await MournbladeUtility.rollMournblade(rollData)
|
||||
})
|
||||
@@ -180,9 +167,7 @@ export class MournbladeUtility {
|
||||
|
||||
const templatePaths = [
|
||||
'systems/fvtt-mournblade/templates/editor-notes-gm.html',
|
||||
'systems/fvtt-mournblade/templates/partial-item-description.html',
|
||||
'systems/fvtt-mournblade/templates/partial-list-niveau.html',
|
||||
'systems/fvtt-mournblade/templates/partial-list-niveau-creature.html'
|
||||
'systems/fvtt-mournblade/templates/partial-item-description.html'
|
||||
]
|
||||
return loadTemplates(templatePaths);
|
||||
}
|
||||
@@ -224,12 +209,10 @@ export class MournbladeUtility {
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static buildListOptions(min, max) {
|
||||
let options = ""
|
||||
static createArrayOptionList(min, max) {
|
||||
let options = [];
|
||||
for (let i = min; i <= max; i++) {
|
||||
options += `<option value="${i}">${i}</option>`
|
||||
options.push({key:`${i}`, label:`${i}`});
|
||||
}
|
||||
return options;
|
||||
}
|
||||
@@ -337,7 +320,7 @@ export class MournbladeUtility {
|
||||
}
|
||||
if (!rollData.attr) {
|
||||
rollData.actionImg = "systems/fvtt-mournblade/assets/icons/" + actor.system.attributs[rollData.attrKey].labelnorm + ".webp"
|
||||
rollData.attr = duplicate(actor.system.attributs[rollData.attrKey])
|
||||
rollData.attr = foundry.utils.duplicate(actor.system.attributs[rollData.attrKey])
|
||||
}
|
||||
|
||||
rollData.diceFormula = rollData.mainDice
|
||||
@@ -349,7 +332,7 @@ export class MournbladeUtility {
|
||||
}
|
||||
//console.log("BEFORE COMP", rollData)
|
||||
if (rollData.competence) {
|
||||
rollData.predilections = duplicate(rollData.competence.system.predilections)
|
||||
rollData.predilections = foundry.utils.duplicate(rollData.competence.system.predilections)
|
||||
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
|
||||
rollData.diceFormula += `+${rollData.attr.value}+${rollData.competence.system.niveau}+${rollData.modificateur}+${compmod}`
|
||||
} else {
|
||||
@@ -376,7 +359,7 @@ export class MournbladeUtility {
|
||||
}
|
||||
desavantagesBonus = Math.min(15, desavantagesBonus)
|
||||
rollData.diceFormula += `+${desavantagesBonus}`
|
||||
|
||||
|
||||
// Monté ?
|
||||
if (rollData.isMonte) {
|
||||
rollData.diceFormula += "+5"
|
||||
@@ -411,10 +394,10 @@ export class MournbladeUtility {
|
||||
rollData.runeduree = 1
|
||||
}
|
||||
}
|
||||
|
||||
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
|
||||
|
||||
let myRoll = await new Roll(rollData.diceFormula).evaluate();
|
||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
rollData.roll = duplicate(myRoll)
|
||||
rollData.roll = foundry.utils.duplicate(myRoll)
|
||||
rollData.diceResult = myRoll.terms[0].results[0].result
|
||||
console.log(">>>> ", myRoll)
|
||||
|
||||
@@ -439,7 +422,7 @@ export class MournbladeUtility {
|
||||
if (rollData.typeAttaque == "immobiliser" && rollData.difficulte > 0 && rollData.isPureSuccess) {
|
||||
actor.setModifier("Immobilisation en cours : -5 pour prochaine action", "roll", -5)
|
||||
}
|
||||
if ( rollData.typeAttaque == "chargecavalerie" ) {
|
||||
if (rollData.typeAttaque == "chargecavalerie") {
|
||||
actor.setModifier("Charge de Cavalerie : -5 défense pour le tour", "defense", -5)
|
||||
}
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
@@ -466,10 +449,10 @@ export class MournbladeUtility {
|
||||
if (rollData.typeAttaque == "charger") {
|
||||
rollData.degatsFormula += "+2"
|
||||
}
|
||||
if ( rollData.typeAttaque == "chargecavalerie" ) {
|
||||
if (rollData.typeAttaque == "chargecavalerie") {
|
||||
rollData.degatsFormula += "+5"
|
||||
}
|
||||
|
||||
|
||||
if (rollData.typeAttaque == "precise") {
|
||||
degatsMessage = "Degats normaux"
|
||||
if (rollData.isHeroique) { // Degats max
|
||||
@@ -499,8 +482,8 @@ export class MournbladeUtility {
|
||||
degatsMessage = "Pas de dégats, mais l'adversaire ne peut pas vous attaquer pour le reste du tour"
|
||||
rollData.degatsFormula = false
|
||||
if (rollData.isHeroique) { // Malus pour prochaine action
|
||||
degatsMessage = "Pas de dégats, mais tout les adversaires avec une défense inférieure ou égale à " + rollData.finalResult-10 +
|
||||
" ne peuvent pas vous attaquer pour le reste du tour"
|
||||
degatsMessage = "Pas de dégats, mais tout les adversaires avec une défense inférieure ou égale à " + rollData.finalResult - 10 +
|
||||
" ne peuvent pas vous attaquer pour le reste du tour"
|
||||
}
|
||||
}
|
||||
if (rollData.typeAttaque == "desarmer") {
|
||||
@@ -525,14 +508,14 @@ export class MournbladeUtility {
|
||||
rollData.degatsFormula += "+" + rollData.degatsFormula
|
||||
}
|
||||
// Latest modifiers
|
||||
for(let mod of rollData.modifiers) {
|
||||
if (mod.system.modifiertype == "degats") {
|
||||
for (let mod of rollData.modifiers) {
|
||||
if (mod.system.modifiertype == "degats") {
|
||||
rollData.degatsFormula += `+${mod.system.value}`
|
||||
}
|
||||
}
|
||||
let degatsRoll = new Roll(rollData.degatsFormula).roll({ async: false, maximize: maximize })
|
||||
}
|
||||
let degatsRoll = await new Roll(rollData.degatsFormula).evaluate({ maximize: maximize })
|
||||
await this.showDiceSoNice(degatsRoll, game.settings.get("core", "rollMode"))
|
||||
rollData.degatsRoll = duplicate(degatsRoll)
|
||||
rollData.degatsRoll = foundry.utils.duplicate(degatsRoll)
|
||||
rollData.finalResult = degatsRoll.total
|
||||
}
|
||||
|
||||
@@ -563,7 +546,7 @@ export class MournbladeUtility {
|
||||
defender.setModifier("Prochaine action complexe", "roll", -rollData.nextMalus)
|
||||
}
|
||||
if (rollData.defenderDesarme) {
|
||||
ui.notifications.info("L'arme de " + defender.name + " est arrachée de ses mains (à gérer manuellement)" )
|
||||
ui.notifications.info("L'arme de " + defender.name + " est arrachée de ses mains (à gérer manuellement)")
|
||||
}
|
||||
let degats = rollData.finalResult
|
||||
|
||||
@@ -580,9 +563,9 @@ export class MournbladeUtility {
|
||||
static async bonusRollMournblade(rollData) {
|
||||
rollData.bonusFormula = rollData.addedBonus
|
||||
|
||||
let bonusRoll = new Roll(rollData.bonusFormula).roll({ async: false })
|
||||
let bonusRoll = await new Roll(rollData.bonusFormula).evaluate()
|
||||
await this.showDiceSoNice(bonusRoll, game.settings.get("core", "rollMode"));
|
||||
rollData.bonusRoll = duplicate(bonusRoll)
|
||||
rollData.bonusRoll = foundry.utils.duplicate(bonusRoll)
|
||||
|
||||
rollData.finalResult += rollData.bonusRoll.total
|
||||
|
||||
@@ -616,7 +599,7 @@ export class MournbladeUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static blindMessageToGM(chatOptions) {
|
||||
let chatGM = duplicate(chatOptions);
|
||||
let chatGM = foundry.utils.duplicate(chatOptions);
|
||||
chatGM.whisper = this.getUsers(user => user.isGM);
|
||||
chatGM.content = "Blinde message of " + game.user.name + "<br>" + chatOptions.content;
|
||||
console.log("blindMessageToGM", chatGM);
|
||||
@@ -679,13 +662,11 @@ export class MournbladeUtility {
|
||||
/* -------------------------------------------- */
|
||||
static getBasicRollData() {
|
||||
let rollData = {
|
||||
rollId: randomID(16),
|
||||
rollId: foundry.utils.randomID(16),
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
modificateursOptions: this.getModificateurOptions(),
|
||||
pointAmeOptions: this.getPointAmeOptions(),
|
||||
difficulte: 0,
|
||||
modificateur: 0,
|
||||
config: duplicate(game.system.mournblade.config),
|
||||
config: foundry.utils.duplicate(game.system.mournblade.config),
|
||||
}
|
||||
MournbladeUtility.updateWithTarget(rollData)
|
||||
return rollData
|
||||
|
Reference in New Issue
Block a user