#90 Gestion des cases modifies de façon permanente

This commit is contained in:
sladecraven 2020-12-30 18:12:01 +01:00
parent 7698c462c8
commit 4bd23b3a59
7 changed files with 111 additions and 8 deletions

View File

@ -124,7 +124,8 @@ export class RdDActorSheet extends ActorSheet {
} }
RdDUtility.filterItemsPerTypeForSheet(data ); RdDUtility.filterItemsPerTypeForSheet(data );
data.data.sortReserve = data.data.reve.reserve.list; data.data.sortReserve = data.data.reve.reserve.list;
data.data.caseSpeciales = data.itemsByType['casetmr'];
RdDUtility.buildArbreDeConteneur( this, data ); RdDUtility.buildArbreDeConteneur( this, data );
data.data.surEncombrementMessage = (data.data.compteurs.surenc.value < 0) ? "Sur-Encombrement!" : ""; data.data.surEncombrementMessage = (data.data.compteurs.surenc.value < 0) ? "Sur-Encombrement!" : "";

View File

@ -46,6 +46,7 @@ export class RdDTMRDialog extends Dialog {
this.nbFatigue = this.viewOnly ? 0 : 1; // 1 premier point de fatigue du à la montée this.nbFatigue = this.viewOnly ? 0 : 1; // 1 premier point de fatigue du à la montée
this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list); this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list);
this.sortReserves = duplicate(this.actor.data.data.reve.reserve.list); this.sortReserves = duplicate(this.actor.data.data.reve.reserve.list);
this.casesSpeciales = this.actor.data.items.filter( item => item.type == 'casetmr');
this.allTokens = []; this.allTokens = [];
this.rencontreState = 'aucune'; this.rencontreState = 'aucune';
this.pixiApp = new PIXI.Application({ width: 720, height: 860 }); this.pixiApp = new PIXI.Application({ width: 720, height: 860 });
@ -69,6 +70,16 @@ export class RdDTMRDialog extends Dialog {
} }
} }
/* -------------------------------------------- */
displaySpecificCase() {
for (let caseTMR of this.casesSpeciales) {
console.log("SPEC CASE ", caseTMR);
if ( caseTMR.data.specific == 'trounoir') {
this._trackToken(this._tokenTrouNoir( caseTMR.data.coord ));
}
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
displayPreviousRencontres() { displayPreviousRencontres() {
console.debug("displayPreviousRencontres", this.rencontresExistantes); console.debug("displayPreviousRencontres", this.rencontresExistantes);
@ -275,7 +286,7 @@ export class RdDTMRDialog extends Dialog {
if (rencontre) { // Manages it if (rencontre) { // Manages it
if (rencontre.rencontre) rencontre = rencontre.rencontre; // Manage stored rencontres if (rencontre.rencontre) rencontre = rencontre.rencontre; // Manage stored rencontres
console.log("manageRencontre", rencontre) console.log("manageRencontre", rencontre);
this.currentRencontre = duplicate(rencontre); this.currentRencontre = duplicate(rencontre);
let dialog = new RdDTMRRencontreDialog("", this, this.currentRencontre); let dialog = new RdDTMRRencontreDialog("", this, this.currentRencontre);
@ -322,6 +333,23 @@ export class RdDTMRDialog extends Dialog {
fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix(this.actor.data.data.sante.fatigue.value, this.actor.data.data.sante.endurance.max).html() + "</table>"; fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix(this.actor.data.data.sante.fatigue.value, this.actor.data.data.sante.endurance.max).html() + "</table>";
} }
/* -------------------------------------------- */
async manageCaseSpeciale( cellDescr, coordTMR ) {
for( let caseTMR of this.casesSpeciales) {
if (caseTMR.data.coord == coordTMR) { // Match !
if (caseTMR.data.specific == 'trounoir') {
let newTMR = TMRUtility.getTMRAleatoire();
let tmrPos = duplicate(this.actor.data.data.reve.tmrpos);
tmrPos.coord = newTMR;
await this.actor.update( { "data.reve.tmrpos": tmrPos } );
ChatMessage.create( {
content: "Vous êtes rentré sur un Trou Noir : ré-insertion aléatoire.",
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
}
}
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
manageCaseHumideResult() { manageCaseHumideResult() {
if (this.toclose) if (this.toclose)
@ -478,6 +506,7 @@ export class RdDTMRDialog extends Dialog {
if ( deplacementType == 'normal') { // Pas de rencontres après un saut de type passeur/changeur/... if ( deplacementType == 'normal') { // Pas de rencontres après un saut de type passeur/changeur/...
await myself.manageRencontre(coordTMR, cellDescr); await myself.manageRencontre(coordTMR, cellDescr);
} }
await myself.manageCaseSpeciale(cellDescr, coordTMR);
await myself.manageCaseHumide(cellDescr); await myself.manageCaseHumide(cellDescr);
await myself.declencheSortEnReserve(coordTMR); await myself.declencheSortEnReserve(coordTMR);
await myself.actor.checkSoufflePeage(cellDescr); await myself.actor.checkSoufflePeage(cellDescr);
@ -554,7 +583,7 @@ export class RdDTMRDialog extends Dialog {
this._addDemiReve(); this._addDemiReve();
this.displayPreviousRencontres(); this.displayPreviousRencontres();
this.displaySortReserve(); this.displaySortReserve();
this.displaySpecificCase();
}); });
if (this.viewOnly) { if (this.viewOnly) {
@ -604,6 +633,19 @@ export class RdDTMRDialog extends Dialog {
return { sprite: sprite, rencontre: rencontre, coordTMR: () => rencontre.coord }; return { sprite: sprite, rencontre: rencontre, coordTMR: () => rencontre.coord };
} }
/* -------------------------------------------- */
_tokenTrouNoir( coord ) {
let sprite = new PIXI.Graphics();
sprite.beginFill(0x050505, 0.8);
sprite.drawCircle(0, 0, (tmrConstants.cellw / 2) - 2);
sprite.endFill();
sprite.decallage = {
x: 0,
y: 2
}
return { sprite: sprite, coordTMR: () => coord }
}
/* -------------------------------------------- */ /* -------------------------------------------- */
_tokenSortEnReserve(sort) { _tokenSortEnReserve(sort) {
let sprite = new PIXI.Graphics(); let sprite = new PIXI.Graphics();

View File

@ -252,6 +252,9 @@ const rencontresTable = [
lac: "98-00", marais: "98-00", gouffre: "98-00", necropole: "98-00", desolation: "98-00" } } lac: "98-00", marais: "98-00", gouffre: "98-00", necropole: "98-00", desolation: "98-00" } }
] ]
/* -------------------------------------------- */
const caseSpecificModes = [ "attache", "trounoir", "humide", "reserve_securite", "reserve_extensible", "maitrisee", "debordement" ];
/* -------------------------------------------- */ /* -------------------------------------------- */
const tmrMovePattern = const tmrMovePattern =
[ { name: 'top', x: 0, y: -1 }, [ { name: 'top', x: 0, y: -1 },
@ -567,6 +570,7 @@ export class TMRUtility {
let caseIndex = letter+num; let caseIndex = letter+num;
ChatMessage.create( { content: "Case aléatoire : " + letter+num + " - " + TMRMapping[caseIndex].label , ChatMessage.create( { content: "Case aléatoire : " + letter+num + " - " + TMRMapping[caseIndex].label ,
whisper: ChatMessage.getWhisperRecipients("GM") } ); whisper: ChatMessage.getWhisperRecipients("GM") } );
return caseIndex;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -589,13 +593,13 @@ export class TMRUtility {
// TODO : Gérer les têtes spéciales réserve! // TODO : Gérer les têtes spéciales réserve!
let sortReserve let sortReserve
let tmrDescr = this.getTMRDescription(coordTMR); let tmrDescr = this.getTMRDescription(coordTMR);
console.log("Sort réserve : ", tmrDescr); //console.log("Sort réserve : ", tmrDescr);
if ( tmrDescr.type == 'fleuve') { // Gestion de la reserve en Fleuve if ( tmrDescr.type == 'fleuve') { // Gestion de la reserve en Fleuve
sortReserve = reserveList.find(it => TMRUtility.getTMRDescription(it.coord).type == 'fleuve' ); sortReserve = reserveList.find(it => TMRUtility.getTMRDescription(it.coord).type == 'fleuve' );
} else { // Reserve sur un case "normale" } else { // Reserve sur un case "normale"
sortReserve = reserveList.find(it => it.coord == coordTMR); sortReserve = reserveList.find(it => it.coord == coordTMR);
} }
console.log("Sort réserve : ", tmrDescr, sortReserve, reserveList); //console.log("Sort réserve : ", tmrDescr, sortReserve, reserveList);
return sortReserve; return sortReserve;
} }

View File

@ -5,7 +5,7 @@
"version": "1.2.0", "version": "1.2.0",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.8", "compatibleCoreVersion": "0.7.8",
"templateVersion": 73, "templateVersion": 75,
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",
"esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ], "esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ],
"styles": ["styles/simple.css"], "styles": ["styles/simple.css"],

View File

@ -541,7 +541,7 @@
} }
}, },
"Item": { "Item": {
"types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", "tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache", "meditation"], "types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", "tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache", "meditation", "casetmr" ],
"objet": { "objet": {
"description": "", "description": "",
"quantite": 1, "quantite": 1,
@ -722,7 +722,15 @@
"purification": "", "purification": "",
"veture": "", "veture": "",
"comportement": "", "comportement": "",
"tmr": "" "tmr": "",
"description": ""
},
"casetmr": {
"coord": "",
"type": "",
"label": "",
"specific": "",
"description": ""
} }
} }
} }

View File

@ -597,6 +597,19 @@
{{/each}} {{/each}}
</ul> </ul>
</div> </div>
<div>
<span><strong>Cases Spéciales:</strong></span>
<ul class="item-list">
{{#each data.caseSpeciales as |casetmr key|}}
<li class="item flexrow" data-item-id="{{casetmr._id}}" data-attribute="{{key}}">
<span class="case-label"><a data-id="{{casetmr._id}}">{{casetmr.name}}</a></span>
<div class="item-controls">
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div>
</div> </div>
{{!-- Equipment Tab --}} {{!-- Equipment Tab --}}

View File

@ -0,0 +1,35 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div class="form-group">
<label for="niveau">Coordonnées TMR </label>
<input class="attribute-value" type="text" name="data.coord" value="{{data.coord}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="niveau">Type</label>
<input class="attribute-value" type="text" name="data.type" value="{{data.type}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="niveau">Label</label>
<input class="attribute-value" type="text" name="data.label" value="{{data.label}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="niveau">Mode spécifique</label>
<input class="attribute-value" type="text" name="data.specific" value="{{data.specific}}" data-dtype="String"/>
</div>
<div class="flexcol">
<span><label>Description : </label></span>
<div class="form-group editor">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</div>
</section>
</form>