Add v12 support
This commit is contained in:
@@ -12,7 +12,7 @@ export class WastelandActorSheet extends ActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-wasteland", "sheet", "actor"],
|
||||
template: "systems/fvtt-wasteland/templates/actor-sheet.html",
|
||||
width: 640,
|
||||
@@ -25,7 +25,7 @@ export class WastelandActorSheet extends ActorSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const objectData = duplicate(this.object)
|
||||
const objectData = foundry.utils.duplicate(this.object)
|
||||
let actorData = objectData
|
||||
|
||||
let formData = {
|
||||
@@ -40,31 +40,32 @@ export class WastelandActorSheet 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()),
|
||||
pouvoirs:duplicate(this.actor.getPouvoirs()),
|
||||
dons: duplicate(this.actor.getDons()),
|
||||
hubrises: duplicate(this.actor.getHubris()),
|
||||
tours:duplicate(this.actor.getTours()),
|
||||
artifex: duplicate(this.actor.getArtifex()),
|
||||
charmes:duplicate(this.actor.getCharmes()),
|
||||
peuple: duplicate(this.actor.getPeuple() || {}),
|
||||
origine: duplicate(this.actor.getOrigine() || {}),
|
||||
heritage: duplicate(this.actor.getHeritage() || {}),
|
||||
metier: duplicate(this.actor.getMetier() || {}),
|
||||
armes: foundry.utils.duplicate(this.actor.getWeapons()),
|
||||
protections: foundry.utils.duplicate(this.actor.getArmors()),
|
||||
pouvoirs:foundry.utils.duplicate(this.actor.getPouvoirs()),
|
||||
dons: foundry.utils.duplicate(this.actor.getDons()),
|
||||
hubrises: foundry.utils.duplicate(this.actor.getHubris()),
|
||||
tours:foundry.utils.duplicate(this.actor.getTours()),
|
||||
artifex: foundry.utils.duplicate(this.actor.getArtifex()),
|
||||
charmes:foundry.utils.duplicate(this.actor.getCharmes()),
|
||||
peuple: foundry.utils.duplicate(this.actor.getPeuple() || {}),
|
||||
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(),
|
||||
config: duplicate(game.system.wasteland.config),
|
||||
capacites: duplicate(this.actor.getCapacites()),
|
||||
equipements: duplicate(this.actor.getEquipments()),
|
||||
monnaies: duplicate(this.actor.getMonnaies()),
|
||||
mutations: duplicate(this.actor.getMutations()),
|
||||
config: foundry.utils.duplicate(game.system.wasteland.config),
|
||||
capacites: foundry.utils.duplicate(this.actor.getCapacites()),
|
||||
equipements: foundry.utils.duplicate(this.actor.getEquipments()),
|
||||
monnaies: foundry.utils.duplicate(this.actor.getMonnaies()),
|
||||
mutations: foundry.utils.duplicate(this.actor.getMutations()),
|
||||
description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}),
|
||||
comportement: await TextEditor.enrichHTML(this.object.system.biodata.comportement, {async: true}),
|
||||
habitat: await TextEditor.enrichHTML(this.object.system.biodata.habitat, {async: true}),
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
editScore: this.options.editScore,
|
||||
isGM: game.user.isGM
|
||||
isGM: game.user.isGM,
|
||||
config: game.system.wasteland.config
|
||||
}
|
||||
this.formData = formData;
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -36,5 +36,22 @@ export const WASTELAND_CONFIG = {
|
||||
"chimie": "Chimie",
|
||||
"electricite": "Électricité",
|
||||
"chimerie": "Chimérie",
|
||||
},
|
||||
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)"
|
||||
},
|
||||
difficulteOptions: {
|
||||
"0": "Aucune/Inconnue",
|
||||
"5": "Facile (5)",
|
||||
"10": "Moyenne (10)",
|
||||
"15": "Ardue (15)",
|
||||
"20": "Hasardeuse (20)",
|
||||
"25": "Insensée (25)",
|
||||
"30": "Pure Folie (30)"
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ export class WastelandCreatureSheet extends WastelandActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-wasteland", "sheet", "creature"],
|
||||
template: "systems/fvtt-wasteland/templates/creature-sheet.html",
|
||||
width: 640,
|
||||
|
@@ -9,7 +9,7 @@ export class WastelandItemSheet extends ItemSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-wasteland", "sheet", "item"],
|
||||
template: "systems/fvtt-wasteland/templates/item-sheet.html",
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }],
|
||||
@@ -48,7 +48,7 @@ export class WastelandItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const objectData = duplicate(this.object)
|
||||
const objectData = foundry.utils.duplicate(this.object)
|
||||
let itemData = objectData
|
||||
let formData = {
|
||||
title: this.title,
|
||||
@@ -59,7 +59,7 @@ export class WastelandItemSheet extends ItemSheet {
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
attributs: WastelandUtility.getAttributs(),
|
||||
config: duplicate(game.system.wasteland.config),
|
||||
config: foundry.utils.duplicate(game.system.wasteland.config),
|
||||
data: itemData.system,
|
||||
system: itemData.system,
|
||||
limited: this.object.limited,
|
||||
@@ -87,7 +87,7 @@ export class WastelandItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
postItem() {
|
||||
let chatData = duplicate(WastelandUtility.data(this.item));
|
||||
let chatData = foundry.utils.duplicate(WastelandUtility.data(this.item));
|
||||
if (this.actor) {
|
||||
chatData.actor = { id: this.actor.id };
|
||||
}
|
||||
@@ -130,26 +130,26 @@ export class WastelandItemSheet 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( { 'data.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( { 'data.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( { 'data.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", used: false })
|
||||
this.object.update( { 'data.predilections': pred })
|
||||
})
|
||||
|
@@ -16,7 +16,6 @@ import { WastelandUtility } from "./wasteland-utility.js";
|
||||
import { WastelandCombat } from "./wasteland-combat.js";
|
||||
import { WastelandItem } from "./wasteland-item.js";
|
||||
import { WASTELAND_CONFIG } from "./wasteland-config.js";
|
||||
import { ClassCounter} from "https://www.uberwald.me/fvtt_appcount/count-class-ready.js"
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
@@ -96,9 +95,6 @@ Hooks.once("ready", function () {
|
||||
|
||||
WastelandUtility.ready();
|
||||
|
||||
ClassCounter.registerUsageCount()
|
||||
welcomeMessage();
|
||||
|
||||
// User warning
|
||||
if (!game.user.isGM && game.user.character == undefined) {
|
||||
ui.notifications.info("Attention ! Aucun personnage n'est relié au joueur !");
|
||||
@@ -115,6 +111,14 @@ Hooks.once("ready", function () {
|
||||
});
|
||||
}
|
||||
|
||||
import("https://www.uberwald.me/fvtt_appcount/count-class-ready.js").then(moduleCounter=>{
|
||||
console.log("ClassCounter loaded", moduleCounter)
|
||||
moduleCounter.ClassCounter.registerUsageCount()
|
||||
}).catch(err=>
|
||||
console.log("No stats available, giving up.")
|
||||
)
|
||||
welcomeMessage();
|
||||
|
||||
importDefaultScene();
|
||||
|
||||
});
|
||||
|
@@ -114,6 +114,28 @@ export class WastelandUtility {
|
||||
static async ready() {
|
||||
const skills = await WastelandUtility.loadCompendium("fvtt-wasteland.skills")
|
||||
this.skills = skills.map(i => i.toObject())
|
||||
|
||||
game.system.wasteland.config.listeNiveauSkill = WastelandUtility.createDirectOptionList(0, 10)
|
||||
game.system.wasteland.config.listeNiveauCreature = WastelandUtility.createDirectOptionList(0, 35)
|
||||
game.system.wasteland.config.modificateurOptions = WastelandUtility.createArrayOptionList(-15, 15)
|
||||
game.system.wasteland.config.pointsAmeOptions = WastelandUtility.createDirectOptionList(0, 20)
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createDirectOptionList(min, max) {
|
||||
let options = {};
|
||||
for (let i = min; i <= max; i++) {
|
||||
options[`${i}`] = `${i}`;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
static createArrayOptionList(min, max) {
|
||||
let options = [];
|
||||
for (let i = min; i <= max; i++) {
|
||||
options.push({key:`${i}`, label:`${i}`});
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -142,7 +164,7 @@ export class WastelandUtility {
|
||||
let rollData = message.getFlag("world", "wasteland-roll")
|
||||
let actor = WastelandUtility.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))
|
||||
await WastelandUtility.rollWasteland(rollData)
|
||||
})
|
||||
}
|
||||
@@ -152,9 +174,7 @@ export class WastelandUtility {
|
||||
|
||||
const templatePaths = [
|
||||
'systems/fvtt-wasteland/templates/editor-notes-gm.html',
|
||||
'systems/fvtt-wasteland/templates/partial-item-description.html',
|
||||
'systems/fvtt-wasteland/templates/partial-list-niveau.html',
|
||||
'systems/fvtt-wasteland/templates/partial-list-niveau-creature.html'
|
||||
'systems/fvtt-wasteland/templates/partial-item-description.html'
|
||||
]
|
||||
return loadTemplates(templatePaths);
|
||||
}
|
||||
@@ -188,15 +208,6 @@ export class WastelandUtility {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createDirectOptionList(min, max) {
|
||||
let options = {};
|
||||
for (let i = min; i <= max; i++) {
|
||||
options[`${i}`] = `${i}`;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static buildListOptions(min, max) {
|
||||
let options = ""
|
||||
@@ -221,7 +232,7 @@ export class WastelandUtility {
|
||||
|
||||
let id = rollData.rollId;
|
||||
let oldRollData = this.rollDataStore[id] || {};
|
||||
let newRollData = mergeObject(oldRollData, rollData);
|
||||
let newRollData = foundry.utils.mergeObject(oldRollData, rollData);
|
||||
this.rollDataStore[id] = newRollData;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
@@ -293,10 +304,10 @@ export class WastelandUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static computeResult(rollData, actor) {
|
||||
static async computeResult(rollData, actor) {
|
||||
if (rollData.charme) {
|
||||
let resultIndex = false
|
||||
let resTab = duplicate(rollData.charme.system.resultats)
|
||||
let resTab = foundry.utils.duplicate(rollData.charme.system.resultats)
|
||||
for(let id in resTab) {
|
||||
let res = resTab[id]
|
||||
if (!resultIndex && rollData.finalResult >= res.value) {
|
||||
@@ -306,7 +317,7 @@ export class WastelandUtility {
|
||||
if (resultIndex) {
|
||||
rollData.charmeDuree = rollData.charme.system.resultats[resultIndex].description
|
||||
}
|
||||
let effectRoll = new Roll(rollData.charmeDice).roll({ async: false })
|
||||
let effectRoll = await new Roll(rollData.charmeDice).roll()
|
||||
if (rollData.charme.system.charmetype == "tour") {
|
||||
rollData.contrecoupResult = effectRoll.total
|
||||
if (rollData.contrecoupResult % 2 == 1) {
|
||||
@@ -350,7 +361,7 @@ export class WastelandUtility {
|
||||
}
|
||||
if (!rollData.attr) {
|
||||
rollData.actionImg = "systems/fvtt-wasteland/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])
|
||||
}
|
||||
|
||||
if (rollData.charme) {
|
||||
@@ -367,7 +378,7 @@ export class WastelandUtility {
|
||||
|
||||
//console.log("BEFORE COMP", rollData)
|
||||
if (rollData.competence) {
|
||||
rollData.predilections = duplicate(rollData.competence.system.predilections.filter(pred => !pred.used) || [])
|
||||
rollData.predilections = foundry.utils.duplicate(rollData.competence.system.predilections.filter(pred => !pred.used) || [])
|
||||
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
|
||||
rollData.diceFormula += `+${rollData.attr.value}+${rollData.competence.system.niveau}+${rollData.modificateur}+${compmod}`
|
||||
} else {
|
||||
@@ -377,14 +388,14 @@ export class WastelandUtility {
|
||||
rollData.diceFormula += `+${rollData.arme.system.bonusmaniementoff}`
|
||||
}
|
||||
|
||||
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
|
||||
let myRoll = await new Roll(rollData.diceFormula).roll()
|
||||
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)
|
||||
|
||||
rollData.finalResult = myRoll.total
|
||||
this.computeResult(rollData, actor)
|
||||
await this.computeResult(rollData, actor)
|
||||
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-wasteland/templates/chat-generic-result.html`, rollData)
|
||||
@@ -396,13 +407,13 @@ export class WastelandUtility {
|
||||
static async bonusRollWasteland(rollData) {
|
||||
rollData.bonusFormula = rollData.addedBonus
|
||||
|
||||
let bonusRoll = new Roll(rollData.bonusFormula).roll({ async: false })
|
||||
let bonusRoll = await new Roll(rollData.bonusFormula).roll()
|
||||
await this.showDiceSoNice(bonusRoll, game.settings.get("core", "rollMode"));
|
||||
rollData.bonusRoll = duplicate(bonusRoll)
|
||||
rollData.bonusRoll = foundry.utils.duplicate(bonusRoll)
|
||||
|
||||
rollData.finalResult += rollData.bonusRoll.total
|
||||
|
||||
this.computeResult(rollData)
|
||||
await this.computeResult(rollData)
|
||||
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-wasteland/templates/chat-generic-result.html`, rollData)
|
||||
@@ -432,7 +443,7 @@ export class WastelandUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
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);
|
||||
@@ -494,7 +505,7 @@ export class WastelandUtility {
|
||||
/* -------------------------------------------- */
|
||||
static getBasicRollData() {
|
||||
let rollData = {
|
||||
rollId: randomID(16),
|
||||
rollId: foundry.utils.randomID(16),
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
modificateursOptions: this.getModificateurOptions(),
|
||||
pointAmeOptions: this.getPointAmeOptions(),
|
||||
|
Reference in New Issue
Block a user