Compare commits
6 Commits
dd296822bc
...
d7f2267d9c
Author | SHA1 | Date | |
---|---|---|---|
d7f2267d9c | |||
57d35a0f9a | |||
417db33752 | |||
bf0eea693a | |||
28ee8607bb | |||
91717a3290 |
@ -214,6 +214,8 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
|||||||
});
|
});
|
||||||
// Boutons spéciaux MJs
|
// Boutons spéciaux MJs
|
||||||
this.html.find('.forcer-tmr-aleatoire').click(async event => this.actor.reinsertionAleatoire("Action MJ"))
|
this.html.find('.forcer-tmr-aleatoire').click(async event => this.actor.reinsertionAleatoire("Action MJ"))
|
||||||
|
this.html.find('.don-de-haut-reve').click(async event => this.actor.addDonDeHautReve())
|
||||||
|
|
||||||
this.html.find('.afficher-tmr').click(async event => this.actor.changeTMRVisible())
|
this.html.find('.afficher-tmr').click(async event => this.actor.changeTMRVisible())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
|||||||
import { DialogChoixXpCarac } from "./dialog-choix-xp-carac.js";
|
import { DialogChoixXpCarac } from "./dialog-choix-xp-carac.js";
|
||||||
import { RdDItemArme } from "./item-arme.js";
|
import { RdDItemArme } from "./item-arme.js";
|
||||||
import { RdDCombatManager } from "./rdd-combat.js";
|
import { RdDCombatManager } from "./rdd-combat.js";
|
||||||
|
import { RdDItemTete } from "./item/tete.js";
|
||||||
|
import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||||
|
|
||||||
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
|
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
|
||||||
|
|
||||||
@ -87,7 +89,7 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$computeIsHautRevant() {
|
$computeIsHautRevant() {
|
||||||
this.system.attributs.hautrevant.value = this.itemTypes['tete'].find(it => Grammar.equalsInsensitive(it.name, 'don de haut-reve'))
|
this.system.attributs.hautrevant.value = this.itemTypes[ITEM_TYPES.tete].find(it => RdDItemTete.isDonDeHautReve(it))
|
||||||
? "Haut rêvant"
|
? "Haut rêvant"
|
||||||
: "";
|
: "";
|
||||||
}
|
}
|
||||||
@ -989,6 +991,16 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async addDonDeHautReve() {
|
||||||
|
if (!game.user.isGM || this.isHautRevant()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const donHR = await RdDItemTete.teteDonDeHautReve()
|
||||||
|
if (donHR) {
|
||||||
|
this.createEmbeddedDocuments('Item', [donHR.toObject()])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async reinsertionAleatoire(raison, accessible = tmr => true) {
|
async reinsertionAleatoire(raison, accessible = tmr => true) {
|
||||||
|
@ -169,10 +169,10 @@ export class Mapping {
|
|||||||
arme: arme
|
arme: arme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static dommagesArme(actor, arme, maniement){
|
static dommagesArme(actor, arme, maniement) {
|
||||||
const dmgArme = RdDItemArme.dommagesReels(arme, maniement)
|
const dmgArme = RdDItemArme.dommagesReels(arme, maniement)
|
||||||
const dommages = Misc.toSignedString(dmgArme + RdDBonus.bonusDmg(actor, maniement, dmgArme))
|
const dommages = Misc.toSignedString(dmgArme + RdDBonus.bonusDmg(actor, maniement, dmgArme))
|
||||||
switch(arme.system.mortalite) {
|
switch (arme.system.mortalite) {
|
||||||
case 'non-mortel': return `(${dommages})`
|
case 'non-mortel': return `(${dommages})`
|
||||||
case 'empoignade': return '-'
|
case 'empoignade': return '-'
|
||||||
}
|
}
|
||||||
@ -259,6 +259,9 @@ export class Mapping {
|
|||||||
const diff = 'R' + RdDItemSort.addSpaceToNonNumeric(sort.system.difficulte)
|
const diff = 'R' + RdDItemSort.addSpaceToNonNumeric(sort.system.difficulte)
|
||||||
return `${sort.name}${ptSeuil} (${caseTMR}) ${diff} ${coutReve}`
|
return `${sort.name}${ptSeuil} (${caseTMR}) ${diff} ${coutReve}`
|
||||||
}
|
}
|
||||||
|
static toVar(caseSpeciale) {
|
||||||
|
return Grammar.toLowerCaseNoAccent(caseSpeciale).startsWith('var') ? 'var' : caseSpeciale
|
||||||
|
}
|
||||||
|
|
||||||
static bonusCase(sort) {
|
static bonusCase(sort) {
|
||||||
const list = RdDItemSort.stringToBonuscases(sort.system.bonuscase).sort(Misc.descending(it => it.bonus))
|
const list = RdDItemSort.stringToBonuscases(sort.system.bonuscase).sort(Misc.descending(it => it.bonus))
|
||||||
|
@ -5,12 +5,12 @@ import { RdDBaseActorReve } from "../actor/base-actor-reve.js";
|
|||||||
import { Grammar } from "../grammar.js";
|
import { Grammar } from "../grammar.js";
|
||||||
import { Misc } from "../misc.js";
|
import { Misc } from "../misc.js";
|
||||||
import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js";
|
import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js";
|
||||||
|
import { RdDItemTete } from "../item/tete.js";
|
||||||
|
|
||||||
const WHITESPACES = "\\s+"
|
const WHITESPACES = "\\s+"
|
||||||
const NUMERIC = "[\\+\\-]?\\d+"
|
const NUMERIC = "[\\+\\-]?\\d+"
|
||||||
const NUMERIC_VALUE = "(?<value>" + NUMERIC + ")"
|
const NUMERIC_VALUE = "(?<value>" + NUMERIC + ")"
|
||||||
|
|
||||||
const XREGEXP_NAME = "(?<name>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)"
|
|
||||||
const XREGEXP_COMP_CREATURE = WHITESPACES + "(?<carac>\\d+)"
|
const XREGEXP_COMP_CREATURE = WHITESPACES + "(?<carac>\\d+)"
|
||||||
+ WHITESPACES + NUMERIC_VALUE
|
+ WHITESPACES + NUMERIC_VALUE
|
||||||
+ "(" + WHITESPACES + "(?<init>\\d+)?\\s+?(?<dommages>[\\+\\-]?\\d+)?" + ")?"
|
+ "(" + WHITESPACES + "(?<init>\\d+)?\\s+?(?<dommages>[\\+\\-]?\\d+)?" + ")?"
|
||||||
@ -22,11 +22,12 @@ const compParser = {
|
|||||||
entite: XREGEXP_COMP_CREATURE
|
entite: XREGEXP_COMP_CREATURE
|
||||||
}
|
}
|
||||||
|
|
||||||
const XREGEXP_SORT_VOIE = "[OHNT\\/]+"
|
const XREGEXP_SORT_VOIE = "(?<voies>[OHNT](\\/[OHNT])*)"
|
||||||
|
const XREGEXP_SORT_NAME = "(?<name>[^\\(]+)"
|
||||||
const XREGEXP_SORT_CASE = "\\((?<case>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)\\)";
|
const XREGEXP_SORT_CASE = "\\((?<case>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)\\)";
|
||||||
|
|
||||||
const XREGEXP_SORT = "(" + XREGEXP_SORT_VOIE
|
const XREGEXP_SORT = "(" + XREGEXP_SORT_VOIE
|
||||||
+ WHITESPACES + XREGEXP_NAME
|
+ WHITESPACES + XREGEXP_SORT_NAME
|
||||||
+ WHITESPACES + XREGEXP_SORT_CASE
|
+ WHITESPACES + XREGEXP_SORT_CASE
|
||||||
+ WHITESPACES + "R(?<diff>([\\-\\d]+|(\\w|\\s)+))"
|
+ WHITESPACES + "R(?<diff>([\\-\\d]+|(\\w|\\s)+))"
|
||||||
+ WHITESPACES + "r(?<reve>(\\d+(\\+)?|\\s\\w+))"
|
+ WHITESPACES + "r(?<reve>(\\d+(\\+)?|\\s\\w+))"
|
||||||
@ -104,7 +105,7 @@ export class RdDStatBlockParser {
|
|||||||
return "vaisseau";
|
return "vaisseau";
|
||||||
}
|
}
|
||||||
|
|
||||||
static async parseStatBlock(statString, type = "npc") {
|
static async parseStatBlock(statString) {
|
||||||
|
|
||||||
//statString = statBlock03;
|
//statString = statBlock03;
|
||||||
if (!statString) {
|
if (!statString) {
|
||||||
@ -122,10 +123,10 @@ export class RdDStatBlockParser {
|
|||||||
statString = statString.trim();
|
statString = statString.trim();
|
||||||
|
|
||||||
// TODO: check for entite
|
// TODO: check for entite
|
||||||
let actorType = RdDStatBlockParser.parseActorType(statString);
|
let type = RdDStatBlockParser.parseActorType(statString);
|
||||||
|
|
||||||
// Now start carac
|
// Now start carac
|
||||||
let actorData = foundry.utils.deepClone(game.model.Actor[actorType]);
|
let actorData = foundry.utils.deepClone(game.model.Actor[type]);
|
||||||
for (let key in actorData.carac) {
|
for (let key in actorData.carac) {
|
||||||
let caracDef = actorData.carac[key];
|
let caracDef = actorData.carac[key];
|
||||||
// Parse the stat string for each caracteristic
|
// Parse the stat string for each caracteristic
|
||||||
@ -136,7 +137,7 @@ export class RdDStatBlockParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If creature we need to setup additionnal fields
|
// If creature we need to setup additionnal fields
|
||||||
switch (actorType) {
|
switch (type) {
|
||||||
case "creature":
|
case "creature":
|
||||||
RdDStatBlockParser.parseCreature(statString, actorData)
|
RdDStatBlockParser.parseCreature(statString, actorData)
|
||||||
break
|
break
|
||||||
@ -147,14 +148,14 @@ export class RdDStatBlockParser {
|
|||||||
|
|
||||||
let items = [];
|
let items = [];
|
||||||
// Get skills from compendium
|
// Get skills from compendium
|
||||||
const competences = await SystemCompendiums.getCompetences(actorType);
|
const competences = await SystemCompendiums.getCompetences(type);
|
||||||
//console.log("Competences : ", competences);
|
//console.log("Competences : ", competences);
|
||||||
for (let comp of competences) {
|
for (let comp of competences) {
|
||||||
let compMatch = XRegExp.exec(statString, XRegExp(comp.name + compParser[actorType], 'giu'));
|
let compMatch = XRegExp.exec(statString, XRegExp(comp.name + compParser[type], 'giu'));
|
||||||
if (compMatch) {
|
if (compMatch) {
|
||||||
comp = comp.toObject()
|
comp = comp.toObject()
|
||||||
comp.system.niveau = Number(compMatch.value);
|
comp.system.niveau = Number(compMatch.value);
|
||||||
if (actorType == "creature" || actorType == "entite") {
|
if (type == "creature" || type == "entite") {
|
||||||
comp.system.carac_value = Number(compMatch.carac);
|
comp.system.carac_value = Number(compMatch.carac);
|
||||||
if (compMatch.dommages != undefined) {
|
if (compMatch.dommages != undefined) {
|
||||||
comp.system.dommages = Number(compMatch.dommages);
|
comp.system.dommages = Number(compMatch.dommages);
|
||||||
@ -163,7 +164,7 @@ export class RdDStatBlockParser {
|
|||||||
}
|
}
|
||||||
items.push(comp)
|
items.push(comp)
|
||||||
}
|
}
|
||||||
else if (actorType == "personnage") {
|
else if (type == "personnage") {
|
||||||
comp = comp.toObject()
|
comp = comp.toObject()
|
||||||
items.push(comp)
|
items.push(comp)
|
||||||
}
|
}
|
||||||
@ -213,82 +214,101 @@ export class RdDStatBlockParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attemp to detect spell
|
|
||||||
let hautRevant = false
|
|
||||||
let sorts = await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-oniros")
|
|
||||||
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-hypnos"))
|
|
||||||
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-narcos"))
|
|
||||||
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-thanatos"))
|
|
||||||
|
|
||||||
XRegExp.forEach(statString, XRegExp(XREGEXP_SORT, 'giu'),
|
if (type == "personnage") {
|
||||||
|
await RdDStatBlockParser.parseHautReve(statString, actorData, items);
|
||||||
|
RdDStatBlockParser.parsePersonnage(statString, actorData);
|
||||||
|
}
|
||||||
|
|
||||||
|
let name = RdDStatBlockParser.extractName(type, statString);
|
||||||
|
|
||||||
|
let newActor = await RdDBaseActorReve.create({ name, type: type, system: actorData, items });
|
||||||
|
await newActor.remiseANeuf()
|
||||||
|
// DUmp....
|
||||||
|
console.log(actorData);
|
||||||
|
}
|
||||||
|
|
||||||
|
static async parseHautReve(statString, actorData, items) {
|
||||||
|
let hautRevant = false;
|
||||||
|
// Attemp to detect spell
|
||||||
|
let sorts = await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-oniros");
|
||||||
|
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-hypnos"));
|
||||||
|
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-narcos"));
|
||||||
|
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-thanatos"));
|
||||||
|
|
||||||
|
XRegExp.forEach(statString, XRegExp(XREGEXP_SORT, 'gu' /* keep case sensitive to match the spell draconic skill */),
|
||||||
function (matchSort, i) {
|
function (matchSort, i) {
|
||||||
let sort = sorts.find(s => Grammar.equalsInsensitive(s.name, matchSort.name))
|
const sortName = Grammar.toLowerCaseNoAccent(matchSort.name).trim().replace("’", "'");
|
||||||
|
let sort = sorts.find(s => Grammar.toLowerCaseNoAccent(s.name) == sortName)
|
||||||
if (sort) {
|
if (sort) {
|
||||||
hautRevant = true
|
hautRevant = true;
|
||||||
sort = sort.toObject();
|
sort = sort.toObject();
|
||||||
if (matchSort.bonus && matchSort.bonuscase) {
|
if (matchSort.bonus && matchSort.bonuscase) {
|
||||||
sort.system.bonuscase = `${matchSort.bonuscase}:${matchSort.bonus}`
|
sort.system.bonuscase = `${matchSort.bonuscase}:${matchSort.bonus}`;
|
||||||
}
|
}
|
||||||
items.push(sort);
|
items.push(sort);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
ui.notifications.warn(`Impossible de trouver le sort ${matchSort.name} / ${sortName}`)
|
||||||
|
console.warn(`Impossible de trouver le sort ${matchSort.name} / ${sortName}`)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (hautRevant) {
|
if (hautRevant) {
|
||||||
let tetes = await SystemCompendiums.getWorldOrCompendiumItems("tete", "tetes-de-dragon-pour-tous-personnages")
|
const donHR = await RdDItemTete.teteDonDeHautReve();
|
||||||
let donHR = tetes.find(t => Grammar.equalsInsensitive(t.name, "Don de Haut-Rêve"))
|
|
||||||
if (donHR) {
|
if (donHR) {
|
||||||
items.push(donHR.toObject());
|
items.push(donHR.toObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const demiReve = XRegExp.exec(statString, XRegExp("Demi-rêve\\s+(?<value>[A-M]\\d{1,2})", 'giu'))
|
||||||
|
actorData.reve.tmrpos.coord = demiReve?.value ?? 'A1'
|
||||||
}
|
}
|
||||||
if (actorType == "personnage") {
|
}
|
||||||
|
|
||||||
let feminin = XRegExp.exec(statString, XRegExp("né(?<value>e?) à", 'giu'));
|
static parsePersonnage(statString, actorData) {
|
||||||
actorData.sexe = (feminin?.value == 'e') ? 'féminin' : 'masculin'
|
actorData.reve.seuil.value = actorData.carac.reve.value
|
||||||
|
|
||||||
// Get hour name : heure du XXXXX
|
const reveActuel = XRegExp.exec(statString, XRegExp("Rêve actuel\\s+(?<value>\\d+)", 'giu'))
|
||||||
let heure = XRegExp.exec(statString, XRegExp("heure (du|de la|des|de l\')\\s*(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s]+),", 'giu'));
|
actorData.reve.reve.value = reveActuel?.value ? Number(reveActuel.value) : actorData.reve.seuil.value
|
||||||
actorData.heure = this.getHeureKey(heure?.value || "Vaisseau");
|
|
||||||
|
|
||||||
// Get age
|
const feminin = XRegExp.exec(statString, XRegExp("né(?<value>e?) à", 'giu'));
|
||||||
let age = XRegExp.exec(statString, XRegExp("(?<value>\\d+) ans", 'giu'));
|
actorData.sexe = (feminin?.value == 'e') ? 'féminin' : 'masculin';
|
||||||
if (age?.value) {
|
|
||||||
actorData.age = Number(age.value);
|
|
||||||
}
|
|
||||||
// Get height
|
|
||||||
let taille = XRegExp.exec(statString, XRegExp("(?<value>\\d+m\\d+)", 'giu'));
|
|
||||||
if (taille?.value) {
|
|
||||||
actorData.taille = taille.value;
|
|
||||||
}
|
|
||||||
// Get weight
|
|
||||||
let poids = XRegExp.exec(statString, XRegExp("(?<value>\\d+) kg", 'giu'));
|
|
||||||
if (poids?.value) {
|
|
||||||
actorData.poids = poids.value;
|
|
||||||
}
|
|
||||||
// Get cheveux
|
|
||||||
let cheveux = XRegExp.exec(statString, XRegExp("kg,\\s+(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+),\\s+yeux", 'giu'));
|
|
||||||
if (cheveux?.value) {
|
|
||||||
actorData.cheveux = cheveux.value;
|
|
||||||
}
|
|
||||||
// Get yeux
|
|
||||||
let yeux = XRegExp.exec(statString, XRegExp("yeux\\s+(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+), Beau", 'giu'));
|
|
||||||
if (yeux?.value) {
|
|
||||||
actorData.yeux = yeux.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get beauty
|
// Get hour name : heure du XXXXX
|
||||||
let beaute = XRegExp.exec(statString, XRegExp("beauté\\s+(?<value>\\d+)", 'giu'));
|
const heure = XRegExp.exec(statString, XRegExp("heure (du|de la|des|de l\')\\s*(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s]+),", 'giu'));
|
||||||
if (beaute?.value) {
|
actorData.heure = this.getHeureKey(heure?.value || "Vaisseau");
|
||||||
actorData.beaute = Number(beaute.value);
|
|
||||||
}
|
// Get age
|
||||||
|
const age = XRegExp.exec(statString, XRegExp("(?<value>\\d+) ans", 'giu'));
|
||||||
|
if (age?.value) {
|
||||||
|
actorData.age = Number(age.value);
|
||||||
|
}
|
||||||
|
// Get height
|
||||||
|
const taille = XRegExp.exec(statString, XRegExp("(?<value>\\d+m\\d+)", 'giu'));
|
||||||
|
if (taille?.value) {
|
||||||
|
actorData.taille = taille.value;
|
||||||
|
}
|
||||||
|
// Get weight
|
||||||
|
const poids = XRegExp.exec(statString, XRegExp("(?<value>\\d+) kg", 'giu'));
|
||||||
|
if (poids?.value) {
|
||||||
|
actorData.poids = poids.value;
|
||||||
|
}
|
||||||
|
// Get cheveux
|
||||||
|
const cheveux = XRegExp.exec(statString, XRegExp("kg,\\s+(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+),\\s+yeux", 'giu'));
|
||||||
|
if (cheveux?.value) {
|
||||||
|
actorData.cheveux = cheveux.value;
|
||||||
|
}
|
||||||
|
// Get yeux
|
||||||
|
const yeux = XRegExp.exec(statString, XRegExp("yeux\\s+(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+), Beau", 'giu'));
|
||||||
|
if (yeux?.value) {
|
||||||
|
actorData.yeux = yeux.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name is all string before ', né'
|
// Get beauty
|
||||||
let name = RdDStatBlockParser.extractName(actorType, statString);
|
const beaute = XRegExp.exec(statString, XRegExp("beauté\\s+(?<value>\\d+)", 'giu'));
|
||||||
|
if (beaute?.value) {
|
||||||
let newActor = RdDBaseActorReve.create({ name: name || "Importé", type: actorType, system: actorData, items: items });
|
actorData.beaute = Number(beaute.value);
|
||||||
|
}
|
||||||
// DUmp....
|
|
||||||
console.log(actorData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static parseCreature(statString, actorData) {
|
static parseCreature(statString, actorData) {
|
||||||
@ -350,24 +370,17 @@ export class RdDStatBlockParser {
|
|||||||
|
|
||||||
static extractName(actorType, statString) {
|
static extractName(actorType, statString) {
|
||||||
switch (actorType) {
|
switch (actorType) {
|
||||||
case "personnage": return RdDStatBlockParser.extractNamePersonnage(statString);
|
case "personnage":
|
||||||
case "creature": return RdDStatBlockParser.extractNameCreature(statString);
|
// Name is all string before first comma ','
|
||||||
|
const namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\s\\d]+),", 'giu'));
|
||||||
|
if (namePersonnage?.value) {
|
||||||
|
return Misc.upperFirst(namePersonnage?.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return RdDStatBlockParser.extractNameCreature(statString);
|
|
||||||
}
|
|
||||||
|
|
||||||
static extractNamePersonnage(statString) {
|
|
||||||
let name = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\s\\d]+),", 'giu'));
|
|
||||||
if (!name?.value) {
|
|
||||||
name = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+taille", 'giu'));
|
|
||||||
}
|
|
||||||
return Misc.upperFirst(name?.value || "Importé");
|
|
||||||
}
|
|
||||||
|
|
||||||
static extractNameCreature(statString) {
|
|
||||||
const name = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+taille", 'giu'));
|
const name = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+taille", 'giu'));
|
||||||
return Misc.upperFirst(name?.value || "Importé");
|
return Misc.upperFirst(name?.value || "Importé");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
|
25
module/item/tete.js
Normal file
25
module/item/tete.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { Grammar } from "../grammar.js"
|
||||||
|
import { ITEM_TYPES, RdDItem } from "../item.js"
|
||||||
|
import { SystemCompendiums } from "../settings/system-compendiums.js"
|
||||||
|
|
||||||
|
const DON_HAUT_REVE = "Don de Haut-Rêve"
|
||||||
|
|
||||||
|
export class RdDItemTete extends RdDItem {
|
||||||
|
|
||||||
|
static get defaultIcon() {
|
||||||
|
return "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp"
|
||||||
|
}
|
||||||
|
|
||||||
|
static isDonDeHautReve(tete) {
|
||||||
|
return tete.type == ITEM_TYPES.tete && Grammar.equalsInsensitive(tete.name, DON_HAUT_REVE)
|
||||||
|
}
|
||||||
|
|
||||||
|
static async teteDonDeHautReve() {
|
||||||
|
const tetes = await SystemCompendiums.getItems("tetes-de-dragon-pour-tous-personnages", ITEM_TYPES.tete)
|
||||||
|
const tete = tetes.find(it => RdDItemTete.isDonDeHautReve(it))
|
||||||
|
if (!tete) {
|
||||||
|
ui.notifications.warn(`Impossible de trouver la tête "${DON_HAUT_REVE}", vérifiez le compendium de têtes pour tous personnages`)
|
||||||
|
}
|
||||||
|
return tete
|
||||||
|
}
|
||||||
|
}
|
@ -137,7 +137,7 @@ class _10_0_21_VehiculeStructureResistanceMax extends Migration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _10_0_33_MigrationNomsDraconic extends Migration {
|
class _10_0_33_MigrationNomsDraconic extends Migration {
|
||||||
get code() { return "competences-creature-parade"; }
|
get code() { return "competences-nom-draconic"; }
|
||||||
get version() { return "10.0.33"; }
|
get version() { return "10.0.33"; }
|
||||||
|
|
||||||
migrationNomDraconic(ancien) {
|
migrationNomDraconic(ancien) {
|
||||||
@ -530,15 +530,25 @@ class _11_2_20_MigrationAstrologie extends Migration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _12_0_24_MigrationVoieSorts extends Migration {
|
class _12_0_26_MigrationVoieSorts extends Migration {
|
||||||
get code() { return "migration-voies-sorts" }
|
get code() { return "migration-voies-sorts" }
|
||||||
get version() { return "12.0.24" }
|
get version() { return "12.0.26" }
|
||||||
|
|
||||||
async migrate() {
|
async migrate() {
|
||||||
await this.applyItemsUpdates(items => items
|
await this.applyItemsUpdates(items => items
|
||||||
.filter(it => ITEM_TYPES.sort == it.type)
|
.filter(it => [ITEM_TYPES.sort, ITEM_TYPES.sortreserve].includes(it.type))
|
||||||
.map(it => this.migrateSort(it))
|
.map(it => this.migrateSort(it))
|
||||||
)
|
)
|
||||||
|
await this.applyItemsUpdates(items => items
|
||||||
|
.filter(it => ITEM_TYPES.competence == it.type && it.system.categorie == 'draconic')
|
||||||
|
.map(it => this.migrateDraconic(it))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
migrateDraconic(it) {
|
||||||
|
return {
|
||||||
|
_id: it.id,
|
||||||
|
name: this.convertDraconic(it.name),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
migrateSort(it) {
|
migrateSort(it) {
|
||||||
return {
|
return {
|
||||||
@ -575,6 +585,7 @@ export class Migrations {
|
|||||||
new _10_7_19_CategorieCompetenceCreature(),
|
new _10_7_19_CategorieCompetenceCreature(),
|
||||||
new _10_7_19_PossessionsEntiteVictime(),
|
new _10_7_19_PossessionsEntiteVictime(),
|
||||||
new _11_2_20_MigrationAstrologie(),
|
new _11_2_20_MigrationAstrologie(),
|
||||||
|
new _12_0_26_MigrationVoieSorts()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.
|
|||||||
import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js"
|
import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js"
|
||||||
import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
|
import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
|
||||||
import { RdDItemSort } from "./item-sort.js"
|
import { RdDItemSort } from "./item-sort.js"
|
||||||
|
import { RdDItemTete } from "./item/tete.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RdD system
|
* RdD system
|
||||||
@ -97,6 +98,7 @@ export class SystemReveDeDragon {
|
|||||||
ombre: RdDItemOmbre,
|
ombre: RdDItemOmbre,
|
||||||
poison: RdDItemPoison,
|
poison: RdDItemPoison,
|
||||||
queue: RdDItemQueue,
|
queue: RdDItemQueue,
|
||||||
|
tete: RdDItemTete,
|
||||||
rencontre: RdDRencontre,
|
rencontre: RdDRencontre,
|
||||||
service: RdDItemService,
|
service: RdDItemService,
|
||||||
signedraconique: RdDItemSigneDraconique,
|
signedraconique: RdDItemSigneDraconique,
|
||||||
|
@ -145,8 +145,8 @@ export class RdDUtility {
|
|||||||
'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.hbs',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.hbs',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.html',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { ChatUtility } from "../chat-utility.js";
|
import { ChatUtility } from "../chat-utility.js";
|
||||||
import { HIDE_DICE, SYSTEM_RDD } from "../constants.js";
|
import { HIDE_DICE, SYSTEM_RDD } from "../constants.js";
|
||||||
|
import { Grammar } from "../grammar.js";
|
||||||
import { RdDItem } from "../item.js";
|
import { RdDItem } from "../item.js";
|
||||||
import { Misc } from "../misc.js";
|
import { Misc } from "../misc.js";
|
||||||
import { RdDDice } from "../rdd-dice.js";
|
import { RdDDice } from "../rdd-dice.js";
|
||||||
@ -84,15 +85,14 @@ export class SystemCompendiums extends FormApplication {
|
|||||||
static async getWorldOrCompendiumItems(itemType, compendium) {
|
static async getWorldOrCompendiumItems(itemType, compendium) {
|
||||||
let items = game.items.filter(it => it.type == itemType)
|
let items = game.items.filter(it => it.type == itemType)
|
||||||
if (compendium) {
|
if (compendium) {
|
||||||
const ids = items.map(it => it.id);
|
const ids = items.map(it => it.id)
|
||||||
const names = items.map(it => it.name.toLowerCase());
|
const names = items.map(it => Grammar.toLowerCaseNoAccent(it.name))
|
||||||
const compendiumItems = await SystemCompendiums.getItems(compendium);
|
const compendiumItems = await SystemCompendiums.getItems(compendium, itemType)
|
||||||
items = items.concat(compendiumItems
|
return items.concat(compendiumItems
|
||||||
.filter(it => it.type == itemType)
|
|
||||||
.filter(it => !ids.includes(it.id))
|
.filter(it => !ids.includes(it.id))
|
||||||
.filter(it => !names.includes(it.name.toLowerCase())));
|
.filter(it => !names.includes(Grammar.equalsInsensitive(it.name))))
|
||||||
}
|
}
|
||||||
return items;
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
static async loadDocument(document) {
|
static async loadDocument(document) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name: Voie d'Hypnos
|
name: Hypnos
|
||||||
type: competence
|
type: competence
|
||||||
img: systems/foundryvtt-reve-de-dragon/icons/competence_hypnos.webp
|
img: systems/foundryvtt-reve-de-dragon/icons/competence_hypnos.webp
|
||||||
_id: bt2cR4aE6lIOeg4F
|
_id: bt2cR4aE6lIOeg4F
|
@ -1,4 +1,4 @@
|
|||||||
name: Voie de Narcos
|
name: Narcos
|
||||||
type: competence
|
type: competence
|
||||||
img: systems/foundryvtt-reve-de-dragon/icons/competence_narcos.webp
|
img: systems/foundryvtt-reve-de-dragon/icons/competence_narcos.webp
|
||||||
_id: u1Peok1EYkBcVsmN
|
_id: u1Peok1EYkBcVsmN
|
@ -1,4 +1,4 @@
|
|||||||
name: Voie d'Oniros
|
name: Oniros
|
||||||
type: competence
|
type: competence
|
||||||
img: systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp
|
img: systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp
|
||||||
_id: nnR2UHelUaF8dxYn
|
_id: nnR2UHelUaF8dxYn
|
@ -1,4 +1,4 @@
|
|||||||
name: Voie de Thanatos
|
name: Thanatos
|
||||||
type: competence
|
type: competence
|
||||||
img: systems/foundryvtt-reve-de-dragon/icons/competence_thanatos.webp
|
img: systems/foundryvtt-reve-de-dragon/icons/competence_thanatos.webp
|
||||||
_id: dPlTQzvU3CEg5qKc
|
_id: dPlTQzvU3CEg5qKc
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"id": "foundryvtt-reve-de-dragon",
|
"id": "foundryvtt-reve-de-dragon",
|
||||||
"title": "Rêve de Dragon",
|
"title": "Rêve de Dragon",
|
||||||
"version": "12.0.24",
|
"version": "12.0.26",
|
||||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.24/rddsystem.zip",
|
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.26/rddsystem.zip",
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download//12.0.24/system.json",
|
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.26/system.json",
|
||||||
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
|
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "11",
|
"minimum": "11",
|
||||||
|
@ -129,11 +129,10 @@
|
|||||||
<div>
|
<div>
|
||||||
{{#if system.attributs.hautrevant.value}}
|
{{#if system.attributs.hautrevant.value}}
|
||||||
<h3>Haut rêvant</h3>
|
<h3>Haut rêvant</h3>
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.html"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.hbs"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<h3>Vous n'avez pas le don de haut-rêve</h3>
|
<h3>Vous n'avez pas le don de haut-rêve</h3>
|
||||||
<p>Attribuer la Tête de Dragon 'Don de Haut Rêve' pour rendre le personnage Haut-Rêvant.</p>
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.hbs"}}
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.html"}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<br><br>
|
<br><br>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.html"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.hbs"}}
|
||||||
<hr>
|
<hr>
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-signes-draconiques.html"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-signes-draconiques.html"}}
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-rencontres.html"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-rencontres.html"}}
|
41
templates/actor/non-haut-revant.hbs
Normal file
41
templates/actor/non-haut-revant.hbs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{{#if (not system.attributs.hautrevant.value)}}
|
||||||
|
<p>Attribuer la Tête de Dragon
|
||||||
|
{{#if options.isGM}}
|
||||||
|
<a class="chat-card-button don-de-haut-reve" data-tooltip="Donner le don de haut-rêve">Don de Haut Rêve</a>
|
||||||
|
{{else}}
|
||||||
|
'Don de Haut Rêve'
|
||||||
|
{{/if}}
|
||||||
|
pour rendre le personnage Haut-Rêvant.</p>
|
||||||
|
{{/if}}
|
||||||
|
<li class="item flexrow">
|
||||||
|
<span class="competence-label">Seuil de Rêve :</span>
|
||||||
|
<span>
|
||||||
|
{{#if options.isGM}}
|
||||||
|
<input class="competence-value seuil-reve-value" type="text" name="system.reve.seuil.value" value="{{system.reve.seuil.value}}" data-dtype="Number"/>
|
||||||
|
{{else}}
|
||||||
|
{{system.reve.seuil.value}}
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="item flexrow" >
|
||||||
|
<span class="competence-label">Refoulement : </span>
|
||||||
|
<span>
|
||||||
|
{{#if options.isGM}}
|
||||||
|
<input class="competence-value" type="text" name="system.reve.refoulement.value" value="{{system.reve.refoulement.value}}" data-dtype="Number"/>
|
||||||
|
{{else}}
|
||||||
|
{{system.reve.refoulement.value}}
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
{{#if system.reve.reve.thanatosused}}
|
||||||
|
<li class="item flexrow" >
|
||||||
|
<span class="competence-label">La prochaine queue est une Ombre</span>
|
||||||
|
<span>
|
||||||
|
<img class="sheet-competence-img" src="systems/foundryvtt-reve-de-dragon/icons/competence_thanatos.webp"/>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
<hr>
|
||||||
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html"}}
|
||||||
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.html"}}
|
||||||
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-tetes.html"}}
|
@ -1,34 +0,0 @@
|
|||||||
<ul class="item-list">
|
|
||||||
<li class="item flexrow">
|
|
||||||
<span class="competence-label">Seuil de Rêve :</span>
|
|
||||||
<span>
|
|
||||||
{{#if options.isGM}}
|
|
||||||
<input class="competence-value seuil-reve-value" type="text" name="system.reve.seuil.value" value="{{system.reve.seuil.value}}" data-dtype="Number"/>
|
|
||||||
{{else}}
|
|
||||||
{{system.reve.seuil.value}}
|
|
||||||
{{/if}}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li class="item flexrow" >
|
|
||||||
<span class="competence-label">Refoulement : </span>
|
|
||||||
<span>
|
|
||||||
{{#if options.isGM}}
|
|
||||||
<input class="competence-value" type="text" name="system.reve.refoulement.value" value="{{system.reve.refoulement.value}}" data-dtype="Number"/>
|
|
||||||
{{else}}
|
|
||||||
{{system.reve.refoulement.value}}
|
|
||||||
{{/if}}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
{{#if system.reve.reve.thanatosused}}
|
|
||||||
<li class="item flexrow" >
|
|
||||||
<span class="competence-label">La prochaine queue est une Ombre</span>
|
|
||||||
<span>
|
|
||||||
<img class="sheet-competence-img" src="systems/foundryvtt-reve-de-dragon/icons/competence_thanatos.webp"/>
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
</ul>
|
|
||||||
<hr>
|
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html"}}
|
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.html"}}
|
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-tetes.html"}}
|
|
Loading…
x
Reference in New Issue
Block a user