forked from public/foundryvtt-reve-de-dragon
Merge v1.3 dans appel au moral
This commit is contained in:
@ -5,10 +5,10 @@
|
||||
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { RdDItem } from "./item.js";
|
||||
import { RdDItemArme } from "./item-arme.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { RdDBonus } from "./rdd-bonus.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDActorSheet extends ActorSheet {
|
||||
@ -38,11 +38,11 @@ export class RdDActorSheet extends ActorSheet {
|
||||
data.data.showCompNiveauBase = this.options.showCompNiveauBase;
|
||||
data.data.montrerArchetype = this.options.montrerArchetype;
|
||||
|
||||
data.itemsByType = RdDItem.buildItemsClassification(data.items);
|
||||
data.itemsByType = Misc.classify(data.items);
|
||||
|
||||
// Competence per category
|
||||
data.data.competenceXPTotal = 0;
|
||||
data.competenceByCategory = RdDItem.classify(
|
||||
data.competenceByCategory = Misc.classify(
|
||||
data.itemsByType.competence,
|
||||
item => item.data.categorie,
|
||||
item => {
|
||||
@ -123,6 +123,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
|
||||
RdDUtility.filterItemsPerTypeForSheet(data);
|
||||
data.data.sortReserve = data.data.reve.reserve.list;
|
||||
data.data.rencontres = duplicate(data.data.reve.rencontre.list);
|
||||
data.data.caseSpeciales = data.itemsByType['casetmr'];
|
||||
RdDUtility.buildArbreDeConteneur(this, data);
|
||||
data.data.surEncombrementMessage = (data.data.compteurs.surenc.value < 0) ? "Sur-Encombrement!" : "";
|
||||
@ -188,18 +189,23 @@ export class RdDActorSheet extends ActorSheet {
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
// Update Inventory Item
|
||||
html.find('.item-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
const item = this.actor.getOwnedItem(li.data("item-id"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
// Update Inventory Item
|
||||
html.find('.rencontre-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
const rencontreKey = li.data("item-id");
|
||||
this.actor.deleteTMRRencontre(rencontreKey);
|
||||
});
|
||||
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
RdDUtility.confirmerSuppression(this, li);
|
||||
});
|
||||
});
|
||||
html.find('.subacteur-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
RdDUtility.confirmerSuppressionSubacteur(this, li);
|
||||
@ -303,6 +309,11 @@ export class RdDActorSheet extends ActorSheet {
|
||||
let musiqueId = li.data('item-id');
|
||||
this.actor.rollMusique(musiqueId);
|
||||
});
|
||||
html.find('.oeuvre-label a').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let oeuvreId = li.data('item-id');
|
||||
this.actor.rollOeuvre(oeuvreId);
|
||||
});
|
||||
html.find('.jeu-label a').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let jeuId = li.data('item-id');
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { RdDItem } from "./item.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDActorVehiculeSheet extends ActorSheet {
|
||||
@ -36,7 +36,7 @@ export class RdDActorVehiculeSheet extends ActorSheet {
|
||||
getData() {
|
||||
let data = super.getData();
|
||||
|
||||
data.itemsByType = RdDItem.buildItemsClassification(data.items);
|
||||
data.itemsByType = Misc.classify(data.items);
|
||||
|
||||
RdDUtility.filterItemsPerTypeForSheet(data);
|
||||
RdDUtility.buildArbreDeConteneur(this, data);
|
||||
|
751
module/actor.js
751
module/actor.js
File diff suppressed because it is too large
Load Diff
@ -4,12 +4,14 @@
|
||||
*/
|
||||
export class ChatUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static onSocketMessage(sockmsg) {
|
||||
switch (sockmsg.msg) {
|
||||
case "msg_delete_chat_message": return ChatUtility.onRemoveMessages(sockmsg.part, sockmsg.gmId);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static onRemoveMessages(part, gmId) {
|
||||
if (game.user._id == gmId) {
|
||||
const toDelete = game.messages.filter(it => it.data.content.includes(part));
|
||||
@ -107,5 +109,5 @@ export class ChatUtility {
|
||||
ChatMessage.create(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,23 @@ export class Grammar {
|
||||
}
|
||||
|
||||
static toLowerCaseNoAccent(words) {
|
||||
return words?.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") ?? words;
|
||||
return words?.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") ?? words;
|
||||
}
|
||||
static articleDetermine(genre) {
|
||||
switch (genre?.toLowerCase()) {
|
||||
case 'f': case 'feminin': return 'la';
|
||||
case 'p': case 'pluriel': return 'les';
|
||||
default:
|
||||
case 'm': case 'masculin': return 'le';
|
||||
}
|
||||
}
|
||||
static articleIndétermine(genre) {
|
||||
switch (genre?.toLowerCase()) {
|
||||
case 'f': case 'feminin': return 'une';
|
||||
case 'p': case 'pluriel': return 'des';
|
||||
case 'n': case 'neutre': return 'du'
|
||||
default:
|
||||
case 'm': case 'masculin': return 'un';
|
||||
}
|
||||
}
|
||||
}
|
@ -59,10 +59,12 @@ export class RdDItemCompetence extends Item {
|
||||
static computeCompetenceXPCost(competence) {
|
||||
let xp = RdDItemCompetence.getDeltaXp(competence.data.base, competence.data.niveau ?? competence.data.base);
|
||||
xp += competence.data.xp ?? 0;
|
||||
if ( competence.name.includes('Thanatos') ) xp *= 2; /// Thanatos compte double !
|
||||
xp += competence.data.xp_sort ?? 0;
|
||||
return xp;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static computeEconomieCompetenceTroncXP(competences) {
|
||||
let economie = 0;
|
||||
for (let troncList of competenceTroncs) {
|
||||
@ -87,17 +89,20 @@ export class RdDItemCompetence extends Item {
|
||||
return RdDItemCompetence.getCompetenceXp(niveau + 1);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getCompetenceXp(niveau) {
|
||||
RdDItemCompetence._valideNiveau(niveau);
|
||||
return niveau < -10 ? 0 : competence_xp_par_niveau[niveau + 10];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getDeltaXp(from, to) {
|
||||
RdDItemCompetence._valideNiveau(from);
|
||||
RdDItemCompetence._valideNiveau(to);
|
||||
return competence_xp_cumul[to] - competence_xp_cumul[from];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _valideNiveau(niveau){
|
||||
if (niveau < -11 || niveau > competence_niveau_max) {
|
||||
console.warn("Niveau en dehors des niveaux de compétences: [-11, " + competence_niveau_max + "]", niveau)
|
||||
|
@ -29,7 +29,7 @@ export class RdDItemCompetenceCreature extends Item {
|
||||
});
|
||||
return arme;
|
||||
}
|
||||
console.error("RdDItem.toArme(", item, ") : impossible de transformer l'Item en arme");
|
||||
console.error("RdDItemCompetenceCreature.toArme(", item, ") : impossible de transformer l'Item en arme");
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
async getData() {
|
||||
let data = super.getData();
|
||||
data.categorieCompetences = RdDUtility.getCategorieCompetences();
|
||||
if ( data.item.type == 'tache' || data.item.type == 'livre' || data.item.type == 'meditation') {
|
||||
if ( data.item.type == 'tache' || data.item.type == 'livre' || data.item.type == 'meditation' || data.item.type == 'oeuvre') {
|
||||
data.caracList = duplicate(game.system.model.Actor.personnage.carac);
|
||||
data.competences = await RdDUtility.loadCompendiumNames( 'foundryvtt-reve-de-dragon.competences' );
|
||||
}
|
||||
@ -80,6 +80,12 @@ export class RdDItemSheet extends ItemSheet {
|
||||
// Select competence categorie
|
||||
html.find("#categorie").on("click", this._onClickSelectCategorie.bind(this) );
|
||||
|
||||
html.find('#sheet-competence-xp').change((event) => {
|
||||
if ( this.object.data.type == 'competence') {
|
||||
RdDUtility.checkThanatosXP( this.object.data.name );
|
||||
}
|
||||
} );
|
||||
|
||||
html.find('#creer-tache-livre').click((event) => {
|
||||
let actorId = event.currentTarget.attributes['data-actor-id'].value;
|
||||
let actor = game.actors.get( actorId );
|
||||
|
@ -68,13 +68,13 @@ export class RdDItemSort extends Item {
|
||||
let list = [];
|
||||
let caseCheck = {};
|
||||
for(let i=0; i<formData.bonusValue.length; i++) {
|
||||
let caseTMR = formData.caseValue[i] || 'A1';
|
||||
caseTMR = caseTMR.toUpperCase();
|
||||
if ( TMRUtility.verifyTMRCoord( caseTMR ) ) { // Sanity check
|
||||
let coord = formData.caseValue[i] || 'A1';
|
||||
coord = coord.toUpperCase();
|
||||
if ( TMRUtility.verifyTMRCoord( coord ) ) { // Sanity check
|
||||
let bonus = formData.bonusValue[i] || 0;
|
||||
if ( bonus > 0 && caseCheck[caseTMR] == undefined ) {
|
||||
caseCheck[caseTMR] = bonus;
|
||||
list.push( caseTMR+":"+bonus );
|
||||
if ( bonus > 0 && caseCheck[coord] == undefined ) {
|
||||
caseCheck[coord] = bonus;
|
||||
list.push( coord+":"+bonus );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -86,21 +86,21 @@ export class RdDItemSort extends Item {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static incrementBonusCase( actor, sort, coordTMR ) {
|
||||
static incrementBonusCase( actor, sort, coord ) {
|
||||
let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false);
|
||||
//console.log("ITEMSORT", sort, bonusCaseList);
|
||||
|
||||
let found = false;
|
||||
let StringList = [];
|
||||
for( let bc of bonusCaseList) {
|
||||
if (bc.case == coordTMR) { // Case existante
|
||||
if (bc.case == coord) { // Case existante
|
||||
found = true;
|
||||
bc.bonus = Number(bc.bonus) + 1;
|
||||
}
|
||||
StringList.push( bc.case+':'+bc.bonus );
|
||||
}
|
||||
if ( !found) { //Nouvelle case, bonus de 1
|
||||
StringList.push(coordTMR+':1');
|
||||
StringList.push(coord+':1');
|
||||
}
|
||||
|
||||
// Sauvegarde/update
|
||||
@ -110,10 +110,10 @@ export class RdDItemSort extends Item {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getCaseBonus( sort, coordTMR) {
|
||||
static getCaseBonus( sort, coord) {
|
||||
let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false);
|
||||
for( let bc of bonusCaseList) {
|
||||
if (bc.case == coordTMR) { // Case existante
|
||||
if (bc.case == coord) { // Case existante
|
||||
return Number(bc.bonus);
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDItem {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static buildItemsClassification(items) {
|
||||
return RdDItem.classify(items, it => it.type)
|
||||
}
|
||||
|
||||
static classify(items, classifier = it => it.type, transform = it => it) {
|
||||
let itemsBy = {};
|
||||
RdDItem.classifyInto(itemsBy, items, classifier, transform);
|
||||
return itemsBy;
|
||||
}
|
||||
|
||||
static classifyInto(itemsBy, items, classifier = it => it.type, transform = it => it) {
|
||||
for (const item of items) {
|
||||
const classification = classifier(item);
|
||||
let list = itemsBy[classification];
|
||||
if (!list) {
|
||||
list = [];
|
||||
itemsBy[classification] = list;
|
||||
}
|
||||
list.push(transform(item));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
/**
|
||||
* This class is intended as a placeholder for utility methods unrelated
|
||||
* to actual classes of the game system or of FoundryVTT
|
||||
@ -41,4 +40,23 @@ export class Misc {
|
||||
default: return '1/' + diviseur;
|
||||
}
|
||||
}
|
||||
|
||||
static classify(items, classifier = it => it.type, transform = it => it) {
|
||||
let itemsBy = {};
|
||||
Misc.classifyInto(itemsBy, items, classifier, transform);
|
||||
return itemsBy;
|
||||
}
|
||||
|
||||
static classifyInto(itemsBy, items, classifier = it => it.type, transform = it => it) {
|
||||
for (const item of items) {
|
||||
const classification = classifier(item);
|
||||
let list = itemsBy[classification];
|
||||
if (!list) {
|
||||
list = [];
|
||||
itemsBy[classification] = list;
|
||||
}
|
||||
list.push(transform(item));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
70
module/poetique.js
Normal file
70
module/poetique.js
Normal file
@ -0,0 +1,70 @@
|
||||
|
||||
const poesieHautReve = [
|
||||
{
|
||||
reference: 'Le Ratier Bretonien',
|
||||
extrait: `Le courant du Fleuve
|
||||
<br>Te domine et te Porte
|
||||
<br>Avant que tu te moeuves
|
||||
<br>Combat le, ou il t'emporte`
|
||||
},
|
||||
{
|
||||
reference: 'Incompatibilité, Charles Beaudelaire',
|
||||
extrait: `Et lorsque par hasard une nuée errante
|
||||
<br>Assombrit dans son vol le lac silencieux,
|
||||
<br>On croirait voir la robe ou l'ombre transparente
|
||||
<br>D'un esprit qui voyage et passe dans les cieux.`
|
||||
},
|
||||
{
|
||||
reference: 'Au fleuve de Loire, Joachim du Bellay',
|
||||
extrait: `Ô de qui la vive course
|
||||
<br>Prend sa bienheureuse source,
|
||||
<br>D’une argentine fontaine,
|
||||
<br>Qui d’une fuite lointaine,
|
||||
<br>Te rends au sein fluctueux
|
||||
<br>De l’Océan monstrueux`
|
||||
},
|
||||
{
|
||||
reference: 'Denis Gerfaud',
|
||||
extrait: `Et l'on peut savoir qui est le maître d'Oniros, c'est le Fleuve de l'Oubli.
|
||||
Et l'on sait qui est le créateur du Fleuve de l'Oubli, c'est Hypnos et Narcos.
|
||||
Mais l'on ne sait pas qui est le maître du Fleuve de l'Oubli,
|
||||
sinon peut-être lui-même, ou peut-être Thanatos` },
|
||||
{
|
||||
reference: 'Denis Gerfaud',
|
||||
extrait: `Narcos est la source du Fleuve de l'Oubli et Hypnos l'embouchure
|
||||
Remonter le Fleuve est la Voie de la Nuit, la Voie du Souvenir.
|
||||
Descendre le Fleuve est la Voie du Jour, la Voie de l'Oubli`
|
||||
},
|
||||
{
|
||||
reference: 'Denis Gerfaud',
|
||||
extrait: `Narcos engendre le fils dont il est la mère à l'heure du Vaisseau,
|
||||
car Oniros s'embarque pour redescendre le Fleuve
|
||||
vers son père Hypnos sur la Voie de l'Oubli`
|
||||
},
|
||||
{
|
||||
reference: 'Denis Gerfaud',
|
||||
extrait: `Hypnos engendre le fils dont il est la mère à l'heure du Serpent, car
|
||||
tel les serpents, Oniros commence à remonter le Fleuve
|
||||
sur le Voie du Souvenir vers son père Narcos`
|
||||
},
|
||||
{
|
||||
reference: 'Denis Gerfaud',
|
||||
extrait: `Ainsi se cuccèdent les Jours et les Ages.
|
||||
<br>Les jours des Dragons sont les Ages des Hommes.`
|
||||
},
|
||||
{
|
||||
reference: 'Denis Gerfaud',
|
||||
extrait: `Ainsi parlent les sages:
|
||||
«Les Dragons sont créateurs de leurs rêves, mais ils ne sont pas créateurs d'Oniros
|
||||
Les Dragons ne sont pas les maîtres de leurs rêvezs, car ils ne sont pas maîtres d'Oniros.
|
||||
Nul ne sait qui est le créateur des Dragons, ni qui est leur maître.
|
||||
Mais l'on peut supposer qui est le maître du Rêve des Dragons, c'est Oniros»`
|
||||
},
|
||||
]
|
||||
|
||||
export class Poetique {
|
||||
static getExtrait(){
|
||||
return poesieHautReve[new Roll("1d" + poesieHautReve.length).evaluate().total - 1]
|
||||
}
|
||||
|
||||
}
|
@ -79,7 +79,8 @@ export class RdDCalendrier extends Application {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDateFromIndex( index ) {
|
||||
getDateFromIndex( index = undefined ) {
|
||||
if ( !index) index = this.getCurrentDayIndex();
|
||||
let month = Math.floor(index / 28);
|
||||
let day = (index - (month*28)) + 1;
|
||||
return day+" "+heuresList[month];
|
||||
|
@ -9,6 +9,23 @@ import { RdDRoll } from "./rdd-roll.js";
|
||||
import { RdDRollTables } from "./rdd-rolltables.js";
|
||||
import { ReglesOptionelles } from "./regles-optionelles.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDCombatManager extends Combat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
cleanItemUse() {
|
||||
for(let turn of this.turns) {
|
||||
turn.actor.resetItemUse()
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async nextRound() {
|
||||
console.log('New round !');
|
||||
this.cleanItemUse();
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDCombat {
|
||||
|
||||
@ -39,13 +56,15 @@ export class RdDCombat {
|
||||
/* -------------------------------------------- */
|
||||
static onUpdateCombat(combat, data) {
|
||||
if (combat.data.round != 0 && combat.turns && combat.data.active) {
|
||||
RdDCombat.combatNouveauRound(combat);
|
||||
RdDCombat.combatNouveauTour(combat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static onPreDeleteCombat(combat, options) {
|
||||
if (game.user.isGM) {
|
||||
combat.cleanItemUse();
|
||||
ChatUtility.removeChatMessageContaining(`<div data-combatid="${combat.id}" data-combatmessage="actor-turn-summary">`)
|
||||
/*
|
||||
* TODO: support de plusieurs combats parallèles
|
||||
@ -64,7 +83,7 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static combatNouveauRound(combat) {
|
||||
static combatNouveauTour(combat) {
|
||||
let turn = combat.turns.find(t => t.tokenId == combat.current.tokenId);
|
||||
if (game.user.isGM) {
|
||||
// seul le GM notifie le status
|
||||
@ -358,6 +377,8 @@ export class RdDCombat {
|
||||
|
||||
let rollData = this._prepareAttaque(competence, arme);
|
||||
console.log("RdDCombat.attaque >>>", rollData);
|
||||
this.attacker.incItemUse( arme._id ); // Usage
|
||||
this.attacker.verifierForceMin( arme );
|
||||
|
||||
const dialog = await RdDRoll.create(this.attacker, rollData,
|
||||
{
|
||||
@ -457,15 +478,24 @@ export class RdDCombat {
|
||||
if (essaisPrecedents) {
|
||||
mergeObject(attackerRoll.essais, essaisPrecedents, { overwrite: true });
|
||||
}
|
||||
|
||||
// # utilisation esquive
|
||||
let esquiveUsage = 0;
|
||||
let esquive = this.defender.getCompetence("esquive");
|
||||
if (esquive) {
|
||||
esquiveUsage = this.defender.getItemUse( esquive._id);
|
||||
}
|
||||
|
||||
const paramChatDefense = {
|
||||
passeArme: attackerRoll.passeArme,
|
||||
essais: attackerRoll.essais,
|
||||
defender: this.defender,
|
||||
attacker: this.attacker,
|
||||
attackerId: this.attackerId,
|
||||
esquiveUsage: esquiveUsage,
|
||||
defenderTokenId: this.defenderTokenId,
|
||||
mainsNues: attackerRoll.dmg.mortalite != 'mortel' && this.defender.getCompetence("Corps à corps"),
|
||||
armes: this._filterArmesParade(this.defender.data.items, attackerRoll.competence, attackerRoll.arme),
|
||||
armes: this._filterArmesParade(this.defender, attackerRoll.competence, attackerRoll.arme),
|
||||
diffLibre: attackerRoll.ajustements?.diffLibre?.value ?? 0,
|
||||
attaqueParticuliere: attackerRoll.particuliere,
|
||||
attaqueCategorie: attackerRoll.competence.data.categorie,
|
||||
@ -510,8 +540,12 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_filterArmesParade(items, competence) {
|
||||
_filterArmesParade(defender, competence) {
|
||||
let items = defender.data.items;
|
||||
items = items.filter(item => RdDItemArme.isArmeUtilisable(item) || RdDItemCompetenceCreature.isCompetenceParade(item));
|
||||
for( let item of items) {
|
||||
item.data.nbUsage = defender.getItemUse( item._id); // Ajout du # d'utilisation ce round
|
||||
}
|
||||
switch (competence.data.categorie) {
|
||||
case 'tir':
|
||||
case 'lancer':
|
||||
@ -575,6 +609,7 @@ export class RdDCombat {
|
||||
let arme = this.defender.getArmeParade(armeParadeId);
|
||||
|
||||
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
|
||||
this.defender.incItemUse( armeParadeId ); // Usage
|
||||
|
||||
let rollData = this._prepareParade(attackerRoll, arme);
|
||||
|
||||
@ -596,6 +631,7 @@ export class RdDCombat {
|
||||
dialog.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_prepareParade(attackerRoll, armeParade) {
|
||||
const compName = armeParade.data.competence;
|
||||
const armeAttaque = attackerRoll.arme;
|
||||
@ -681,6 +717,7 @@ export class RdDCombat {
|
||||
}
|
||||
console.log("RdDCombat.esquive >>>", attackerRoll, esquive);
|
||||
let rollData = this._prepareEsquive(attackerRoll, esquive);
|
||||
this.defender.incItemUse( esquive._id ); // Usage
|
||||
|
||||
const dialog = await RdDRoll.create(this.defender, rollData,
|
||||
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html' }, {
|
||||
|
@ -1,16 +1,16 @@
|
||||
/* -------------------------------------------- */
|
||||
|
||||
import { ChatUtility } from "./chat-utility.js";
|
||||
import { DeDraconique } from "./de-draconique.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDDice } from "./rdd-dice.js";
|
||||
import { RdDNameGen } from "./rdd-namegen.js";
|
||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||
import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js";
|
||||
import { RdDRollTables } from "./rdd-rolltables.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { TMRRencontres } from "./tmr-rencontres.js";
|
||||
import { TMRUtility } from "./tmr-utility.js";
|
||||
import { TMRType, TMRUtility } from "./tmr-utility.js";
|
||||
|
||||
const rddRollNumeric = /(\d+)\s*([\+\-]?\d+)?\s*(s)?/;
|
||||
|
||||
@ -22,21 +22,25 @@ export class RdDCommands {
|
||||
const rddCommands = new RdDCommands();
|
||||
rddCommands.registerCommand({ path: ["/aide"], func: (content, msg, params) => rddCommands.help(msg), descr: "Affiche l'aide pour toutes les commandes" });
|
||||
rddCommands.registerCommand({ path: ["/help"], func: (content, msg, params) => rddCommands.help(msg), descr: "Affiche l'aide pour toutes les commandes" });
|
||||
rddCommands.registerCommand({ path: ["/table", "queues"], func: (content, msg, params) => RdDRollTables.getQueue(), descr: "Tire une Queue de Dragon" });
|
||||
rddCommands.registerCommand({ path: ["/table", "ombre"], func: (content, msg, params) => RdDRollTables.getOmbre(), descr: "Tire une Ombre de Dragon" });
|
||||
rddCommands.registerCommand({ path: ["/table", "tetehr"], func: (content, msg, params) => RdDRollTables.getTeteHR(), descr: "Tire une Tête de Dragon pour Hauts Revants" });
|
||||
rddCommands.registerCommand({ path: ["/table", "tete"], func: (content, msg, params) => RdDRollTables.getTete(), descr: "Tire une Tête de Dragon" });
|
||||
rddCommands.registerCommand({ path: ["/table", "souffle"], func: (content, msg, params) => RdDRollTables.getSouffle(), descr: " Tire un Souffle de Dragon" });
|
||||
rddCommands.registerCommand({ path: ["/table", "tarot"], func: (content, msg, params) => RdDRollTables.getTarot(), descr: "Tire une carte du Tarot Draconique" });
|
||||
rddCommands.registerCommand({ path: ["/table", "tmr"], func: (content, msg, params) => TMRUtility.getTMRAleatoire(), descr: "Tire une case aléatoire des Terres médianes" });
|
||||
rddCommands.registerCommand({ path: ["/table", "queues"], func: (content, msg, params) => RdDRollTables.getQueue(true), descr: "Tire une Queue de Dragon" });
|
||||
rddCommands.registerCommand({ path: ["/table", "ombre"], func: (content, msg, params) => RdDRollTables.getOmbre(true), descr: "Tire une Ombre de Dragon" });
|
||||
rddCommands.registerCommand({ path: ["/table", "tetehr"], func: (content, msg, params) => RdDRollTables.getTeteHR(true), descr: "Tire une Tête de Dragon pour Hauts Revants" });
|
||||
rddCommands.registerCommand({ path: ["/table", "tete"], func: (content, msg, params) => RdDRollTables.getTete(true), descr: "Tire une Tête de Dragon" });
|
||||
rddCommands.registerCommand({ path: ["/table", "souffle"], func: (content, msg, params) => RdDRollTables.getSouffle(true), descr: " Tire un Souffle de Dragon" });
|
||||
rddCommands.registerCommand({ path: ["/table", "comp"], func: (content, msg, params) => RdDRollTables.getCompetence(true), descr: "Tire une compétence au hasard" });
|
||||
rddCommands.registerCommand({ path: ["/table", "tarot"], func: (content, msg, params) => RdDRollTables.getTarot(true), descr: "Tire une carte du Tarot Draconique" });
|
||||
rddCommands.registerCommand({ path: ["/nom"], func: (content, msg, params) => RdDNameGen.getName(msg, params), descr: "Génère un nom aléatoire" });
|
||||
|
||||
rddCommands.registerCommand({ path: ["/tmra"], func: (content, msg, params) => TMRUtility.getTMRAleatoire(), descr: "Tire une case aléatoire des Terres médianes" });
|
||||
rddCommands.registerCommand({
|
||||
path: ["/tmra"], func: (content, msg, params) => rddCommands.getTMRAleatoire(msg, params),
|
||||
descr: `Tire une case aléatoire des Terres médianes
|
||||
<br><strong>/tmra forêt</strong> détermine une 'forêt' aléatoire
|
||||
<br><strong>/tmra</strong> détermine une case aléatoire dans toutes les TMR` });
|
||||
rddCommands.registerCommand({
|
||||
path: ["/tmrr"], func: (content, msg, params) => rddCommands.getRencontreTMR(params),
|
||||
descr: `
|
||||
Exemple: <strong>/tmrr foret</strong> lance un d100 et détermine la rencontre correspondante en 'forêt'
|
||||
Exemple: <strong>/tmrr forêt 47</strong> détermine la rencontre en 'forêt' pour un jet de dé de 47
|
||||
`
|
||||
descr: `Détermine une rencontre dans un type de case
|
||||
<br><strong>/tmrr foret</strong> lance un d100 et détermine la rencontre correspondante en 'forêt'
|
||||
<br><strong>/tmrr forêt 47</strong> détermine la rencontre en 'forêt' pour un jet de dé de 47`
|
||||
});
|
||||
|
||||
rddCommands.registerCommand({
|
||||
@ -55,27 +59,24 @@ export class RdDCommands {
|
||||
rddCommands.registerCommand({
|
||||
path: ["/rdd"], func: (content, msg, params) => rddCommands.rollRdd(msg, params),
|
||||
descr: `Effectue un jet de dés dans la table de résolution. Exemples:
|
||||
<br><strong>/rdd</strong> ouvre la table de résolution
|
||||
<br><strong>/rdd 10 3</strong> effectue un jet 10 à +3
|
||||
<br><strong>/rdd 10 +2</strong> effectue un jet 10 à +2
|
||||
<br><strong>/rdd 15 -2</strong> effectue un jet 15 à -2
|
||||
<br><strong>/rdd 15 0 s</strong> effectue un jet 15 à 0, avec significative requise
|
||||
`
|
||||
<br><strong>/rdd</strong> ouvre la table de résolution
|
||||
<br><strong>/rdd 10 3</strong> effectue un jet 10 à +3
|
||||
<br><strong>/rdd 10 +2</strong> effectue un jet 10 à +2
|
||||
<br><strong>/rdd 15 -2</strong> effectue un jet 15 à -2
|
||||
<br><strong>/rdd 15 0 s</strong> effectue un jet 15 à 0, avec significative requise`
|
||||
});
|
||||
rddCommands.registerCommand({ path: ["/ddr"], func: (content, msg, params) => rddCommands.rollDeDraconique(msg), descr: "Lance un Dé Draconique" });
|
||||
|
||||
rddCommands.registerCommand({
|
||||
path: ["/payer"], func: (content, msg, params) => RdDUtility.afficherDemandePayer(params[0], params[1]),
|
||||
descr: `Permet de payer un montant. Exemples:
|
||||
<br><strong>/payer 5s 10d</strong> permet d'envoyer un message pour payer 5 sols et 10 deniers
|
||||
<br><strong>/payer 10d</strong> permet d'envoyer un message pour payer 10 deniers
|
||||
`
|
||||
<br><strong>/payer 5s 10d</strong> permet d'envoyer un message pour payer 5 sols et 10 deniers
|
||||
<br><strong>/payer 10d</strong> permet d'envoyer un message pour payer 10 deniers`
|
||||
});
|
||||
rddCommands.registerCommand({
|
||||
path: ["/astro"], func: (content, msg, params) => RdDUtility.afficherHeuresChanceMalchance(params[0]),
|
||||
descr: `Affiche les heures de chance et de malchance selon l'heure de naissance donnée en argument. Exemples:
|
||||
<br><strong>/astro Lyre</strong>
|
||||
`
|
||||
<br><strong>/astro Lyre</strong>`
|
||||
});
|
||||
game.system.rdd.commands = rddCommands;
|
||||
}
|
||||
@ -187,7 +188,7 @@ export class RdDCommands {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getRencontreTMR(params) {
|
||||
if (params.length == 1 || params.length ==2) {
|
||||
if (params.length == 1 || params.length == 2) {
|
||||
return TMRRencontres.rollRencontre(params[0], params[1])
|
||||
}
|
||||
else {
|
||||
@ -234,6 +235,18 @@ export class RdDCommands {
|
||||
RdDCommands._chatAnswer(msg, `Lancer d'un Dé draconique: ${ddr.total}`);
|
||||
}
|
||||
|
||||
getTMRAleatoire(msg, params) {
|
||||
if (params.length < 2) {
|
||||
let type = params[0];
|
||||
const tmr = TMRUtility.getTMRAleatoire(it => it.type == type);
|
||||
RdDCommands._chatAnswer(msg, `Case aléatoire: ${tmr.coord} - ${tmr.label}`);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCoutXpComp(msg, params) {
|
||||
if (params && (params.length == 1 || params.length == 2)) {
|
||||
|
@ -1,17 +1,15 @@
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
* Mapping des types d'Item/Actor vers le nom d'affichage.
|
||||
* Par défaut, on prend le type avec la première lettre
|
||||
* majuscule, pas besoin d'ajouter tous les types.
|
||||
*/
|
||||
const typeDisplayName = {
|
||||
"objet": "Objet",
|
||||
"arme": "Arme",
|
||||
"armure": "Armure",
|
||||
"conteneur": "Conteneur",
|
||||
"competence": "Compétence",
|
||||
"sort": "Sort",
|
||||
"herbe": "Plante",
|
||||
"ingredient": "Ingrédient",
|
||||
"livre": "Livre",
|
||||
"potion": "Potion",
|
||||
"munition": "Munition",
|
||||
"queue": "Queue de dragon",
|
||||
"ombre": "Ombre de Thanatos",
|
||||
"souffle": "Souffle de Dragon",
|
||||
@ -20,20 +18,16 @@ const typeDisplayName = {
|
||||
"rencontresTMR": "Rencontre des TMR",
|
||||
"competencecreature": "Compétence de créature",
|
||||
"nombreastral": "Nombre astral",
|
||||
"casetmr": "Case des TMR",
|
||||
"casetmr": "Effet sur TMR",
|
||||
"recettealchimique": "Recette alchimique",
|
||||
"recettecuisine": "Recette de cuisine",
|
||||
"tarot": "Carte de tarot draconique",
|
||||
"tache": "Tâche",
|
||||
"meditation": "Méditation",
|
||||
"monnaie": "Monnaie",
|
||||
"musique": "Morceau de musique",
|
||||
"chant": "Chanson",
|
||||
"danse": "Danse",
|
||||
"jeu": "Jeu",
|
||||
"personnage": "Personnage",
|
||||
"creature": "Créature",
|
||||
"entite": "Entité de cauchemar",
|
||||
"entite": "Entité",
|
||||
"vehicule": "Véhicule"
|
||||
}
|
||||
|
||||
|
84
module/rdd-hotbar-drop.js
Normal file
84
module/rdd-hotbar-drop.js
Normal file
@ -0,0 +1,84 @@
|
||||
|
||||
export class RdDHotbar {
|
||||
|
||||
/**
|
||||
* Create a macro when dropping an entity on the hotbar
|
||||
* Item - open roll dialog for item
|
||||
* Actor - open actor sheet
|
||||
* Journal - open journal sheet
|
||||
*/
|
||||
static initDropbar( ) {
|
||||
|
||||
Hooks.on("hotbarDrop", async (bar, data, slot) => {
|
||||
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
|
||||
if (data.type == "Item") {
|
||||
if (data.data.type != "arme" && data.data.type != "competence" )
|
||||
return
|
||||
let item = data.data
|
||||
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}");`;
|
||||
let macro = game.macros.entities.find(m => (m.name === item.name) && (m.command === command));
|
||||
if (!macro) {
|
||||
macro = await Macro.create({
|
||||
name: item.name,
|
||||
type: "script",
|
||||
img: item.img,
|
||||
command: command
|
||||
}, { displaySheet: false })
|
||||
}
|
||||
game.user.assignHotbarMacro(macro, slot);
|
||||
}
|
||||
// Create a macro to open the actor sheet of the actor dropped on the hotbar
|
||||
else if (data.type == "Actor") {
|
||||
let actor = game.actors.get(data.id);
|
||||
let command = `game.actors.get("${data.id}").sheet.render(true)`
|
||||
let macro = game.macros.entities.find(m => (m.name === actor.name) && (m.command === command));
|
||||
if (!macro) {
|
||||
macro = await Macro.create({
|
||||
name: actor.data.name,
|
||||
type: "script",
|
||||
img: actor.data.img,
|
||||
command: command
|
||||
}, { displaySheet: false })
|
||||
game.user.assignHotbarMacro(macro, slot);
|
||||
}
|
||||
}
|
||||
// Create a macro to open the journal sheet of the journal dropped on the hotbar
|
||||
else if (data.type == "JournalEntry") {
|
||||
let journal = game.journal.get(data.id);
|
||||
let command = `game.journal.get("${data.id}").sheet.render(true)`
|
||||
let macro = game.macros.entities.find(m => (m.name === journal.name) && (m.command === command));
|
||||
if (!macro) {
|
||||
macro = await Macro.create({
|
||||
name: journal.data.name,
|
||||
type: "script",
|
||||
img: "systems/wfrp4e/icons/buildings/scroll.png",
|
||||
command: command
|
||||
}, { displaySheet: false })
|
||||
game.user.assignHotbarMacro(macro, slot);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/** Roll macro */
|
||||
static rollMacro(itemName, itemType, bypassData) {
|
||||
const speaker = ChatMessage.getSpeaker();
|
||||
let actor;
|
||||
if (speaker.token) actor = game.actors.tokens[speaker.token];
|
||||
if (!actor) actor = game.actors.get(speaker.actor);
|
||||
let item = actor ? actor.items.find(i => i.name === itemName && i.type == itemType) : null;
|
||||
if (!item) return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`);
|
||||
|
||||
item = item.data;
|
||||
|
||||
// Trigger the item roll
|
||||
switch (item.type) {
|
||||
case "arme":
|
||||
return actor.rollArme(item.data.competence, itemName);
|
||||
case "competence":
|
||||
return actor.rollCompetence( itemName );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -20,13 +20,15 @@ import { RdDCalendrier } from "./rdd-calendrier.js";
|
||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||
import { RdDTokenHud } from "./rdd-token-hud.js";
|
||||
import { RdDCommands } from "./rdd-commands.js";
|
||||
import { RdDCombat } from "./rdd-combat.js";
|
||||
import { RdDCombatManager, RdDCombat } from "./rdd-combat.js";
|
||||
import { ChatUtility } from "./chat-utility.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { StatusEffects } from "./status-effects.js";
|
||||
import { RddCompendiumOrganiser } from "./rdd-compendium-organiser.js";
|
||||
import { ReglesOptionelles } from "./regles-optionelles.js";
|
||||
import { TMRRencontres } from "./tmr-rencontres.js";
|
||||
import { RdDHotbar } from "./rdd-hotbar-drop.js"
|
||||
import { EffetsDraconiques } from "./tmr/effets-draconiques.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
@ -113,7 +115,8 @@ Hooks.once("init", async function () {
|
||||
// Create useful storage space
|
||||
game.system.rdd = {
|
||||
TMRUtility,
|
||||
RdDUtility
|
||||
RdDUtility,
|
||||
RdDHotbar
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -217,6 +220,7 @@ Hooks.once("init", async function () {
|
||||
Actors.registerSheet("foundryvtt-reve-de-dragon", RdDActorEntiteSheet, { types: ["entite"], makeDefault: true });
|
||||
Items.unregisterSheet("core", ItemSheet);
|
||||
Items.registerSheet("foundryvtt-reve-de-dragon", RdDItemSheet, { makeDefault: true });
|
||||
CONFIG.Combat.entityClass = RdDCombatManager;
|
||||
|
||||
// Handlebar function pour container
|
||||
Handlebars.registerHelper('buildConteneur', (objet) => { return RdDUtility.buildConteneur(objet); });
|
||||
@ -231,8 +235,10 @@ Hooks.once("init", async function () {
|
||||
RdDActor.init();
|
||||
RddCompendiumOrganiser.init();
|
||||
ReglesOptionelles.init();
|
||||
EffetsDraconiques.init()
|
||||
TMRUtility.init();
|
||||
TMRRencontres.init();
|
||||
RdDHotbar.initDropbar();
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -296,4 +302,9 @@ Hooks.on("chatMessage", (html, content, msg) => {
|
||||
/* -------------------------------------------- */
|
||||
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
|
||||
RdDUtility.pushInitiativeOptions(html, options);
|
||||
})
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
Hooks.on("renderChatMessage", async (app, html, msg) => {
|
||||
RdDUtility.onRenderChatMessage(app, html, msg);
|
||||
});
|
||||
|
17
module/rdd-namegen.js
Normal file
17
module/rdd-namegen.js
Normal file
@ -0,0 +1,17 @@
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
const words = [ 'pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i', 'onse', 'iane', 'ane', 'zach', 'arri', 'ba', 'bo', 'bi',
|
||||
'alta', 'par', 'pir', 'zor', 'zir', 'de', 'pol', 'tran', 'no', 'la','al' , 'pul', 'one', 'ner', 'nur' ];
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDNameGen {
|
||||
|
||||
static getName( msg, params ) {
|
||||
let max = words.length;
|
||||
let name = words[new Roll("1d"+max+" -1").roll().total];
|
||||
name += words[new Roll("1d"+max+" -1").roll().total];
|
||||
//console.log(name);
|
||||
ChatMessage.create( { content: `Nom : ${name}`, whisper: ChatMessage.getWhisperRecipients("GM") } );
|
||||
}
|
||||
|
||||
}
|
@ -46,18 +46,23 @@ export class RdDRoll extends Dialog {
|
||||
surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false,
|
||||
surencMalusValue: actor.getSurenc(),
|
||||
useMalusSurenc: false,
|
||||
<<<<<<< HEAD
|
||||
appelAuMoralPossible : false, /* Est-ce que l'appel au moral est possible ? Variable utisé pour l'affichage ou non de la ligne concernant le moral */
|
||||
appelAuMoralDemander :false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */
|
||||
jetEchouerMoralDiminuer : false, /* Pour l'affichage dans le chat */
|
||||
use: { libre:true, conditions: true, surenc: false, encTotal: false, appelAuMoral : false /* Le jet se fait ou non en utilisant l'appel au moral */},
|
||||
=======
|
||||
use: { libre: true, conditions: true, surenc: false, encTotal: false, },
|
||||
>>>>>>> v1.3
|
||||
isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
||||
useMalusEncTotal: false,
|
||||
encTotal: actor.getEncTotal(),
|
||||
ajustementAstrologique: actor.ajustementAstrologique(),
|
||||
surprise: actor.getSurprise(false),
|
||||
canClose: true
|
||||
}
|
||||
mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
|
||||
if ( rollData.forceCarac) {
|
||||
if (rollData.forceCarac) {
|
||||
rollData.carac = rollData.forceCarac;
|
||||
}
|
||||
RollDataAjustements.calcul(rollData, actor);
|
||||
@ -85,7 +90,12 @@ export class RdDRoll extends Dialog {
|
||||
close: close
|
||||
};
|
||||
for (let action of actions) {
|
||||
conf.buttons[action.name] = { label: action.label, callback: html => this.onAction(action, html) };
|
||||
conf.buttons[action.name] = {
|
||||
label: action.label, callback: html => {
|
||||
this.rollData.canClose = true;
|
||||
this.onAction(action, html)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
super(conf, options);
|
||||
@ -94,6 +104,14 @@ export class RdDRoll extends Dialog {
|
||||
this.rollData = rollData;
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this.rollData.canClose) {
|
||||
return super.close();
|
||||
}
|
||||
ui.notifications.info("Vous devez faire ce jet de dés!");
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async onAction(action, html) {
|
||||
await RdDResolutionTable.rollData(this.rollData);
|
||||
@ -114,7 +132,7 @@ export class RdDRoll extends Dialog {
|
||||
this.bringToTop();
|
||||
|
||||
var dialog = this;
|
||||
|
||||
|
||||
function onLoad() {
|
||||
let rollData = dialog.rollData;
|
||||
// Update html, according to data
|
||||
@ -124,7 +142,7 @@ export class RdDRoll extends Dialog {
|
||||
$("#carac").val(rollData.competence.data.defaut_carac);
|
||||
}
|
||||
if (rollData.selectedSort) {
|
||||
$("#draconic").val( rollData.selectedSort.data.listIndex ); // Uniquement a la selection du sort, pour permettre de changer
|
||||
$("#draconic").val(rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer
|
||||
}
|
||||
RdDItemSort.setCoutReveReel(rollData.selectedSort);
|
||||
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
|
||||
@ -157,9 +175,9 @@ export class RdDRoll extends Dialog {
|
||||
html.find('#sort').change((event) => {
|
||||
let sortKey = Misc.toInt(event.currentTarget.value);
|
||||
this.rollData.selectedSort = this.rollData.sortList[sortKey]; // Update the selectedCarac
|
||||
this.rollData.bonus = RdDItemSort.getCaseBonus(this.rollData.selectedSort, this.rollData.coord);
|
||||
this.rollData.bonus = RdDItemSort.getCaseBonus(this.rollData.selectedSort, this.rollData.tmr.coord);
|
||||
RdDItemSort.setCoutReveReel(this.rollData.selectedSort);
|
||||
$("#draconic").val( this.rollData.selectedSort.data.listIndex ); // Uniquement a la selection du sort, pour permettre de changer
|
||||
$("#draconic").val(this.rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#ptreve-variable').change((event) => {
|
||||
@ -168,12 +186,6 @@ export class RdDRoll extends Dialog {
|
||||
console.log("RdDRollSelectDialog - Cout reve", ptreve);
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#ptreve-variable').change((event) => {
|
||||
let ptreve = Misc.toInt(event.currentTarget.value);
|
||||
this.rollData.selectedSort.data.ptreve_reel = ptreve; // Update the selectedCarac
|
||||
console.log("RdDRollSelectDialog - Cout reve", ptreve);
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#coupsNonMortels').change((event) => {
|
||||
this.rollData.dmg.mortalite = event.currentTarget.checked ? "non-mortel" : "mortel";
|
||||
this.updateRollResult();
|
||||
@ -232,7 +244,9 @@ export class RdDRoll extends Dialog {
|
||||
dmgText = '(' + dmgText + ')';
|
||||
}
|
||||
if (rollData.selectedSort) {
|
||||
rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord);
|
||||
rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.tmr.coord);
|
||||
HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(rollData.selectedSort))
|
||||
HtmlUtility._showControlWhen($("#div-sort-ptreve"), RdDItemSort.isCoutVariable(rollData.selectedSort))
|
||||
}
|
||||
|
||||
if ( ! RdDCarac.isActionPhysique(rollData.selectedCarac || ! actor.isPersonnage() ) ) {
|
||||
@ -244,28 +258,18 @@ export class RdDRoll extends Dialog {
|
||||
|
||||
}
|
||||
|
||||
|
||||
RollDataAjustements.calcul(rollData, this.actor);
|
||||
rollData.finalLevel = this._computeFinalLevel(rollData);
|
||||
|
||||
|
||||
HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used);
|
||||
HtmlUtility._showControlWhen($("#divAppelAuMoral"), rollData.appelAuMoralPossible );
|
||||
HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence));
|
||||
HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData));
|
||||
|
||||
// Sort management
|
||||
if (rollData.selectedSort) {
|
||||
rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord);
|
||||
//console.log("Toggle show/hide", rollData.selectedSort);
|
||||
HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(rollData.selectedSort))
|
||||
HtmlUtility._showControlWhen($("#div-sort-ptreve"), RdDItemSort.isCoutVariable(rollData.selectedSort))
|
||||
}
|
||||
|
||||
// Mise à jour valeurs
|
||||
$("#compdialogTitle").text(this._getTitle(rollData));
|
||||
$('#coupsNonMortels').prop('checked', rollData.coupsNonMortels);
|
||||
$("#dmg-arme-actor").text(dmgText);
|
||||
// $("#defenseur-surprise").text(RdDBonus.description(rollData.ajustements.attaqueDefenseurSurpris.descr));
|
||||
$('.table-ajustement').remove();
|
||||
$(".table-resolution").remove();
|
||||
$(".table-proba-reussite").remove();
|
||||
@ -276,7 +280,7 @@ export class RdDRoll extends Dialog {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async buildAjustements(rollData){
|
||||
async buildAjustements(rollData) {
|
||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ajustements.html`, rollData);
|
||||
return html;
|
||||
}
|
||||
|
@ -35,15 +35,20 @@ export class RdDRollTables {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getSouffle(toChat = true) {
|
||||
static async getCompetence(toChat = false) {
|
||||
return await RdDRollTables.drawItemFromRollTable("Détermination aléatoire de compétence", toChat);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getSouffle(toChat = false) {
|
||||
return await RdDRollTables.drawItemFromRollTable("Souffles de Dragon", toChat);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getQueue(toChat = true) {
|
||||
let queue = await RdDRollTables.drawItemFromRollTable("Queues de dragon", toChat);
|
||||
static async getQueue(toChat = false) {
|
||||
let queue = await RdDRollTables.drawItemFromRollTable("Queues de dragon", toChat);
|
||||
if (queue.name.toLowerCase().includes('lancinant') ) {
|
||||
queue = await RdDRollTables.drawItemFromRollTable("Désirs lancinants", toChat);
|
||||
queue = await RdDRollTables.drawItemFromRollTable("Désirs lancinants", toChat);
|
||||
}
|
||||
if (queue.name.toLowerCase().includes('fixe') ) {
|
||||
queue = await RdDRollTables.drawItemFromRollTable("Idées fixes", toChat);
|
||||
@ -52,17 +57,17 @@ export class RdDRollTables {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getTete(toChat = true) {
|
||||
static async getTete(toChat = false) {
|
||||
return await RdDRollTables.drawItemFromRollTable("Têtes de Dragon pour haut-rêvants", toChat);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getTeteHR(toChat = true) {
|
||||
static async getTeteHR(toChat = false) {
|
||||
return await RdDRollTables.drawItemFromRollTable("Têtes de Dragon pour tous personnages", toChat);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getOmbre(toChat = true) {
|
||||
static async getOmbre(toChat = false) {
|
||||
return await RdDRollTables.drawItemFromRollTable("Ombre de Thanatos", toChat);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,22 @@
|
||||
/* -------------------------------------------- */
|
||||
export class RdDTMRRencontreDialog extends Dialog {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(html, tmrApp, rencontre) {
|
||||
constructor(html, tmrApp, rencontre, postRencontre) {
|
||||
const dialogConf = {
|
||||
title: "Rencontre en TMR!",
|
||||
content: "Vous recontrez un " + rencontre.name + " de force " + rencontre.force + "<br>",
|
||||
buttons: {
|
||||
derober: { icon: '<i class="fas fa-check"></i>', label: "Se dérober", callback: () => { this.toClose = true; this.tmrApp.derober() } },
|
||||
refouler: { icon: '<i class="fas fa-check"></i>', label: "Refouler", callback: () => { this.toClose = true; this.tmrApp.refouler() } },
|
||||
maitiser: { icon: '<i class="fas fa-check"></i>', label: "Maîtriser", callback: () => { this.toClose = true; this.tmrApp.maitriser() } }
|
||||
derober: { icon: '<i class="fas fa-check"></i>', label: "Se dérober", callback: () => { this.onButtonFuir(() => tmrApp.derober()); } },
|
||||
refouler: { icon: '<i class="fas fa-check"></i>', label: "Refouler", callback: () => this.onButtonAction(() => tmrApp.refouler()) },
|
||||
maitiser: { icon: '<i class="fas fa-check"></i>', label: "Maîtriser", callback: () => this.onButtonAction(() => tmrApp.maitriserRencontre()) }
|
||||
},
|
||||
default: "derober"
|
||||
}
|
||||
};
|
||||
if (rencontre.ignorer) {
|
||||
dialogConf.buttons.ignorer = { icon: '<i class="fas fa-check"></i>', label: "Ignorer", callback: () => { this.toClose = true; this.tmrApp.ignorerRencontre() }};
|
||||
}
|
||||
|
||||
dialogConf.buttons.ignorer = { icon: '<i class="fas fa-check"></i>', label: "Ignorer", callback: () => this.onButtonAction(() => tmrApp.ignorerRencontre()) }
|
||||
};
|
||||
|
||||
const dialogOptions = {
|
||||
classes: ["tmrrencdialog"],
|
||||
width: 320, height: 240,
|
||||
@ -26,13 +26,25 @@ export class RdDTMRRencontreDialog extends Dialog {
|
||||
|
||||
this.toClose = false;
|
||||
this.rencontreData = duplicate(rencontre);
|
||||
this.postRencontre = postRencontre;
|
||||
this.tmrApp = tmrApp;
|
||||
this.tmrApp.minimize();
|
||||
}
|
||||
|
||||
async onButtonAction(action) {
|
||||
this.toClose = true;
|
||||
await action();
|
||||
this.postRencontre();
|
||||
}
|
||||
|
||||
async onButtonFuir(action) {
|
||||
this.toClose = true;
|
||||
await action();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
close() {
|
||||
if ( this.toClose ) {
|
||||
if (this.toClose) {
|
||||
this.tmrApp.maximize();
|
||||
return super.close();
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
import { RdDItemArme } from "./item-arme.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const categorieCompetences = {
|
||||
@ -95,7 +97,6 @@ function _buildAllSegmentsFatigue(max) {
|
||||
ligneFatigue[caseIncrementee + 6]++;
|
||||
ligneFatigue.fatigueMax = 2 * (i + 1);
|
||||
fatigue[i + 1] = ligneFatigue;
|
||||
|
||||
}
|
||||
return fatigue;
|
||||
}
|
||||
@ -128,18 +129,6 @@ const fatigueMarche = {
|
||||
"tresdifficile": { "4": 4, "6": 6 }
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Static tables for commands /table */
|
||||
const table2func = {
|
||||
"rdd": { descr: "rdd: Ouvre la table de résolution", func: RdDRollResolutionTable.open },
|
||||
"queues": { descr: "queues: Tire une queue de Dragon", func: RdDRollTables.getQueue },
|
||||
"ombre": { descr: "ombre: Tire une Ombre de Dragon", func: RdDRollTables.getOmbre },
|
||||
"tetehr": { descr: "tetehr: Tire une Tête de Dragon pour Hauts Revants", fund: RdDRollTables.getTeteHR },
|
||||
"tete": { descr: "tete: Tire une Tête de Dragon", func: RdDRollTables.getTete },
|
||||
"souffle": { descr: "souffle: Tire un Souffle de Dragon", func: RdDRollTables.getSouffle },
|
||||
"tarot": { descr: "tarot: Tire une carte de Tarot Dracnique", func: RdDRollTables.getTarot }
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const definitionsBlessures = [
|
||||
{ type: "legere", facteur: 2 },
|
||||
@ -265,6 +254,11 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html'
|
||||
];
|
||||
|
||||
Handlebars.registerHelper('upperFirst', str=> Misc.upperFirst(str ?? 'Null'));
|
||||
Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? 'NULL' );
|
||||
Handlebars.registerHelper('le', str => Grammar.articleDetermine(str) );
|
||||
Handlebars.registerHelper('un', str => Grammar.articleIndetermine(str) );
|
||||
|
||||
return loadTemplates(templatePaths);
|
||||
}
|
||||
|
||||
@ -320,6 +314,7 @@ export class RdDUtility {
|
||||
data.data.chants = this.checkNull(data.itemsByType['chant']);
|
||||
data.data.danses = this.checkNull(data.itemsByType['danse']);
|
||||
data.data.musiques = this.checkNull(data.itemsByType['musique']);
|
||||
data.data.oeuvres = this.checkNull(data.itemsByType['oeuvre']);
|
||||
data.data.jeux = this.checkNull(data.itemsByType['jeu']);
|
||||
data.data.recettescuisine = this.checkNull(data.itemsByType['recettecuisine']);
|
||||
data.data.recettesAlchimiques = this.checkNull(data.itemsByType['recettealchimique']);
|
||||
@ -584,18 +579,23 @@ export class RdDUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getLocalisation() {
|
||||
// TODO: bouger dans une RollTable du compendium et chercher dans les RoolTable puis compendium pour permettre le changement?
|
||||
static getLocalisation( type = 'personnage' ) {
|
||||
let result = new Roll("1d20").roll().total;
|
||||
let txt = ""
|
||||
if (result <= 3) txt = "Jambe, genou, pied, jarret";
|
||||
else if (result <= 7) txt = "Hanche, cuisse, fesse";
|
||||
else if (result <= 9) txt = "Ventre, reins";
|
||||
else if (result <= 12) txt = "Poitrine, dos";
|
||||
else if (result <= 14) txt = "Avant-bras, main, coude";
|
||||
else if (result <= 18) txt = "Epaule, bras, omoplate";
|
||||
else if (result == 19) txt = "Tête";
|
||||
else if (result == 20) txt = "Tête (visage)";
|
||||
if ( type == 'personnage') {
|
||||
if (result <= 3) txt = "Jambe, genou, pied, jarret";
|
||||
else if (result <= 7) txt = "Hanche, cuisse, fesse";
|
||||
else if (result <= 9) txt = "Ventre, reins";
|
||||
else if (result <= 12) txt = "Poitrine, dos";
|
||||
else if (result <= 14) txt = "Avant-bras, main, coude";
|
||||
else if (result <= 18) txt = "Epaule, bras, omoplate";
|
||||
else if (result == 19) txt = "Tête";
|
||||
else if (result == 20) txt = "Tête (visage)";
|
||||
} else {
|
||||
if (result <= 7) txt = "Jambes/Pattes";
|
||||
else if (result <= 18) txt = "Corps";
|
||||
else if (result <= 20) txt = "Tête";
|
||||
}
|
||||
|
||||
return { result: result, label: txt };
|
||||
}
|
||||
@ -1024,5 +1024,22 @@ export class RdDUtility {
|
||||
ui.notifications.warn("Pas d'heure de naissance selectionnée")
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
static checkThanatosXP(compName) {
|
||||
if ( compName.includes('Thanatos') ) {
|
||||
let message = "Vous avez mis des points d'Expérience dans la Voie de Thanatos !<br>Vous devez réduire manuellement d'un même montant d'XP une autre compétence Draconique.";
|
||||
ChatMessage.create({
|
||||
whisper: ChatMessage.getWhisperRecipients(game.user.name),
|
||||
content: message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
static async onRenderChatMessage( app, html, msg ) {
|
||||
// TODO
|
||||
//console.log(app, html, msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -94,10 +94,10 @@ export const referenceAjustements = {
|
||||
getDescr: (rollData, actor) => rollData.diviseurSignificative > 1 ? `Facteur significative <span class="rdd-diviseur">×${Misc.getFractionHtml(rollData.diviseurSignificative)}</span>` : ''
|
||||
},
|
||||
isEcaille: {
|
||||
isVisible: (rollData, actor) => rollData.arme && rollData.arme.data.magique && Number(rollData.arme.data.ecaille_efficacite) > 0,
|
||||
isUsed: (rollData, actor) => rollData.arme && rollData.arme.data.magique && Number(rollData.arme.data.ecaille_efficacite) > 0,
|
||||
isVisible: (rollData, actor) => rollData.arme?.data.magique && Number(rollData.arme?.data.ecaille_efficacite) > 0,
|
||||
isUsed: (rollData, actor) => rollData.arme?.data.magique && Number(rollData.arme?.data.ecaille_efficacite) > 0,
|
||||
getLabel: (rollData, actor) => "Ecaille d'Efficacité: ",
|
||||
getValue: (rollData, actor) => (rollData.arme && rollData.arme.data.magique && Number(rollData.arme.data.ecaille_efficacite) > 0) ? rollData.arme.data.ecaille_efficacite : 0,
|
||||
getValue: (rollData, actor) => (rollData.arme?.data.magique && Number(rollData.arme.data.ecaille_efficacite) > 0) ? rollData.arme.data.ecaille_efficacite : 0,
|
||||
},
|
||||
finesse: {
|
||||
isUsed: (rollData, actor) => RdDBonus.isDefenseAttaqueFinesse(rollData),
|
||||
@ -112,12 +112,12 @@ export const referenceAjustements = {
|
||||
getDescr: (rollData, actor) => RdDBonus.find(actor.getSurprise()).descr
|
||||
},
|
||||
bonusCase: {
|
||||
isUsed: (rollData, actor) => rollData.selectedSort && rollData.coord,
|
||||
getDescr: (rollData, actor) => rollData.selectedSort && rollData.coord ? `Bonus de case: ${RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord)}%` : ''
|
||||
isUsed: (rollData, actor) => rollData.selectedSort && rollData.tmr.coord,
|
||||
getDescr: (rollData, actor) => rollData.selectedSort && rollData.tmr.coord ? `Bonus de case: ${RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.tmr.coord)}%` : ''
|
||||
},
|
||||
rencontreTMR: {
|
||||
isVisible: (rollData, actor) => rollData.tmr && rollData.rencontre.name,
|
||||
isUsed: (rollData, actor) => rollData.tmr && rollData.rencontre.name,
|
||||
isVisible: (rollData, actor) => rollData.tmr && rollData.rencontre?.name,
|
||||
isUsed: (rollData, actor) => rollData.tmr && rollData.rencontre?.name,
|
||||
getLabel: (rollData, actor) => rollData.rencontre?.name,
|
||||
getValue: (rollData, actor) => - (rollData.rencontre?.force ?? 0)
|
||||
}
|
||||
|
@ -84,9 +84,9 @@ const typeRencontres = {
|
||||
},
|
||||
|
||||
changeur: {
|
||||
msgSucces: (data) => `Le ${data.rencontre.name} vaincu accepte de vous déplacer sur une autre ${TMRType[data.tmr.type]} de votre choix en échange de sa liberté.`,
|
||||
msgSucces: (data) => `Le ${data.rencontre.name} vaincu accepte de vous déplacer sur une autre ${TMRType[data.tmr.type].name} de votre choix en échange de sa liberté.`,
|
||||
msgEchec: (data) => {
|
||||
data.newTMR = TMRUtility.getTMRAleatoire(data.tmr.type);
|
||||
data.newTMR = TMRUtility.getTMRAleatoire(it => it.type = data.tmr.type);
|
||||
return `Le ${data.rencontre.name} vous embobine avec des promesses, et vous transporte en ${data.newTMR.label} sans attendre votre avis.`;
|
||||
},
|
||||
postSucces: (tmrDialog, data) => {
|
||||
@ -230,7 +230,7 @@ const typeRencontres = {
|
||||
msgSucces: (data) => `A tout seigneur, tout honneur, vous faites face à un ${data.rencontre.name}. Vous le maîtrisez et récupérez ses rêves. Vous gagnez ses ${data.rencontre.force} points de rêve`,
|
||||
msgEchec: (data) => `A tout seigneur, tout honneur, vous faites face à un ${data.rencontre.name}. La rencontre tourne au cauchemar, dans la lutte épique, vous subissez ${data.rolled.isETotal ? 'deux queues' : 'une queue'} de dragon!`,
|
||||
postSucces: (tmrDialog, data) => TMRRencontres.onPostSuccessReveDeDragon(tmrDialog, data),
|
||||
postEchec: (tmrDialog, data) => TMRRencontres.onPostSuccessReveDeDragon(tmrDialog, data),
|
||||
postEchec: (tmrDialog, data) => TMRRencontres.onPostEchecReveDeDragon(tmrDialog, data),
|
||||
poesieSucces: {
|
||||
reference: "Rêve de Dragon, Denis Gerfaud",
|
||||
extrait: `Le monde est Rêve de Dragons, mais nous ne savons
|
||||
@ -248,44 +248,44 @@ const typeRencontres = {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const mauvaisesRencontres = [
|
||||
{ code: "mangeur1d6", name: "Mangeur de Rêve", type: "mangeur", genre: "m", force: "1d6", refoulement: 2, isMauvaise: true },
|
||||
{ code: "mangeur", name: "Mangeur de Rêve", type: "mangeur", genre: "m", force: "1d6", refoulement: 2, isMauvaise: true },
|
||||
{ code: "mangeur2d6", name: "Mangeur de Rêve", type: "mangeur", genre: "m", force: "2d6", refoulement: 2, isMauvaise: true },
|
||||
{ code: "reflet2d6+4", name: "Reflet d'ancien Rêve", type: "reflet", genre: "m", force: "2d6+4", refoulement: 2, isPersistant: true, isMauvaise: true },
|
||||
{ code: "tbblanc2d6+4", name: "Tourbillon blanc", type: "tbblanc", genre: "m", force: "2d6+4", refoulement: 2, isPersistant: true, isMauvaise: true },
|
||||
{ code: "tbnoir2d8+4", name: "Tourbillon noir", type: "tbnoir", genre: "m", force: "2d8+4", refoulement: 2, isPersistant: true, isMauvaise: true },
|
||||
{ code: "passfou2d8", name: "Passeur fou", type: "passeurfou", genre: "m", force: "2d8", refoulement: 2, isMauvaise: true },
|
||||
{ code: "tbrouge2d8", name: "Tourbillon rouge", type: "tbrouge", genre: "m", force: "2d8", refoulement: 3, isPersistant: true, isMauvaise: true }
|
||||
{ code: "reflet+4", name: "Reflet d'ancien Rêve", type: "reflet", genre: "m", force: "2d6+4", refoulement: 2, isPersistant: true, isMauvaise: true },
|
||||
{ code: "tbblanc+4", name: "Tourbillon blanc", type: "tbblanc", genre: "m", force: "2d6+4", refoulement: 2, isPersistant: true, isMauvaise: true },
|
||||
{ code: "tbnoir+4", name: "Tourbillon noir", type: "tbnoir", genre: "m", force: "2d8+4", refoulement: 2, isPersistant: true, isMauvaise: true },
|
||||
{ code: "passfou", name: "Passeur fou", type: "passeurfou", genre: "m", force: "2d8", refoulement: 2, isMauvaise: true },
|
||||
{ code: "tbrouge", name: "Tourbillon rouge", type: "tbrouge", genre: "m", force: "2d8", refoulement: 3, isPersistant: true, isMauvaise: true }
|
||||
]
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const rencontresStandard = [
|
||||
{ code: "messager2d4", name: "Messager des Rêves", type: "messager", genre: "m", force: "2d4", ignorer: true },
|
||||
{ code: "passeur2d4", name: "Passeur des Rêves", type: "passeur", genre: "m", force: "2d4", ignorer: true },
|
||||
{ code: "fleur1d6", name: "Fleur des Rêves", type: "fleur", genre: "f", force: "1d6", ignorer: true },
|
||||
{ code: "mangeur1d6", name: "Mangeur de Rêve", type: "mangeur", genre: "m", force: "1d6" },
|
||||
{ code: "changeur2d6", name: "Changeur de Rêve", type: "changeur", genre: "m", force: "2d6" },
|
||||
{ code: "briseur2d6", name: "Briseur de Rêve", type: "briseur", genre: "m", force: "2d6", quitterTMR: true },
|
||||
{ code: "reflet1d6", name: "Reflet d'ancien Rêve", type: "reflet", genre: "m", force: "2d6", isPersistant: true },
|
||||
{ code: "tbblanc2d6", name: "Tourbillon blanc", type: "tbblanc", genre: "m", force: "2d6", isPersistant: true },
|
||||
{ code: "tbnoir2d8", name: "Tourbillon noir", type: "tbnoir", genre: "m", force: "2d8", isPersistant: true },
|
||||
{ code: "rdd1ddr+7", name: "Rêve de Dragon", type: "rdd", genre: "m", force: "1ddr + 7", refoulement: 2, quitterTMR: true }
|
||||
{ code: "messager", name: "Messager des Rêves", type: "messager", genre: "m", force: "2d4", ignorer: true },
|
||||
{ code: "passeur", name: "Passeur des Rêves", type: "passeur", genre: "m", force: "2d4", ignorer: true },
|
||||
{ code: "fleur", name: "Fleur des Rêves", type: "fleur", genre: "f", force: "1d6", ignorer: true },
|
||||
{ code: "mangeur", name: "Mangeur de Rêve", type: "mangeur", genre: "m", force: "1d6" },
|
||||
{ code: "changeur", name: "Changeur de Rêve", type: "changeur", genre: "m", force: "2d6" },
|
||||
{ code: "briseur", name: "Briseur de Rêve", type: "briseur", genre: "m", force: "2d6", quitterTMR: true },
|
||||
{ code: "reflet", name: "Reflet d'ancien Rêve", type: "reflet", genre: "m", force: "2d6", isPersistant: true },
|
||||
{ code: "tbblanc", name: "Tourbillon blanc", type: "tbblanc", genre: "m", force: "2d6", isPersistant: true },
|
||||
{ code: "tbnoir", name: "Tourbillon noir", type: "tbnoir", genre: "m", force: "2d8", isPersistant: true },
|
||||
{ code: "rdd", name: "Rêve de Dragon", type: "rdd", genre: "m", force: "1ddr + 7", refoulement: 2, quitterTMR: true }
|
||||
];
|
||||
|
||||
const tableRencontres = {
|
||||
cite: [{ code: 'messager2d4', range: [1, 25] }, { code: 'passeur2d4', range: [26, 50] }, { code: 'fleur1d6', range: [51, 65] }, { code: 'mangeur1d6', range: [66, 70] }, { code: 'changeur2d6', range: [71, 80] }, { code: 'briseur2d6', range: [81, 85] }, { code: 'reflet2d6', range: [86, 90] }, { code: 'tbblanc2d6', range: [91, 94] }, { code: 'tbnoir2d8', range: [95, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
sanctuaire: [{ code: 'messager2d4', range: [1, 25] }, { code: 'passeur2d4', range: [26, 50] }, { code: 'fleur1d6', range: [51, 65] }, { code: 'mangeur1d6', range: [66, 70] }, { code: 'changeur2d6', range: [71, 80] }, { code: 'briseur2d6', range: [81, 85] }, { code: 'reflet2d6', range: [86, 90] }, { code: 'tbblanc2d6', range: [91, 94] }, { code: 'tbnoir2d8', range: [95, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
plaines: [{ code: 'messager2d4', range: [1, 20] }, { code: 'passeur2d4', range: [21, 40] }, { code: 'fleur1d6', range: [41, 55] }, { code: 'mangeur1d6', range: [56, 60] }, { code: 'changeur2d6', range: [61, 75] }, { code: 'briseur2d6', range: [76, 82] }, { code: 'reflet2d6', range: [83, 88] }, { code: 'tbblanc2d6', range: [89, 93] }, { code: 'tbnoir2d8', range: [94, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
pont: [{ code: 'messager2d4', range: [1, 20] }, { code: 'passeur2d4', range: [21, 40] }, { code: 'fleur1d6', range: [41, 55] }, { code: 'mangeur1d6', range: [56, 60] }, { code: 'changeur2d6', range: [61, 75] }, { code: 'briseur2d6', range: [76, 82] }, { code: 'reflet2d6', range: [83, 88] }, { code: 'tbblanc2d6', range: [89, 93] }, { code: 'tbnoir2d8', range: [94, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
collines: [{ code: 'messager2d4', range: [1, 15] }, { code: 'passeur2d4', range: [16, 30] }, { code: 'fleur1d6', range: [31, 42] }, { code: 'mangeur1d6', range: [43, 54] }, { code: 'changeur2d6', range: [55, 69] }, { code: 'briseur2d6', range: [70, 82] }, { code: 'reflet2d6', range: [83, 88] }, { code: 'tbblanc2d6', range: [89, 93] }, { code: 'tbnoir2d8', range: [94, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
foret: [{ code: 'messager2d4', range: [1, 15] }, { code: 'passeur2d4', range: [16, 30] }, { code: 'fleur1d6', range: [31, 42] }, { code: 'mangeur1d6', range: [43, 54] }, { code: 'changeur2d6', range: [55, 69] }, { code: 'briseur2d6', range: [70, 82] }, { code: 'reflet2d6', range: [83, 88] }, { code: 'tbblanc2d6', range: [89, 93] }, { code: 'tbnoir2d8', range: [94, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
monts: [{ code: 'messager2d4', range: [1, 10] }, { code: 'passeur2d4', range: [11, 20] }, { code: 'fleur1d6', range: [21, 26] }, { code: 'mangeur1d6', range: [27, 44] }, { code: 'changeur2d6', range: [45, 59] }, { code: 'briseur2d6', range: [60, 75] }, { code: 'reflet2d6', range: [76, 85] }, { code: 'tbblanc2d6', range: [86, 92] }, { code: 'tbnoir2d8', range: [93, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
desert: [{ code: 'messager2d4', range: [1, 10] }, { code: 'passeur2d4', range: [11, 20] }, { code: 'fleur1d6', range: [21, 26] }, { code: 'mangeur1d6', range: [27, 44] }, { code: 'changeur2d6', range: [45, 59] }, { code: 'briseur2d6', range: [60, 75] }, { code: 'reflet2d6', range: [76, 85] }, { code: 'tbblanc2d6', range: [86, 92] }, { code: 'tbnoir2d8', range: [93, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
fleuve: [{ code: 'messager2d4', range: [1, 5] }, { code: 'passeur2d4', range: [6, 10] }, { code: 'fleur1d6', range: [11, 13] }, { code: 'mangeur1d6', range: [14, 37] }, { code: 'changeur2d6', range: [38, 49] }, { code: 'briseur2d6', range: [50, 65] }, { code: 'reflet2d6', range: [66, 79] }, { code: 'tbblanc2d6', range: [80, 89] }, { code: 'tbnoir2d8', range: [90, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
lac: [{ code: 'messager2d4', range: [1, 5] }, { code: 'passeur2d4', range: [6, 10] }, { code: 'fleur1d6', range: [11, 13] }, { code: 'mangeur1d6', range: [14, 37] }, { code: 'changeur2d6', range: [38, 49] }, { code: 'briseur2d6', range: [50, 65] }, { code: 'reflet2d6', range: [66, 79] }, { code: 'tbblanc2d6', range: [80, 89] }, { code: 'tbnoir2d8', range: [90, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
marais: [{ code: 'messager2d4', range: [1, 2] }, { code: 'passeur2d4', range: [3, 4] }, { code: 'fleur1d6', range: [5, 5] }, { code: 'mangeur1d6', range: [6, 29] }, { code: 'changeur2d6', range: [30, 39] }, { code: 'briseur2d6', range: [40, 60] }, { code: 'reflet2d6', range: [61, 75] }, { code: 'tbblanc2d6', range: [76, 86] }, { code: 'tbnoir2d8', range: [87, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
gouffre: [{ code: 'messager2d4', range: [1, 2] }, { code: 'passeur2d4', range: [3, 4] }, { code: 'fleur1d6', range: [5, 5] }, { code: 'mangeur1d6', range: [6, 29] }, { code: 'changeur2d6', range: [30, 39] }, { code: 'briseur2d6', range: [40, 60] }, { code: 'reflet2d6', range: [61, 75] }, { code: 'tbblanc2d6', range: [76, 86] }, { code: 'tbnoir2d8', range: [87, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
necropole: [{ code: 'mangeur1d6', range: [1, 20] }, { code: 'changeur2d6', range: [21, 30] }, { code: 'briseur2d6', range: [31, 50] }, { code: 'reflet2d6', range: [51, 65] }, { code: 'tbblanc2d6', range: [66, 80] }, { code: 'tbnoir2d8', range: [81, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }],
|
||||
desolation: [{ code: 'mangeur1d6', range: [1, 20] }, { code: 'changeur2d6', range: [21, 30] }, { code: 'briseur2d6', range: [31, 50] }, { code: 'reflet2d6', range: [51, 65] }, { code: 'tbblanc2d6', range: [66, 80] }, { code: 'tbnoir2d8', range: [81, 97] }, { code: 'rdd1ddr+7', range: [98, 100] }]
|
||||
cite: [{ code: 'messager', range: [1, 25] }, { code: 'passeur', range: [26, 50] }, { code: 'fleur', range: [51, 65] }, { code: 'mangeur', range: [66, 70] }, { code: 'changeur', range: [71, 80] }, { code: 'briseur', range: [81, 85] }, { code: 'reflet', range: [86, 90] }, { code: 'tbblanc', range: [91, 94] }, { code: 'tbnoir', range: [95, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
sanctuaire: [{ code: 'messager', range: [1, 25] }, { code: 'passeur', range: [26, 50] }, { code: 'fleur', range: [51, 65] }, { code: 'mangeur', range: [66, 70] }, { code: 'changeur', range: [71, 80] }, { code: 'briseur', range: [81, 85] }, { code: 'reflet', range: [86, 90] }, { code: 'tbblanc', range: [91, 94] }, { code: 'tbnoir', range: [95, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
plaines: [{ code: 'messager', range: [1, 20] }, { code: 'passeur', range: [21, 40] }, { code: 'fleur', range: [41, 55] }, { code: 'mangeur', range: [56, 60] }, { code: 'changeur', range: [61, 75] }, { code: 'briseur', range: [76, 82] }, { code: 'reflet', range: [83, 88] }, { code: 'tbblanc', range: [89, 93] }, { code: 'tbnoir', range: [94, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
pont: [{ code: 'messager', range: [1, 20] }, { code: 'passeur', range: [21, 40] }, { code: 'fleur', range: [41, 55] }, { code: 'mangeur', range: [56, 60] }, { code: 'changeur', range: [61, 75] }, { code: 'briseur', range: [76, 82] }, { code: 'reflet', range: [83, 88] }, { code: 'tbblanc', range: [89, 93] }, { code: 'tbnoir', range: [94, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
collines: [{ code: 'messager', range: [1, 15] }, { code: 'passeur', range: [16, 30] }, { code: 'fleur', range: [31, 42] }, { code: 'mangeur', range: [43, 54] }, { code: 'changeur', range: [55, 69] }, { code: 'briseur', range: [70, 82] }, { code: 'reflet', range: [83, 88] }, { code: 'tbblanc', range: [89, 93] }, { code: 'tbnoir', range: [94, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
foret: [{ code: 'messager', range: [1, 15] }, { code: 'passeur', range: [16, 30] }, { code: 'fleur', range: [31, 42] }, { code: 'mangeur', range: [43, 54] }, { code: 'changeur', range: [55, 69] }, { code: 'briseur', range: [70, 82] }, { code: 'reflet', range: [83, 88] }, { code: 'tbblanc', range: [89, 93] }, { code: 'tbnoir', range: [94, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
monts: [{ code: 'messager', range: [1, 10] }, { code: 'passeur', range: [11, 20] }, { code: 'fleur', range: [21, 26] }, { code: 'mangeur', range: [27, 44] }, { code: 'changeur', range: [45, 59] }, { code: 'briseur', range: [60, 75] }, { code: 'reflet', range: [76, 85] }, { code: 'tbblanc', range: [86, 92] }, { code: 'tbnoir', range: [93, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
desert: [{ code: 'messager', range: [1, 10] }, { code: 'passeur', range: [11, 20] }, { code: 'fleur', range: [21, 26] }, { code: 'mangeur', range: [27, 44] }, { code: 'changeur', range: [45, 59] }, { code: 'briseur', range: [60, 75] }, { code: 'reflet', range: [76, 85] }, { code: 'tbblanc', range: [86, 92] }, { code: 'tbnoir', range: [93, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
fleuve: [{ code: 'messager', range: [1, 5] }, { code: 'passeur', range: [6, 10] }, { code: 'fleur', range: [11, 13] }, { code: 'mangeur', range: [14, 37] }, { code: 'changeur', range: [38, 49] }, { code: 'briseur', range: [50, 65] }, { code: 'reflet', range: [66, 79] }, { code: 'tbblanc', range: [80, 89] }, { code: 'tbnoir', range: [90, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
lac: [{ code: 'messager', range: [1, 5] }, { code: 'passeur', range: [6, 10] }, { code: 'fleur', range: [11, 13] }, { code: 'mangeur', range: [14, 37] }, { code: 'changeur', range: [38, 49] }, { code: 'briseur', range: [50, 65] }, { code: 'reflet', range: [66, 79] }, { code: 'tbblanc', range: [80, 89] }, { code: 'tbnoir', range: [90, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
marais: [{ code: 'messager', range: [1, 2] }, { code: 'passeur', range: [3, 4] }, { code: 'fleur', range: [5, 5] }, { code: 'mangeur', range: [6, 29] }, { code: 'changeur', range: [30, 39] }, { code: 'briseur', range: [40, 60] }, { code: 'reflet', range: [61, 75] }, { code: 'tbblanc', range: [76, 86] }, { code: 'tbnoir', range: [87, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
gouffre: [{ code: 'messager', range: [1, 2] }, { code: 'passeur', range: [3, 4] }, { code: 'fleur', range: [5, 5] }, { code: 'mangeur', range: [6, 29] }, { code: 'changeur', range: [30, 39] }, { code: 'briseur', range: [40, 60] }, { code: 'reflet', range: [61, 75] }, { code: 'tbblanc', range: [76, 86] }, { code: 'tbnoir', range: [87, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
necropole: [{ code: 'mangeur', range: [1, 20] }, { code: 'changeur', range: [21, 30] }, { code: 'briseur', range: [31, 50] }, { code: 'reflet', range: [51, 65] }, { code: 'tbblanc', range: [66, 80] }, { code: 'tbnoir', range: [81, 97] }, { code: 'rdd', range: [98, 100] }],
|
||||
desolation: [{ code: 'mangeur', range: [1, 20] }, { code: 'changeur', range: [21, 30] }, { code: 'briseur', range: [31, 50] }, { code: 'reflet', range: [51, 65] }, { code: 'tbblanc', range: [66, 80] }, { code: 'tbnoir', range: [81, 97] }, { code: 'rdd', range: [98, 100] }]
|
||||
}
|
||||
|
||||
|
||||
@ -378,7 +378,8 @@ export class TMRRencontres {
|
||||
/* -------------------------------------------- */
|
||||
static async evaluerForceRencontre(rencontre) {
|
||||
if (TMRRencontres.isReveDeDragon(rencontre)) {
|
||||
rencontre.force = await DeDraconique.ddr("selfroll").total + 7;
|
||||
const ddr = await DeDraconique.ddr("selfroll")
|
||||
rencontre.force = 7 + ddr.total;
|
||||
}
|
||||
else {
|
||||
rencontre.force = new Roll(rencontre.force).evaluate().total;
|
||||
@ -471,14 +472,14 @@ export class TMRRencontres {
|
||||
}
|
||||
|
||||
static async onPostSuccessReveDeDragon(tmrDialog, data) {
|
||||
await data.actor.appliquerReveDeDragon(data.rolled, data.rencontre.force);
|
||||
if (data.rolled.isPart) {
|
||||
await data.actor.appliquerExperience(data.rolled, 'reve', data.competence);
|
||||
}
|
||||
await data.actor.resultCombatReveDeDragon(data);
|
||||
}
|
||||
|
||||
|
||||
static async onPostEchecReveDeDragon(tmrDialog, data) {
|
||||
await data.actor.appliquerReveDeDragon(data.rolled, data.rencontre.force);
|
||||
await data.actor.resultCombatReveDeDragon(data);
|
||||
tmrDialog.close();
|
||||
}
|
||||
}
|
||||
|
@ -1,243 +1,244 @@
|
||||
import { DeDraconique } from "./de-draconique.js";
|
||||
import { TMRRencontres } from "./tmr-rencontres.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const TMRMapping = {
|
||||
A1: { type: "cite", label: "Cité Vide"},
|
||||
B1: { type: "plaines", label: "Plaines d’Assorh"},
|
||||
C1: { type: "necropole", label: "Nécropole de Kroak"},
|
||||
D1: { type: "fleuve", label: "Fleuve"},
|
||||
E1: { type: "monts", label: "Monts de Kanaï"},
|
||||
F1: { type: "cite", label: "Cité Glauque"},
|
||||
G1: { type: "desolation", label: "Désolation de Demain"},
|
||||
H1: { type: "lac", label: "Lac d’Anticalme"},
|
||||
I1: { type: "plaines", label: "Plaines Grises"},
|
||||
J1: { type: "monts", label: "Monts Fainéants"},
|
||||
K1: { type: "cite", label: "Cité d’Onkause"},
|
||||
L1: { type: "fleuve", label: "Fleuve"},
|
||||
M1: { type: "cite", label: "Cité Jalouse"},
|
||||
|
||||
A2: { type: "desert", label: "Désert de Mieux"},
|
||||
B2: { type: "collines", label: "Collines de Dawell"},
|
||||
C2: { type: "marais", label: "Marais Glignants"},
|
||||
D2: { type: "cite", label: "Cité de Frost"},
|
||||
E2: { type: "plaines", label: "Plaines de Fiask"},
|
||||
F2: { type: "lac", label: "Lac de Misère"},
|
||||
G2: { type: "marais", label: "Marais Nuisants"},
|
||||
H2: { type: "collines", label: "Collines de Parta"},
|
||||
I2: { type: "foret", label: "Forêt Fade"},
|
||||
J2: { type: "desert", label: "Désert de Poly"},
|
||||
K2: { type: "foret", label: "Forêt Tamée"},
|
||||
L2: { type: "fleuve", label: "Fleuve"},
|
||||
M2: { type: "necropole", label: "Nécropole de Logos"},
|
||||
const TMRMapping = {
|
||||
A1: { type: "cite", label: "Cité Vide" },
|
||||
B1: { type: "plaines", label: "Plaines d’Assorh" },
|
||||
C1: { type: "necropole", label: "Nécropole de Kroak" },
|
||||
D1: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
E1: { type: "monts", label: "Monts de Kanaï" },
|
||||
F1: { type: "cite", label: "Cité Glauque" },
|
||||
G1: { type: "desolation", label: "Désolation de Demain" },
|
||||
H1: { type: "lac", label: "Lac d’Anticalme" },
|
||||
I1: { type: "plaines", label: "Plaines Grises" },
|
||||
J1: { type: "monts", label: "Monts Fainéants" },
|
||||
K1: { type: "cite", label: "Cité d’Onkause" },
|
||||
L1: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
M1: { type: "cite", label: "Cité Jalouse" },
|
||||
|
||||
A3: { type: "desolation", label: "Désolation de Demain"},
|
||||
B3: { type: "plaines", label: "Plaines de Rubéga"},
|
||||
C3: { type: "fleuve", label: "Fleuve"},
|
||||
D3: { type: "gouffre", label: "Gouffre d’Oki"},
|
||||
E3: { type: "foret", label: "Forêt d’Estoubh"},
|
||||
F3: { type: "fleuve", label: "Fleuve"},
|
||||
G3: { type: "gouffre", label: "Gouffre de Sun"},
|
||||
H3: { type: "foret", label: "Forêt de Ganna"},
|
||||
I3: { type: "monts", label: "Monts Grinçants"},
|
||||
J3: { type: "cite", label: "Cité Venin"},
|
||||
K3: { type: "plaines", label: "Plaines de Dois"},
|
||||
L3: { type: "lac", label: "Lac Laineux"},
|
||||
M3: { type: "monts", label: "Monts de Vdah"},
|
||||
A2: { type: "desert", label: "Désert de Mieux" },
|
||||
B2: { type: "collines", label: "Collines de Dawell" },
|
||||
C2: { type: "marais", label: "Marais Glignants" },
|
||||
D2: { type: "cite", label: "Cité de Frost" },
|
||||
E2: { type: "plaines", label: "Plaines de Fiask" },
|
||||
F2: { type: "lac", label: "Lac de Misère" },
|
||||
G2: { type: "marais", label: "Marais Nuisants" },
|
||||
H2: { type: "collines", label: "Collines de Parta" },
|
||||
I2: { type: "foret", label: "Forêt Fade" },
|
||||
J2: { type: "desert", label: "Désert de Poly" },
|
||||
K2: { type: "foret", label: "Forêt Tamée" },
|
||||
L2: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
M2: { type: "necropole", label: "Nécropole de Logos" },
|
||||
|
||||
A4: { type: "foret", label: "Forêt de Falconax"},
|
||||
B4: { type: "monts", label: "Monts Crâneurs"},
|
||||
C4: { type: "pont", label: "Pont de Giolii"},
|
||||
D4: { type: "lac", label: "Lac de Foam"},
|
||||
E4: { type: "plaines", label: "Plaines d’Orti"},
|
||||
F4: { type: "fleuve", label: "Fleuve"},
|
||||
G4: { type: "sanctuaire", label: "Sanctuaire Blanc"},
|
||||
H4: { type: "plaines", label: "Plaines de Psark"},
|
||||
I4: { type: "plaines", label: "Plaines de Xiax"},
|
||||
J4: { type: "collines", label: "Collines d’Encre"},
|
||||
K4: { type: "pont", label: "Pont de Fah"},
|
||||
L4: { type: "sanctuaire", label: "Sanctuaire Mauve"},
|
||||
M4: { type: "gouffre", label: "Gouffre Grisant"},
|
||||
A3: { type: "desolation", label: "Désolation de Demain" },
|
||||
B3: { type: "plaines", label: "Plaines de Rubéga" },
|
||||
C3: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
D3: { type: "gouffre", label: "Gouffre d’Oki" },
|
||||
E3: { type: "foret", label: "Forêt d’Estoubh" },
|
||||
F3: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
G3: { type: "gouffre", label: "Gouffre de Sun" },
|
||||
H3: { type: "foret", label: "Forêt de Ganna" },
|
||||
I3: { type: "monts", label: "Monts Grinçants" },
|
||||
J3: { type: "cite", label: "Cité Venin" },
|
||||
K3: { type: "plaines", label: "Plaines de Dois" },
|
||||
L3: { type: "lac", label: "Lac Laineux" },
|
||||
M3: { type: "monts", label: "Monts de Vdah" },
|
||||
|
||||
A5: { type: "plaines", label: "Plaines de Trilkh"},
|
||||
B5: { type: "collines", label: "Collines de Tanegy"},
|
||||
C5: { type: "marais", label: "Marais Flouants"},
|
||||
D5: { type: "fleuve", label: "Fleuve"},
|
||||
E5: { type: "monts", label: "Monts Brûlants"},
|
||||
F5: { type: "cite", label: "Cité de Panople"},
|
||||
G5: { type: "pont", label: "Pont d’Ik"},
|
||||
H5: { type: "desert", label: "Désert de Krane"},
|
||||
I5: { type: "desolation", label: "Désolation de Demain"},
|
||||
J5: { type: "marais", label: "Marais de Jab"},
|
||||
K5: { type: "fleuve", label: "Fleuve"},
|
||||
L5: { type: "collines", label: "Collines Suaves"},
|
||||
M5: { type: "cite", label: "Cité Rimarde"},
|
||||
A4: { type: "foret", label: "Forêt de Falconax" },
|
||||
B4: { type: "monts", label: "Monts Crâneurs" },
|
||||
C4: { type: "pont", label: "Pont de Giolii" },
|
||||
D4: { type: "lac", label: "Lac de Foam" },
|
||||
E4: { type: "plaines", label: "Plaines d’Orti" },
|
||||
F4: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
G4: { type: "sanctuaire", label: "Sanctuaire Blanc" },
|
||||
H4: { type: "plaines", label: "Plaines de Psark" },
|
||||
I4: { type: "plaines", label: "Plaines de Xiax" },
|
||||
J4: { type: "collines", label: "Collines d’Encre" },
|
||||
K4: { type: "pont", label: "Pont de Fah" },
|
||||
L4: { type: "sanctuaire", label: "Sanctuaire Mauve" },
|
||||
M4: { type: "gouffre", label: "Gouffre Grisant" },
|
||||
|
||||
A6: { type: "necropole", label: "Nécropole de Zniak"},
|
||||
B6: { type: "foret", label: "Forêt de Bust"},
|
||||
C6: { type: "cite", label: "Cité Pavois"},
|
||||
D6: { type: "fleuve", label: "Fleuve"},
|
||||
E6: { type: "sanctuaire", label: "Sanctuaire de Plaine"},
|
||||
F6: { type: "fleuve", label: "Fleuve"},
|
||||
G6: { type: "marais", label: "Marais Glutants"},
|
||||
H6: { type: "monts", label: "Monts Gurdes"},
|
||||
I6: { type: "necropole", label: "Nécropole de Xotar"},
|
||||
J6: { type: "lac", label: "Lac d’Iaupe"},
|
||||
K6: { type: "desolation", label: "Désolation de Demain"},
|
||||
L6: { type: "foret", label: "Forêt Gueuse"},
|
||||
M6: { type: "desolation", label: "Désolation de Demain"},
|
||||
A5: { type: "plaines", label: "Plaines de Trilkh" },
|
||||
B5: { type: "collines", label: "Collines de Tanegy" },
|
||||
C5: { type: "marais", label: "Marais Flouants" },
|
||||
D5: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
E5: { type: "monts", label: "Monts Brûlants" },
|
||||
F5: { type: "cite", label: "Cité de Panople" },
|
||||
G5: { type: "pont", label: "Pont d’Ik" },
|
||||
H5: { type: "desert", label: "Désert de Krane" },
|
||||
I5: { type: "desolation", label: "Désolation de Demain" },
|
||||
J5: { type: "marais", label: "Marais de Jab" },
|
||||
K5: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
L5: { type: "collines", label: "Collines Suaves" },
|
||||
M5: { type: "cite", label: "Cité Rimarde" },
|
||||
|
||||
A7: { type: "plaines", label: "Plaines de l’Arc"},
|
||||
B7: { type: "marais", label: "Marais Bluants"},
|
||||
C7: { type: "fleuve", label: "Fleuve"},
|
||||
D7: { type: "plaines", label: "Plaines d’A!a"},
|
||||
E7: { type: "foret", label: "Forêt de Glusks"},
|
||||
F7: { type: "fleuve", label: "Fleuve"},
|
||||
G7: { type: "cite", label: "Cité de Terwa"},
|
||||
H7: { type: "gouffre", label: "Gouffre de Kapfa"},
|
||||
I7: { type: "plaines", label: "Plaines de Troo"},
|
||||
J7: { type: "fleuve", label: "Fleuve"},
|
||||
K7: { type: "cite", label: "Cité de Kolix"},
|
||||
L7: { type: "gouffre", label: "Gouffre d’Episophe"},
|
||||
M7: { type: "desert", label: "Désert de Lave"},
|
||||
A6: { type: "necropole", label: "Nécropole de Zniak" },
|
||||
B6: { type: "foret", label: "Forêt de Bust" },
|
||||
C6: { type: "cite", label: "Cité Pavois" },
|
||||
D6: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
E6: { type: "sanctuaire", label: "Sanctuaire de Plaine" },
|
||||
F6: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
G6: { type: "marais", label: "Marais Glutants" },
|
||||
H6: { type: "monts", label: "Monts Gurdes" },
|
||||
I6: { type: "necropole", label: "Nécropole de Xotar" },
|
||||
J6: { type: "lac", label: "Lac d’Iaupe" },
|
||||
K6: { type: "desolation", label: "Désolation de Demain" },
|
||||
L6: { type: "foret", label: "Forêt Gueuse" },
|
||||
M6: { type: "desolation", label: "Désolation de Demain" },
|
||||
|
||||
A8: { type: "gouffre", label: "Gouffre de Shok"},
|
||||
B8: { type: "fleuve", label: "Fleuve"},
|
||||
C8: { type: "foret", label: "Forêt Turmide"},
|
||||
D8: { type: "cite", label: "Cité d’Olak"},
|
||||
E8: { type: "plaines", label: "Plaines d’Iolise"},
|
||||
F8: { type: "lac", label: "Lac des Chats"},
|
||||
G8: { type: "plaines", label: "Plaines Sans Joie"},
|
||||
H8: { type: "foret", label: "Forêt d’Ourf"},
|
||||
I8: { type: "fleuve", label: "Fleuve"},
|
||||
J8: { type: "monts", label: "Monts Barask"},
|
||||
K8: { type: "desert", label: "Désert de Fumée"},
|
||||
L8: { type: "monts", label: "Monts Tavelés"},
|
||||
M8: { type: "plaines", label: "Plaines Lavées"},
|
||||
A7: { type: "plaines", label: "Plaines de l’Arc" },
|
||||
B7: { type: "marais", label: "Marais Bluants" },
|
||||
C7: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
D7: { type: "plaines", label: "Plaines d’A!a" },
|
||||
E7: { type: "foret", label: "Forêt de Glusks" },
|
||||
F7: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
G7: { type: "cite", label: "Cité de Terwa" },
|
||||
H7: { type: "gouffre", label: "Gouffre de Kapfa" },
|
||||
I7: { type: "plaines", label: "Plaines de Troo" },
|
||||
J7: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
K7: { type: "cite", label: "Cité de Kolix" },
|
||||
L7: { type: "gouffre", label: "Gouffre d’Episophe" },
|
||||
M7: { type: "desert", label: "Désert de Lave" },
|
||||
|
||||
A9: { type: "collines", label: "Collines de Korrex"},
|
||||
B9: { type: "lac", label: "Lac de Lucre"},
|
||||
C9: { type: "monts", label: "Monts Tuméfiés"},
|
||||
D9: { type: "pont", label: "Pont d’Orx"},
|
||||
E9: { type: "fleuve", label: "Fleuve"},
|
||||
F9: { type: "plaines", label: "Plaines de Foe"},
|
||||
G9: { type: "desolation", label: "Désolation de Demain"},
|
||||
H9: { type: "collines", label: "Collines de Noirseul"},
|
||||
I9: { type: "fleuve", label: "Fleuve"},
|
||||
J9: { type: "marais", label: "Marais Gronchants"},
|
||||
K9: { type: "sanctuaire", label: "Sanctuaire Noir"},
|
||||
L9: { type: "collines", label: "Collines Cornues"},
|
||||
M9: { type: "necropole", label: "Nécropole de Zonar"},
|
||||
A8: { type: "gouffre", label: "Gouffre de Shok" },
|
||||
B8: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
C8: { type: "foret", label: "Forêt Turmide" },
|
||||
D8: { type: "cite", label: "Cité d’Olak" },
|
||||
E8: { type: "plaines", label: "Plaines d’Iolise" },
|
||||
F8: { type: "lac", label: "Lac des Chats" },
|
||||
G8: { type: "plaines", label: "Plaines Sans Joie" },
|
||||
H8: { type: "foret", label: "Forêt d’Ourf" },
|
||||
I8: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
J8: { type: "monts", label: "Monts Barask" },
|
||||
K8: { type: "desert", label: "Désert de Fumée" },
|
||||
L8: { type: "monts", label: "Monts Tavelés" },
|
||||
M8: { type: "plaines", label: "Plaines Lavées" },
|
||||
|
||||
A10: { type: "sanctuaire", label: "Sanctuaire d’Olis"},
|
||||
B10: { type: "monts", label: "Monts Salés"},
|
||||
C10: { type: "marais", label: "Marais de Dom"},
|
||||
D10: { type: "fleuve", label: "Fleuve"},
|
||||
E10: { type: "gouffre", label: "Gouffre de Junk"},
|
||||
F10: { type: "marais", label: "Marais Zultants"},
|
||||
G10: { type: "cite", label: "Cité de Sergal"},
|
||||
H10: { type: "plaines", label: "Plaines Noires"},
|
||||
I10: { type: "lac", label: "Lac Wanito"},
|
||||
J10: { type: "fleuve", label: "Fleuve"},
|
||||
K10: { type: "plaines", label: "Plaines Jaunes"},
|
||||
L10: { type: "desert", label: "Désert de Nicrop"},
|
||||
M10: { type: "foret", label: "Forêt de Jajou"},
|
||||
A9: { type: "collines", label: "Collines de Korrex" },
|
||||
B9: { type: "lac", label: "Lac de Lucre" },
|
||||
C9: { type: "monts", label: "Monts Tuméfiés" },
|
||||
D9: { type: "pont", label: "Pont d’Orx" },
|
||||
E9: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
F9: { type: "plaines", label: "Plaines de Foe" },
|
||||
G9: { type: "desolation", label: "Désolation de Demain" },
|
||||
H9: { type: "collines", label: "Collines de Noirseul" },
|
||||
I9: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
J9: { type: "marais", label: "Marais Gronchants" },
|
||||
K9: { type: "sanctuaire", label: "Sanctuaire Noir" },
|
||||
L9: { type: "collines", label: "Collines Cornues" },
|
||||
M9: { type: "necropole", label: "Nécropole de Zonar" },
|
||||
|
||||
A11: { type: "desolation", label: "Désolation de Demain"},
|
||||
B11: { type: "cite", label: "Cité de Brilz"},
|
||||
C11: { type: "pont", label: "Pont de Roï"},
|
||||
D11: { type: "desolation", label: "Désolation de Demain"},
|
||||
E11: { type: "lac", label: "Lac de Glinster"},
|
||||
F11: { type: "cite", label: "Cité de Noape"},
|
||||
G11: { type: "fleuve", label: "Fleuve"},
|
||||
H11: { type: "fleuve", label: "Fleuve"},
|
||||
I11: { type: "pont", label: "Pont de Yalm"},
|
||||
J11: { type: "plaines", label: "Plaines de Miltiar"},
|
||||
K11: { type: "cite", label: "Cité Tonnerre"},
|
||||
L11: { type: "collines", label: "Collines de Kol"},
|
||||
M11: { type: "cite", label: "Cité Crapaud"},
|
||||
A10: { type: "sanctuaire", label: "Sanctuaire d’Olis" },
|
||||
B10: { type: "monts", label: "Monts Salés" },
|
||||
C10: { type: "marais", label: "Marais de Dom" },
|
||||
D10: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
E10: { type: "gouffre", label: "Gouffre de Junk" },
|
||||
F10: { type: "marais", label: "Marais Zultants" },
|
||||
G10: { type: "cite", label: "Cité de Sergal" },
|
||||
H10: { type: "plaines", label: "Plaines Noires" },
|
||||
I10: { type: "lac", label: "Lac Wanito" },
|
||||
J10: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
K10: { type: "plaines", label: "Plaines Jaunes" },
|
||||
L10: { type: "desert", label: "Désert de Nicrop" },
|
||||
M10: { type: "foret", label: "Forêt de Jajou" },
|
||||
|
||||
A12: { type: "plaines", label: "Plaines Sages"},
|
||||
B12: { type: "fleuve", label: "Fleuve"},
|
||||
C12: { type: "lac", label: "Lac de Fricassa"},
|
||||
D12: { type: "collines", label: "Collines d’Huaï"},
|
||||
E12: { type: "monts", label: "Monts Ajourés"},
|
||||
F12: { type: "necropole", label: "Nécropole de Troat"},
|
||||
G12: { type: "plaines", label: "Plaines de Lufmil"},
|
||||
H12: { type: "collines", label: "Collines de Tooth"},
|
||||
I12: { type: "gouffre", label: "Gouffre Abimeux"},
|
||||
J12: { type: "cite", label: "Cité Folle"},
|
||||
K12: { type: "desolation", label: "Désolation de Demain"},
|
||||
L12: { type: "plaines", label: "Plaines Venteuses"},
|
||||
M12: { type: "collines", label: "Collines Révulsantes"},
|
||||
A11: { type: "desolation", label: "Désolation de Demain" },
|
||||
B11: { type: "cite", label: "Cité de Brilz" },
|
||||
C11: { type: "pont", label: "Pont de Roï" },
|
||||
D11: { type: "desolation", label: "Désolation de Demain" },
|
||||
E11: { type: "lac", label: "Lac de Glinster" },
|
||||
F11: { type: "cite", label: "Cité de Noape" },
|
||||
G11: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
H11: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
I11: { type: "pont", label: "Pont de Yalm" },
|
||||
J11: { type: "plaines", label: "Plaines de Miltiar" },
|
||||
K11: { type: "cite", label: "Cité Tonnerre" },
|
||||
L11: { type: "collines", label: "Collines de Kol" },
|
||||
M11: { type: "cite", label: "Cité Crapaud" },
|
||||
|
||||
A13: { type: "fleuve", label: "Fleuve"},
|
||||
B13: { type: "gouffre", label: "Gouffre des Litiges"},
|
||||
C13: { type: "desert", label: "Désert de Neige"},
|
||||
D13: { type: "cite", label: "Cité Sordide"},
|
||||
E13: { type: "plaines", label: "Plaines de Xnez"},
|
||||
F13: { type: "foret", label: "Forêt des Cris"},
|
||||
G13: { type: "plaines", label: "Plaines Calcaires"},
|
||||
H13: { type: "desolation", label: "Désolation de Demain"},
|
||||
I13: { type: "monts", label: "Monts Bigleux"},
|
||||
J13: { type: "gouffre", label: "Gouffre de Gromph"},
|
||||
K13: { type: "foret", label: "Forêt de Kluth"},
|
||||
L13: { type: "monts", label: "Monts Dormants"},
|
||||
M13: { type: "plaines", label: "Plaines d’Anjou"},
|
||||
A12: { type: "plaines", label: "Plaines Sages" },
|
||||
B12: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
C12: { type: "lac", label: "Lac de Fricassa" },
|
||||
D12: { type: "collines", label: "Collines d’Huaï" },
|
||||
E12: { type: "monts", label: "Monts Ajourés" },
|
||||
F12: { type: "necropole", label: "Nécropole de Troat" },
|
||||
G12: { type: "plaines", label: "Plaines de Lufmil" },
|
||||
H12: { type: "collines", label: "Collines de Tooth" },
|
||||
I12: { type: "gouffre", label: "Gouffre Abimeux" },
|
||||
J12: { type: "cite", label: "Cité Folle" },
|
||||
K12: { type: "desolation", label: "Désolation de Demain" },
|
||||
L12: { type: "plaines", label: "Plaines Venteuses" },
|
||||
M12: { type: "collines", label: "Collines Révulsantes" },
|
||||
|
||||
A14: { type: "collines", label: "Collines de Stolis"},
|
||||
B14: { type: "necropole", label: "Nécropole de Gorlo"},
|
||||
C14: { type: "foret", label: "Forêt de Bissam"},
|
||||
D14: { type: "sanctuaire", label: "Sanctuaire Plat"},
|
||||
E14: { type: "monts", label: "Monts de Quath"},
|
||||
F14: { type: "plaines", label: "Plaines Brisées"},
|
||||
G14: { type: "desert", label: "Désert de Sek"},
|
||||
H14: { type: "plaines", label: "Plaines Blanches"},
|
||||
I14: { type: "cite", label: "Cité Destituée"},
|
||||
J14: { type: "desert", label: "Désert de Sank"},
|
||||
K14: { type: "necropole", label: "Nécropole d’Antinéar"},
|
||||
L14: { type: "plaines", label: "Plaines de Jislith"},
|
||||
M14: { type: "desolation", label: "Désolation de Demain"},
|
||||
A13: { type: "fleuve", label: "Fleuve de l'Oubli" },
|
||||
B13: { type: "gouffre", label: "Gouffre des Litiges" },
|
||||
C13: { type: "desert", label: "Désert de Neige" },
|
||||
D13: { type: "cite", label: "Cité Sordide" },
|
||||
E13: { type: "plaines", label: "Plaines de Xnez" },
|
||||
F13: { type: "foret", label: "Forêt des Cris" },
|
||||
G13: { type: "plaines", label: "Plaines Calcaires" },
|
||||
H13: { type: "desolation", label: "Désolation de Demain" },
|
||||
I13: { type: "monts", label: "Monts Bigleux" },
|
||||
J13: { type: "gouffre", label: "Gouffre de Gromph" },
|
||||
K13: { type: "foret", label: "Forêt de Kluth" },
|
||||
L13: { type: "monts", label: "Monts Dormants" },
|
||||
M13: { type: "plaines", label: "Plaines d’Anjou" },
|
||||
|
||||
A15: { type: "cite", label: "Cité de Mielh"},
|
||||
C15: { type: "plaines", label: "Plaines de Toué"},
|
||||
E15: { type: "foret", label: "Forêt des Furies"},
|
||||
G15: { type: "plaines", label: "Plaines des Soupirs"},
|
||||
I15: { type: "monts", label: "Monts des Dragées"},
|
||||
K15: { type: "collines", label: "Collines Pourpres"},
|
||||
M15: { type: "cite", label: "Cité de Klana"}
|
||||
}
|
||||
A14: { type: "collines", label: "Collines de Stolis" },
|
||||
B14: { type: "necropole", label: "Nécropole de Gorlo" },
|
||||
C14: { type: "foret", label: "Forêt de Bissam" },
|
||||
D14: { type: "sanctuaire", label: "Sanctuaire Plat" },
|
||||
E14: { type: "monts", label: "Monts de Quath" },
|
||||
F14: { type: "plaines", label: "Plaines Brisées" },
|
||||
G14: { type: "desert", label: "Désert de Sek" },
|
||||
H14: { type: "plaines", label: "Plaines Blanches" },
|
||||
I14: { type: "cite", label: "Cité Destituée" },
|
||||
J14: { type: "desert", label: "Désert de Sank" },
|
||||
K14: { type: "necropole", label: "Nécropole d’Antinéar" },
|
||||
L14: { type: "plaines", label: "Plaines de Jislith" },
|
||||
M14: { type: "desolation", label: "Désolation de Demain" },
|
||||
|
||||
export const TMRType = {
|
||||
cite: "cité",
|
||||
sanctuaire: "sanctuaire",
|
||||
plaines: "plaines",
|
||||
pont: "pont",
|
||||
collines: "collines",
|
||||
foret: "forêt",
|
||||
monts: "monts",
|
||||
desert: "désert",
|
||||
fleuve: "fleuve",
|
||||
lac: "lac",
|
||||
marais: "marais",
|
||||
gouffre: "gouffre",
|
||||
necropole: "nécropole",
|
||||
desolation: "désolation"
|
||||
A15: { type: "cite", label: "Cité de Mielh" },
|
||||
C15: { type: "plaines", label: "Plaines de Toué" },
|
||||
E15: { type: "foret", label: "Forêt des Furies" },
|
||||
G15: { type: "plaines", label: "Plaines des Soupirs" },
|
||||
I15: { type: "monts", label: "Monts des Dragées" },
|
||||
K15: { type: "collines", label: "Collines Pourpres" },
|
||||
M15: { type: "cite", label: "Cité de Klana" }
|
||||
}
|
||||
|
||||
export const TMRType = {
|
||||
cite: { name: "cité", genre: "f" },
|
||||
sanctuaire: { name: "sanctuaire" },
|
||||
plaines: { name: "plaines", genre: "p" },
|
||||
pont: { name: "pont", genre: "m" },
|
||||
collines: { name: "collines", genre: "p" },
|
||||
foret: { name: "forêt", genre: "f" },
|
||||
monts: { name: "monts", genre: "p" },
|
||||
desert: { name: "désert", genre: "m" },
|
||||
fleuve: { name: "fleuve", genre: "m" },
|
||||
lac: { name: "lac", genre: "m" },
|
||||
marais: { name: "marais", genre: "m" },
|
||||
gouffre: { name: "gouffre", genre: "m" },
|
||||
necropole: { name: "nécropole", genre: "f" },
|
||||
desolation: { name: "désolation", genre: "f" }
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const caseSpecificModes = [ "attache", "trounoir", "debordement", "reserve_extensible", "maitrisee" ];
|
||||
const caseSpecificModes = ["attache", "trounoir", "debordement", "reserve_extensible", "maitrisee"];
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const tmrRandomMovePatten =
|
||||
[ { name: 'top', x: 0, y: -1 },
|
||||
{ name: 'topright', x: 1, y: -1 },
|
||||
{ name: 'botright', x: 1, y: 1 },
|
||||
{ name: 'bot', x: 0, y: 1 },
|
||||
{ name: 'botleft', x: -1, y: 1 },
|
||||
{ name: 'topleft', x: -1, y: -1 }
|
||||
]
|
||||
const tmrRandomMovePatten =
|
||||
[{ name: 'top', x: 0, y: -1 },
|
||||
{ name: 'topright', x: 1, y: -1 },
|
||||
{ name: 'botright', x: 1, y: 1 },
|
||||
{ name: 'bot', x: 0, y: 1 },
|
||||
{ name: 'botleft', x: -1, y: 1 },
|
||||
{ name: 'topleft', x: -1, y: -1 }
|
||||
]
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export const tmrConstants = {
|
||||
@ -246,79 +247,116 @@ export const tmrConstants = {
|
||||
cellw: 55,
|
||||
cellh: 55,
|
||||
gridx: 28,
|
||||
gridy: 28
|
||||
gridy: 28,
|
||||
// tailles
|
||||
third: 18,
|
||||
half: 27.5,
|
||||
twoThird: 36,
|
||||
full: 55,
|
||||
// decallages
|
||||
center: { x: 0, y: 0 },
|
||||
top: { x: 0, y: -11.5 },
|
||||
topLeft: { x: -11.5, y: -11.5 },
|
||||
left: { x: -11.5, y: 0 },
|
||||
bottomLeft: { x: -11.5, y: 11.5 },
|
||||
bottom: { x: 0, y: 11.5 },
|
||||
bottomRight: { x: 11.5, y: 11.5 },
|
||||
right: { x: 11.5, y: 0 },
|
||||
topRight: { x: 11.5, y: -11.5 },
|
||||
}
|
||||
|
||||
// couleurs
|
||||
export const tmrColors = {
|
||||
sort: 0xFF8800,
|
||||
tetes: 0xA000FF,
|
||||
souffle: 0x804040,
|
||||
trounoir: 0x401060,
|
||||
demireve: 0x00FFEE,
|
||||
rencontre: 0xFF0000,
|
||||
casehumide: 0x1050F0,
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class TMRUtility {
|
||||
export class TMRUtility {
|
||||
static init() {
|
||||
for (let coord in TMRMapping) {
|
||||
TMRMapping[coord].coord = coord;
|
||||
}
|
||||
let tmrByType = Misc.classify(Object.values(TMRMapping));
|
||||
for (const [type, list] of Object.entries(tmrByType)) {
|
||||
TMRType[type].list = list;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static convertToTMRCoord( x, y )
|
||||
{
|
||||
y = y + 1
|
||||
let letterX = String.fromCharCode(65+x);
|
||||
return letterX+y
|
||||
static convertToTMRCoord(pos) {
|
||||
let letterX = String.fromCharCode(65 + (pos.x));
|
||||
return letterX + (pos.y + 1)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static verifyTMRCoord( coord ) {
|
||||
static verifyTMRCoord(coord) {
|
||||
let TMRregexp = new RegExp(/([A-M])(\d+)/g);
|
||||
let res = TMRregexp.exec( coord );
|
||||
let res = TMRregexp.exec(coord);
|
||||
if (res && res[1] && res[2]) {
|
||||
if (res[2] > 0 && res[2] < 16) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static convertToCellCoord( coordTMR )
|
||||
{
|
||||
static convertToCellPos(coordTMR) {
|
||||
let x = coordTMR.charCodeAt(0) - 65;
|
||||
let y = coordTMR.substr(1) - 1;
|
||||
return {x: x, y: y}
|
||||
return { x: x, y: y }
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getTMR( coordTMR)
|
||||
{
|
||||
static getTMR(coordTMR) {
|
||||
return TMRMapping[coordTMR];
|
||||
}
|
||||
|
||||
static isCaseHumide(tmr) {
|
||||
return tmr.type == 'fleuve' || tmr.type == 'lac' || tmr.type == 'marais';
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** Some debug functions */
|
||||
static async setForceRencontre( index, force = undefined ) {
|
||||
this.prochaineRencontre = TMRRencontres.getRencontre( index );
|
||||
if (this.prochaineRencontre ) {
|
||||
static async setForceRencontre(index, force = undefined) {
|
||||
this.prochaineRencontre = TMRRencontres.getRencontre(index);
|
||||
if (this.prochaineRencontre) {
|
||||
if (force) {
|
||||
this.prochaineRencontre.force = force;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
await TMRRencontres.evaluerForceRencontre(this.prochaineRencontre)
|
||||
}
|
||||
console.log("La prochaine rencontre sera:", this.prochaineRencontre.name, " force:", this.prochaineRencontre.force);
|
||||
}
|
||||
else {
|
||||
ui.notifications.warn("Pas de prochaine rencontre valide pour "+index);
|
||||
ui.notifications.warn("Pas de prochaine rencontre valide pour " + index);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isForceRencontre() {
|
||||
return this.prochaineRencontre
|
||||
return this.prochaineRencontre;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static utiliseForceRencontre() {
|
||||
const rencontre = this.prochaineRencontre;
|
||||
this.prochaineRencontre = undefined;
|
||||
return rencontre;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getDirectionPattern() {
|
||||
let roll = new Roll("1d"+tmrRandomMovePatten.length).evaluate().total;
|
||||
return tmrRandomMovePatten[roll -1];
|
||||
let roll = new Roll("1d" + tmrRandomMovePatten.length).evaluate().total;
|
||||
return tmrRandomMovePatten[roll - 1];
|
||||
}
|
||||
|
||||
static deplaceTMRAleatoire(coord) {
|
||||
@ -326,103 +364,66 @@ export class TMRUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static deplaceTMRSelonPattern( coord, direction, nTime ) {
|
||||
for (let i=0; i <nTime; i++) {
|
||||
let currentPosXY = TMRUtility.convertToCellCoord(coord);
|
||||
static deplaceTMRSelonPattern(coord, direction, nTime) {
|
||||
for (let i = 0; i < nTime; i++) {
|
||||
let currentPosXY = TMRUtility.convertToCellPos(coord);
|
||||
currentPosXY.x = currentPosXY.x + direction.x;
|
||||
currentPosXY.y = currentPosXY.y + direction.y;
|
||||
if ( this._checkTMRCoord(currentPosXY.x, currentPosXY.y) ) { // Sortie de carte ! Ré-insertion aléatoire
|
||||
coord = TMRUtility.convertToTMRCoord(currentPosXY.x, currentPosXY.y);
|
||||
if (this._checkTMRCoord(currentPosXY.x, currentPosXY.y)) { // Sortie de carte ! Ré-insertion aléatoire
|
||||
coord = TMRUtility.convertToTMRCoord(currentPosXY);
|
||||
} else {
|
||||
coord = this.getTMRAleatoire();
|
||||
coord = this.getTMRAleatoire().coord;
|
||||
}
|
||||
console.log("Nouvelle case iteration !!!", i, coord);
|
||||
}
|
||||
return coord;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async rencontreTMRRoll( coordTMR, cellDescr, isMauvaise = false )
|
||||
{
|
||||
let rencontre;
|
||||
if ( this.prochaineRencontre ) {
|
||||
rencontre = this.prochaineRencontre;
|
||||
rencontre.coord = coordTMR;
|
||||
this.prochaineRencontre = undefined;
|
||||
}
|
||||
else if ( isMauvaise ) {
|
||||
rencontre = await TMRRencontres.getMauvaiseRencontre();
|
||||
} else {
|
||||
rencontre = await TMRRencontres.getRencontreAleatoire(cellDescr.type);
|
||||
}
|
||||
rencontre.coord = coordTMR;
|
||||
return rencontre;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getListTMR(terrain) {
|
||||
let list = [];
|
||||
for (let index in TMRMapping) {
|
||||
if (TMRMapping[index].type == terrain){
|
||||
list.push(TMRMapping[index]);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return TMRType[terrain].list;
|
||||
}
|
||||
|
||||
static getListCoordTMR(terrain) {
|
||||
return this.getListTMR(terrain).map(it=>it.coord);
|
||||
static filterTMR(filter) {
|
||||
return Object.values(TMRMapping).filter(filter);
|
||||
}
|
||||
|
||||
static filterTMRCoord(filter) {
|
||||
return TMRUtility.filterTMR(filter).map(it => it.coord);
|
||||
}
|
||||
|
||||
static getTMRAleatoire(filter = undefined) {
|
||||
let list = TMRUtility.filterTMR(filter);
|
||||
let index = new Roll("1d" + list.length).evaluate().total - 1;
|
||||
return list[index];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getTMRAleatoire(terrain=undefined)
|
||||
{
|
||||
if (terrain) {
|
||||
let list = TMRUtility.getListTMR(terrain);
|
||||
let index = new Roll("1d" + list.length).evaluate().total - 1;
|
||||
return list[index];
|
||||
}
|
||||
let num = new Roll("1d15").roll().total;
|
||||
let letter, letterValue;
|
||||
if ( num == 15) {
|
||||
letterValue = new Roll( "1d7").roll().total;
|
||||
letter = String.fromCharCode( 65 + ((parseInt(letterValue)-1)*2) );
|
||||
} else {
|
||||
letterValue = new Roll( "1d13 + 64" ).roll().total;
|
||||
letter = String.fromCharCode( letterValue );
|
||||
}
|
||||
let caseIndex = letter+num;
|
||||
ChatMessage.create( { content: "Case aléatoire : " + letter+num + " - " + TMRMapping[caseIndex].label ,
|
||||
whisper: ChatMessage.getWhisperRecipients("GM") } );
|
||||
return caseIndex;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _checkTMRCoord( x, y ) {
|
||||
if (x >= 0 && x < 13 && y >= 0 && y < 14 ) return true;
|
||||
if (x >= 0 && x < 13 && x%2 == 0 && y == 14 ) return true;
|
||||
static _checkTMRCoord(x, y) {
|
||||
if (x >= 0 && x < 13 && y >= 0 && y < 14) return true;
|
||||
if (x >= 0 && x < 13 && x % 2 == 0 && y == 14) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static computeRealPictureCoordinates( coordXY, tmrConstants ) {
|
||||
static computeRealPictureCoordinates(coordXY, tmrConstants) {
|
||||
let decallagePairImpair = (coordXY.x % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y;
|
||||
return {
|
||||
return {
|
||||
x: tmrConstants.gridx + (coordXY.x * tmrConstants.cellw),
|
||||
y: tmrConstants.gridy + (coordXY.y * tmrConstants.cellh) + decallagePairImpair
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getSortReserveList( reserveList, coordTMR ) {
|
||||
static getSortReserveList(reserveList, coordTMR) {
|
||||
// TODO : Gérer les têtes spéciales réserve!
|
||||
let sortReserveList
|
||||
let tmrDescr = this.getTMR(coordTMR);
|
||||
//console.log("Sort réserve : ", tmrDescr);
|
||||
if ( tmrDescr.type == 'fleuve') { // Gestion de la reserve en Fleuve
|
||||
sortReserveList = reserveList.filter(it => TMRUtility.getTMR(it.coord).type == 'fleuve' );
|
||||
if (tmrDescr.type == 'fleuve') { // Gestion de la reserve en Fleuve
|
||||
sortReserveList = reserveList.filter(it => TMRUtility.getTMR(it.coord).type == 'fleuve');
|
||||
} else { // Reserve sur un case "normale"
|
||||
sortReserveList = reserveList.filter(it => it.coord == coordTMR);
|
||||
sortReserveList = reserveList.filter(it => it.coord == coordTMR);
|
||||
}
|
||||
//console.log("Sort réserve : ", tmrDescr, sortReserve, reserveList);
|
||||
return sortReserveList;
|
||||
@ -432,22 +433,22 @@ export class TMRUtility {
|
||||
/** Returns a list of case inside a given distance
|
||||
*
|
||||
*/
|
||||
static getTMRPortee(coord, portee) {
|
||||
return TMRUtility.getTMRArea(coord, portee, tmrConstants);
|
||||
static getTMRPortee(centerCoord, portee) {
|
||||
return TMRUtility.getTMRArea(centerCoord, portee, tmrConstants);
|
||||
}
|
||||
|
||||
static getTMRArea( coord, distance, tmrConstants ) {
|
||||
let pos = this.convertToCellCoord( coord );
|
||||
let posPic = this.computeRealPictureCoordinates( pos, tmrConstants );
|
||||
static getTMRArea(centerCoord, distance, tmrConstants) {
|
||||
let centerPos = this.convertToCellPos(centerCoord);
|
||||
let posPic = this.computeRealPictureCoordinates(centerPos, tmrConstants);
|
||||
let caseList = [];
|
||||
for (let x=pos.x-distance; x<=pos.x+distance; x++ ) { // Loop thru lines
|
||||
for (let y=pos.y-distance; y<=pos.y+distance; y++ ) { // Loop thru lines
|
||||
//console.log("Parsing position", x, y);
|
||||
if ( this._checkTMRCoord(x, y) ) { // Coordinate is valie
|
||||
let posPicNow = this.computeRealPictureCoordinates( {x: x, y: y}, tmrConstants );
|
||||
let dist = Math.sqrt(Math.pow(posPicNow.x - posPic.x,2) + Math.pow(posPicNow.y - posPic.y, 2)) / tmrConstants.cellw;
|
||||
if ( dist < distance+0.5) {
|
||||
caseList.push( this.convertToTMRCoord(x, y) ); // Inside the area
|
||||
for (let dx = -distance; dx <= distance; dx++) { // Loop thru lines
|
||||
for (let dy = -distance; dy <= distance; dy++) { // Loop thru lines
|
||||
const currentPos = { x: centerPos.x + dx, y: centerPos.y + dy };
|
||||
if (this._checkTMRCoord(currentPos.x, currentPos.y)) { // Coordinate is valie
|
||||
let posPicNow = this.computeRealPictureCoordinates(currentPos, tmrConstants);
|
||||
let dist = Math.sqrt(Math.pow(posPicNow.x - posPic.x, 2) + Math.pow(posPicNow.y - posPic.y, 2)) / tmrConstants.cellw;
|
||||
if (dist < distance + 0.5) {
|
||||
caseList.push(this.convertToTMRCoord(currentPos)); // Inside the area
|
||||
}
|
||||
}
|
||||
}
|
||||
|
20
module/tmr/carte-tmr.js
Normal file
20
module/tmr/carte-tmr.js
Normal file
@ -0,0 +1,20 @@
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class CarteTmr extends Draconique {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return '' }
|
||||
match(item) { return false; }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, item) { }
|
||||
|
||||
code() { return 'tmr' }
|
||||
img() { return 'systems/foundryvtt-reve-de-dragon/styles/img/ui/tmp_main_r1.webp' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.carteTmr(this.code());
|
||||
}
|
||||
}
|
31
module/tmr/debordement.js
Normal file
31
module/tmr/debordement.js
Normal file
@ -0,0 +1,31 @@
|
||||
import { tmrColors, tmrConstants, TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class Debordement extends Draconique {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return 'souffle' }
|
||||
match(item) { return Draconique.isSouffleDragon(item) && item.name.toLowerCase().includes('trou noir'); }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, item) { await this._creerCaseTmr(actor); }
|
||||
|
||||
code() { return 'debordement' }
|
||||
tooltip(linkData) { return `Débordement en ${TMRUtility.getTMR(linkData.data.coord).label}` }
|
||||
img() { return 'systems/foundryvtt-reve-de-dragon/icons/svg/wave.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(),
|
||||
{
|
||||
color: tmrColors.casehumide, alpha: 0.5, taille: tmrConstants.twoThird, decallage: tmrConstants.bottom
|
||||
});
|
||||
}
|
||||
|
||||
async _creerCaseTmr(actor) {
|
||||
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
|
||||
const tmr = TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord)));
|
||||
await this.createCaseTmr(actor, 'Debordement: ' + tmr.label, tmr);
|
||||
}
|
||||
}
|
27
module/tmr/demi-reve.js
Normal file
27
module/tmr/demi-reve.js
Normal file
@ -0,0 +1,27 @@
|
||||
import { tmrColors, tmrConstants } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class DemiReve extends Draconique {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return '' }
|
||||
match(item) { return false; }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, item) { }
|
||||
|
||||
code() { return 'demi-reve' }
|
||||
tooltip(linkData) { return `Demi-rêve` }
|
||||
img() { return 'icons/svg/sun.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
const sprite = pixiTMR.sprite(this.code(), {
|
||||
color: tmrColors.demireve,
|
||||
taille: (tmrConstants.full * 0.7)
|
||||
});
|
||||
pixiTMR.animate(pixiApp => pixiApp.ticker.add((delta) => sprite.rotation -= 0.01 * delta));
|
||||
return sprite;
|
||||
}
|
||||
}
|
118
module/tmr/draconique.js
Normal file
118
module/tmr/draconique.js
Normal file
@ -0,0 +1,118 @@
|
||||
import { PixiTMR } from "./pixi-tmr.js";
|
||||
|
||||
const registeredEffects = [
|
||||
]
|
||||
|
||||
/**
|
||||
* Définition des informations d'une "draconique" (queue, ombre, tête, souffle) qui influence les TMR
|
||||
*/
|
||||
export class Draconique
|
||||
{
|
||||
static isCaseTMR(element) { return element.type == 'casetmr'; }
|
||||
static isQueueDragon(element) { return element.type == 'queue' || element.type == 'ombre'; }
|
||||
static isSouffleDragon(element) { return element.type == 'souffle'; }
|
||||
static isTeteDragon(element) { return element.type == 'tete'; }
|
||||
static isQueueSouffle(it) { return Draconique.isQueueDragon(it) || Draconique.isSouffleDragon(it); }
|
||||
|
||||
static register(draconique) {
|
||||
registeredEffects[draconique.code()] = draconique;
|
||||
if (draconique.img()) {
|
||||
PixiTMR.register(draconique.code(), draconique.img())
|
||||
}
|
||||
return draconique;
|
||||
}
|
||||
|
||||
static all() {
|
||||
return Object.values(registeredEffects);
|
||||
}
|
||||
static get(code) {
|
||||
return registeredEffects[code];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item un Item quelconque
|
||||
* @returns true si l'item correspond
|
||||
*/
|
||||
match(item) {
|
||||
return Draconique.isQueueDragon(item) || Draconique.isSouffleDragon(item) || Draconique.isTeteDragon(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns un message à afficher si la draconique doit être gérée manuellement.
|
||||
*/
|
||||
manualMessage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Méthode responsable de gérer une draconique (par exemple, ajouter des casetmr pour la fermeture des cités).
|
||||
* @param actor auquel la draconique est ajoutée
|
||||
*/
|
||||
async onActorCreateOwned(actor) {
|
||||
return false;
|
||||
}
|
||||
async onActorDeleteOwned(actor) {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @return le code interne utilisé pour les casetmr correpondant
|
||||
*/
|
||||
code() { return undefined }
|
||||
|
||||
/**
|
||||
* @param {*} linkData données associées au token pixi (une casetmr, un sort en réserve, une rencontre en attente)
|
||||
* @returns un tooltip à afficher au dessus du token
|
||||
*/
|
||||
tooltip(linkData) { return undefined }
|
||||
|
||||
/**
|
||||
* @param {*} img l'url du fichier image à utiliser pour le token. Si indéfini (et si createSprite n'est pas surchargé),
|
||||
* un disque est utilisé.
|
||||
*/
|
||||
img() { return undefined }
|
||||
|
||||
/**
|
||||
* factory d'élément graphique PIXI correpsondant à l'objet draconique
|
||||
* @param {*} pixiTMR instance de PixiTMR qui gère les tooltips, les méthodes de création de sprite standard, les clicks.
|
||||
*/
|
||||
token(pixiTMR, linkData, coordTMR, type = undefined) {
|
||||
const token = {
|
||||
sprite: this._createSprite(pixiTMR),
|
||||
coordTMR: coordTMR
|
||||
};
|
||||
token[type ?? this.code()] = linkData;
|
||||
pixiTMR.addTooltip(token.sprite, this.tooltip(linkData));
|
||||
return token;
|
||||
|
||||
return sprite;
|
||||
}
|
||||
/**
|
||||
* factory d'élément graphique PIXI correpsondant à l'objet draconique
|
||||
* @param {*} pixiTMR instance de PixiTMR qui gère les tooltips, les méthodes de création de sprite standard, les clicks.
|
||||
*/
|
||||
_createSprite(pixiTMR) {
|
||||
if (this.img()) {
|
||||
return pixiTMR.sprite(this.code());
|
||||
}
|
||||
else{
|
||||
return pixiTMR.circle()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} it un item à tester
|
||||
* @param {*} coord les coordonnées d'une case. Si undefined toute case du type correspondra,
|
||||
*/
|
||||
isCase(it, coord = undefined) {
|
||||
return Draconique.isCaseTMR(it) && it.data.specific == this.code() && (coord ? it.data.coord == coord : true);
|
||||
}
|
||||
|
||||
async createCaseTmr(actor, label, tmr) {
|
||||
await actor.createOwnedItem({
|
||||
name: label, type: 'casetmr', img: this.img(), _id: randomID(16),
|
||||
data: { coord: tmr.coord, specific: this.code() }
|
||||
});
|
||||
}
|
||||
|
||||
}
|
152
module/tmr/effets-draconiques.js
Normal file
152
module/tmr/effets-draconiques.js
Normal file
@ -0,0 +1,152 @@
|
||||
import { Debordement } from "./debordement.js";
|
||||
import { FermetureCites } from "./fermeture-cites.js";
|
||||
import { QueteEaux } from "./quete-eaux.js";
|
||||
import { TerreAttache } from "./terre-attache.js";
|
||||
import { ReserveExtensible } from "./reserve-extensible.js";
|
||||
import { DemiReve } from "./demi-reve.js";
|
||||
import { TrouNoir } from "./trou-noir.js";
|
||||
import { Rencontre } from "./rencontre.js";
|
||||
import { SortReserve } from "./sort-reserve.js";
|
||||
import { CarteTmr } from "./carte-tmr.js";
|
||||
import { PontImpraticable } from "./pont-impraticable.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
import { PresentCites } from "./present-cites.js";
|
||||
|
||||
|
||||
|
||||
export class EffetsDraconiques {
|
||||
static carteTmr = new CarteTmr();
|
||||
static demiReve = new DemiReve();
|
||||
static rencontre = new Rencontre();
|
||||
static sortReserve = new SortReserve();
|
||||
static debordement = new Debordement();
|
||||
static presentCites = new PresentCites();
|
||||
static fermetureCites = new FermetureCites();
|
||||
static queteEaux = new QueteEaux();
|
||||
static reserveExtensible = new ReserveExtensible();
|
||||
static terreAttache = new TerreAttache();
|
||||
static trouNoir = new TrouNoir();
|
||||
static pontImpraticable = new PontImpraticable();
|
||||
|
||||
static init() {
|
||||
Draconique.register(EffetsDraconiques.carteTmr);
|
||||
Draconique.register(EffetsDraconiques.demiReve);
|
||||
Draconique.register(EffetsDraconiques.rencontre);
|
||||
Draconique.register(EffetsDraconiques.sortReserve);
|
||||
Draconique.register(EffetsDraconiques.debordement);
|
||||
Draconique.register(EffetsDraconiques.fermetureCites);
|
||||
Draconique.register(EffetsDraconiques.queteEaux);
|
||||
Draconique.register(EffetsDraconiques.reserveExtensible);
|
||||
Draconique.register(EffetsDraconiques.terreAttache);
|
||||
Draconique.register(EffetsDraconiques.trouNoir);
|
||||
Draconique.register(EffetsDraconiques.pontImpraticable);
|
||||
Draconique.register(EffetsDraconiques.presentCites);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isCaseInondee(caseTMR, coord) {
|
||||
return EffetsDraconiques.debordement.isCase(caseTMR, coord) || EffetsDraconiques.pontImpraticable.isCase(caseTMR, coord);
|
||||
}
|
||||
|
||||
static isCaseTrouNoir(caseTMR, coord) {
|
||||
return EffetsDraconiques.trouNoir.isCase(caseTMR, coord);
|
||||
}
|
||||
|
||||
static isReserveExtensible(caseTMR, coord) {
|
||||
return EffetsDraconiques.reserveExtensible.isCase(caseTMR, coord);
|
||||
}
|
||||
|
||||
static isTerreAttache(caseTMR, coord) {
|
||||
return EffetsDraconiques.terreAttache.isCase(caseTMR, coord);
|
||||
}
|
||||
|
||||
static isCiteFermee(caseTMR, coord) {
|
||||
return EffetsDraconiques.fermetureCites.isCase(caseTMR, coord);
|
||||
}
|
||||
|
||||
static isPresentCite(caseTMR, coord) {
|
||||
return EffetsDraconiques.presentCites.isCase(caseTMR, coord);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static isMauvaiseRencontre(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isQueueSouffle(it) && it.name.toLowerCase().includes('mauvaise rencontre'));
|
||||
}
|
||||
|
||||
static isMonteeLaborieuse(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isQueueSouffle(it) && it.name.toLowerCase().includes('montée laborieuse'));
|
||||
}
|
||||
|
||||
static isFermetureCite(element) {
|
||||
/* -------------------------------------------- */
|
||||
return EffetsDraconiques.isMatching(element, it => EffetsDraconiques.fermetureCites.match(it));
|
||||
}
|
||||
|
||||
static isPontImpraticable(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => EffetsDraconiques.pontImpraticable.match(it));
|
||||
}
|
||||
|
||||
static isDoubleResistanceFleuve(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isSouffleDragon(it) && it.name.toLowerCase().includes('résistance du fleuve'));
|
||||
}
|
||||
|
||||
static isPeage(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isSouffleDragon(it) && it.name.toLowerCase().includes('péage'));
|
||||
}
|
||||
|
||||
static isPeriple(element) {
|
||||
// TODO
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isSouffleDragon(it) && ir.name.toLowerCase() == 'périple');
|
||||
}
|
||||
|
||||
static isDesorientation(element) {
|
||||
// TODO
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isSouffleDragon(it) && it.name.toLowerCase() == 'désorientation');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isConquete(element) {
|
||||
// TODO
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isQueueDragon(it) && it.name.toLowerCase() == 'conquête');
|
||||
}
|
||||
|
||||
static isPelerinage(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isQueueDragon(it) && it.name.toLowerCase() == 'pélerinage');
|
||||
}
|
||||
|
||||
static countInertieDraconique(element) {
|
||||
return EffetsDraconiques.count(element, it => Draconique.isQueueDragon(it) && it.name.toLowerCase().includes('inertie draconique'));
|
||||
}
|
||||
|
||||
static isUrgenceDraconique(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isQueueDragon(it) && it.name.toLowerCase() == 'urgence draconique');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isDonDoubleReve(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isTeteDragon(it) && it.name == 'Don de double-rêve');
|
||||
}
|
||||
|
||||
static isConnaissanceFleuve(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isTeteDragon(it) && it.name.toLowerCase().includes('connaissance du fleuve'));
|
||||
}
|
||||
|
||||
static isReserveEnSecurite(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isTeteDragon(it) && it.name.toLowerCase().includes(' en sécurité'));
|
||||
}
|
||||
|
||||
static isDeplacementAccelere(element) {
|
||||
return EffetsDraconiques.isMatching(element, it => Draconique.isTeteDragon(it) && it.name.toLowerCase().includes(' déplacement accéléré'));
|
||||
}
|
||||
|
||||
static isMatching(element, matcher) {
|
||||
return EffetsDraconiques.toItems(element).find(matcher);
|
||||
}
|
||||
static count(element, matcher) {
|
||||
return EffetsDraconiques.toItems(element).filter(matcher).length;
|
||||
}
|
||||
|
||||
static toItems(element) {
|
||||
return (element?.entity === 'Actor') ? element.data.items : (element?.entity === 'Item') ? [element] : [];
|
||||
}
|
||||
|
||||
}
|
33
module/tmr/fermeture-cites.js
Normal file
33
module/tmr/fermeture-cites.js
Normal file
@ -0,0 +1,33 @@
|
||||
import { tmrColors, tmrConstants, TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class FermetureCites extends Draconique {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return 'souffle' }
|
||||
match(item) { return Draconique.isSouffleDragon(item) && item.name.toLowerCase() == 'fermeture des cités'; }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, item) { await this._fermerLesCites(actor); }
|
||||
|
||||
code() { return 'fermeture' }
|
||||
tooltip(linkData) { return `La ${TMRUtility.getTMR(linkData.data.coord).label} est fermée` }
|
||||
img() { return 'icons/svg/door-closed.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(),
|
||||
{
|
||||
color: tmrColors.souffle, alpha: 0.9, taille: tmrConstants.full, decallage: { x: 2, y: 0 }
|
||||
});
|
||||
}
|
||||
|
||||
async _fermerLesCites(actor) {
|
||||
let existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
|
||||
let ouvertes = TMRUtility.filterTMR(it => it.type == 'cite' && !existants.includes(it.coord));
|
||||
for (let tmr of ouvertes) {
|
||||
await this.createCaseTmr(actor, 'Fermeture: ' + tmr.label, tmr);
|
||||
}
|
||||
}
|
||||
}
|
148
module/tmr/pixi-tmr.js
Normal file
148
module/tmr/pixi-tmr.js
Normal file
@ -0,0 +1,148 @@
|
||||
import { tmrConstants } from "../tmr-utility.js";
|
||||
|
||||
const tooltipStyle = new PIXI.TextStyle({
|
||||
fontFamily: 'CaslonAntique',
|
||||
fontSize: 18,
|
||||
fill: '#FFFFFF',
|
||||
stroke: '#000000',
|
||||
strokeThickness: 3
|
||||
});
|
||||
|
||||
|
||||
export class PixiTMR {
|
||||
|
||||
static textures = []
|
||||
|
||||
constructor(tmrObject, pixiApp) {
|
||||
this.tmrObject = tmrObject;
|
||||
this.pixiApp = pixiApp ?? tmrObject.pixiApp;
|
||||
this.callbacksOnAnimate = [];
|
||||
}
|
||||
|
||||
load(onLoad = (loader, resources) => {}) {
|
||||
let loader = this.pixiApp.loader;
|
||||
for (const [name, img] of Object.entries(PixiTMR.textures)) {
|
||||
loader = loader.add(name, img);
|
||||
}
|
||||
loader.load((loader, resources) => {
|
||||
onLoad(loader, resources);
|
||||
for (let onAnimate of this.callbacksOnAnimate) {
|
||||
onAnimate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static register(name, img) {
|
||||
PixiTMR.textures[name] = img;
|
||||
}
|
||||
|
||||
animate(animation = pixiApp=>{})
|
||||
{
|
||||
this.callbacksOnAnimate.push(() => animation(this.pixiApp));
|
||||
}
|
||||
|
||||
carteTmr(code) {
|
||||
const carteTmr = new PIXI.Sprite(PIXI.utils.TextureCache[code]);
|
||||
// Setup the position of the TMR
|
||||
carteTmr.x = 0;
|
||||
carteTmr.y = 0;
|
||||
carteTmr.width = 720;
|
||||
carteTmr.height = 860;
|
||||
// Rotate around the center
|
||||
carteTmr.anchor.set(0);
|
||||
carteTmr.interactive = true;
|
||||
carteTmr.buttonMode = true;
|
||||
carteTmr.tmrObject = this;
|
||||
// atténue les couleurs des TMRs
|
||||
const tmrColorFilter = new PIXI.filters.ColorMatrixFilter();
|
||||
tmrColorFilter.contrast(1);
|
||||
tmrColorFilter.brightness(0.2);
|
||||
tmrColorFilter.saturate(-0.5);
|
||||
carteTmr.filters = [tmrColorFilter];
|
||||
if (!this.tmrObject.viewOnly) {
|
||||
carteTmr.on('pointerdown', event => this.onClickBackground(event));
|
||||
}
|
||||
this.pixiApp.stage.addChild(carteTmr);
|
||||
return carteTmr;
|
||||
}
|
||||
|
||||
sprite(code, options = {}) {
|
||||
const texture = PIXI.utils.TextureCache[code];
|
||||
if (!texture) {
|
||||
console.error("Texture manquante", code)
|
||||
return;
|
||||
}
|
||||
let sprite = new PIXI.Sprite(texture);
|
||||
sprite.width = options.taille ?? tmrConstants.half;
|
||||
sprite.height = options.taille ?? tmrConstants.half;
|
||||
sprite.anchor.set(0.5);
|
||||
sprite.tint = options.color ?? 0x000000;
|
||||
sprite.alpha = options.alpha ?? 0.75;
|
||||
sprite.decallage = options.decallage ?? tmrConstants.center;
|
||||
this.pixiApp.stage.addChild(sprite);
|
||||
return sprite;
|
||||
}
|
||||
|
||||
circle(name, options = {}) {
|
||||
let sprite = new PIXI.Graphics();
|
||||
sprite.beginFill(options.color, options.opacity);
|
||||
sprite.drawCircle(0, 0, (options.taille ?? 12) / 2);
|
||||
sprite.endFill();
|
||||
sprite.decallage = options.decallage ?? tmrConstants.topLeft;
|
||||
this.pixiApp.stage.addChild(sprite);
|
||||
return sprite;
|
||||
}
|
||||
|
||||
addTooltip(sprite, text) {
|
||||
if (text) {
|
||||
sprite.tooltip = new PIXI.Text(text, tooltipStyle);
|
||||
sprite.isOver = false;
|
||||
sprite.interactive = true;
|
||||
sprite.on('pointerdown', event => this.onClickBackground(event))
|
||||
.on('pointerover', () => this.onShowTooltip(sprite))
|
||||
.on('pointerout', () => this.onHideTooltip(sprite));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onClickBackground(event) {
|
||||
this.tmrObject.onClickTMR(event)
|
||||
}
|
||||
|
||||
onShowTooltip(sprite) {
|
||||
if (sprite.tooltip) {
|
||||
|
||||
if (!sprite.isOver) {
|
||||
sprite.tooltip.x = sprite.x;
|
||||
sprite.tooltip.y = sprite.y;
|
||||
this.pixiApp.stage.addChild(sprite.tooltip);
|
||||
}
|
||||
sprite.isOver = true;
|
||||
}
|
||||
}
|
||||
|
||||
onHideTooltip(sprite) {
|
||||
if (sprite.tooltip) {
|
||||
if (sprite.isOver) {
|
||||
this.pixiApp.stage.removeChild(sprite.tooltip);
|
||||
}
|
||||
sprite.isOver = false;
|
||||
}
|
||||
}
|
||||
|
||||
setPosition( sprite, pos) {
|
||||
let decallagePairImpair = (pos.x % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y;
|
||||
let dx = (sprite.decallage == undefined) ? 0 : sprite.decallage.x;
|
||||
let dy = (sprite.decallage == undefined) ? 0 : sprite.decallage.y;
|
||||
sprite.x = tmrConstants.gridx + (pos.x * tmrConstants.cellw) + dx;
|
||||
sprite.y = tmrConstants.gridy + (pos.y * tmrConstants.cellh) + dy + decallagePairImpair;
|
||||
}
|
||||
|
||||
getCaseRectangle(pos) {
|
||||
let decallagePairImpair = (pos.x % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y;
|
||||
let x = tmrConstants.gridx + (pos.x * tmrConstants.cellw) - (tmrConstants.cellw / 2);
|
||||
let y = tmrConstants.gridy + (pos.y * tmrConstants.cellh) - (tmrConstants.cellh / 2) + decallagePairImpair;
|
||||
return { x: x, y: y, w: tmrConstants.cellw, h: tmrConstants.cellh };
|
||||
}
|
||||
|
||||
}
|
40
module/tmr/pont-impraticable.js
Normal file
40
module/tmr/pont-impraticable.js
Normal file
@ -0,0 +1,40 @@
|
||||
import { tmrColors, tmrConstants, TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class PontImpraticable extends Draconique {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return 'souffle' }
|
||||
match(item) { return Draconique.isSouffleDragon(item) && item.name.toLowerCase().includes('impraticabilité des ponts'); }
|
||||
|
||||
async onActorCreateOwned(actor, item) { await this._creerCaseTmr(actor); }
|
||||
async onActorDeleteOwned(actor, item) { await this._supprimerCaseTmr(actor); }
|
||||
|
||||
code() { return 'pont-impraticable' }
|
||||
tooltip(linkData) { return `${TMRUtility.getTMR(linkData.data.coord).label} impraticable` }
|
||||
img() { return 'systems/foundryvtt-reve-de-dragon/icons/svg/wave.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(),
|
||||
{
|
||||
color: tmrColors.casehumide, alpha: 0.5, taille: tmrConstants.twoThird, decallage: tmrConstants.bottom
|
||||
});
|
||||
}
|
||||
|
||||
async _creerCaseTmr(actor) {
|
||||
const ponts = TMRUtility.getListTMR('pont');
|
||||
for (let tmr of ponts) {
|
||||
await this.createCaseTmr(actor, 'Pont impraticable: ' + tmr.label, tmr);
|
||||
}
|
||||
}
|
||||
|
||||
async _supprimerCaseTmr(actor) {
|
||||
const existants = actor.data.items.filter(it => this.isCase(it));
|
||||
for (let caseTMR of existants) {
|
||||
await actor.deleteOwnedItem(caseTMR._id);
|
||||
}
|
||||
}
|
||||
}
|
42
module/tmr/present-cites.js
Normal file
42
module/tmr/present-cites.js
Normal file
@ -0,0 +1,42 @@
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { tmrColors, tmrConstants, TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class PresentCites extends Draconique {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return 'tete' }
|
||||
match(item) { return Draconique.isTeteDragon(item) && item.name.toLowerCase() == 'présent des cités'; }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, item) { await this._ajouterPresents(actor); }
|
||||
|
||||
code() { return 'present-cites' }
|
||||
tooltip(linkData) { return `La ${TMRUtility.getTMR(linkData.data.coord).label} a un présent` }
|
||||
img() { return 'systems/foundryvtt-reve-de-dragon/icons/svg/gift.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(),
|
||||
{
|
||||
color: tmrColors.tetes, alpha: 0.7, taille: tmrConstants.third, decallage:tmrConstants.topRight
|
||||
});
|
||||
}
|
||||
|
||||
async _ajouterPresents(actor) {
|
||||
let existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
|
||||
if (existants.length >0 ) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user),
|
||||
content: "Vous avez encore des présents dans des cités, vous devrez tirer une autre tête pour remplacer celle ci!"
|
||||
})
|
||||
}
|
||||
else{
|
||||
let cites = TMRUtility.filterTMR(it => it.type == 'cite');
|
||||
for (let tmr of cites) {
|
||||
await this.createCaseTmr(actor, 'Présent: ' + tmr.label, tmr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
module/tmr/quete-eaux.js
Normal file
25
module/tmr/quete-eaux.js
Normal file
@ -0,0 +1,25 @@
|
||||
import { tmrColors, tmrConstants, TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class QueteEaux extends Draconique {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return 'tete' }
|
||||
match(item) { return Draconique.isTeteDragon(item) && item.name.toLowerCase().includes("quête des eaux"); }
|
||||
manualMessage() { return "Vous devrez re-configurer votre Quête des Eaux une fois un lac ou marais vaincu" }
|
||||
async onActorCreateOwned(actor, item) { await this._creerCaseTmr(actor); }
|
||||
|
||||
code() { return 'maitrisee' }
|
||||
tooltip(linkData) { return `Quête des eaux, le ${TMRUtility.getTMR(linkData.data.coord).label} est maîtrisé` }
|
||||
img() { return 'icons/svg/bridge.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(), { color: tmrColors.tetes, decallage: tmrConstants.topRight });
|
||||
}
|
||||
|
||||
async _creerCaseTmr(actor) {
|
||||
await this.createCaseTmr(actor, "Quête des eaux à déterminer", {coord:'A0'});
|
||||
}
|
||||
}
|
22
module/tmr/rencontre.js
Normal file
22
module/tmr/rencontre.js
Normal file
@ -0,0 +1,22 @@
|
||||
import { tmrColors, tmrConstants } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class Rencontre extends Draconique {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return '' }
|
||||
match(item) { return false; }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, item) { }
|
||||
|
||||
code() { return 'rencontre' }
|
||||
tooltip(linkData) { return `${linkData.name} de force ${linkData.force}` }
|
||||
img() { return 'systems/foundryvtt-reve-de-dragon/icons/heures/hd06.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(), { color: tmrColors.rencontre, taille: tmrConstants.full, decallage: { x: 2, y: 2 } });
|
||||
}
|
||||
}
|
28
module/tmr/reserve-extensible.js
Normal file
28
module/tmr/reserve-extensible.js
Normal file
@ -0,0 +1,28 @@
|
||||
import { tmrColors, tmrConstants, TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class ReserveExtensible extends Draconique {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return 'tete' }
|
||||
match(item) { return Draconique.isTeteDragon(item) && item.name.toLowerCase().includes("réserve extensible"); }
|
||||
manualMessage() { return "Vous pouvez re-configurer votre Réserve extensible" }
|
||||
async onActorCreateOwned(actor, item) { await this._creerCaseTmr(actor); }
|
||||
|
||||
code() { return 'reserve_extensible' }
|
||||
tooltip(linkData) { return `Réserve extensible en ${TMRUtility.getTMR(linkData.data.coord).label} !` }
|
||||
img() { return 'icons/svg/chest.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(), { color: tmrColors.tetes, decallage: tmrConstants.left});
|
||||
}
|
||||
|
||||
async _creerCaseTmr(actor) {
|
||||
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
|
||||
const tmr = TMRUtility.getTMRAleatoire(it => !(it.type == 'fleuve' || existants.includes(it.coord)));
|
||||
await this.createCaseTmr(actor, "Nouvelle Réserve extensible", tmr);
|
||||
}
|
||||
|
||||
}
|
22
module/tmr/sort-reserve.js
Normal file
22
module/tmr/sort-reserve.js
Normal file
@ -0,0 +1,22 @@
|
||||
import { tmrColors, tmrConstants } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class SortReserve extends Draconique {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return '' }
|
||||
match(item) { return false; }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, item) { }
|
||||
|
||||
code() { return 'sort' }
|
||||
tooltip(linkData) { return `${linkData.name}, r${linkData.data.ptreve_reel}` }
|
||||
img() { return 'icons/svg/book.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(), { color: tmrColors.sort, decallage: tmrConstants.right });
|
||||
}
|
||||
}
|
25
module/tmr/terre-attache.js
Normal file
25
module/tmr/terre-attache.js
Normal file
@ -0,0 +1,25 @@
|
||||
import { tmrColors, tmrConstants, TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class TerreAttache extends Draconique {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return 'tete' }
|
||||
match(item) { return Draconique.isTeteDragon(item) && item.name.toLowerCase().includes("terre d'attache"); }
|
||||
manualMessage() { return "Vous pouvez re-configurer votre Terre d'Attache" }
|
||||
async onActorCreateOwned(actor, item) { await this._creerCaseTmr(actor); }
|
||||
|
||||
code() { return 'attache' }
|
||||
tooltip(linkData) { return `Terre d'attache en ${TMRUtility.getTMR(linkData.data.coord).label} !` }
|
||||
img() { return 'icons/svg/anchor.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(), { color: tmrColors.tetes, decallage: tmrConstants.topLeft });
|
||||
}
|
||||
|
||||
async _creerCaseTmr(actor) {
|
||||
await this.createCaseTmr(actor, "Terre d'attache à déterminer", {coord:'A0'});
|
||||
}
|
||||
}
|
30
module/tmr/trou-noir.js
Normal file
30
module/tmr/trou-noir.js
Normal file
@ -0,0 +1,30 @@
|
||||
import { tmrColors, tmrConstants, TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class TrouNoir extends Draconique {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return 'souffle' }
|
||||
match(item) { return Draconique.isSouffleDragon(item) && item.name.toLowerCase().includes('trou noir'); }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, item) { await this._creerCaseTmr(actor); }
|
||||
|
||||
code() { return 'trounoir' }
|
||||
tooltip(linkData) { return `Trou noir en ${TMRUtility.getTMR(linkData.data.coord).label} !` }
|
||||
img() { return 'icons/svg/explosion.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(),
|
||||
{
|
||||
color: tmrColors.trounoir, alpha: 1, taille: tmrConstants.full, decallage: { x: 2, y: 2 },
|
||||
});
|
||||
}
|
||||
|
||||
async _creerCaseTmr(actor) {
|
||||
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
|
||||
const tmr = TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord)));
|
||||
await this.createCaseTmr(actor, 'Trou noir: ' + tmr.label, tmr);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user