Initialisation valeurs actuelles
Prise encompte de l'endutrance et vie actuelles
This commit is contained in:
parent
f13677106e
commit
d9af32b168
@ -224,10 +224,38 @@ export class RdDStatBlockParser {
|
|||||||
|
|
||||||
let newActor = await RdDBaseActorReve.create({ name, type: type, system: actorData, items });
|
let newActor = await RdDBaseActorReve.create({ name, type: type, system: actorData, items });
|
||||||
await newActor.remiseANeuf()
|
await newActor.remiseANeuf()
|
||||||
|
await RdDStatBlockParser.setValActuelle(newActor, statString)
|
||||||
// DUmp....
|
// DUmp....
|
||||||
console.log(actorData);
|
console.log(actorData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async setValActuelle(newActor, statString) {
|
||||||
|
const updates = {
|
||||||
|
}
|
||||||
|
const endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?<value>\\d+)\\s+(\\(actuelle\\s*:\\s+(?<actuelle>\\d+)\\))?", 'giu'));
|
||||||
|
if (endurance?.value) {
|
||||||
|
if (newActor.getEnduranceMax() != endurance.value) {
|
||||||
|
const message = `Vérifier le calcul de l'endurance, calcul: ${newActor.getEnduranceMax()} / import: ${endurance.value}`;
|
||||||
|
RdDStatBlockParser.warning(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (endurance?.actuelle) {
|
||||||
|
updates['system.sante.endurance.value'] = Number(endurance?.actuelle)
|
||||||
|
}
|
||||||
|
|
||||||
|
const vie = XRegExp.exec(statString, XRegExp("vie\\s+(?<value>\\d+)\\s+(\\(actuelle\\s*:\\s+(?<actuelle>\\d+)\\))?", 'giu'));
|
||||||
|
if (vie?.value) {
|
||||||
|
if (newActor.getVieMax() != vie.value) {
|
||||||
|
const message = `Vérifier le calcul de la vie, calcul: ${newActor.getVieMax()} / import: ${vie.value}`;
|
||||||
|
RdDStatBlockParser.warning(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (vie?.actuelle) {
|
||||||
|
updates['system.sante.vie.value'] = Number(vie?.actuelle)
|
||||||
|
}
|
||||||
|
await newActor.update(updates)
|
||||||
|
}
|
||||||
|
|
||||||
static async parseHautReve(statString, actorData, items) {
|
static async parseHautReve(statString, actorData, items) {
|
||||||
let hautRevant = false;
|
let hautRevant = false;
|
||||||
// Attemp to detect spell
|
// Attemp to detect spell
|
||||||
@ -248,9 +276,8 @@ export class RdDStatBlockParser {
|
|||||||
}
|
}
|
||||||
items.push(sort);
|
items.push(sort);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
ui.notifications.warn(`Impossible de trouver le sort ${matchSort.name} / ${sortName}`)
|
RdDStatBlockParser.warning(`Impossible de trouver le sort ${matchSort.name} / ${sortName}`)
|
||||||
console.warn(`Impossible de trouver le sort ${matchSort.name} / ${sortName}`)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -264,7 +291,7 @@ export class RdDStatBlockParser {
|
|||||||
actorData.reve.tmrpos.coord = demiReve?.value ?? 'A1'
|
actorData.reve.tmrpos.coord = demiReve?.value ?? 'A1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static parsePersonnage(statString, actorData) {
|
static parsePersonnage(statString, actorData) {
|
||||||
actorData.reve.seuil.value = actorData.carac.reve.value
|
actorData.reve.seuil.value = actorData.carac.reve.value
|
||||||
|
|
||||||
@ -312,24 +339,10 @@ export class RdDStatBlockParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static parseCreature(statString, actorData) {
|
static parseCreature(statString, actorData) {
|
||||||
let plusDom = XRegExp.exec(statString, XRegExp("\\+dom\\s+(?<value>[\\+\\-]?\\d+)", 'giu'));
|
|
||||||
if (plusDom?.values) {
|
|
||||||
actorData.attributs.plusdom.value = Number(plusDom.value);
|
|
||||||
}
|
|
||||||
let protection = XRegExp.exec(statString, XRegExp("protection\\s+(?<value>[\\-]?\\d+)", 'giu'));
|
let protection = XRegExp.exec(statString, XRegExp("protection\\s+(?<value>[\\-]?\\d+)", 'giu'));
|
||||||
if (protection?.value) {
|
if (protection?.value) {
|
||||||
actorData.attributs.protection.value = Number(protection.value);
|
actorData.attributs.protection.value = Number(protection.value);
|
||||||
}
|
}
|
||||||
let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?<value>\\d+)", 'giu'));
|
|
||||||
if (endurance?.value) {
|
|
||||||
actorData.sante.endurance.value = Number(endurance.value);
|
|
||||||
actorData.sante.endurance.max = Number(endurance.value);
|
|
||||||
}
|
|
||||||
let vie = XRegExp.exec(statString, XRegExp("vie\\s+(?<value>\\d+)", 'giu'));
|
|
||||||
if (vie.value) {
|
|
||||||
actorData.sante.vie.value = Number(vie.value);
|
|
||||||
actorData.sante.vie.max = Number(vie.value);
|
|
||||||
}
|
|
||||||
let vitesse = XRegExp.exec(statString, XRegExp("vitesse\\s+(?<value>[\\d\\/]+)", 'giu'));
|
let vitesse = XRegExp.exec(statString, XRegExp("vitesse\\s+(?<value>[\\d\\/]+)", 'giu'));
|
||||||
if (vitesse?.value) {
|
if (vitesse?.value) {
|
||||||
actorData.attributs.vitesse.value = vitesse.value;
|
actorData.attributs.vitesse.value = vitesse.value;
|
||||||
@ -337,11 +350,6 @@ export class RdDStatBlockParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static parseEntite(statString, actorData) {
|
static parseEntite(statString, actorData) {
|
||||||
let plusDom = XRegExp.exec(statString, XRegExp("\\+dom\\s+(?<value>[\\+\\-]?\\d+)", 'giu'));
|
|
||||||
if (plusDom?.values) {
|
|
||||||
actorData.attributs.plusdom.value = Number(plusDom.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
actorData.definition.categorieentite = 'cauchemar'
|
actorData.definition.categorieentite = 'cauchemar'
|
||||||
actorData.definition.typeentite = ENTITE_NONINCARNE
|
actorData.definition.typeentite = ENTITE_NONINCARNE
|
||||||
let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?<value>\\d+)", 'giu'));
|
let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?<value>\\d+)", 'giu'));
|
||||||
@ -381,6 +389,11 @@ export class RdDStatBlockParser {
|
|||||||
return Misc.upperFirst(name?.value || "Importé");
|
return Misc.upperFirst(name?.value || "Importé");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static warning(message) {
|
||||||
|
ui.notifications.warn(message);
|
||||||
|
console.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user