2021-02-11 02:48:27 +01:00
|
|
|
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";
|
2021-02-12 01:44:27 +01:00
|
|
|
import { Desorientation } from "./desorientation.js";
|
|
|
|
import { Conquete } from "./conquete.js";
|
2021-02-12 18:31:49 +01:00
|
|
|
import { Pelerinage } from "./pelerinage.js";
|
2021-02-28 01:56:17 +01:00
|
|
|
import { Periple } from "./periple.js";
|
|
|
|
import { UrgenceDraconique } from "./urgence-draconique.js";
|
2021-02-11 02:48:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
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();
|
2021-02-12 01:44:27 +01:00
|
|
|
static desorientation = new Desorientation();
|
|
|
|
static conquete = new Conquete();
|
2021-02-12 18:31:49 +01:00
|
|
|
static pelerinage = new Pelerinage();
|
2021-02-28 01:56:17 +01:00
|
|
|
static periple = new Periple();
|
|
|
|
static urgenceDraconique = new UrgenceDraconique();
|
2021-02-11 02:48:27 +01:00
|
|
|
|
|
|
|
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);
|
2021-02-12 01:44:27 +01:00
|
|
|
Draconique.register(EffetsDraconiques.desorientation);
|
|
|
|
Draconique.register(EffetsDraconiques.conquete);
|
2021-02-12 18:31:49 +01:00
|
|
|
Draconique.register(EffetsDraconiques.pelerinage);
|
2021-02-28 01:56:17 +01:00
|
|
|
Draconique.register(EffetsDraconiques.periple);
|
|
|
|
Draconique.register(EffetsDraconiques.urgenceDraconique);
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
static isCaseInondee(caseTMR, coord) {
|
2021-02-12 01:16:02 +01:00
|
|
|
return EffetsDraconiques.debordement.isCase(caseTMR, coord) ||
|
|
|
|
EffetsDraconiques.pontImpraticable.isCase(caseTMR, coord);
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2021-02-12 01:44:27 +01:00
|
|
|
|
|
|
|
static isInnaccessible(caseTMR, coord) {
|
|
|
|
return EffetsDraconiques.trouNoir.isCase(caseTMR, coord) ||
|
|
|
|
EffetsDraconiques.desorientation.isCase(caseTMR, coord);
|
|
|
|
}
|
2021-02-12 18:31:49 +01:00
|
|
|
|
2021-02-11 02:48:27 +01:00
|
|
|
static isCaseTrouNoir(caseTMR, coord) {
|
|
|
|
return EffetsDraconiques.trouNoir.isCase(caseTMR, coord);
|
|
|
|
}
|
2021-02-12 01:44:27 +01:00
|
|
|
|
2021-02-12 18:31:49 +01:00
|
|
|
static isCasePelerinage(caseTMR, coord) {
|
|
|
|
return EffetsDraconiques.pelerinage.isCase(caseTMR, coord);
|
|
|
|
}
|
|
|
|
|
2021-02-11 02:48:27 +01:00
|
|
|
static isReserveExtensible(caseTMR, coord) {
|
|
|
|
return EffetsDraconiques.reserveExtensible.isCase(caseTMR, coord);
|
|
|
|
}
|
2021-02-12 01:44:27 +01:00
|
|
|
|
2021-02-11 02:48:27 +01:00
|
|
|
static isTerreAttache(caseTMR, coord) {
|
|
|
|
return EffetsDraconiques.terreAttache.isCase(caseTMR, coord);
|
|
|
|
}
|
2021-02-12 01:44:27 +01:00
|
|
|
|
2021-02-11 02:48:27 +01:00
|
|
|
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'));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2021-02-12 01:44:27 +01:00
|
|
|
static isFermetureCite(element) {
|
2021-02-11 02:48:27 +01:00
|
|
|
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) {
|
2021-02-28 01:56:17 +01:00
|
|
|
return EffetsDraconiques.isMatching(element, it => EffetsDraconiques.periple.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static isDesorientation(element) {
|
2021-02-12 01:44:27 +01:00
|
|
|
return EffetsDraconiques.isMatching(element, it => EffetsDraconiques.desorientation.match(it)); // TODO
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2021-02-12 18:31:49 +01:00
|
|
|
static isSortImpossible(element) {
|
2021-02-28 01:56:17 +01:00
|
|
|
return EffetsDraconiques.isMatching(element, it =>
|
|
|
|
EffetsDraconiques.conquete.match(it) ||
|
|
|
|
EffetsDraconiques.periple.match(it) ||
|
|
|
|
EffetsDraconiques.urgenceDraconique.match(it) ||
|
|
|
|
EffetsDraconiques.pelerinage.match(it)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
static isSortReserveImpossible(element) {
|
|
|
|
return EffetsDraconiques.isMatching(element, it =>
|
|
|
|
EffetsDraconiques.conquete.match(it) ||
|
|
|
|
EffetsDraconiques.periple.match(it) ||
|
|
|
|
EffetsDraconiques.pelerinage.match(it)
|
|
|
|
);
|
2021-02-12 18:31:49 +01:00
|
|
|
}
|
|
|
|
|
2021-02-11 02:48:27 +01:00
|
|
|
static isConquete(element) {
|
2021-02-12 01:44:27 +01:00
|
|
|
return EffetsDraconiques.isMatching(element, it => EffetsDraconiques.conquete.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static isPelerinage(element) {
|
2021-02-12 18:31:49 +01:00
|
|
|
return EffetsDraconiques.isMatching(element, it => EffetsDraconiques.pelerinage.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static countInertieDraconique(element) {
|
|
|
|
return EffetsDraconiques.count(element, it => Draconique.isQueueDragon(it) && it.name.toLowerCase().includes('inertie draconique'));
|
|
|
|
}
|
|
|
|
|
|
|
|
static isUrgenceDraconique(element) {
|
2021-02-28 01:56:17 +01:00
|
|
|
return EffetsDraconiques.isMatching(element, it => EffetsDraconiques.urgenceDraconique.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
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] : [];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|