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-03-22 20:10:37 +01:00
|
|
|
import { Misc } from "../misc.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);
|
|
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
2021-03-22 20:10:37 +01:00
|
|
|
static isMauvaiseRencontre(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => Draconique.isQueueSouffle(it) && it.name.toLowerCase().includes('mauvaise rencontre'));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 20:10:37 +01:00
|
|
|
static isMonteeLaborieuse(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => Draconique.isQueueSouffle(it) && it.name.toLowerCase().includes('montée laborieuse'));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2021-03-22 20:10:37 +01:00
|
|
|
static isFermetureCite(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => EffetsDraconiques.fermetureCites.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 20:10:37 +01:00
|
|
|
static isPontImpraticable(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => EffetsDraconiques.pontImpraticable.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 20:10:37 +01:00
|
|
|
static isDoubleResistanceFleuve(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => Draconique.isSouffleDragon(it) && it.name.toLowerCase().includes('résistance du fleuve'));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 20:10:37 +01:00
|
|
|
static isPeage(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => Draconique.isSouffleDragon(it) && it.name.toLowerCase().includes('péage'));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 20:10:37 +01:00
|
|
|
static isPeriple(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => EffetsDraconiques.periple.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 20:10:37 +01:00
|
|
|
static isDesorientation(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => EffetsDraconiques.desorientation.match(it)); // TODO
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2021-03-22 20:10:37 +01:00
|
|
|
static isSortImpossible(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it =>
|
2021-02-28 01:56:17 +01:00
|
|
|
EffetsDraconiques.conquete.match(it) ||
|
|
|
|
EffetsDraconiques.periple.match(it) ||
|
|
|
|
EffetsDraconiques.urgenceDraconique.match(it) ||
|
|
|
|
EffetsDraconiques.pelerinage.match(it)
|
|
|
|
);
|
|
|
|
}
|
2021-03-22 20:10:37 +01:00
|
|
|
|
|
|
|
static isSortReserveImpossible(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it =>
|
2021-02-28 01:56:17 +01:00
|
|
|
EffetsDraconiques.conquete.match(it) ||
|
|
|
|
EffetsDraconiques.periple.match(it) ||
|
|
|
|
EffetsDraconiques.pelerinage.match(it)
|
|
|
|
);
|
2021-02-12 18:31:49 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 20:10:37 +01:00
|
|
|
static isConquete(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => EffetsDraconiques.conquete.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 20:10:37 +01:00
|
|
|
static isPelerinage(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => EffetsDraconiques.pelerinage.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2021-03-22 20:10:37 +01:00
|
|
|
|
|
|
|
static countInertieDraconique(item) {
|
|
|
|
return EffetsDraconiques.count(item, it => Draconique.isQueueDragon(it) && it.name.toLowerCase().includes('inertie draconique'));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2021-03-22 20:10:37 +01:00
|
|
|
|
|
|
|
static isUrgenceDraconique(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => EffetsDraconiques.urgenceDraconique.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2021-03-22 20:10:37 +01:00
|
|
|
|
2021-02-11 02:48:27 +01:00
|
|
|
/* -------------------------------------------- */
|
2021-03-22 20:10:37 +01:00
|
|
|
static isDonDoubleReve(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => Draconique.isTeteDragon(it) && it.name == 'Don de double-rêve');
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2021-03-22 20:10:37 +01:00
|
|
|
|
|
|
|
static isConnaissanceFleuve(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => Draconique.isTeteDragon(it) && it.name.toLowerCase().includes('connaissance du fleuve'));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2021-03-22 20:10:37 +01:00
|
|
|
|
|
|
|
static isReserveEnSecurite(item) {
|
|
|
|
return EffetsDraconiques.isMatching(item, it => Draconique.isTeteDragon(it) && it.name.toLowerCase().includes(' en sécurité'));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2021-03-22 20:10:37 +01:00
|
|
|
|
|
|
|
static isDeplacementAccelere(item) {
|
|
|
|
item = Misc.data(item);
|
|
|
|
return EffetsDraconiques.isMatching(item, it => Draconique.isTeteDragon(it) && it.name.toLowerCase().includes(' déplacement accéléré'));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2021-03-22 20:10:37 +01:00
|
|
|
|
|
|
|
static isMatching(item, matcher) {
|
|
|
|
return EffetsDraconiques.toItems(item).find(matcher);
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2021-03-22 20:10:37 +01:00
|
|
|
static count(item, matcher) {
|
|
|
|
return EffetsDraconiques.toItems(item).filter(matcher).length;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 20:10:37 +01:00
|
|
|
static toItems(item) {
|
2021-03-25 18:33:10 +01:00
|
|
|
return (item?.documentName === 'Actor') ? item.data.items : (item?.documentName === 'Item') ? [Misc.data(item)] : [];
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|