Gestion des signes draconiques #455
61
dev-notes.md
Normal file
61
dev-notes.md
Normal file
@ -0,0 +1,61 @@
|
||||
# Actor notes
|
||||
|
||||
> The Actor#getData default implementation gives you the following for use in sheet rendering:
|
||||
|
||||
```
|
||||
actor -> the Actor instance
|
||||
data -> a cloned copy of Actor#data
|
||||
items -> a cloned copy of Actor#data#items
|
||||
effects -> a cloned copy of Actor#data#effects
|
||||
```
|
||||
|
||||
> if all you need is a safe copy of `Actor#data`, you'll be much better off by simply defining your own function and avoiding all the wasted work that the parent class does which will slow down your sheet
|
||||
```js
|
||||
getData(options) {
|
||||
return {
|
||||
data: foundry.utils.deepClone(this.object.data)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
who knows, maybe you don't even need to copy your actor data, skip the copy and it's even faster:
|
||||
```js
|
||||
getData(options) {
|
||||
return {
|
||||
data: this.object.data
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Atropos19/02/2021
|
||||
There are two recommended ways to create owned items in 0.8.0:
|
||||
```js
|
||||
await Item.create(itemData, {parent: actor});
|
||||
await actor.createEmbeddedDocuments("Item", itemDataArray);
|
||||
```
|
||||
|
||||
|
||||
You can update an embedded item in one of two ways:
|
||||
```js
|
||||
//Method 1:
|
||||
|
||||
const item = actor.items.get(itemId);
|
||||
item.update(data);
|
||||
|
||||
//Method 2:
|
||||
actor.updateEmbeddedDocuments("Item", [{_id: itemId, ...}]);
|
||||
```
|
||||
|
||||
|
||||
I noticed adding an ActiveEffect to an actor in code using
|
||||
|
||||
```js
|
||||
this.createEmbeddedDocuments('ActiveEffect', [effet], options);
|
||||
this.applyActiveEffects();
|
||||
```
|
||||
|
||||
Atropos — Aujourd’hui à 14:42
|
||||
Two notes on this:
|
||||
1. You don't actually need to call this.applyActiveEffects() because this will happen automatically whenever an effect is created/updated/deleted
|
||||
2. If you want to suppress the automatic display of the sheet for the newly created document, you can pass options.renderSheet = false as part of your options object
|
@ -71,7 +71,7 @@ export class RdDActorEntiteSheet extends ActorSheet {
|
||||
// Update Inventory Item
|
||||
html.find('.item-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
const item = this.actor.getEmbeddedDocuments('Item', li.data("itemId"));
|
||||
const item = this.actor.getEmbeddedDocument('Item', li.data("itemId"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
|
||||
|
@ -95,7 +95,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
caracTotal: RdDCarac.computeTotal(formData.data.carac, formData.data.beaute),
|
||||
// Mise à jour de l'encombrement total et du prix de l'équipement
|
||||
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
|
||||
prixTotalEquipement: await this.actor.computePrixTotalEquipement(),
|
||||
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
||||
surprise: RdDBonus.find(this.actor.getSurprise(false)).descr,
|
||||
fatigue: {
|
||||
malus: RdDUtility.calculMalusFatigue(formData.data.sante.fatigue.value, formData.data.sante.endurance.max),
|
||||
@ -173,16 +173,16 @@ export class RdDActorSheet extends ActorSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async creerObjet() {
|
||||
let itemType = $("#creer-equipement").val();
|
||||
let itemType = $(".item-type").val();
|
||||
await this.createItem('Nouveau ' + itemType, itemType);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async selectObjetType() {
|
||||
let itemType = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "monnaie"];
|
||||
let options = '<span class="competence-label">Selectionnez le type d\'équipement</span><select id="creer-equipement">';
|
||||
for (let typeName of itemType) {
|
||||
options += '<option value="' + typeName + '">' + typeName + '</option>'
|
||||
let typeObjets = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "monnaie"];
|
||||
let options = `<span class="competence-label">Selectionnez le type d'équipement</span><select class="item-type">`;
|
||||
for (let typeName of typeObjets) {
|
||||
options += `<option value="${typeName}">${typeName}</option>`
|
||||
}
|
||||
options += '</select>';
|
||||
let d = new Dialog({
|
||||
@ -199,6 +199,27 @@ export class RdDActorSheet extends ActorSheet {
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async selectTypeOeuvre() {
|
||||
let typeOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu" ];
|
||||
let options = `<span class="competence-label">Selectionnez le type d'oeuvre</span><select class="item-type">`;
|
||||
for (let typeName of typeOeuvres) {
|
||||
options += `<option value="${typeName}">${typeName}</option>`
|
||||
}
|
||||
options += '</select>';
|
||||
let d = new Dialog({
|
||||
title: "Créer une oeuvre",
|
||||
content: options,
|
||||
buttons: {
|
||||
one: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Créer l'oeuvre",
|
||||
callback: () => this.creerObjet()
|
||||
}
|
||||
}
|
||||
});
|
||||
d.render(true);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
@ -246,12 +267,15 @@ export class RdDActorSheet extends ActorSheet {
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
html.find('#creer-tache').click(ev => {
|
||||
html.find('.creer-tache').click(ev => {
|
||||
this.createEmptyTache();
|
||||
});
|
||||
html.find('#creer-un-objet').click(ev => {
|
||||
html.find('.creer-un-objet').click(ev => {
|
||||
this.selectObjetType();
|
||||
});
|
||||
html.find('.creer-une-oeuvre').click(ev => {
|
||||
this.selectTypeOeuvre();
|
||||
});
|
||||
html.find('#nettoyer-conteneurs').click(ev => {
|
||||
this.actor.nettoyerConteneurs();
|
||||
});
|
||||
@ -407,19 +431,19 @@ export class RdDActorSheet extends ActorSheet {
|
||||
// Display info about queue
|
||||
html.find('.queuesouffle-label a').click((event) => {
|
||||
let myID = event.currentTarget.attributes['data-item-id'].value;
|
||||
const item = this.actor.getEmbeddedDocuments('Item', myID);
|
||||
const item = this.actor.getEmbeddedDocument('Item', myID);
|
||||
item.sheet.render(true);
|
||||
});
|
||||
// Info sort
|
||||
html.find('.sort-label a').click((event) => {
|
||||
let myID = event.currentTarget.attributes['data-id'].value;
|
||||
const item = this.actor.getEmbeddedDocuments('Item', myID);
|
||||
const item = this.actor.getEmbeddedDocument('Item', myID);
|
||||
item.sheet.render(true);
|
||||
});
|
||||
// Info sort
|
||||
html.find('.case-label a').click((event) => {
|
||||
let myID = event.currentTarget.attributes['data-id'].value;
|
||||
const item = this.actor.getEmbeddedDocuments('Item', myID);
|
||||
const item = this.actor.getEmbeddedDocument('Item', myID);
|
||||
item.sheet.render(true);
|
||||
});
|
||||
|
||||
|
@ -87,7 +87,7 @@ export class RdDActorVehiculeSheet extends ActorSheet {
|
||||
// Update Inventory Item
|
||||
html.find('.item-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
const item = this.actor.getEmbeddedDocuments('Item', li.data("itemId"));
|
||||
const item = this.actor.getEmbeddedDocument('Item', li.data("itemId"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
// Delete Inventory Item
|
||||
|
191
module/actor.js
191
module/actor.js
@ -57,39 +57,38 @@ export class RdDActor extends Actor {
|
||||
* This overrided create() function adds initial items
|
||||
* Namely: Basic skills, money,
|
||||
*
|
||||
* @param {Object} data Barebones actor data which this function adds onto.
|
||||
* @param {Object} actorData Barebones actor data which this function adds onto.
|
||||
* @param {Object} options (Unused) Additional options which customize the creation workflow.
|
||||
*
|
||||
*/
|
||||
|
||||
static async create(data, options) {
|
||||
static async create(actorData, options) {
|
||||
// Case of compendium global import
|
||||
if (data instanceof Array) {
|
||||
return super.create(data, options);
|
||||
if (actorData instanceof Array) {
|
||||
return super.create(actorData, options);
|
||||
}
|
||||
|
||||
const isPersonnage = data.type == "personnage";
|
||||
const isPersonnage = actorData.type == "personnage";
|
||||
// If the created actor has items (only applicable to duplicated actors) bypass the new actor creation logic
|
||||
if (data.items) {
|
||||
let actor = super.create(data, options);
|
||||
if (actorData.items) {
|
||||
let actor = super.create(actorData, options);
|
||||
if (isPersonnage) {
|
||||
await actor.checkMonnaiePresence(data.items);
|
||||
await actor.checkMonnaiePresence(actorData.items);
|
||||
}
|
||||
return actor;
|
||||
}
|
||||
|
||||
const competences = await RdDUtility.loadCompendium(RdDItemCompetence.actorCompendium(data.type));
|
||||
data.items = competences.map(it => Misc.data(it));
|
||||
const competences = await RdDUtility.loadCompendium(RdDItemCompetence.actorCompendium(actorData.type));
|
||||
actorData.items = competences.map(it => Misc.data(it));
|
||||
if (isPersonnage) {
|
||||
data.items = data.items.concat(Monnaie.monnaiesData());
|
||||
actorData.items = actorData.items.concat(Monnaie.monnaiesData());
|
||||
}
|
||||
return super.create(data, options);
|
||||
return super.create(actorData, options);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareData() {
|
||||
super.prepareData();
|
||||
|
||||
const actorData = this.data;
|
||||
|
||||
// Dynamic computing fields
|
||||
@ -138,6 +137,7 @@ export class RdDActor extends Actor {
|
||||
async _prepareCharacterData(actorData) {
|
||||
// Initialize empty items
|
||||
RdDCarac.computeCarac(actorData.data);
|
||||
this.computeIsHautRevant();
|
||||
this.computeEncombrementTotalEtMalusArmure();
|
||||
this.computePrixTotalEquipement();
|
||||
this.computeEtatGeneral();
|
||||
@ -232,7 +232,7 @@ export class RdDActor extends Actor {
|
||||
return Math.floor(this.encTotal ?? 0);
|
||||
}
|
||||
getPrixTotalEquipement() {
|
||||
return Math.floor(this.prixTotalEquipement ?? 0);
|
||||
return Math.floor(Misc.templateData(this).prixTotalEquipement ?? 0);
|
||||
}
|
||||
getSurenc() {
|
||||
return Misc.toInt(Misc.templateData(this).compteurs.surenc?.value);
|
||||
@ -245,8 +245,14 @@ export class RdDActor extends Actor {
|
||||
getObjet(id) {
|
||||
return id ? this.data.items.find(it => it.id == id) : undefined;
|
||||
}
|
||||
listItemsData(type) {
|
||||
return this.filterItemsData(it => it.type == type);
|
||||
}
|
||||
filterItemsData(filter) {
|
||||
return this.data.items.map(it => Misc.data(it)).filter(filter);
|
||||
}
|
||||
getItemOfType(id, type) {
|
||||
return id ? this.data.items.find(it => it.id == id && it.type == type) : undefined;
|
||||
return id ? this.data.items.find(it => it.id == id && Misc.data(it).type == type) : undefined;
|
||||
}
|
||||
getMonnaie(id) {
|
||||
return this.getItemOfType(id, 'monnaie');
|
||||
@ -343,13 +349,11 @@ export class RdDActor extends Actor {
|
||||
|
||||
async _recupereChance() {
|
||||
// On ne récupère un point de chance que si aucun appel à la chance dans la journée
|
||||
if (this.getFlag('foundryvtt-reve-de-dragon', 'utilisationChance')) {
|
||||
// Nouveau jour, suppression du flag
|
||||
await this.unsetFlag('foundryvtt-reve-de-dragon', 'utilisationChance');
|
||||
}
|
||||
else {
|
||||
if (this.getChanceActuel() < this.getChance() && !this.getFlag('foundryvtt-reve-de-dragon', 'utilisationChance')) {
|
||||
await this.chanceActuelleIncDec(1);
|
||||
}
|
||||
// Nouveau jour, suppression du flag
|
||||
await this.unsetFlag('foundryvtt-reve-de-dragon', 'utilisationChance');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -651,14 +655,14 @@ export class RdDActor extends Actor {
|
||||
return;
|
||||
}
|
||||
}
|
||||
const actorData = Misc.data(this);
|
||||
const tplData = Misc.templateData(this);
|
||||
if (caracName == "reve") {
|
||||
if (caracValue > Misc.toInt(actorData.data.reve.seuil.value)) {
|
||||
if (caracValue > Misc.toInt(tplData.reve.seuil.value)) {
|
||||
this.setPointsDeSeuil(caracValue);
|
||||
}
|
||||
}
|
||||
if (caracName == "chance") {
|
||||
if (caracValue > Misc.toInt(actorData.data.compteurs.chance.value)) {
|
||||
if (caracValue > Misc.toInt(tplData.compteurs.chance.value)) {
|
||||
this.setPointsDeChance(caracValue);
|
||||
}
|
||||
}
|
||||
@ -927,7 +931,7 @@ export class RdDActor extends Actor {
|
||||
// gestion conteneur/contenu
|
||||
if (item.conteneurId) { // l'Objet était dans un conteneur
|
||||
let newConteneurId = itemMap[item.conteneurId]; // Get conteneur
|
||||
let newConteneur = this.data.items.find(subItem => subItem._id == newConteneurId);
|
||||
let newConteneur = this.getObjet(newConteneurId);
|
||||
|
||||
let newItemId = itemMap[item.id]; // Get newItem
|
||||
|
||||
@ -944,62 +948,67 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
detectSurEncombrement() {
|
||||
let maxEnc = 0;
|
||||
if (this.data.type == 'vehicule')
|
||||
maxEnc = Misc.templateData(this).capacite_encombrement;
|
||||
else
|
||||
maxEnc = Misc.templateData(this).attributs.encombrement.value;
|
||||
let diffEnc = Number(this.data.encTotal) - Number(maxEnc);
|
||||
return Math.max(0, Math.ceil(diffEnc));
|
||||
return Math.max(0, Math.ceil(Number(this.data.encTotal) - this.getEncombrementMax()));
|
||||
}
|
||||
getEncombrementMax() {
|
||||
return (this.data.type == 'vehicule')
|
||||
? Misc.templateData(this).capacite_encombrement
|
||||
: Misc.templateData(this).attributs.encombrement.value;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async computeIsHautRevant() {
|
||||
const tplData = Misc.templateData(this);
|
||||
tplData.attributs.hautrevant.value = this.listItemsData('tete').find(it => Grammar.toLowerCaseNoAccent(it.name) == 'don de haut-reve')
|
||||
? "Haut rêvant"
|
||||
: "";
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async computeEncombrementTotalEtMalusArmure() {
|
||||
let encTotal = 0;
|
||||
let newMalusArmure = 0;
|
||||
for (const item of this.data.items.filter(it => Misc.templateData(it).encombrement != undefined)) {
|
||||
let itemData = item.data; // v0.8 normalization
|
||||
if (itemData.type == 'armure' && itemData.data.equipe) { // Armure équipée, intégration du malus armure total
|
||||
newMalusArmure += itemData.data.malus;
|
||||
await this.computeMalusArmure();
|
||||
return this.computeEncombrement();
|
||||
}
|
||||
// Calcul encombrement
|
||||
if (itemData.data && itemData.data.encombrement != undefined) {
|
||||
if (!Number(itemData.data.encombrement)) itemData.data.encombrement = 0; // Auto-fix
|
||||
if (itemData.data.quantite == undefined) itemData.data.quantite = 1; // Auto-fix
|
||||
if (itemData.data.quantite < 0) itemData.data.quantite = 0; // Auto-fix
|
||||
itemData.data.encTotal = Number(itemData.data.encombrement) * Number(itemData.data.quantite);
|
||||
encTotal += itemData.data.encTotal;
|
||||
} else {
|
||||
itemData.data.encTotal = 0; // Force default enc
|
||||
}
|
||||
}
|
||||
// Mise à jour valeur totale et états
|
||||
this.data.encTotal = encTotal;
|
||||
this.detectSurEncombrement();
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeEncombrement() {
|
||||
Misc.templateData(this).encTotal = this.filterItemsData(it => it.data.encombrement)
|
||||
.map(it => this._calcEncItem(it))
|
||||
.reduce(Misc.sum(), 0);
|
||||
return Misc.templateData(this).encTotal;
|
||||
}
|
||||
|
||||
_calcEncItem(it) {
|
||||
it.data.encombrement = Number(it.data.encombrement ?? 0);
|
||||
it.data.quantite = Math.min(1, Number(it.data.quantite ?? 1));
|
||||
it.data.encTotal = it.data.encombrement * it.data.quantite;
|
||||
return it.data.encTotal;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async computeMalusArmure() {
|
||||
const newMalusArmure = this.filterItemsData(it => it.type == 'armure' && it.data.equipe)
|
||||
.map(it => it.data.malus ?? 0)
|
||||
.reduce(Misc.sum(), 0);
|
||||
// Mise à jour éventuelle du malus armure
|
||||
if (newMalusArmure && Misc.templateData(this).attributs?.malusarmure?.value != newMalusArmure) {
|
||||
await this.updateAttributeValue("malusarmure", newMalusArmure);
|
||||
}
|
||||
return encTotal;
|
||||
return newMalusArmure;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async computePrixTotalEquipement() {
|
||||
computePrixTotalEquipement() {
|
||||
let prixTotalEquipement = 0;
|
||||
|
||||
// prix total de l'équipement est la somme du cout de chaque équipement multiplié par sa quantité.
|
||||
for (const item of this.data.items) {
|
||||
let itemData = item.data; // v0.8 normalization
|
||||
if (itemData.data && itemData.data.cout != undefined) {
|
||||
if (!Number(itemData.data.cout)) itemData.data.cout = 0; // Auto-fix
|
||||
if (itemData.data.quantite == undefined) itemData.data.quantite = 1; // Auto-fix
|
||||
if (itemData.data.cout < 0) itemData.data.cout = 0; // Auto-fix
|
||||
prixTotalEquipement += Number(itemData.data.cout) * Number(itemData.data.quantite);
|
||||
}
|
||||
for (const itemData of this.filterItemsData(it => it?.data.cout)) {
|
||||
const cout = Math.min(Number(itemData.data.cout ?? 0), 0);
|
||||
const quantite = Math.min(Number(itemData.data?.quantite ?? 1), 1);
|
||||
prixTotalEquipement += cout * quantite;
|
||||
}
|
||||
// Mise à jour valeur totale de l'équipement
|
||||
this.prixTotalEquipement = prixTotalEquipement;
|
||||
Misc.templateData(this).prixTotalEquipement = prixTotalEquipement;
|
||||
return prixTotalEquipement;
|
||||
}
|
||||
|
||||
@ -1115,7 +1124,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
buildTMRInnaccessible() {
|
||||
const tmrInnaccessibles = this.data.items.filter(it => Draconique.isCaseTMR(it) &&
|
||||
const tmrInnaccessibles = this.filterItemsData(it => Draconique.isCaseTMR(it) &&
|
||||
EffetsDraconiques.isInnaccessible(it));
|
||||
return tmrInnaccessibles.map(it => it.data.coord);
|
||||
}
|
||||
@ -1435,22 +1444,21 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async moralIncDec(ajustementMoral) {
|
||||
let actorData
|
||||
let tplData = Misc.templateData(this);
|
||||
if (ajustementMoral != 0) {
|
||||
actorData = Misc.data(this);
|
||||
let moral = Misc.toInt(actorData.data.compteurs.moral.value) + ajustementMoral
|
||||
let moral = Misc.toInt(tplData.compteurs.moral.value) + ajustementMoral
|
||||
if (moral > 3) { // exaltation
|
||||
const exaltation = Misc.toInt(actorData.data.compteurs.exaltation.value) + moral - 3;
|
||||
const exaltation = Misc.toInt(tplData.compteurs.exaltation.value) + moral - 3;
|
||||
await this.updateCompteurValue('exaltation', exaltation);
|
||||
}
|
||||
if (moral < -3) { // dissolution
|
||||
const dissolution = Misc.toInt(actorData.data.compteurs.dissolution.value) + 3 - moral;
|
||||
const dissolution = Misc.toInt(tplData.compteurs.dissolution.value) + 3 - moral;
|
||||
await this.updateCompteurValue('dissolution', dissolution);
|
||||
}
|
||||
moral = Math.max(-3, Math.min(moral, 3));
|
||||
await this.updateCompteurValue('moral', moral);
|
||||
}
|
||||
return actorData.data.compteurs.moral.value;
|
||||
return tplData.compteurs.moral.value;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1667,7 +1675,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async checkCompetenceXP(compName, newXP = undefined) {
|
||||
let competence = RdDItemCompetence.findCompetence(this.data.items, compName);
|
||||
let competence = this.getCompetence(compName);
|
||||
if (competence && newXP && newXP == competence.data.xp) { // Si édition, mais sans changement XP
|
||||
return;
|
||||
}
|
||||
@ -1834,7 +1842,7 @@ export class RdDActor extends Actor {
|
||||
let addMsg = "";
|
||||
let rencSpecial = this.data.items.find(item => EffetsDraconiques.isMauvaiseRencontre(item));
|
||||
if (rencSpecial) {
|
||||
rencSpecial = duplicate(rencSpecial); // To keep it
|
||||
rencSpecial = Misc.data(rencSpecial); // To keep it
|
||||
if (rencSpecial.type != 'souffle') {
|
||||
this.deleteEmbeddedDocuments('Item', [rencSpecial._id]); // Suppression dans la liste des queues
|
||||
addMsg = " La queue a été supprimée de votre fiche automatiquement";
|
||||
@ -2261,9 +2269,6 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async rollAppelChance(onSuccess = () => { }, onEchec = () => { }) {
|
||||
// Stocke si utilisation de la chance
|
||||
await this.unsetFlag('foundryvtt-reve-de-dragon', 'utilisationChance');
|
||||
await this.setFlag('foundryvtt-reve-de-dragon', 'utilisationChance', true);
|
||||
|
||||
let rollData = { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' };
|
||||
const dialog = await RdDRoll.create(this, rollData,
|
||||
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html' },
|
||||
@ -2283,6 +2288,7 @@ export class RdDActor extends Actor {
|
||||
async _appelChanceResult(rollData, onSuccess = () => { }, onEchec = () => { }) {
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html')
|
||||
if (rollData.rolled.isSuccess) {
|
||||
await this.setFlag('foundryvtt-reve-de-dragon', 'utilisationChance', true);
|
||||
await this.chanceActuelleIncDec(-1);
|
||||
onSuccess();
|
||||
}
|
||||
@ -2292,11 +2298,8 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async chanceActuelleIncDec(value, limit = true) {
|
||||
chance = Math.max(Misc.templateData(this).compteurs.chance.value + value, 0);
|
||||
if (limit) {
|
||||
chance = Math.min(chance.value, this.getChance())
|
||||
}
|
||||
async chanceActuelleIncDec(value) {
|
||||
const chance = Math.min(this.getChance(), Math.max(this.getChanceActuel() + value, 0));
|
||||
await this.updateCompteurValue("chance", chance);
|
||||
}
|
||||
|
||||
@ -2326,7 +2329,8 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
checkDesirLancinant() {
|
||||
let queue = this.data.items.filter((item) => item.name.toLowerCase().includes('lancinant'));
|
||||
let queue = this.filterItemsData(it => it.type == 'queue' || it.type == 'ombre')
|
||||
.filter(it => Grammar.toLowerCaseNoAccent(it.name).includes('desir lancinant'));
|
||||
return (queue.length > 0);
|
||||
}
|
||||
|
||||
@ -2376,7 +2380,7 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async ajouteNombreAstral(data) {
|
||||
// Gestion expérience (si existante)
|
||||
data.competence = RdDItemCompetence.findCompetence(this.data.items, "astrologie");
|
||||
data.competence = this.getCompetence("astrologie");
|
||||
data.selectedCarac = Misc.templateData(this).carac["vue"];
|
||||
this._appliquerAjoutExperience(data);
|
||||
|
||||
@ -2388,7 +2392,7 @@ export class RdDActor extends Actor {
|
||||
await this.createEmbeddedDocuments("Item", [item]);
|
||||
|
||||
// Suppression des anciens nombres astraux
|
||||
let toDelete = this.data.items.filter(it => it.data.jourindex < game.system.rdd.calendrier.getCurrentDayIndex());
|
||||
let toDelete = this.listItemsData('nombreastral').filter(it => it.data.jourindex < game.system.rdd.calendrier.getCurrentDayIndex());
|
||||
const deletions = toDelete.map(it => it._id);
|
||||
await this.deleteEmbeddedDocuments("Item", deletions);
|
||||
|
||||
@ -2451,12 +2455,12 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getSortList() {
|
||||
return this.data.items.filter(it => it.data.type == "sort");
|
||||
return this.listItemsData("sort");
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
countMonteeLaborieuse() { // Return +1 par queue/ombre/souffle Montée Laborieuse présente
|
||||
let countMonteeLaborieuse = this.data.items.filter(it => EffetsDraconiques.isMonteeLaborieuse(it)).length;
|
||||
let countMonteeLaborieuse = this.filterItemsData(it => EffetsDraconiques.isMonteeLaborieuse(it)).length;
|
||||
if (countMonteeLaborieuse > 0) {
|
||||
ChatMessage.create({
|
||||
content: `Vous êtes sous le coup d'une Montée Laborieuse : vos montées en TMR coûtent ${countMonteeLaborieuse} Point de Rêve de plus.`,
|
||||
@ -2510,7 +2514,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme(compName, armeName = undefined) {
|
||||
let arme = armeName ? this.data.items.find(it => it.name == armeName && RdDItemArme.isArme(it)) : undefined;
|
||||
let arme = armeName ? this.data.items.find(it => Misc.data(it).name == armeName && RdDItemArme.isArme(it)) : undefined;
|
||||
let competence = this.getCompetence(compName);
|
||||
|
||||
if (arme || armeName || (competence.type == 'competencecreature' && competence.data.iscombat)) {
|
||||
@ -2532,7 +2536,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getArmeParade(armeParadeId) {
|
||||
const item = armeParadeId ? this.getEmbeddedDocuments('Item', armeParadeId) : undefined;
|
||||
const item = armeParadeId ? this.getEmbeddedDocument('Item', armeParadeId) : undefined;
|
||||
return RdDItemArme.getArmeData(item);
|
||||
}
|
||||
|
||||
@ -2549,9 +2553,9 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async equiperObjet(itemID) {
|
||||
let item = this.getEmbeddedDocuments('Item', itemID);
|
||||
if (item?.data?.data) {
|
||||
let itemData = Misc.itemData(item);
|
||||
let item = this.getEmbeddedDocument('Item', itemID);
|
||||
let itemData = Misc.data(item);
|
||||
if (itemData?.data) {
|
||||
const isEquipe = !itemData.data.equipe;
|
||||
let update = { _id: item._id, "data.equipe": isEquipe };
|
||||
await this.updateEmbeddedDocuments('Item', [update]);
|
||||
@ -2567,7 +2571,8 @@ export class RdDActor extends Actor {
|
||||
let dmg = (attackerRoll.dmg.dmgArme ?? 0) + (attackerRoll.dmg.dmgActor ?? 0);
|
||||
let armeData = attackerRoll.arme;
|
||||
let protection = 0;
|
||||
const armures = this.data.items.filter(it => it.type == "armure" && it.data.equipe);
|
||||
const armures = this.items.map(it => Misc.data(it))
|
||||
.filter(it => it.type == "armure" && it.data.equipe);
|
||||
for (const itemData of armures) {
|
||||
protection += new Roll(itemData.data.protection.toString()).roll().total;
|
||||
if (dmg > 0) {
|
||||
@ -2575,7 +2580,7 @@ export class RdDActor extends Actor {
|
||||
dmg = 0;
|
||||
}
|
||||
}
|
||||
const penetration = armeData ? Misc.toInt(armeData.data.penetration) : 0;
|
||||
const penetration = Misc.toInt(armeData?.data.penetration ?? 0);
|
||||
protection = Math.max(protection - penetration, 0);
|
||||
protection += this.getProtectionNaturelle();
|
||||
// Gestion des cas particuliers sur la fenêtre d'encaissement
|
||||
@ -2922,10 +2927,10 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async effectuerTacheAlchimie(recetteId, alchimieName, alchimieData) {
|
||||
let recette = this.data.items.find(item => item.type == 'recettealchimique' && item.id == recetteId);
|
||||
let recette = this.getItemOfType(recetteId, 'recettealchimique');
|
||||
const actorData = Misc.data(this);
|
||||
if (recette) {
|
||||
let competence = this.data.items.find(item => item.type == 'competence' && item.name.toLowerCase() == "alchimie");
|
||||
let competence = this.getCompetence("alchimie");
|
||||
let diffAlchimie = RdDAlchimie.getDifficulte(alchimieData);
|
||||
let rollData = {
|
||||
recette: recette,
|
||||
|
@ -5,8 +5,8 @@ export class RdDItemCompetenceCreature extends Item {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static setRollDataCreature(rollData) {
|
||||
rollData.competence = Misc.data(rollData.competence);
|
||||
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } };
|
||||
rollData.competence = duplicate(rollData.competence);
|
||||
rollData.competence.data.defaut_carac = "carac_creature";
|
||||
rollData.competence.data.categorie = "creature";
|
||||
rollData.selectedCarac = rollData.carac.carac_creature;
|
||||
|
@ -30,7 +30,7 @@ export class Monnaie {
|
||||
}
|
||||
|
||||
static filtrerMonnaies(items) {
|
||||
return items.filter(it => it.type == 'monnaie');
|
||||
return items.filter(it => Misc.data(it).type == 'monnaie');
|
||||
}
|
||||
|
||||
static monnaiesManquantes(items) {
|
||||
|
@ -73,7 +73,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
console.log(formData.competences);
|
||||
}
|
||||
if ( formData.type == 'recettealchimique' ) {
|
||||
RdDAlchimie.processManipulation(formData.item, this.actor && this.actor.id );
|
||||
RdDAlchimie.processManipulation(objectData, this.actor && this.actor.id );
|
||||
}
|
||||
if ( this.actor ) {
|
||||
formData.isOwned = true;
|
||||
|
@ -97,19 +97,8 @@ export class Misc {
|
||||
return [...new Set(array)];
|
||||
}
|
||||
|
||||
static actorData(actor) {
|
||||
return Misc.data(actor);
|
||||
}
|
||||
|
||||
static itemData(item) {
|
||||
return Misc.data(item);
|
||||
}
|
||||
|
||||
static data(it) {
|
||||
if (it instanceof Item) {
|
||||
return it.data;
|
||||
}
|
||||
if (it instanceof Actor) {
|
||||
if (it instanceof Actor || it instanceof Item || it instanceof Combatant) {
|
||||
return it.data;
|
||||
}
|
||||
return it;
|
||||
|
@ -1,68 +1,56 @@
|
||||
/* -------------------------------------------- */
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
const matchOperations = new RegExp(/@(\w*){([\w\-]+)}/ig);
|
||||
const matchOperationTerms = new RegExp(/@(\w*){([\w\-]+)}/i);
|
||||
/* -------------------------------------------- */
|
||||
export class RdDAlchimie {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static processManipulation( recette, actorId = undefined ) {
|
||||
static processManipulation(recetteData, actorId = undefined) {
|
||||
//console.log("CALLED", recette, recette.isOwned, actorId );
|
||||
let manip = duplicate(recette.data.manipulation);
|
||||
let reg1 = new RegExp(/@(\w*){([\w\-]+)}/ig);
|
||||
let matchArray = manip.match( reg1 );
|
||||
let manip = recetteData.data.manipulation;
|
||||
let matchArray = manip.match(matchOperations);
|
||||
if (matchArray) {
|
||||
for (let matchStr of matchArray) {
|
||||
let reg2 = new RegExp(/@(\w*){([\w\-]+)}/i);
|
||||
let result = matchStr.match(reg2);
|
||||
let result = matchStr.match(matchOperationTerms);
|
||||
//console.log("RESULT ", result);
|
||||
if (result[1] && result[2]) {
|
||||
let commande = Misc.upperFirst(result[1]);
|
||||
let replacement = this[`_alchimie${commande}`](recette, result[2], actorId);
|
||||
let replacement = this[`_alchimie${commande}`](recetteData, result[2], actorId);
|
||||
manip = manip.replace(result[0], replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
recette.data.manipulation_update = manip;
|
||||
recetteData.data.manipulation_update = manip;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _alchimieCouleur(recette, couleurs, actorId) {
|
||||
let replacement
|
||||
if (actorId) {
|
||||
replacement = `<span class="alchimie-tache"><a data-recette-id="${recette._id}" data-actor-id="${actorId}" data-alchimie-tache="couleur" data-alchimie-data="${couleurs}">couleur ${couleurs}</a></span>`;
|
||||
return `<span class="alchimie-tache"><a data-recette-id="${recette._id}" data-actor-id="${actorId}" data-alchimie-tache="couleur" data-alchimie-data="${couleurs}">couleur ${couleurs}</a></span>`;
|
||||
} else {
|
||||
replacement = `<span class="alchimie-tache">couleur ${couleurs} </span>`;
|
||||
return `<span class="alchimie-tache">couleur ${couleurs} </span>`;
|
||||
}
|
||||
return replacement;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _alchimieConsistance(recette, consistances, actorId) {
|
||||
let replacement
|
||||
if (actorId) {
|
||||
replacement = `<span class="alchimie-tache"><a data-recette-id="${recette._id}" data-actor-id="${actorId}" data-alchimie-tache="consistance" data-alchimie-data="${consistances}">consistance ${consistances}</a></span>`;
|
||||
return `<span class="alchimie-tache"><a data-recette-id="${recette._id}" data-actor-id="${actorId}" data-alchimie-tache="consistance" data-alchimie-data="${consistances}">consistance ${consistances}</a></span>`;
|
||||
} else {
|
||||
replacement = `<span class="alchimie-tache">consistance ${consistances} </span>`;
|
||||
return `<span class="alchimie-tache">consistance ${consistances} </span>`;
|
||||
}
|
||||
return replacement;
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getDifficulte(aspects) {
|
||||
let aspectsArray = aspects.split('-');
|
||||
let diff = 0;
|
||||
let nbDifferent = 0;
|
||||
let aspectsHash = {}
|
||||
for (let colconst of aspectsArray) {
|
||||
if ( aspectsHash[colconst] ){ // Deja present, augmente difficulté de 1
|
||||
diff -= 1;
|
||||
} else {
|
||||
nbDifferent++;
|
||||
aspectsHash[colconst] = colconst; // Keep track
|
||||
}
|
||||
}
|
||||
diff = diff - ((nbDifferent>1) ? nbDifferent : 0); // Ca doit marcher ....
|
||||
return Math.min(0, diff); // Pour être sur
|
||||
let elements = aspects.split('-');
|
||||
let composantes = elements.length;
|
||||
let distincts = Object.keys(Misc.classifyFirst(elements, it => it)).length;
|
||||
if (distincts == 1) {
|
||||
composantes--;
|
||||
}
|
||||
return Math.min(0, -composantes);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,8 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
/* -------------------------------------------- */
|
||||
static async create(actor, dialogConfig) {
|
||||
|
||||
let data = { nombres: this.organizeNombres( actor),
|
||||
let data = {
|
||||
nombres: this.organizeNombres(actor),
|
||||
dates: game.system.rdd.calendrier.getJoursSuivants(10),
|
||||
etat: actor.getEtatGeneral(),
|
||||
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||
@ -44,7 +45,7 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static organizeNombres(actor) {
|
||||
let itemNombres = actor.data.items.filter( (item) => item.type == 'nombreastral');
|
||||
let itemNombres = actor.listItemsData('nombreastral');
|
||||
let itemFiltered = {};
|
||||
for (let item of itemNombres) {
|
||||
if (itemFiltered[item.data.jourindex]) {
|
||||
@ -61,7 +62,8 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
requestJetAstrologie() {
|
||||
let data = { id: this.actor.data._id,
|
||||
let data = {
|
||||
id: this.actor.data._id,
|
||||
carac_vue: Misc.data(this.actor).data.carac['vue'].value,
|
||||
etat: this.dataNombreAstral.etat,
|
||||
astrologie: this.dataNombreAstral.astrologie,
|
||||
|
@ -199,7 +199,7 @@ export class RdDCalendrier extends Application {
|
||||
/* -------------------------------------------- */
|
||||
syncPlayerTime(calendrier) {
|
||||
this.calendrier = duplicate(calendrier); // Local copy update
|
||||
this.updateDisplay(); // Then update
|
||||
this.updateDisplay();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -247,21 +247,19 @@ export class RdDCalendrier extends Application {
|
||||
console.log(request);
|
||||
let jourDiff = this.getLectureAstrologieDifficulte(request.date);
|
||||
let niveau = Number(request.astrologie.data.niveau) + Number(request.conditions) + Number(jourDiff) + Number(request.etat);
|
||||
let rolled = await RdDResolutionTable.rollData({
|
||||
let rollData= {
|
||||
caracValue: request.carac_vue,
|
||||
finalLevel: niveau,
|
||||
showDice: false
|
||||
});
|
||||
};
|
||||
await RdDResolutionTable.rollData(rollData);
|
||||
let nbAstral = this.getNombreAstral(request.date);
|
||||
let nbAstralFaux = nbAstral;
|
||||
request.rolled = rollData.rolled;
|
||||
request.isValid = true;
|
||||
request.rolled = rolled;
|
||||
if (!rolled.isSuccess) {
|
||||
if (!request.rolled.isSuccess) {
|
||||
request.isValid = false;
|
||||
while (nbAstralFaux == nbAstral) {
|
||||
nbAstralFaux = new Roll("1d12").evaluate( { async: false} ).total;
|
||||
}
|
||||
nbAstral = nbAstralFaux;
|
||||
let nbAstralFaux = new Roll("1d11").evaluate( { async: false} ).total;
|
||||
nbAstral = nbAstral==nbAstralFaux ? 12 : nbAstralFaux;
|
||||
// Mise à jour des nombres astraux du joueur
|
||||
let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == request.date);
|
||||
astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstralFaux });
|
||||
@ -338,7 +336,7 @@ export class RdDCalendrier extends Application {
|
||||
if (game.user.isGM) {
|
||||
dateHTML = dateHTML + " - NA: " + this.getCurrentNombreAstral();
|
||||
}
|
||||
for (let handle of document.getElementsByClassName("calendar-move-handle")) {
|
||||
for (let handle of document.getElementsByClassName("calendar-date-rdd")) {
|
||||
handle.innerHTML = dateHTML;
|
||||
}
|
||||
for (let heure of document.getElementsByClassName("calendar-heure-texte")) {
|
||||
|
@ -143,18 +143,20 @@ export class RdDCombatManager extends Combat {
|
||||
// Gestion des armes 1/2 mains
|
||||
let armesEquipe = [];
|
||||
for (const arme of armes) {
|
||||
if (arme.data.equipe) {
|
||||
armesEquipe.push(arme);
|
||||
let comp = competences.find(c => c.name == arme.data.competence);
|
||||
arme.data.initiative = RdDCombatManager.calculInitiative(arme.data.niveau, carac[comp.data.defaut_carac].value);
|
||||
let armeData = Misc.data(arme);
|
||||
if (armeData.data.equipe) {
|
||||
let compData = competences.map(c => Misc.data(c)).find(c => c.name == armeData.data.competence);
|
||||
|
||||
armesEquipe.push(armeData);
|
||||
armeData.data.initiative = RdDCombatManager.calculInitiative(armeData.data.niveau, carac[compData.data.defaut_carac].value);
|
||||
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
|
||||
if (arme.data.unemain && !arme.data.deuxmains) {
|
||||
arme.data.mainInfo = "(1m)";
|
||||
} else if (!arme.data.unemain && arme.data.deuxmains) {
|
||||
arme.data.mainInfo = "(2m)";
|
||||
} else if (arme.data.unemain && arme.data.deuxmains) {
|
||||
arme.data.mainInfo = "(1m)";
|
||||
let arme2main = duplicate(arme);
|
||||
if (armeData.data.unemain && !armeData.data.deuxmains) {
|
||||
armeData.data.mainInfo = "(1m)";
|
||||
} else if (!armeData.data.unemain && armeData.data.deuxmains) {
|
||||
armeData.data.mainInfo = "(2m)";
|
||||
} else if (armeData.data.unemain && armeData.data.deuxmains) {
|
||||
armeData.data.mainInfo = "(1m)";
|
||||
let arme2main = duplicate(armeData);
|
||||
arme2main.data.mainInfo = "(2m)";
|
||||
arme2main.data.dommages = arme2main.data.dommages.split("/")[1]; // Existence temporaire uniquement dans la liste des armes, donc OK
|
||||
arme2main.data.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace !
|
||||
@ -174,6 +176,7 @@ export class RdDCombatManager extends Combat {
|
||||
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`)
|
||||
return [];
|
||||
}
|
||||
const actorData = Misc.data(combatant.actor);
|
||||
let items = combatant.actor.data.items;
|
||||
let actions = []
|
||||
if (combatant.actor.isCreature()) {
|
||||
@ -182,14 +185,15 @@ export class RdDCombatManager extends Combat {
|
||||
} else {
|
||||
// Recupération des items 'arme'
|
||||
let armes = items.filter(it => RdDItemArme.isArmeUtilisable(it))
|
||||
.map(arme => duplicate(arme)) /* pas de changements aux armes d'origine */
|
||||
.concat(RdDItemArme.mainsNues());
|
||||
|
||||
let competences = items.filter(it => it.type == 'competence');
|
||||
actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, Misc.data(combatant.actor).data.carac));
|
||||
actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, actorData.data.carac));
|
||||
|
||||
if (actorData.data.attributs.hautrevant.value){
|
||||
actions.push({ name: "Draconic", data: { initOnly: true, competence: "Draconic" } });
|
||||
}
|
||||
}
|
||||
|
||||
actions.push({ name: "Autre action", data: { initOnly: true, competence: "Autre action" } });
|
||||
for (let index = 0; index < actions.length; index++) {
|
||||
|
@ -7,17 +7,23 @@ export class RdDEncaisser extends Dialog {
|
||||
/* -------------------------------------------- */
|
||||
constructor(html, actor) {
|
||||
// Common conf
|
||||
const buttonsCreatures = {
|
||||
"mortel": { label: "mortel", callback: html => this.performEncaisser("mortel") },
|
||||
"non-mortel": { label: "non-mortel", callback: html => this.performEncaisser("non-mortel") },
|
||||
};
|
||||
const buttonsEntitesCauchemar = {
|
||||
"cauchemar": { label: "cauchemar", callback: html => this.performEncaisser("cauchemar") }
|
||||
};
|
||||
const buttons = actor.isEntiteCauchemar() ? buttonsEntitesCauchemar : buttonsCreatures;
|
||||
|
||||
let dialogConf = {
|
||||
title: "Jet d'Encaissement",
|
||||
content: html,
|
||||
buttons: {
|
||||
"mortel": { label: "mortel", callback: html => this.performEncaisser(html, "mortel") },
|
||||
"non-mortel": { label: "non-mortel", callback: html => this.performEncaisser(html, "non-mortel") },
|
||||
"cauchemar": { label: "cauchemar", callback: html => this.performEncaisser(html, "cauchemar") }
|
||||
},
|
||||
buttons: buttons,
|
||||
default: "coupMortel"
|
||||
}
|
||||
|
||||
|
||||
let dialogOptions = {
|
||||
classes: ["rdddialog"],
|
||||
width: 320,
|
||||
@ -32,13 +38,15 @@ export class RdDEncaisser extends Dialog {
|
||||
this.encaisserSpecial = "aucun";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
performEncaisser(html, mortalite = "mortel") {
|
||||
performEncaisser(mortalite) {
|
||||
this.actor.encaisserDommages({
|
||||
dmg: {
|
||||
total: Number(this.modifier),
|
||||
encaisserSpecial: this.encaisserSpecial,
|
||||
loc: { result: 0, label: "Corps" },
|
||||
loc: { result: 0, label: "" },
|
||||
mortalite: mortalite
|
||||
}
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* -------------------------------------------- */
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDCombatManager } from "./rdd-combat.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
@ -24,7 +25,7 @@ export class RdDTokenHud {
|
||||
|
||||
let token = canvas.tokens.get(tokenId);
|
||||
let actor = token.actor;
|
||||
let combatant = game.combat.data.combatants.find(c => c.tokenId == token.data._id);
|
||||
let combatant = game.combat.combatants.find(c => Misc.data(c).tokenId == tokenId);
|
||||
app.hasExtension = true;
|
||||
|
||||
let armesList = RdDCombatManager.buildListeActionsCombat(combatant) ;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1093,12 +1093,7 @@ ul, li {
|
||||
.calendar-date-rdd {
|
||||
font-family: "GoudyAcc";
|
||||
color: #CCC;
|
||||
font-weight: bold;
|
||||
font-size: 1.10rem;
|
||||
opacity: 90;
|
||||
}
|
||||
#calendar-move-handle {
|
||||
font-family: "GoudyAcc";
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
|
@ -6,7 +6,7 @@
|
||||
"manifestPlusVersion": "1.0.0",
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.7.9",
|
||||
"templateVersion": 96,
|
||||
"templateVersion": 97,
|
||||
"author": "LeRatierBretonnien",
|
||||
"authors": [
|
||||
{
|
||||
|
@ -430,6 +430,12 @@
|
||||
"value": 0,
|
||||
"label": "Protection naturelle",
|
||||
"derivee": false
|
||||
},
|
||||
"hautrevant": {
|
||||
"type": "string",
|
||||
"value": "",
|
||||
"label": "Haut rêvant",
|
||||
"derivee": true
|
||||
}
|
||||
},
|
||||
"reve": {
|
||||
|
@ -197,7 +197,7 @@
|
||||
{{!-- Equipment Tab --}}
|
||||
<div class="tab items" data-group="primary" data-tab="items">
|
||||
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} <b>{{calc.surEncombrementMessage}}</b></span> -
|
||||
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span>
|
||||
<span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
|
||||
{{#if options.isGM}}
|
||||
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
|
||||
{{/if}}
|
||||
|
@ -1,3 +1,5 @@
|
||||
{{log 'calc' calc}}
|
||||
|
||||
<form class="{{cssClass}}" autocomplete="off">
|
||||
|
||||
{{!-- Sheet Header --}}
|
||||
@ -59,9 +61,11 @@
|
||||
<span class="gm-only remise-a-neuf"><a title="Remise à neuf"><img class="button-img" src="icons/svg/regen.svg" alt="Remise à neuf"/></a></span>
|
||||
<span id="dormir-une-heure"><a title="Dormir une heure"><img class="button-img" src="icons/svg/sleep.svg" alt="Dormir une heure"/></a></span>
|
||||
<span id="dormir-chateau-dormant"><a title="Chateau Dormant"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg" alt="Chateau Dormant"/></a></span>
|
||||
{{#if data.attributs.hautrevant.value}}
|
||||
<span id="monte-tmr"><a title="Montée dans les Terres Médianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg" alt="Montée dans les Terres Médianes !"/></a></span>
|
||||
<span id="monte-tmr-rapide"><a title="Montée accélérée dans les Terres Médianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-rapide.svg" alt="Montée accélérée dans les Terres Médianes !"/></a></span>
|
||||
<span id="visu-tmr"><a title="Regarder les Terres Médianes"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-view.svg" alt="Regarder les Terres Médianes"/></a></span>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<span class="tooltip">Malus de fatigue : {{calc.fatigue.malus}}
|
||||
@ -160,6 +164,7 @@
|
||||
</span>
|
||||
</li>
|
||||
{{#each data.attributs as |attr key|}}
|
||||
{{#unless (eq key 'hautrevant')}}
|
||||
<li class="competence flexrow list-item" data-attribute="{{key}}">
|
||||
<span class="competence-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} :
|
||||
{{#if (eq key 'protection')}}
|
||||
@ -169,6 +174,7 @@
|
||||
{{/if}}
|
||||
</span>
|
||||
</li>
|
||||
{{/unless}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
<ul class="carac-list alterne-list">
|
||||
@ -295,6 +301,7 @@
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
{{#if data.attributs.hautrevant.value}}
|
||||
<header class="competence-header flexrow">
|
||||
<span class="competence-title">Draconic</span>
|
||||
</header>
|
||||
@ -303,6 +310,8 @@
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
|
||||
<div>
|
||||
<ul class="item-list">
|
||||
<li class="item flexrow">
|
||||
@ -461,7 +470,19 @@
|
||||
|
||||
{{!-- Connaissances Tab --}}
|
||||
<div class="tab connaissances" data-group="primary" data-tab="connaissances">
|
||||
<h3>Oeuvres diverses :</h3>
|
||||
<h3>Tâches</h3><a class='creer-tache'>Créer une nouvelle Tâche</a>
|
||||
<ul class="item-list alterne-list">
|
||||
{{#each taches as |tache id|}}
|
||||
<li class="item flexrow list-item" data-item-id="{{tache._id}}"><span class="competence-title tache-label"><a>{{tache.name}} ({{tache.data.points_de_tache_courant}}/{{tache.data.points_de_tache}})</a></span>
|
||||
<div class="item-controls">
|
||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
<hr>
|
||||
<h3>Oeuvres diverses :</h3><a class="creer-une-oeuvre">Créer une oeuvre</a>
|
||||
<ul class="item-list alterne-list">
|
||||
{{#each chants as |chant id|}}
|
||||
<li class="item flexrow list-item" data-item-id="{{chant._id}}"><span>Chant</span><span class="competence-title chant-label"><a>{{chant.name}} (niveau {{chant.data.niveau}})</a></span>
|
||||
@ -526,25 +547,19 @@
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
<h3>Tâches</h3><a id='creer-tache'>Créer une nouvelle Tâche</a>
|
||||
<ul class="item-list alterne-list">
|
||||
{{#each taches as |tache id|}}
|
||||
<li class="item flexrow list-item" data-item-id="{{tache._id}}"><span class="competence-title tache-label"><a>{{tache.name}} ({{tache.data.points_de_tache_courant}}/{{tache.data.points_de_tache}})</a></span>
|
||||
<div class="item-controls">
|
||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
<hr>
|
||||
<h3>Astrologie</h3>
|
||||
<span class="astrologie-label"><a id="jet-astrologie">Astrologie : Nombres Astraux</a></span>
|
||||
</div>
|
||||
|
||||
{{!-- hautreve Tab --}}
|
||||
<div class="tab hautreve " data-group="primary" data-tab="hautreve" style="height:200px">
|
||||
<div>
|
||||
<h3>Haut rêve:</h3>
|
||||
{{#if data.attributs.hautrevant.value}}
|
||||
<h3>Haut rêvant</h3>
|
||||
{{/if}}
|
||||
<ul class="item-list">
|
||||
{{#if data.attributs.hautrevant.value}}
|
||||
<li class="item flexrow">
|
||||
<span class="competence-label">Position en TMR :</span>
|
||||
<span>
|
||||
@ -555,6 +570,7 @@
|
||||
{{/if}}
|
||||
</span>
|
||||
</li>
|
||||
{{/if}}
|
||||
<li class="item flexrow">
|
||||
<span class="competence-label">Seuil de Rêve :</span>
|
||||
<span>
|
||||
@ -575,12 +591,10 @@
|
||||
{{/if}}
|
||||
</span>
|
||||
</li>
|
||||
<li class="item flexrow" >
|
||||
<span class="astrologie-label"><a id="jet-astrologie">Astrologie : Nombres Astraux</a></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<hr>
|
||||
{{#if data.attributs.hautrevant.value}}
|
||||
<div>
|
||||
<h3>Sorts:</h3>
|
||||
<ul class="item-list">
|
||||
@ -649,9 +663,10 @@
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
<hr>
|
||||
{{/if}}
|
||||
|
||||
{{!-- Queues, Souffles, Tetes, Ombre --}}
|
||||
<hr>
|
||||
<h3>Queues:</h3>
|
||||
<ul class="flex-group-left">
|
||||
{{#each queues as |queue key|}}
|
||||
@ -723,7 +738,7 @@
|
||||
<span class="item-name">Estimation de l'équipement : {{numberFormat calc.prixTotalEquipement decimals=2}} Sols</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span>
|
||||
<span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
|
||||
{{#if options.isGM}}
|
||||
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
|
||||
{{/if}}
|
||||
|
@ -69,7 +69,7 @@
|
||||
{{!-- Equipment Tab --}}
|
||||
<div class="tab items" data-group="primary" data-tab="items">
|
||||
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.capacite_encombrement}} <b>{{calc.surEncombrementMessage}}</b></span> -
|
||||
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span>
|
||||
<span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
|
||||
{{#if options.isGM}}
|
||||
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
|
||||
{{/if}}
|
||||
|
@ -17,6 +17,6 @@
|
||||
{{/if}}
|
||||
<a class='chat-card-button' id='echec-total-attaque' data-attackerId='{{attackerId}}'
|
||||
data-defenderTokenId='{{defenderTokenId}}'>
|
||||
Tirer l'échec total !
|
||||
Tirer la maladresse !
|
||||
</a>
|
||||
</div>
|
@ -1,6 +1,6 @@
|
||||
<img class="chat-icon" src="{{competence.img}}" alt="{{oeuvre.data.competence}}" />
|
||||
<h4>
|
||||
{{alias}} tente de chanter la chanson : {{oeuvre.name}} (niveau {{oeuvre.data.niveau}})
|
||||
{{alias}} tente de chanter : {{oeuvre.name}} (niveau {{oeuvre.data.niveau}})
|
||||
</h4>
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
|
||||
<hr>
|
||||
|
@ -17,9 +17,9 @@
|
||||
</h4>
|
||||
<div>
|
||||
Je d'encaissement de {{roll.total}}
|
||||
{{#unless (eq armure 0)}}, l'armure a protègé de {{armure}} {{#unless (eq penetration 0)}}(pénétration de {{penetration}})
|
||||
{{/unless}}
|
||||
{{/unless}}, total: <span class="rdd-roll-echec">{{total}}</span>
|
||||
{{#unless (eq armure 0)}}, l'armure a protègé de {{armure}}
|
||||
{{~#unless (eq penetration 0)}} (pénétration de {{penetration}}){{/unless}}
|
||||
{{~/unless}}, total: <span class="rdd-roll-echec">{{total}}</span>
|
||||
<br>
|
||||
{{alias}}
|
||||
{{#if (eq dmg.mortalite 'cauchemar')}}subit le coup
|
||||
@ -29,10 +29,14 @@
|
||||
{{else if critiques}}subit une blessure critique
|
||||
{{else if mort}}vient de mourir
|
||||
{{else}}s'en sort sans une égratignure
|
||||
{{~/if~}}
|
||||
{{~#unless (eq dmg.mortalite 'cauchemar')}}
|
||||
{{#if dmg.loc.label}}
|
||||
{{#if (gt roll.total 0)}}({{dmg.loc.label}}){{/if}}
|
||||
{{/if}}
|
||||
({{dmg.loc.label}})
|
||||
{{#if (gt endurance 0)}}
|
||||
{{#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance
|
||||
{{/unless~}}
|
||||
{{~#if (gt endurance 0)}}
|
||||
{{~#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance
|
||||
{{#if (ne vie 0)}}, <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}}
|
||||
{{/if}}
|
||||
{{#if (ne dmg.mortalite 'cauchemar')}}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="rdd-hud-list tokenhudext left">
|
||||
{{#each armes as |arme key|}}
|
||||
{{#unless arme.data.initOnly}}
|
||||
<div class="control-icon tokenhudicon rdd-hud-menu rdd-attaque" data-combatant-id="{{../combatant._id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}">
|
||||
<div class="control-icon tokenhudicon rdd-hud-menu rdd-attaque" data-combatant-id="{{../combatant.id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}">
|
||||
<label>C:{{arme.name}} {{arme.data.mainInfo}}</label>
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
@ -2,12 +2,12 @@
|
||||
<img class="rdd-hud-togglebutton" src="icons/svg/sword.svg" width="36" height="36" title="Initiative" />
|
||||
<div class="rdd-hud-list tokenhudext right">
|
||||
{{#each armes as |arme key|}}
|
||||
<div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{arme.command}}" data-combatant-id="{{../combatant._id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}">
|
||||
<div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{arme.command}}" data-combatant-id="{{../combatant.id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}">
|
||||
<label>I:{{arme.name}} {{arme.data.mainInfo}}</label>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{#each commandes as |commande key|}}
|
||||
<div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{commande.command}}" data-combatant-id="{{../combatant._id}}" data-arme-id="{{commande.index}}" title="{{commande.name}}">
|
||||
<div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{commande.command}}" data-combatant-id="{{../combatant.id}}" data-arme-id="{{commande.index}}" title="{{commande.name}}">
|
||||
<label>I:{{commande.name}}</label>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
@ -24,16 +24,16 @@
|
||||
<label>Exotisme</label>
|
||||
<input class="attribute-value" type="text" name="data.exotisme" value="{{data.exotisme}}" data-dtype="Number"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Référence / Auteur</label>
|
||||
<input class="attribute-value" type="text" name="data.reference" value="{{data.reference}}" data-dtype="String"/>
|
||||
</div>
|
||||
<div class="flexcol">
|
||||
<span><label>Ingrédients : </label></span>
|
||||
<div class="form-group editor">
|
||||
{{editor content=data.ingredients target="data.ingredients" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Référence / Auteur</label>
|
||||
<input class="attribute-value" type="text" name="data.reference" value="{{data.reference}}" data-dtype="String"/>
|
||||
</div>
|
||||
<div class="flexcol">
|
||||
<span><label>Description : </label></span>
|
||||
<div class="form-group editor">
|
||||
|
Loading…
Reference in New Issue
Block a user