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";
|
2022-06-12 08:17:59 +02:00
|
|
|
import { Grammar } from "../grammar.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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2022-04-23 01:02:03 +02:00
|
|
|
static isSortImpossible(actor) {
|
|
|
|
return actor.data.items.find(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
|
|
|
|
2022-04-23 01:02:03 +02:00
|
|
|
static isSortReserveImpossible(actor) {
|
|
|
|
return actor.data.items.find(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
|
|
|
}
|
|
|
|
|
2022-06-12 08:17:59 +02:00
|
|
|
static filterItems(actor, filter, name) {
|
|
|
|
return actor.data.items.filter(filter)
|
|
|
|
.filter(it => Grammar.includesLowerCaseNoAccent(it.name, name));
|
|
|
|
}
|
|
|
|
|
2022-04-23 01:02:03 +02:00
|
|
|
static isDonDoubleReve(actor) {
|
2022-06-12 08:17:59 +02:00
|
|
|
return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, 'Don de double-rêve').length>0;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2022-04-23 01:02:03 +02:00
|
|
|
static isConnaissanceFleuve(actor) {
|
2022-06-12 08:17:59 +02:00
|
|
|
return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, 'connaissance du fleuve').length>0;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2022-04-23 01:02:03 +02:00
|
|
|
|
|
|
|
static isReserveEnSecurite(actor) {
|
2022-06-12 08:17:59 +02:00
|
|
|
return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, 'réserve en sécurité').length>0;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2022-04-23 01:02:03 +02:00
|
|
|
|
|
|
|
static isDeplacementAccelere(actor) {
|
2022-06-12 08:17:59 +02:00
|
|
|
return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, ' déplacement accéléré').length>0;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2022-04-23 01:02:03 +02:00
|
|
|
|
|
|
|
static isDoubleResistanceFleuve(actor) {
|
2022-06-12 08:17:59 +02:00
|
|
|
return EffetsDraconiques.filterItems(actor, Draconique.isSouffleDragon, 'résistance du fleuve').length>0;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2022-04-23 01:02:03 +02:00
|
|
|
|
|
|
|
static countInertieDraconique(actor) {
|
2022-06-12 08:17:59 +02:00
|
|
|
return EffetsDraconiques.filterItems(actor, Draconique.isQueueDragon, 'inertie draconique').length;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2022-04-23 01:02:03 +02:00
|
|
|
|
|
|
|
static countMonteeLaborieuse(actor) {
|
2022-06-12 08:17:59 +02:00
|
|
|
return EffetsDraconiques.filterItems(actor, Draconique.isQueueSouffle, 'montée laborieuse').length;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2022-04-23 01:02:03 +02:00
|
|
|
|
|
|
|
static mauvaiseRencontre(actor) {
|
2022-06-12 08:17:59 +02:00
|
|
|
const mauvaisesRencontres = EffetsDraconiques.filterItems(actor, Draconique.isQueueSouffle, 'mauvaise rencontre');
|
|
|
|
return mauvaisesRencontres.length>0 ? mauvaisesRencontres[0] : undefined;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2022-04-23 01:02:03 +02:00
|
|
|
|
|
|
|
static isPontImpraticable(actor) {
|
|
|
|
return actor.data.items.find(it => EffetsDraconiques.pontImpraticable.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
2022-04-23 01:02:03 +02:00
|
|
|
|
|
|
|
static isUrgenceDraconique(actor) {
|
|
|
|
return actor.data.items.find(it => EffetsDraconiques.urgenceDraconique.match(it));
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2022-04-23 01:02:03 +02:00
|
|
|
static isPeage(actor) {
|
2022-06-12 08:17:59 +02:00
|
|
|
return EffetsDraconiques.filterItems(actor, Draconique.isSouffleDragon, 'péage').length > 0;
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|
|
|
|
|
2022-04-23 01:02:03 +02:00
|
|
|
|
2021-02-11 02:48:27 +01:00
|
|
|
}
|