Migration datamodels !
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* -------------------------------------------- */
|
||||
import { YggdrasillUtility } from "./yggdrasill-utility.js";
|
||||
import { YggdrasillRoll } from "./yggdrasill-roll-dialog.js";
|
||||
import { YggdrasillRollDialog } from "./applications/yggdrasill-roll-dialog.mjs";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const statusEffects = [
|
||||
@@ -441,45 +441,37 @@ export class YggdrasillActor extends Actor {
|
||||
let sumame = baseame.charisme.value + baseame.communication.value + baseame.instinct.value
|
||||
|
||||
let newPV = (sumcorps*3) + (sumesprit *2) + sumame;
|
||||
if ( newPV != this.system.caracsecondaire.pv.max) {
|
||||
this.system.caracsecondaire.pv.max = newPV;
|
||||
this.update( { 'system.caracsecondaire.pv.max': newPV });
|
||||
}
|
||||
this.system.caracsecondaire.pv.max = newPV;
|
||||
|
||||
this.system.caracsecondaire.reaction.value = baseesprit.intellect.value + baseesprit.perception.value + baseame.instinct.value;
|
||||
let newReac = baseesprit.intellect.value + baseesprit.perception.value + baseame.instinct.value;
|
||||
if ( newReac != this.system.caracsecondaire.reaction.max) {
|
||||
this.system.caracsecondaire.reaction.max = newReac
|
||||
this.update( { 'system.caracsecondaire.reaction.max': newReac });
|
||||
}
|
||||
this.system.caracsecondaire.reaction.max = newReac
|
||||
|
||||
this.system.caracsecondaire.defensephy.value = basecorps.agilite.value + basecorps.vigueur.value + baseame.instinct.value;
|
||||
let newDef = basecorps.agilite.value + basecorps.vigueur.value + baseame.instinct.value;
|
||||
if ( newDef != this.system.caracsecondaire.defensephy.max) {
|
||||
this.system.caracsecondaire.defensephy.max = newDef
|
||||
this.update( { 'system.caracsecondaire.defensephy.max': newDef });
|
||||
this.system.caracsecondaire.defensephy.max = newDef
|
||||
// Initialize bonusmalus if not set
|
||||
if (this.system.caracsecondaire.defensephy.bonusmalus === undefined) {
|
||||
this.system.caracsecondaire.defensephy.bonusmalus = 0
|
||||
}
|
||||
this.system.caracsecondaire.defensephy.total = newDef + this.system.caracsecondaire.defensephy.bonusmalus
|
||||
|
||||
this.system.caracsecondaire.defensemen.value = baseesprit.tenacite.value + baseame.instinct.value + baseesprit.intellect.value;
|
||||
newDef = baseesprit.tenacite.value + baseame.instinct.value + baseesprit.intellect.value;
|
||||
if ( newDef != this.system.caracsecondaire.defensemen.max) {
|
||||
this.system.caracsecondaire.defensemen.max = newDef
|
||||
this.update( { 'system.caracsecondaire.defensemen.max': newDef });
|
||||
this.system.caracsecondaire.defensemen.max = newDef
|
||||
// Initialize bonusmalus if not set
|
||||
if (this.system.caracsecondaire.defensemen.bonusmalus === undefined) {
|
||||
this.system.caracsecondaire.defensemen.bonusmalus = 0
|
||||
}
|
||||
this.system.caracsecondaire.defensemen.total = newDef + this.system.caracsecondaire.defensemen.bonusmalus
|
||||
|
||||
this.system.caracsecondaire.deplacement.value = basecorps.agilite.value + basecorps.vigueur.value;
|
||||
let depl = basecorps.agilite.value + basecorps.vigueur.value;
|
||||
if ( depl != this.system.caracsecondaire.deplacement.max) {
|
||||
this.system.caracsecondaire.deplacement.max = depl
|
||||
this.update( { 'system.caracsecondaire.deplacement.max': depl });
|
||||
}
|
||||
this.system.caracsecondaire.deplacement.max = depl
|
||||
|
||||
this.system.caracsecondaire.capaenc.value = (basecorps.puissance.value * 2) + basecorps.vigueur.value;
|
||||
let enc = (basecorps.puissance.value * 2) + basecorps.vigueur.value;
|
||||
if ( enc != this.system.caracsecondaire.capaenc.max ) {
|
||||
this.system.caracsecondaire.capaenc.max = enc
|
||||
this.update( { 'system.caracsecondaire.capaenc.max': enc });
|
||||
}
|
||||
this.system.caracsecondaire.capaenc.max = enc
|
||||
|
||||
//console.log("CARAC SEC", this.system.caracsecondaire)
|
||||
}
|
||||
@@ -531,9 +523,7 @@ export class YggdrasillActor extends Actor {
|
||||
isBlesse: this.system.etat.etat == "blesse",
|
||||
}
|
||||
this.addDefaultRoll(rollData)
|
||||
let rollDialog = await YggdrasillRoll.create( this, rollData);
|
||||
console.log(rollDialog);
|
||||
rollDialog.render( true );
|
||||
await YggdrasillRollDialog.create( this, rollData);
|
||||
} else {
|
||||
ui.notifications.warn("Attribut non trouvée");
|
||||
}
|
||||
@@ -541,11 +531,11 @@ export class YggdrasillActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
addDefaultRoll(rollData) {
|
||||
rollData.optionsBonusMalus= YggdrasillUtility.createOptions(-15, 15)
|
||||
rollData.bonusMalus= "0"
|
||||
rollData.bonusMalus= 0
|
||||
rollData.optionsFuror= YggdrasillUtility.createOptions(0, this.getCurrentFuror())
|
||||
rollData.furorUsage= "0"
|
||||
rollData.furorUsage= 0
|
||||
rollData.optionsBD= YggdrasillUtility.createOptions(0, +15)
|
||||
rollData.sr= "0"
|
||||
rollData.sr= 0
|
||||
rollData.puissanceRune = 1
|
||||
rollData.optionsPuissanceRune= YggdrasillUtility.createOptions(1, +15)
|
||||
rollData.supportRune= "peau"
|
||||
@@ -571,9 +561,7 @@ export class YggdrasillActor extends Actor {
|
||||
}
|
||||
this.addDefaultRoll(rollData)
|
||||
console.log("CARAC : ", rollData, this.system.carac);
|
||||
let rollDialog = await YggdrasillRoll.create( this, rollData);
|
||||
console.log(rollDialog);
|
||||
rollDialog.render( true );
|
||||
await YggdrasillRollDialog.create( this, rollData);
|
||||
} else {
|
||||
ui.notifications.warn("Caractéristique non trouvée");
|
||||
}
|
||||
@@ -598,9 +586,7 @@ export class YggdrasillActor extends Actor {
|
||||
isMeurtri: this.isMeurtri(),
|
||||
}
|
||||
this.addDefaultRoll(rollData)
|
||||
let rollDialog = await YggdrasillRoll.create( this, rollData);
|
||||
console.log(rollDialog);
|
||||
rollDialog.render( true );
|
||||
await YggdrasillRollDialog.create( this, rollData);
|
||||
} else {
|
||||
ui.notifications.warn("Compétence non trouvée");
|
||||
}
|
||||
@@ -691,9 +677,7 @@ export class YggdrasillActor extends Actor {
|
||||
}
|
||||
this.addDefaultRoll(rollData)
|
||||
rollData.sr = 14
|
||||
let rollDialog = await YggdrasillRoll.create( this, rollData);
|
||||
console.log(rollDialog);
|
||||
rollDialog.render( true );
|
||||
await YggdrasillRollDialog.create( this, rollData);
|
||||
} else {
|
||||
ui.notifications.warn("Sortilège ou Compétence non trouvée !", sort, compName);
|
||||
}
|
||||
@@ -734,9 +718,7 @@ export class YggdrasillActor extends Actor {
|
||||
}
|
||||
this.addDefaultRoll(rollData)
|
||||
rollData.sr = 14
|
||||
let rollDialog = await YggdrasillRoll.create( this, rollData);
|
||||
console.log(rollDialog);
|
||||
rollDialog.render( true );
|
||||
await YggdrasillRollDialog.create( this, rollData);
|
||||
} else {
|
||||
ui.notifications.warn("Arme ou Compétence Martiale non trouvée !", arme, compName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user