Sort en réserve en fleuve

Les sorts en réserve en fleuve sont indiqués sur toutes les cases fleuve
This commit is contained in:
Vincent Vandemeulebrouck 2023-12-09 01:04:33 +01:00
parent 05cd02b694
commit 3ab48511a0
5 changed files with 151 additions and 22 deletions

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 512 512"
style="height: 256px; width: 256px;"
version="1.1"
id="svg24"
sodipodi:docname="sort-reserve-humide3.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<metadata
id="metadata30">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs28" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2794"
inkscape:window-height="1756"
id="namedview26"
showgrid="false"
inkscape:zoom="2.8786993"
inkscape:cx="323.66586"
inkscape:cy="227.70764"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg24" />
<g
id="g881"
transform="translate(2.1482304,2.80716)">
<path
d="m 243.94189,104.37921 -82.23331,178.13543 82.23331,27.44784 z"
class=""
fill="#f4e3d7"
fill-opacity="1"
id="path2"
style="stroke-width:1.10232" />
<path
d="m 263.7837,104.37921 v 205.58327 l 82.23331,-27.44784 z"
class=""
fill="#f4e3d7"
fill-opacity="1"
id="path4"
style="stroke-width:1.10232" />
<path
d="M 168.21228,221.005 18.274279,239.7445 141.75653,278.32581 Z"
class=""
fill="#f4e3d7"
fill-opacity="1"
id="path6"
style="stroke-width:1.10232" />
<path
d="M 339.51331,221.005 365.96906,278.32581 489.5395,239.7445 Z"
class=""
fill="#f4e3d7"
fill-opacity="1"
id="path8"
style="stroke-width:1.10232" />
<path
d="M -0.24475089,254.73609 114.97007,398.80973 230.27308,326.7178 Z"
class=""
fill="#f4e3d7"
fill-opacity="1"
id="path10"
style="stroke-width:1.10232" />
<path
d="M 507.94829,254.73609 277.45251,326.7178 392.75552,398.80973 Z"
class=""
fill="#f4e3d7"
fill-opacity="1"
id="path12"
style="stroke-width:1.10232" />
<path
d="M 253.8628,335.42615 147.37837,402.00647 H 360.34722 Z"
class=""
fill="#f4e3d7"
fill-opacity="1"
id="path14"
style="stroke-width:1.10232" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -17,6 +17,7 @@ import { STATUSES } from "./settings/status-effects.js";
import { RdDRencontre } from "./item/rencontre.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { TYPES } from "./item.js";
import { Misc } from "./misc.js";
const TMR_DISPLAY_SIZE = {
code: 'tmr-display-size',
@ -141,7 +142,7 @@ export class RdDTMRDialog extends Dialog {
// Le reste...
this.updateValuesDisplay();
}
async onDeplacement() {
await this.manageRencontre(TMRUtility.getTMR(this._getCoordActor()));
}
@ -249,26 +250,21 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
_getTokensCasesTmr() {
return this.casesSpeciales.map(c => this._tokenCaseSpeciale(c)).filter(token => token);
}
_getTokensRencontres() {
return this.rencontresExistantes.map(it => this._tokenRencontre(it));
}
_getTokensSortsReserve() {
return this.actor.itemTypes[TYPES.sortreserve].map(it => this._tokenSortEnReserve(it));
return Misc.concat(this.casesSpeciales.map(caseSpeciale =>
Draconique.get(caseSpeciale.system.specific)?.token(this.pixiTMR, caseSpeciale, () => caseSpeciale.system.coord)
))
}
/* -------------------------------------------- */
_tokenRencontre(rencontre) {
return EffetsDraconiques.rencontre.token(this.pixiTMR, rencontre, () => rencontre.system.coord);
_getTokensRencontres() {
return Misc.concat(this.rencontresExistantes.map(rencontre =>
EffetsDraconiques.rencontre.tokens(this.pixiTMR, rencontre, () => rencontre.system.coord)
))
}
_tokenCaseSpeciale(casetmr) {
const caseData = casetmr;
const draconique = Draconique.get(caseData.system.specific);
return draconique?.token(this.pixiTMR, caseData, () => caseData.system.coord);
}
_tokenSortEnReserve(sortReserve) {
return EffetsDraconiques.sortReserve.token(this.pixiTMR, sortReserve, () => sortReserve.system.coord);
_getTokensSortsReserve() {
const sortsReserve = this.actor.itemTypes[TYPES.sortreserve];
return Misc.concat(sortsReserve.map(sortReserve =>
EffetsDraconiques.sortReserve.tokens(this.pixiTMR, sortReserve, () => sortReserve.system.coord)))
}
_tokenDemiReve() {
@ -344,7 +340,7 @@ export class RdDTMRDialog extends Dialog {
this._tellToGM(this.actor.name + " a quitté les terres médianes");
}
await this.actor.santeIncDec((ReglesOptionnelles.isUsing("appliquer-fatigue") ? "fatigue" : "endurance"),
this.cumulFatigue)
this.cumulFatigue)
}
await super.close();
this.pixiTMR.close()
@ -1128,6 +1124,9 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
_trackToken(token) {
if (!token) {
return
}
if (this.demiReve === token && this.isDemiReveCache()) {
return;
}

View File

@ -18,8 +18,8 @@ export class Draconique {
static isTeteDragon(item) { return item.type == TYPES.tete; }
static isQueueSouffle(item) { return Draconique.isQueueDragon(item) || Draconique.isSouffleDragon(item); }
static register(draconique) {
registeredEffects[draconique.code()] = draconique;
static register(draconique, code = undefined) {
registeredEffects[code ?? draconique.code()] = draconique;
if (draconique.img()) {
PixiTMR.register(draconique.code(), draconique.img())
}
@ -90,6 +90,15 @@ export class Draconique {
*/
token(pixiTMR, linkData, coordTMR, type = undefined) {
const tooltip = this.tooltip(linkData);
return this._createToken(pixiTMR, linkData, coordTMR, type, tooltip);
}
tokens(pixiTMR, linkData, coordTMR, type = undefined) {
const tooltip = this.tooltip(linkData);
return [this._createToken(pixiTMR, linkData, coordTMR, type, tooltip)];
}
_createToken(pixiTMR, linkData, coordTMR, type, tooltip) {
const token = {
sprite: this.createSprite(pixiTMR),
coordTMR: coordTMR,

View File

@ -6,7 +6,7 @@ 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 { SortReserve, SortReserveHumide } from "./sort-reserve.js";
import { CarteTmr } from "./carte-tmr.js";
import { PontImpraticable } from "./pont-impraticable.js";
import { Draconique } from "./draconique.js";
@ -26,6 +26,7 @@ export class EffetsDraconiques {
static demiReve = new DemiReve();
static rencontre = new Rencontre();
static sortReserve = new SortReserve();
static sortReserveHumide = new SortReserveHumide();
static debordement = new Debordement();
static presentCites = new PresentCites();
static fermetureCites = new FermetureCites();
@ -49,6 +50,7 @@ export class EffetsDraconiques {
Draconique.register(EffetsDraconiques.demiReve);
Draconique.register(EffetsDraconiques.rencontre);
Draconique.register(EffetsDraconiques.sortReserve);
Draconique.register(EffetsDraconiques.sortReserveHumide);
Draconique.register(EffetsDraconiques.debordement);
Draconique.register(EffetsDraconiques.fermetureCites);
Draconique.register(EffetsDraconiques.queteEaux);

View File

@ -1,5 +1,7 @@
import { tmrTokenZIndex } from "../tmr-constants.js";
import { TMRUtility } from "../tmr-utility.js";
import { Draconique } from "./draconique.js";
import { EffetsDraconiques } from "./effets-draconiques.js";
export class SortReserve extends Draconique {
@ -19,4 +21,19 @@ export class SortReserve extends Draconique {
taille: () => pixiTMR.sizes.third,
});
}
tokens(pixiTMR, linkData, coordTMR, type = undefined) {
if (TMRUtility.getTMR(coordTMR()).type == 'fleuve') {
const tooltip = this.tooltip(linkData)
const fleuves = TMRUtility.getListTMR('fleuve')
return fleuves.map(f => EffetsDraconiques.sortReserveHumide._createToken(pixiTMR, linkData, () => f.coord, type?? this.code(), tooltip))
}
return super.tokens(pixiTMR, linkData, coordTMR, type)
}
}
export class SortReserveHumide extends SortReserve {
code() { return 'sortreservehumide' }
tooltip(sort) { return `${sort.name} en fleuve, r${sort.system.ptreve}` }
img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/sort-reserve-humide.svg' }
}