2020-12-31 11:53:41 +01:00
|
|
|
|
import { DeDraconique } from "./de-draconique.js";
|
2021-01-29 15:13:59 +01:00
|
|
|
|
import { TMRRencontres } from "./tmr-rencontres.js";
|
2021-01-26 19:47:18 +01:00
|
|
|
|
import { Grammar } from "./grammar.js";
|
2021-02-05 01:38:40 +01:00
|
|
|
|
import { Misc } from "./misc.js";
|
2020-11-16 04:31:53 +01:00
|
|
|
|
|
2020-07-17 22:04:35 +02:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" },
|
|
|
|
|
|
|
|
|
|
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" }
|
|
|
|
|
}
|
2020-07-21 23:51:24 +02:00
|
|
|
|
|
2021-02-06 21:53:25 +01:00
|
|
|
|
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" }
|
2021-01-29 15:13:59 +01:00
|
|
|
|
}
|
2020-07-17 22:04:35 +02:00
|
|
|
|
|
2021-02-06 21:53:25 +01:00
|
|
|
|
export const poesieCaseHumide = [
|
|
|
|
|
{
|
|
|
|
|
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. 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»`
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
2020-12-30 18:12:01 +01:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
const caseSpecificModes = ["attache", "trounoir", "debordement", "reserve_extensible", "maitrisee"];
|
2020-12-30 18:12:01 +01:00
|
|
|
|
|
2020-11-21 14:30:00 +01:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
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 }
|
|
|
|
|
]
|
2020-11-21 14:30:00 +01:00
|
|
|
|
|
2021-01-29 15:13:59 +01:00
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
export const tmrConstants = {
|
|
|
|
|
col1_y: 30,
|
|
|
|
|
col2_y: 55,
|
|
|
|
|
cellw: 55,
|
|
|
|
|
cellh: 55,
|
|
|
|
|
gridx: 28,
|
|
|
|
|
gridy: 28
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-04 20:52:04 +01:00
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
|
2020-07-17 22:04:35 +02:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
export class TMRUtility {
|
2021-01-29 15:13:59 +01:00
|
|
|
|
static init() {
|
|
|
|
|
for (let coord in TMRMapping) {
|
|
|
|
|
TMRMapping[coord].coord = coord;
|
|
|
|
|
}
|
2021-02-05 01:38:40 +01:00
|
|
|
|
let tmrByType = Misc.classify(Object.values(TMRMapping));
|
|
|
|
|
for (const [type, list] of Object.entries(tmrByType)) {
|
|
|
|
|
TMRType[type].list = list;
|
|
|
|
|
}
|
2021-01-29 15:13:59 +01:00
|
|
|
|
}
|
2020-12-04 20:52:04 +01:00
|
|
|
|
|
2020-07-17 22:04:35 +02:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
static convertToTMRCoord(pos) {
|
|
|
|
|
let letterX = String.fromCharCode(65 + (pos.x));
|
|
|
|
|
return letterX + (pos.y + 1)
|
2020-07-17 22:04:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-04 20:52:04 +01:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
static verifyTMRCoord(coord) {
|
2020-12-04 20:52:04 +01:00
|
|
|
|
let TMRregexp = new RegExp(/([A-M])(\d+)/g);
|
2021-02-06 21:53:25 +01:00
|
|
|
|
let res = TMRregexp.exec(coord);
|
2020-12-04 20:52:04 +01:00
|
|
|
|
if (res && res[1] && res[2]) {
|
|
|
|
|
if (res[2] > 0 && res[2] < 16) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2021-02-06 21:53:25 +01:00
|
|
|
|
}
|
2020-12-04 20:52:04 +01:00
|
|
|
|
|
2020-07-17 22:04:35 +02:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
static convertToCellPos(coordTMR) {
|
2020-07-17 22:04:35 +02:00
|
|
|
|
let x = coordTMR.charCodeAt(0) - 65;
|
|
|
|
|
let y = coordTMR.substr(1) - 1;
|
2021-02-06 21:53:25 +01:00
|
|
|
|
return { x: x, y: y }
|
2020-07-17 22:04:35 +02:00
|
|
|
|
}
|
2021-02-06 21:53:25 +01:00
|
|
|
|
|
2020-07-17 22:04:35 +02:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
static getTMR(coordTMR) {
|
2020-07-17 22:04:35 +02:00
|
|
|
|
return TMRMapping[coordTMR];
|
|
|
|
|
}
|
2021-02-06 21:53:25 +01:00
|
|
|
|
|
2020-11-20 16:45:20 +01:00
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
/** Some debug functions */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
static async setForceRencontre(index, force = undefined) {
|
|
|
|
|
this.prochaineRencontre = TMRRencontres.getRencontre(index);
|
|
|
|
|
if (this.prochaineRencontre) {
|
2021-01-29 15:13:59 +01:00
|
|
|
|
if (force) {
|
|
|
|
|
this.prochaineRencontre.force = force;
|
|
|
|
|
}
|
2021-02-06 21:53:25 +01:00
|
|
|
|
else {
|
2021-01-29 15:13:59 +01:00
|
|
|
|
await TMRRencontres.evaluerForceRencontre(this.prochaineRencontre)
|
|
|
|
|
}
|
|
|
|
|
console.log("La prochaine rencontre sera:", this.prochaineRencontre.name, " force:", this.prochaineRencontre.force);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2021-02-06 21:53:25 +01:00
|
|
|
|
ui.notifications.warn("Pas de prochaine rencontre valide pour " + index);
|
2021-01-29 15:13:59 +01:00
|
|
|
|
}
|
2020-11-20 16:45:20 +01:00
|
|
|
|
}
|
2021-02-06 21:53:25 +01:00
|
|
|
|
|
2020-11-20 16:45:20 +01:00
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
static isForceRencontre() {
|
2021-02-06 21:53:25 +01:00
|
|
|
|
return this.prochaineRencontre;
|
|
|
|
|
}
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
static utiliseForceRencontre() {
|
|
|
|
|
const rencontre = this.prochaineRencontre;
|
|
|
|
|
this.prochaineRencontre = undefined;
|
|
|
|
|
return rencontre;
|
2020-11-20 16:45:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-21 14:30:00 +01:00
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
static getDirectionPattern() {
|
2021-02-06 21:53:25 +01:00
|
|
|
|
let roll = new Roll("1d" + tmrRandomMovePatten.length).evaluate().total;
|
|
|
|
|
return tmrRandomMovePatten[roll - 1];
|
2020-11-21 14:30:00 +01:00
|
|
|
|
}
|
2021-01-29 15:13:59 +01:00
|
|
|
|
|
|
|
|
|
static deplaceTMRAleatoire(coord) {
|
|
|
|
|
return TMRUtility.deplaceTMRSelonPattern(coord, TMRUtility.getDirectionPattern(), 1);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-21 18:16:18 +01:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
static deplaceTMRSelonPattern(coord, direction, nTime) {
|
|
|
|
|
for (let i = 0; i < nTime; i++) {
|
2021-02-05 01:38:40 +01:00
|
|
|
|
let currentPosXY = TMRUtility.convertToCellPos(coord);
|
2021-01-29 15:13:59 +01:00
|
|
|
|
currentPosXY.x = currentPosXY.x + direction.x;
|
|
|
|
|
currentPosXY.y = currentPosXY.y + direction.y;
|
2021-02-06 21:53:25 +01:00
|
|
|
|
if (this._checkTMRCoord(currentPosXY.x, currentPosXY.y)) { // Sortie de carte ! Ré-insertion aléatoire
|
2021-02-05 01:38:40 +01:00
|
|
|
|
coord = TMRUtility.convertToTMRCoord(currentPosXY);
|
2020-11-21 18:16:18 +01:00
|
|
|
|
} else {
|
2021-02-05 01:38:40 +01:00
|
|
|
|
coord = this.getTMRAleatoire().coord;
|
2020-11-21 18:16:18 +01:00
|
|
|
|
}
|
2021-01-29 15:13:59 +01:00
|
|
|
|
console.log("Nouvelle case iteration !!!", i, coord);
|
2020-11-21 18:16:18 +01:00
|
|
|
|
}
|
2021-01-29 15:13:59 +01:00
|
|
|
|
return coord;
|
2020-11-21 18:16:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-17 16:30:03 +01:00
|
|
|
|
/* -------------------------------------------- */
|
2021-01-29 15:13:59 +01:00
|
|
|
|
static getListTMR(terrain) {
|
2021-02-05 01:38:40 +01:00
|
|
|
|
return TMRType[terrain].list;
|
2020-11-16 04:31:53 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-29 15:13:59 +01:00
|
|
|
|
static getListCoordTMR(terrain) {
|
2021-02-06 21:53:25 +01:00
|
|
|
|
return this.getListTMR(terrain).map(it => it.coord);
|
2020-07-17 22:04:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-05 01:38:40 +01:00
|
|
|
|
static getTMRAleatoire(terrain = undefined) {
|
|
|
|
|
let list = terrain ? TMRUtility.getListTMR(terrain) : Object.values(TMRMapping);
|
|
|
|
|
let index = new Roll("1d" + list.length).evaluate().total - 1;
|
2021-02-06 21:53:25 +01:00
|
|
|
|
return list[index];
|
2020-09-13 23:08:52 +02:00
|
|
|
|
}
|
2020-11-18 23:49:05 +01:00
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
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;
|
2020-11-18 23:49:05 +01:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
static computeRealPictureCoordinates(coordXY, tmrConstants) {
|
2020-11-18 23:49:05 +01:00
|
|
|
|
let decallagePairImpair = (coordXY.x % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y;
|
2021-02-06 21:53:25 +01:00
|
|
|
|
return {
|
2020-11-18 23:49:05 +01:00
|
|
|
|
x: tmrConstants.gridx + (coordXY.x * tmrConstants.cellw),
|
|
|
|
|
y: tmrConstants.gridy + (coordXY.y * tmrConstants.cellh) + decallagePairImpair
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-30 11:50:18 +01:00
|
|
|
|
/* -------------------------------------------- */
|
2021-02-06 21:53:25 +01:00
|
|
|
|
static getSortReserveList(reserveList, coordTMR) {
|
2020-12-30 11:50:18 +01:00
|
|
|
|
// TODO : Gérer les têtes spéciales réserve!
|
2020-12-30 19:18:07 +01:00
|
|
|
|
let sortReserveList
|
2021-01-29 15:13:59 +01:00
|
|
|
|
let tmrDescr = this.getTMR(coordTMR);
|
2020-12-30 18:12:01 +01:00
|
|
|
|
//console.log("Sort réserve : ", tmrDescr);
|
2021-02-06 21:53:25 +01:00
|
|
|
|
if (tmrDescr.type == 'fleuve') { // Gestion de la reserve en Fleuve
|
|
|
|
|
sortReserveList = reserveList.filter(it => TMRUtility.getTMR(it.coord).type == 'fleuve');
|
2020-12-30 11:50:18 +01:00
|
|
|
|
} else { // Reserve sur un case "normale"
|
2021-02-06 21:53:25 +01:00
|
|
|
|
sortReserveList = reserveList.filter(it => it.coord == coordTMR);
|
2020-12-30 11:50:18 +01:00
|
|
|
|
}
|
2020-12-30 18:12:01 +01:00
|
|
|
|
//console.log("Sort réserve : ", tmrDescr, sortReserve, reserveList);
|
2020-12-30 19:18:07 +01:00
|
|
|
|
return sortReserveList;
|
2020-12-30 11:50:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-18 23:49:05 +01:00
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
/** Returns a list of case inside a given distance
|
|
|
|
|
*
|
|
|
|
|
*/
|
2021-02-05 01:38:40 +01:00
|
|
|
|
static getTMRPortee(centerCoord, portee) {
|
|
|
|
|
return TMRUtility.getTMRArea(centerCoord, portee, tmrConstants);
|
2021-01-29 15:13:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-06 21:53:25 +01:00
|
|
|
|
static getTMRArea(centerCoord, distance, tmrConstants) {
|
|
|
|
|
let centerPos = this.convertToCellPos(centerCoord);
|
|
|
|
|
let posPic = this.computeRealPictureCoordinates(centerPos, tmrConstants);
|
2020-11-18 23:49:05 +01:00
|
|
|
|
let caseList = [];
|
2021-02-06 21:53:25 +01:00
|
|
|
|
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
|
2020-11-18 23:49:05 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return caseList;
|
|
|
|
|
}
|
2020-07-17 22:04:35 +02:00
|
|
|
|
}
|
|
|
|
|
|