Gestion des signes draconiques #455

Closed
vincent.vandeme wants to merge 233 commits from v1.4-signes-draconiques into master
17 changed files with 170 additions and 21 deletions
Showing only changes of commit 4ecc8826f6 - Show all commits

View File

@ -139,7 +139,8 @@ export class RdDActorSheet extends ActorSheet {
formData.hautreve = {
sortsReserve: formData.data.reve.reserve.list,
rencontres: duplicate(formData.data.reve.rencontre.list),
casesTmr: formData.itemsByType.casetmr
casesTmr: formData.itemsByType.casetmr,
cacheTMR: this.actor.isTMRCache()
}
RdDUtility.buildArbreDeConteneur(this, formData);
@ -398,7 +399,15 @@ export class RdDActorSheet extends ActorSheet {
actor.sheet.render(true);
}
});
// Boutons spéciaux MJs
html.find('.forcer-tmr-aleatoire').click((event) => {
this.actor.cacheTMRetMessage();
});
html.find('.afficher-tmr').click((event) => {
this.actor.afficheTMRetMessage();
});
// Points de reve actuel
html.find('.ptreve-actuel a').click((event) => {
this.actor.rollCarac('reve-actuel');

View File

@ -1217,9 +1217,31 @@ export class RdDActor extends Actor {
async montreTMR( ) {
await this.update({ 'data.reve.tmrpos.cache': false });
}
async isTMRCache( ) {
isTMRCache( ) {
return this.data.data.reve.tmrpos.cache;
}
/* -------------------------------------------- */
async cacheTMRetMessage() {
await this.reinsertionAleatoire();
await this.cacheTMR();
game.socket.emit("system.foundryvtt-reve-de-dragon", {
msg: "msg_tmr_move", data: {
actorId: this.data._id,
tmrPos: this.data.data.reve.tmrpos
}
});
}
/* -------------------------------------------- */
async afficheTMRetMessage() {
await this.montreTMR();
game.socket.emit("system.foundryvtt-reve-de-dragon", {
msg: "msg_tmr_move", data: {
actorId: this.data._id,
tmrPos: this.data.data.reve.tmrpos
}
});
}
/* -------------------------------------------- */
async reinsertionAleatoire(raison) {
@ -2739,7 +2761,7 @@ export class RdDActor extends Actor {
refreshTMRView(tmrData) {
console.log("REFRESH !!!!");
if (this.currentTMR) {
this.currentTMR.forceDemiRevePositionView();
this.currentTMR.externalRefresh( tmrData)
}
}

View File

@ -44,9 +44,6 @@ export class RdDTMRDialog extends Dialog {
}
super(dialogConf, dialogOptions);
if ( actor.isTMRCache() ) {
console.log("TMR cachées !!!!!!");
}
this.tmrdata = duplicate(tmrData);
this.actor = actor;
@ -61,25 +58,30 @@ export class RdDTMRDialog extends Dialog {
this.rencontreState = 'aucune';
this.pixiApp = new PIXI.Application({ width: 720, height: 860 });
this.pixiTMR = new PixiTMR(this, this.pixiApp);
this.pixiTMR = new PixiTMR(this, this.pixiApp);
this.cacheTMR = (game.user.isGM) ? false: actor.isTMRCache();
this.callbacksOnAnimate = [];
if (!this.viewOnly) {
this.actor.setStatusDemiReve(true);
this._tellToGM(this.actor.name + " monte dans les terres médianes (" + tmrData.mode + ")");
}
// load the texture we need
this.pixiTMR.load((loader, resources) => this.createPixiSprites());
}
/* -------------------------------------------- */
loadCasesSpeciales() {
this.casesSpeciales = this.actor.data.items.filter(item => Draconique.isCaseTMR(item));
}
/* -------------------------------------------- */
loadSortsReserve() {
this.sortsReserves = Misc.data(this.actor).data.reve.reserve.list;
}
/* -------------------------------------------- */
loadRencontres() {
this.rencontresExistantes = this.actor.getTMRRencontres();
}
@ -87,9 +89,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
createPixiSprites() {
EffetsDraconiques.carteTmr.createSprite(this.pixiTMR);
this.updateTokens();
this.demiReve = this._tokenDemiReve();
this._updateDemiReve();
}
@ -147,7 +147,30 @@ export class RdDTMRDialog extends Dialog {
}
_updateDemiReve() {
this._setTokenPosition(this.demiReve);
if ( !this.cacheTMR) {
this._setTokenPosition(this.demiReve);
}
}
/* -------------------------------------------- */
async moveFromKey( move ) {
let pos = TMRUtility.convertToCellPos(Misc.data(this.actor).data.reve.tmrpos.coord);
if (move == 'top') pos.y -= 1;
if (move == 'bottom') pos.y += 1;
if (move.includes('left')) pos.x -= 1;
if (move.includes('right')) pos.x += 1;
if (pos.x % 2 == 1) {
if (move == 'top-left') pos.y -= 1;
if (move == 'top-right') pos.y -= 1;
} else {
if (move == 'bottom-left') pos.y += 1;
if (move == 'bottom-right') pos.y += 1;
}
let targetCoord = TMRUtility.convertToTMRCoord(pos);
await this._deplacerDemiReve(targetCoord, 'normal');
this.checkQuitterTMR();
}
/* -------------------------------------------- */
@ -169,6 +192,25 @@ export class RdDTMRDialog extends Dialog {
return;
}
html.find('#dir-top').click((event) => {
this.moveFromKey("top");
} );
html.find('#dir-top-left').click((event) => {
this.moveFromKey("top-left");
} );
html.find('#dir-top-right').click((event) => {
this.moveFromKey("top-right");
} );
html.find('#dir-bottom-left').click((event) => {
this.moveFromKey("bottom-left");
} );
html.find('#dir-bottom-right').click((event) => {
this.moveFromKey("bottom-right");
} );
html.find('#dir-bottom').click((event) => {
this.moveFromKey("bottom");
} );
// Gestion du cout de montée en points de rêve
let reveCout = ((this.tmrdata.isRapide && !EffetsDraconiques.isDeplacementAccelere(this.actor)) ? -2 : -1)
- this.actor.countMonteeLaborieuse();
@ -190,8 +232,12 @@ export class RdDTMRDialog extends Dialog {
ptsreve.innerHTML = actorData.data.reve.reve.value;
let tmrpos = document.getElementById("tmr-pos");
let tmr = TMRUtility.getTMR(actorData.data.reve.tmrpos.coord);
tmrpos.innerHTML = actorData.data.reve.tmrpos.coord + " (" + tmr.label + ")";
if ( this.cacheTMR ) {
tmrpos.innerHTML = '?? ('+ TMRUtility.getTMRType( actorData.data.reve.tmrpos.coord ) + ')';
} else {
let tmr = TMRUtility.getTMR(actorData.data.reve.tmrpos.coord);
tmrpos.innerHTML = actorData.data.reve.tmrpos.coord + " (" + tmr.label + ")";
}
let etat = document.getElementById("tmr-etatgeneral-value");
etat.innerHTML = this.actor.getEtatGeneral();
@ -214,7 +260,6 @@ export class RdDTMRDialog extends Dialog {
}
}
/* -------------------------------------------- */
async derober() {
await this.actor.addTMRRencontre(this.currentRencontre);
@ -222,6 +267,7 @@ export class RdDTMRDialog extends Dialog {
this._tellToGM(this.actor.name + " s'est dérobé et quitte les TMR.");
this.close();
}
/* -------------------------------------------- */
async refouler() {
this._tellToGM(this.actor.name + " a refoulé : " + this.currentRencontre.name);
@ -265,12 +311,14 @@ export class RdDTMRDialog extends Dialog {
this.rencontreState = state;
}
/* -------------------------------------------- */
async choisirCasePortee(coord, portee) {
// Récupère la liste des cases à portées
let locList = TMRUtility.getTMRPortee(coord, portee);
this.colorierZoneRencontre(locList);
}
/* -------------------------------------------- */
async choisirCaseType(type) {
const locList = TMRUtility.filterTMR(it => it.type == type).map(it => it.coord);
this.colorierZoneRencontre(locList);
@ -298,6 +346,7 @@ export class RdDTMRDialog extends Dialog {
return false;
}
/* -------------------------------------------- */
async quitterLesTMRInconscient() {
if (this.currentRencontre?.isPersistant) {
await this.refouler();
@ -366,6 +415,7 @@ export class RdDTMRDialog extends Dialog {
}
}
/* -------------------------------------------- */
_rollPresentCite(rencontreData) {
let rolled = RdDResolutionTable.computeChances(rencontreData.reve, 0);
mergeObject(rolled, { caracValue: rencontreData.reve, finalLevel: 0, roll: rolled.score });
@ -426,6 +476,7 @@ export class RdDTMRDialog extends Dialog {
}
}
/* -------------------------------------------- */
_presentCite(tmr, postRencontre) {
const presentCite = this.casesSpeciales.find(c => EffetsDraconiques.presentCites.isCase(c, tmr.coord));
if (presentCite) {
@ -435,6 +486,7 @@ export class RdDTMRDialog extends Dialog {
return presentCite;
}
/* -------------------------------------------- */
async _utiliserPresentCite(presentCite, typeRencontre, tmr, postRencontre) {
this.currentRencontre = TMRRencontres.getRencontre(typeRencontre);
await TMRRencontres.evaluerForceRencontre(this.currentRencontre);
@ -467,7 +519,8 @@ export class RdDTMRDialog extends Dialog {
if (TMRUtility.isForceRencontre() || myRoll == 7) {
return await this.rencontreTMRRoll(tmr, this.actor.isRencontreSpeciale());
}
this._tellToUser(myRoll + ": Pas de rencontre en " + tmr.label + " (" + tmr.coord + ")");
let locTMR = (this.montreTMR) ? tmr.label + " (" + tmr.coord + ")" : "??";
this._tellToUser(myRoll + ": Pas de rencontre en " + locTMR);
}
/* -------------------------------------------- */
@ -633,6 +686,7 @@ export class RdDTMRDialog extends Dialog {
await this._maitriserTMR(rollData, r => this._onResultatConquerir(r, options));
}
/* -------------------------------------------- */
async _onResultatConquerir(rollData, options) {
if (rollData.rolled.isETotal) {
rollData.souffle = await this.actor.ajouterSouffle({ chat: false });
@ -799,7 +853,7 @@ export class RdDTMRDialog extends Dialog {
// Validation de la case de destination (gestion du cas des rencontres qui peuvent téléporter)
let deplacementType = this._calculDeplacement(targetCoord, currentCoord, currentPos, eventPos);
// Si le deplacement est valide
if (deplacementType == 'normal' || deplacementType == 'saut') {
await this._deplacerDemiReve(targetCoord, deplacementType);
@ -838,12 +892,23 @@ export class RdDTMRDialog extends Dialog {
this.nettoyerRencontre();
}
/* -------------------------------------------- */
externalRefresh( tmrData ) {
this.cacheTMR = (game.user.isGM) ? false: this.actor.isTMRCache();
this.createPixiSprites();
this.forceDemiRevePositionView();
this.updateValuesDisplay();
this.updateTokens();
console.log("TMR REFRESHED !!!");
}
/* -------------------------------------------- */
async _deplacerDemiReve(targetCoord, deplacementType) {
if (this.currentRencontre != 'normal') {
this.nettoyerRencontre();
}
let tmr = TMRUtility.getTMR(targetCoord);
console.log("deplacerDemiReve", tmr, this);
//console.log("deplacerDemiReve", tmr, this);
// Gestion cases spéciales type Trou noir, etc
tmr = await this.manageTmrInnaccessible(tmr);
@ -924,7 +989,9 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
_setTokenPosition(token) {
this.pixiTMR.setPosition(token.sprite, TMRUtility.convertToCellPos(token.coordTMR()));
if ( !this.cacheTMR) {
this.pixiTMR.setPosition(token.sprite, TMRUtility.convertToCellPos(token.coordTMR()));
}
}
/* -------------------------------------------- */

View File

@ -510,10 +510,11 @@ export class RdDUtility {
case "msg_response_nombre_astral":
return RdDUtility.responseNombreAstral(sockmsg.data);
case "msg_tmr_move":
if (game.user.isGM) {
let actor = game.actors.get(sockmsg.data.actorId);
let actor = game.actors.get(sockmsg.data.actorId);
if (actor.isOwner || game.user.isGM ) {
actor.refreshTMRView(sockmsg.data.tmrPos);
}
break;
}
}

View File

@ -335,9 +335,14 @@ export class TMRUtility {
return TMRMapping[coord]?.label ?? (coord + ": case inconnue");
}
static getTMRType(coord) {
const tmr = TMRMapping[coord];
return Misc.upperFirst(tmr.type);
}
static getTMRDescr(coord) {
const tmr = TMRMapping[coord];
return Grammar.articleDetermine(tmr.genre) + ' ' + tmr.label;
return Grammar.articleDetermine(tmr.type) + ' ' + tmr.label;
}
static isCaseHumide(tmr) {

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1 @@
<svg style="height: 512px; width: 512px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><defs><radialGradient id="delapouite-plain-square-gradient-0"><stop offset="0%" stop-color="#000" stop-opacity="1"></stop><stop offset="100%" stop-color="#9b9b9b" stop-opacity="1"></stop></radialGradient></defs><rect fill="url(#pattern)" stroke="#000000" stroke-opacity="1" stroke-width="1" height="510" width="510" rx="32" ry="32"></rect><svg><defs><filter id="b" x="-.024" width="1.048" y="-.024" height="1.048" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="4.823"></feGaussianBlur></filter><filter id="a" x="-.012" width="1.024" y="-.012" height="1.024" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="2.55"></feGaussianBlur></filter><filter id="c" x="-.112" width="1.225" y="-.077" height="1.153" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="15.63"></feGaussianBlur></filter><filter id="e" x="-.237" width="1.475" y="-.249" height="1.497" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="18.7"></feGaussianBlur></filter><filter id="d" x="-.213" width="1.426" y="-.151" height="1.303" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="18.7"></feGaussianBlur></filter></defs><path d="M196.6 1.207c-2.5 11.323-4.8 22.703-10.2 33.383-7-10.68-12.6-20.91-16.7-31.988L2.494 4.338C13 104.9 10.86 175.3 1.979 278.3L15.4 295.5l-9.494 6.3L2.6 462.7l1.019 45.9 112.681 3.1c3.6-16.1 6.5-32.5 13.2-47.3 4.5 14.4 5.7 29.4 7 44.4l160 .3c.8-6.1.7-8.1 2.3-14.4 5.1 4.5 7.8 9.5 10.6 14.5.8-10.1 3.9-19.8 7-29.5 4.8 9.2 6.7 19.4 8.8 29.5l185.2.4-4.6-78.2-21.4-8.2 21.3-4.9 5.8-395.47c-7-6.73-13.3-13.744-18-21.465l-15.1.114-2.1 20.321-1.4 47.23.8 84.87-8.6-97.14c9.3-16.86 2.2-39.69 5.7-55.239-92.1 1.696-184.1.685-276.2-.314z" overflow="visible" color="#000" fill="#ebc893" fill-rule="evenodd" stroke="#e0aa58" enable-background="accumulate"></path><path d="M196.6 1.203c-2.5 11.327-4.8 22.707-10.2 33.387-7-10.68-12.6-20.91-16.7-31.99L2.494 4.336C13 104.9 10.86 175.3 1.979 278.3L15.4 295.5l-9.494 6.3L2.6 462.7l1.019 45.9 112.681 3.1c.5-2.1-7.9-2.3-7.4-4.5L5.244 504.5l-.914-47.3 4.63-153.7 12.42-9-13.093-16.8C16.95 177.3 16.36 104 6.113 5.992l162.687.164c4 10.804 10.3 24.254 17.1 34.664 5.3-10.41 9.5-25.97 12-37.02 89.8.974 173.8 3.521 263.6 1.867 4.6 1.226 10.6.431 11.3-4.149-92.1 1.696-184.1.684-276.2-.315zm296.9.158l-15.1.116-.6 6.277 13.5-2.557c4.6 7.533 9.7 12.383 16.6 18.943l-4.6 389.06-19.9 9.9 4.1-.6 18.2-4.2 5.8-395.47c-7-6.73-13.3-13.748-18-21.469zm9.6 435.739l3.5 69.7-177.7.1c.4 2.1-4.1.2-3.7 2.3l185.2.4-4.6-78.2zm-370 25.1c-1 2.2-2.9.4-3.7 2.6 4.2 14 5.8 29.5 7.1 44l158 .3c1.9-5 .8-9.7 4.3-14.4 5.1 4.5 7.8 9.5 10.6 14.5.8-10.1 3.9-19.8 7-29.5 1.8 3.4 3.2 7 4.3 10.6-1.4-5.6-2.4-8.3-5.1-13.4-3 9.4-6.7 16.2-7.5 26-2.7-4.9-5.4-9.7-10.4-14.1-3.4 4.6-6.2 9.1-8 14l-147.6 3.4c-3.4-14.6-7.1-30.3-9-44z" overflow="visible" color="#000" opacity=".527" fill="#c87137" fill-rule="evenodd" filter="url(#a)" enable-background="accumulate"></path><path d="M200.1 16.1c-2.3 10.67-10.5 21.38-15.6 31.44-6.6-10.06-13.9-19.69-17.7-30.12L17.34 19.05C24.61 113.6 7.605 179.3 16.85 277l18.26 20.1L10.34 309l7.1 141.6.96 43.3 90.2 3.4c3.4-15.2 15-35.6 21.3-49.6 4.3 13.6 15.4 36.7 16.6 50.9l45.1.8 13.8-18.7 14.4 22.2 68.7-8.6c1.8-4.7 4.5-9.1 7.8-13.5 4.8 4.2 7.4 8.9 10 13.6.8-9.5 7.7-19.6 10.6-28.7 4.5 8.6 19.9 28.9 33.1 33.9l114.6 5.6 22.3-14.7 19.4 14.7-14.5-67.6-34.6-14.2 37.5-15.1 2.1-96.9-14.5-21.9 15.2-13.4 5.1-239.63c-5.2-21.09-11.8-24.89-16.9-20.22l-4.2 2.11 2 19.14.7 44.47-7.1 124.23-18.3-137.78c8.8-15.88-3.9-35.38-.6-50.02-67.1 1.24-140.4-13.332-202.8-3.28-14 2.25-23.7 21.31-36.9 24.48-4.3 1.03-13.9-23.45-18.4-23.5z" overflow="visible" enable-background="accumulate" filter="url(#b)" fill-rule="evenodd" fill="#f6e7d0" color="#000"></path><path d="M354 27.39l-70.3 96.91 46.4 97.6-56.2 43.6 33 74.4-30.2 63.2 69.8 48.8 31.6 29.5 31.6-13.3L365.9 335l55.5-36.5 2.1-146.1-56.9-101.83zM116.6 55.48L89.9 123.6s33.7 65.3 35.8 68.8c2.1 3.6-7 118-7 118l42.8 73.8s9.9-82.9 7.1-83.6c-2.8-.7-29.5-42.1-29.5-42.1l23.8-84.3-36.5-37.2z" color="#000" overflow="visible" fill="#f2dbb9" fill-rule="evenodd" filter="url(#c)" enable-background="accumulate"></path><path d="M39.33 172.1l-5.62 108.1L74.45 328 42.84 464.9l96.96-39.3 30.2 42.9 74.4-38.7-80.8-169.9-60.4-16.9z" color="#000" overflow="visible" fill="#eed3a4" fill-rule="evenodd" enable-background="accumulate" filter="url(#d)"></path><path d="M266.9 66.72L324.5 191 434 221.2l21.8-111.6-41.4-68.86z" color="#000" overflow="visible" fill="#eed3a4" fill-rule="evenodd" enable-background="accumulate" filter="url(#e)"></path></svg><g class="" style="" transform="translate(0,3)"><path d="M23.05 23.05V488.9H488.9V23.05H23.05z" fill="#fff" fill-opacity="1" transform="translate(25.6, 25.6) scale(0.9, 0.9) rotate(-360, 256, 256) skewX(0) skewY(0)"></path></g></svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -271,6 +271,18 @@ table {border: 1px solid #7a7971;}
vertical-align: bottom;
}
.small-button-direction {
height: 32px;
width: 32px;
border: 0;
vertical-align: bottom;
}
.small-button-direction:hover {
color: rgba(255, 255, 128, 0.7);
border: 1px solid rgba(255, 128, 0, 0.8);
cursor: pointer;
}
.foundryvtt-reve-de-dragon .sheet-header .header-fields {
-webkit-box-flex: 1;
-ms-flex: 1;

View File

@ -461,13 +461,27 @@
{{/if}}
<ul class="item-list">
{{#if data.attributs.hautrevant.value}}
{{#if options.isGM}}
<li class="item flexrow">
<span>
<a class="chat-card-button forcer-tmr-aleatoire">Ré-insertion aléatoire (ie TMR cachée)</a>
</span>
<span>
<a class="chat-card-button afficher-tmr">Montrer les TMR</a>
</span>
</li>
{{/if}}
<li class="item flexrow">
<span class="competence-label">Position en TMR :</span>
<span>
{{#if options.isGM}}
<input class="competence-value" type="text" name="data.reve.tmrpos.coord" value="{{data.reve.tmrpos.coord}}" data-dtype="String"/>
{{else}}
{{#if hautreve.cacheTMR}}
??
{{else}}
{{data.reve.tmrpos.coord}}
{{/if}}
{{/if}}
</span>
</li>

View File

@ -4,6 +4,16 @@
<table id="tmrsheet">
<tr id="tmrrow1">
<td>
<div class="flex-group-center">
<img class="small-button-direction" id='dir-top-left' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-top-left.svg'>
<img class="small-button-direction" id='dir-top' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-top.svg'>
<img class="small-button-direction" id='dir-top-right' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-top-right.svg'>
</div>
<div class="flex-group-center">
<img class="small-button-direction" id='dir-bottom-left' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom-left.svg'>
<img class="small-button-direction" id='dir-bottom' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom.svg'>
<img class="small-button-direction" id='dir-bottom-right' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom-right.svg'>
</div>
<div class="flex-group-center">
<a id="lancer-sort">Lancer un Sort</a>
</div>