Add sort
This commit is contained in:
parent
c82d0fe8a1
commit
b9baa32d02
24
RdD.geany
24
RdD.geany
@ -28,21 +28,15 @@ long_line_behaviour=1
|
||||
long_line_column=72
|
||||
|
||||
[files]
|
||||
current_page=13
|
||||
FILE_NAME_0=9714;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
|
||||
FILE_NAME_1=5468;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2
|
||||
FILE_NAME_2=17984;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
|
||||
FILE_NAME_3=6672;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2
|
||||
FILE_NAME_4=11979;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-tmr-dialog.js;0;2
|
||||
FILE_NAME_5=1692;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-tmr.html;0;2
|
||||
FILE_NAME_6=8489;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
|
||||
FILE_NAME_7=761;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-main.js;0;2
|
||||
FILE_NAME_8=8120;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fstyles%2Fsimple.css;0;2
|
||||
FILE_NAME_9=18700;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Ftmr-utility.js;0;2
|
||||
FILE_NAME_10=396;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-roll-sort.html;0;2
|
||||
FILE_NAME_11=244;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-roll-carac.html;0;2
|
||||
FILE_NAME_12=335;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-competence.html;0;2
|
||||
FILE_NAME_13=1259;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-roll-dialog.js;0;2
|
||||
current_page=5
|
||||
FILE_NAME_0=9759;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
|
||||
FILE_NAME_1=8120;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fstyles%2Fsimple.css;0;2
|
||||
FILE_NAME_2=19778;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Ftmr-utility.js;0;2
|
||||
FILE_NAME_3=21106;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
|
||||
FILE_NAME_4=6287;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2
|
||||
FILE_NAME_5=20083;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
|
||||
FILE_NAME_6=1547;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-tmr-dialog.js;0;2
|
||||
FILE_NAME_7=1767;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-roll-dialog.js;0;2
|
||||
|
||||
[VTE]
|
||||
last_dir=/home/sigmar
|
||||
|
@ -160,9 +160,14 @@ export class RdDActorSheet extends ActorSheet {
|
||||
this.actor.rollArme( armeName);
|
||||
});
|
||||
|
||||
// Display TMR
|
||||
// Display TMR, normal
|
||||
html.find('.monte-tmr a').click((event) => {
|
||||
this.actor.displayTMR( );
|
||||
this.actor.displayTMR( false );
|
||||
});
|
||||
|
||||
// Display TMR, fast
|
||||
html.find('.monte-tmr-rapide a').click((event) => {
|
||||
this.actor.displayTMR( true );
|
||||
});
|
||||
|
||||
// Display info about queue
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { TMRUtility } from "./tmr-utility.js";
|
||||
import { RdDRollDialog } from "./rdd-roll-dialog.js";
|
||||
import { RdDTMRDialog } from "./rdd-tmr-dialog.js";
|
||||
|
||||
@ -193,13 +194,41 @@ export class RdDActor extends Actor {
|
||||
await this.setFlag( "foundryvtt-reve-de-dragon", "rollData", undefined );
|
||||
await this.setFlag( "foundryvtt-reve-de-dragon", "rollData", rollData );
|
||||
|
||||
// Sort management
|
||||
let lvl = ""
|
||||
if ( rollData.selectedSort) {
|
||||
if ( rollData.selectedSort) { // Lancement de sort !
|
||||
specialStr = "<br>Lancement du sort <strong>" + rollData.selectedSort.name + "</strong> : " + rollData.selectedSort.data.draconic + "/" + rollData.selectedSort.data.difficulte +
|
||||
"/" + rollData.selectedSort.data.caseTMR + "/" + rollData.selectedSort.data.ptreve;
|
||||
specialStr += "<br>Depuis la case " + rollData.coord + "(" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
|
||||
lvl = rollData.selectedDraconic.name +"/"+ rollData.selectedSort.name;
|
||||
specialStr = "";
|
||||
let costReve = rollData.selectedSort.data.ptreve;
|
||||
let myReve = duplicate(this.data.data.reve.reve);
|
||||
if ( rollData.pointsDeTache > 0 ) { // Réussite du sort !
|
||||
if (rollData.pointsDeTache >= 4 ) costReve = Math.ceil(costReve/2);
|
||||
if (costReve < 1 ) costReve = 1;
|
||||
myReve.value = myReve.value - costReve; // Todo 0 pts de reve !!!!
|
||||
if (myReve.value < 0) myReve.value = 0;
|
||||
await this.update( {"data.reve.reve": myReve } );
|
||||
specialStr += "<br>Réussite du sort pour " + costReve + " Points de Rêve";
|
||||
} else {
|
||||
if ( rollData.pointsDeTache == -4) { // Echec total !
|
||||
costReve *= 2;
|
||||
myReve.value = myReve.value - costReve; // Todo 0 pts de reve !!!!
|
||||
if (myReve.value < 0) myReve.value = 0;
|
||||
await this.update( {"data.reve.reve": myReve } );
|
||||
specialStr += "<br><strong>Echec TOTAL</strong> du sort !, pour " + costReve + " Points de Rêve";
|
||||
} else {
|
||||
specialStr += "<br>Echec du sort !";
|
||||
}
|
||||
}
|
||||
if (myReve.value == 0) { // 0 points de reve
|
||||
ChatMessage.create( {title: "Zero Points de Reve !", content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" } );
|
||||
}
|
||||
} else {
|
||||
lvl = (rollData.competence) ? rollData.competence.name : rollData.bmValue;
|
||||
}
|
||||
|
||||
// Final chat message
|
||||
let chatOptions = { content: "<strong>Test : " + rollData.selectedCarac.label + " / " + lvl + "</strong><br>Jet : " +
|
||||
rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " -> " + rollData.rollTarget.score + "%<br><strong>Résutat : </strong>" + result + "<br>" +
|
||||
"<strong>" + quality + "</strong>" + specialStr + xpmsg,
|
||||
@ -265,9 +294,8 @@ export class RdDActor extends Actor {
|
||||
|
||||
let refoulement = duplicate(this.data.data.reve.refoulement);
|
||||
refoulement.value = refoulement.value + value;
|
||||
let myroll = new Roll("d20");
|
||||
myroll.roll();
|
||||
if ( myroll.total <= refoulement.value ) {
|
||||
let total = new Roll("d20").roll().total;
|
||||
if ( total <= refoulement.value ) {
|
||||
ChatMessage.create( { title : "Souffle de Dragon",
|
||||
content: game.user.name + " subit un Souffle de Dragon !" } );
|
||||
refoulement.value = 0;
|
||||
@ -321,9 +349,7 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
testSiSonne( sante, endurance )
|
||||
{
|
||||
let myroll = new Roll("d20");
|
||||
myroll.roll();
|
||||
let result = myroll.total;
|
||||
let result = new Roll("d20").roll().total;
|
||||
if ( result <= endurance.value)
|
||||
sante.sonne.value = false;
|
||||
if ( result > endurance.value || result == 20) // 20 is always a failure
|
||||
@ -366,12 +392,12 @@ export class RdDActor extends Actor {
|
||||
|
||||
if (lastValue - data.value > 1) this.testSiSonne(sante, data); // Peut-être sonné si 2 points d'endurance perdus d'un coup
|
||||
}
|
||||
console.log(name, inc, data.value);
|
||||
//console.log(name, inc, data.value);
|
||||
|
||||
let diffEndurance = sante.endurance.max - this.data.data.sante.endurance.value;
|
||||
if ( sante.fatigue.value < diffEndurance) // If endurance lost, then the same amount of fatigue cannot be recovered
|
||||
sante.fatigue.value = diffEndurance;
|
||||
console.log("SANTE::::", sante);
|
||||
//console.log("SANTE::::", sante);
|
||||
|
||||
await this.update( {"data.sante": sante } );
|
||||
}
|
||||
@ -493,9 +519,10 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async displayTMR( sortID )
|
||||
async displayTMR( isRapide=false )
|
||||
{
|
||||
if (this.data.data.reve.reve.value <= 1 ) {
|
||||
let minReveValue = (isRapide) ? 3 : 2;
|
||||
if (this.data.data.reve.reve.value <= minReveValue ) {
|
||||
ChatMessage.create( { title: "Montée impossible !", content: "Vous n'avez plus assez de Points de Reve pour monter dans les Terres Médianes",
|
||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
||||
return;
|
||||
@ -506,10 +533,11 @@ export class RdDActor extends Actor {
|
||||
draconic: this.getDraconicList(),
|
||||
sort: this.getSortList(),
|
||||
caracReve: this.data.data.carac.reve.value,
|
||||
pointsReve: this.data.data.reve.reve.value
|
||||
pointsReve: this.data.data.reve.reve.value,
|
||||
isRapide: isRapide
|
||||
}
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', data );
|
||||
new RdDTMRDialog(sortID, html, this ).render(true);
|
||||
new RdDTMRDialog(html, this, data ).render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -78,7 +78,6 @@ Hooks.on("chatMessage", (html, content, msg) => {
|
||||
let commands = content.match(regExp);
|
||||
let command = commands[0];
|
||||
|
||||
|
||||
// Roll on a table
|
||||
if (command === "/table") {
|
||||
let tableName = commands[1].toLowerCase();
|
||||
|
@ -8,7 +8,7 @@ import { TMRUtility } from "./tmr-utility.js";
|
||||
export class RdDTMRDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(sort, html, actor) {
|
||||
constructor( html, actor, tmrData) {
|
||||
|
||||
// Common conf
|
||||
let dialogConf = {
|
||||
@ -31,18 +31,24 @@ export class RdDTMRDialog extends Dialog {
|
||||
|
||||
super(dialogConf, dialogOptions);
|
||||
|
||||
this.tmrdata = duplicate(tmrData);
|
||||
this.col1_y = 30;
|
||||
this.col2_y = 55;
|
||||
this.cellh = 55;
|
||||
this.cellw = 55;
|
||||
this.actor = actor;
|
||||
this.sort = sort;
|
||||
this.nbFatigue = 1; // 1 premier point de fatigue du à la montée
|
||||
this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list);
|
||||
//console.log(this.rencontresExistantes);
|
||||
this.pixiApp = new PIXI.Application( {width: 720, height: 860 } );
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
close() {
|
||||
this.actor.santeIncDec("fatigue", this.nbFatigue).then( super.close() ); // moving 1 cell costs 1 fatigue
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
displayPreviousRencontres() {
|
||||
for (let rencontre of this.rencontresExistantes) {
|
||||
@ -203,16 +209,28 @@ export class RdDTMRDialog extends Dialog {
|
||||
let carac = this.actor.getCurrentReve();
|
||||
let level = draconic.data.niveau - 7;
|
||||
let scoreDef = CONFIG.RDD.resolutionTable[carac][level+10];
|
||||
let myroll = new Roll("d100");
|
||||
myroll.roll();
|
||||
let result = new Roll("d100").roll().total;
|
||||
let content = "";
|
||||
let mycallback;
|
||||
console.log(">>>>", scoreDef);
|
||||
if ( myroll.total > scoreDef.score ) {
|
||||
content = "Vous êtes entré sur une case humide, et vous avez <strong>raté</strong> votre maîtrise ! Vous <strong>quittez les Terres Médianes</strong> ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + myroll.total + " / " + scoreDef.score;
|
||||
if ( result > scoreDef.score ) {
|
||||
content = "Vous êtes entré sur une case humide, et vous avez <strong>raté</strong> votre maîtrise ! Vous <strong>quittez les Terres Médianes</strong> ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + result + " / " + scoreDef.score;
|
||||
if ( result >= scoreDef.etotal ) {
|
||||
let souffle = TMRUtility.getSouffle(true);
|
||||
content += "<br>Vous avez fait un Echec Total. Vous subissez un Souffle de Dragon : " + souffle.name ;
|
||||
this.actor.createOwnedItem( souffle );
|
||||
}
|
||||
this.toclose = true;
|
||||
} else {
|
||||
content = "Vous êtes entré sur une case humide, et vous avez <strong>réussi</strong> votre maîtrise ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + myroll.total + " / " + scoreDef.score;
|
||||
content = "Vous êtes entré sur une case humide, et vous avez <strong>réussi</strong> votre maîtrise ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + result + " / " + scoreDef.score;
|
||||
if ( result <= scoreDef.part ) {
|
||||
content += "<br>Vous avez fait une Réussite Particulière";
|
||||
if ( level < 0 ) {
|
||||
let xpcarac = Math.floor( Math.abs(level) / 2);
|
||||
let xpcomp = (Math.abs(level) % 2 == 1) ? xpcarac+1 : xpcarac;
|
||||
content += "<br>Points d'expérience gagné ! " + xpcarac + " - " + xpcomp;
|
||||
}
|
||||
}
|
||||
}
|
||||
let humideDiag = new Dialog( {title: "Case humide",
|
||||
content: content,
|
||||
@ -273,7 +291,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
await myself.actor.update( { "data.reve.tmrpos": tmrPos } );
|
||||
myself.updateSprites(myself);
|
||||
|
||||
myself.actor.santeIncDec("fatigue", 1); // moving 1 cell costs 1 fatigue
|
||||
myself.nbFatigue += 1;
|
||||
myself.updateValuesDisplay();
|
||||
myself.manageRencontre(coordTMR, cellDescr);
|
||||
myself.manageCaseHumide( cellDescr );
|
||||
@ -329,8 +347,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
this.displayPreviousRencontres();
|
||||
} );
|
||||
|
||||
await this.actor.santeIncDec("fatigue", 1); // 1 point defatigue
|
||||
await this.actor.updatePointsDeReve(-1); // 1 point defatigue
|
||||
await this.actor.updatePointsDeReve( (this.tmrdata.isRapide) ? -2 : -1); // 1 point defatigue
|
||||
this.updateValuesDisplay();
|
||||
let cellDescr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord);
|
||||
this.manageRencontre( this.actor.data.data.reve.tmrpos.coord,cellDescr );
|
||||
|
@ -313,9 +313,7 @@ export class RdDUtility {
|
||||
/* -------------------------------------------- */
|
||||
static getLocalisation( )
|
||||
{
|
||||
let myroll = new Roll("d20");
|
||||
myroll.roll();
|
||||
let result = myroll.total;
|
||||
let result = new Roll("d20").roll().total;
|
||||
let txt = ""
|
||||
if ( result <= 3 ) txt = "Jambe, genou, pied, jarret";
|
||||
else if ( result <= 7 ) txt = "Hanche, cuisse, fesse";
|
||||
|
File diff suppressed because one or more lines are too long
@ -303,7 +303,10 @@
|
||||
{{!-- hautreve Tab --}}
|
||||
<div class="tab hautreve" data-group="primary" data-tab="hautreve" style="height:200px">
|
||||
<div>
|
||||
<span class="monte-tmr"><strong><a>Monter dans les Terres Medianes !</a></strong></span>
|
||||
<span class="monte-tmr"><strong><a>Monter Normale dans les Terres Medianes !</a></strong></span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="monte-tmr-rapide"><strong><a>Monter Accélérée dans les Terres Medianes !</a></strong></span>
|
||||
</div>
|
||||
<div>
|
||||
<ol class="item-list">
|
||||
|
Loading…
Reference in New Issue
Block a user