Fix v12 issue + remove warnings

This commit is contained in:
2024-04-27 09:33:22 +02:00
parent d7b7bccbdf
commit 0487893f47
42 changed files with 138 additions and 179 deletions

View File

@ -449,6 +449,7 @@ export class EcrymeActor extends Actor {
rollData.applyTranscendence = "execution"
rollData.traitsBonus = foundry.utils.duplicate(rollData.traits)
rollData.traitsMalus = foundry.utils.duplicate(rollData.traits)
console.log("ROLLDATA", rollData)
let confrontStartDialog = await EcrymeConfrontStartDialog.create(this, rollData)
confrontStartDialog.render(true)
}

View File

@ -10,14 +10,14 @@ export const ECRYME_CONFIG = {
"melee": "ECRY.ui.melee",
"ranged": "ECRY.ui.ranged"
},
traitLevel: [
{value: -3, text: "-3"},
{value: -2, text: "-2"},
{value: -1, text: "-1"},
{value: +1, text: "+1"},
{value: +2, text: "+2"},
{value: +3, text: "+3"}
],
traitLevel: {
"-3":{value: "-3", text: "-3"},
"-2":{value: "-2", text: "-2"},
"-1":{value: "-1", text: "-1"},
"+1":{value: "+1", text: "+1"},
"+2":{value: "+2", text: "+2"},
"+3":{value: "+3", text: "+3"}
},
impactTypes: {
physical: "ECRY.ui.physical",
mental: "ECRY.ui.mental",
@ -30,7 +30,7 @@ export const ECRYME_CONFIG = {
major: "ECRY.ui.major"
},
difficulty: {
"-1": {difficulty: "ECRY.ui.none", frequency: "ECRY.ui.none", value: "-"},
"-1": {difficulty: "ECRY.ui.none", frequency: "ECRY.ui.none", value: "-1"},
"8": { difficulty: "ECRY.ui.troublesome", frequency: "ECRY.ui.occasional", value: 8 },
"10": { difficulty: "ECRY.ui.difficult", frequency: "ECRY.ui.uncommon", value: 10 },
"12": { difficulty: "ECRY.ui.verydifficult", frequency: "ECRY.ui.rare", value: 12 },
@ -60,17 +60,16 @@ export const ECRYME_CONFIG = {
},
transcendanceOptions: {
"execution": "ECRY.ui.execution",
"preservation": "EC,RY.ui.preservation"
"preservation": "ECRY.ui.preservation"
},
bonusMalusPersoOptions: [
{value: "-3", label: "-3"},
{value: "-2", label: "-2"},
{value: "-1", label: "-1"},
{value: "0", label: "0"},
{value: "+1", label: "+1"},
{value: "+2", label: "+2"},
{value: "+3", label: "+3"}
]
bonusMalusPersoOptions: {
"-3": {value: "-3", label: "-3"},
"-2": {value: "-2", label: "-2"},
"-1": {value: "-1", label: "-1"},
"0": {value: "0", label: "0"},
"+1": {value: "1", label: "+1"},
"+2": {value: "2", label: "+2"},
"+3": {value: "3", label: "+3"}
}
}

View File

@ -216,7 +216,7 @@ export class EcrymeUtility {
confront.impactPreservation = this.getImpactFromEffect(Math.abs(confront.effectPreservation))
}
if (confront.marginPreservation > 0) {
confront.bonus1 = -confront.marginPreservation
confront.bonus1 = confront.marginPreservation
}
let msg = await this.createChatWithRollMode(this.confrontData1.alias, {
@ -558,7 +558,7 @@ export class EcrymeUtility {
let actor = game.actors.get(rollData.actorId)
// Fix difficulty
if (!rollData.difficulty || rollData.difficulty == "-") {
if (!rollData.difficulty || rollData.difficulty == "-1") {
rollData.difficulty = 0
}
rollData.difficulty = Number(rollData.difficulty)
@ -685,14 +685,14 @@ export class EcrymeUtility {
let rollData = {
rollId: foundry.utils.randomID(16),
type: "roll-data",
bonusMalusPerso: 0,
bonusMalusPerso: "0",
bonusMalusSituation: 0,
bonusMalusDef: 0,
annencyBonus: 0,
bonusMalusPortee: 0,
skillTranscendence: 0,
rollMode: game.settings.get("core", "rollMode"),
difficulty: "-",
difficulty: "-1",
useSpleen: false,
useIdeal: false,
impactMalus: 0,

View File

@ -163,9 +163,9 @@ export class EcrymeConfrontDialog extends Dialog {
// Apply Transcend if needed
if (this.rollData.skillTranscendence > 0) {
if (this.rollData.applyTranscendence == "execution") {
this.rollData.executionTotal += this.rollData.skillTranscendence
this.rollData.executionTotal += Number(this.rollData.skillTranscendence)
} else {
this.rollData.preservationTotal += this.rollData.skillTranscendence
this.rollData.preservationTotal += Number(this.rollData.skillTranscendence)
}
}
}
@ -212,19 +212,19 @@ export class EcrymeConfrontDialog extends Dialog {
for (let id of rollData.traitsBonusSelected) {
let trait = rollData.traitsBonus.find(t => t._id == id)
trait.activated = true
rollData.bonusMalusTraits += trait.system.level
rollData.bonusMalusTraits += Number(trait.system.level)
}
}
if (rollData.traitsMalusSelected && rollData.traitsMalusSelected.length > 0) {
for (let id of rollData.traitsMalusSelected) {
let trait = rollData.traitsMalus.find(t => t._id == id)
trait.activated = true
rollData.bonusMalusTraits -= trait.system.level
rollData.bonusMalusTraits -= Number(trait.system.level)
}
}
rollData.executionTotal += rollData.bonusMalusTraits + rollData.bonusMalusPerso
rollData.preservationTotal += rollData.bonusMalusTraits + rollData.bonusMalusPerso
rollData.executionTotal += Number(rollData.bonusMalusTraits) + Number(rollData.bonusMalusPerso)
rollData.preservationTotal += Number(rollData.bonusMalusTraits) + Number(rollData.bonusMalusPerso)
this.refreshDialog()
}
@ -234,7 +234,7 @@ export class EcrymeConfrontDialog extends Dialog {
super.activateListeners(html);
html.find('#bonusMalusPerso').change((event) => {
this.rollData.bonusMalusPerso = Number(event.currentTarget.value)
this.rollData.bonusMalusPerso = event.currentTarget.value
this.computeTotals()
})
html.find('#roll-specialization').change((event) => {

View File

@ -58,6 +58,7 @@ export class EcrymeRollDialog extends Dialog {
$(function () { onLoad(); });
html.find('#bonusMalusPerso').change((event) => {
console.log("DIFF", event.currentTarget.value)
this.rollData.bonusMalusPerso = Number(event.currentTarget.value)
})
html.find('#roll-difficulty').change((event) => {