Ongoing progress for weapons

This commit is contained in:
LeRatierBretonnien 2020-06-12 11:47:41 +02:00
parent b16e977b19
commit 711ff19b10
5 changed files with 82 additions and 44 deletions

View File

@ -27,19 +27,18 @@ long_line_behaviour=1
long_line_column=72
[files]
current_page=1
FILE_NAME_0=8132;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
FILE_NAME_1=0;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2
FILE_NAME_2=10137;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
FILE_NAME_3=1756;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-roll-dialog.js;0;2
FILE_NAME_4=2092;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
current_page=2
FILE_NAME_0=4448;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
FILE_NAME_1=5464;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2
FILE_NAME_2=1630;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
FILE_NAME_3=2579;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-roll-dialog.js;0;2
FILE_NAME_4=10119;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
FILE_NAME_5=0;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-competence.html;0;2
FILE_NAME_6=17162;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2
FILE_NAME_6=14208;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2
FILE_NAME_7=543;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-main.js;0;2
FILE_NAME_8=1639;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-competence-sheet.html;0;2
FILE_NAME_9=752;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-arme-sheet.html;0;2
FILE_NAME_10=401;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fsystem.json;0;2
FILE_NAME_11=10349;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fstyles%2Fsimple.css;0;2
FILE_NAME_9=1796;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-arme-sheet.html;0;2
FILE_NAME_10=10349;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fstyles%2Fsimple.css;0;2
[VTE]
last_dir=/home/sigmar

View File

@ -94,7 +94,7 @@ export class RdDActorSheet extends ActorSheet {
/** @override */
activateListeners(html) {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;

View File

@ -94,12 +94,39 @@ export class RdDActor extends Actor {
rollData.qualite = -6;
}
// Manage weapon categories when parrying (cf. page 115 )
let need_significative = false; // Do we need to have a sgnificative ?
let need_resist = false; // Do we need to have a sgnificative ?
if ( rollData.arme && rollData.attackerRoll ) { // Manage parade depeding on weapon type, and change roll results
let attCategory = RdDUtility.getArmeCategory( rollData.attackerRoll.arme );
let defCategory = RdDUtility.getArmeCategory( rollData.arme );
if ( defCategory == "bouclier" )
need_significative = true;
else if ( attCategory != defCategory )
need_significative = true;
if ( attCategory.match("epee") && ( defCategory == "hache" || defCategory == "lance") )
need_resist = true;
}
// Sonne management or if need_significative is set
if ( this.data.data.sante.sonne.value || need_significative) {
if (rollData.pointsDeTache >= 2 ) { // Reussite normale dès que significative
quality = "Réussite Normale";
rollData.pointsDeTache = 1;
rollData.qualite = 0;
} else if (rollData.pointsDeTache < 2 ) { // Not a "significative"
quality = "Echec Normal";
rollData.pointsDeTache = 0;
rollData.qualite = -2;
}
}
// Fight management !
let defenseMsg;
let encaisser = false;
let specialStr = "<br>Points de taches : " + rollData.pointsDeTache; // Per default
if ( rollData.arme ) { // In case of fight, replace the "tache" per dommages + localization. "tache" indicates if result is OK or not
if ( rollData.attackerRoll) {
if ( rollData.arme ) { // In case of fight, replace the "tache" message per dommages + localization. "tache" indicates if result is OK or not
if ( rollData.attackerRoll) { // Defense case !
if ( rollData.pointsDeTache > 0 ) { // Réussite !
specialStr = "<br><strong>Attaque parée/esquivée !</strong>";
} else {
@ -212,13 +239,14 @@ export class RdDActor extends Actor {
sante.fatigue.value = sante.fatigue.value - inc
// If endurance is 0 -> -1 vie
if ( data.value == 0 ) {
if ( data.value == 0 && sante.vie.value > 0) {
sante.vie.value = sante.vie.value - 1;
}
let diffVie = sante.vie.max - sante.vie.value;
if ( data.value > data.max - (diffVie*2) ) {
data.value = data.max - (diffVie*2);
}
if ( data.value < 0 ) data.value = 0; // Security
let blessures = this.data.data.blessures;
let maxEnd = Math.floor( data.max / blessures.graves.nombre);
@ -227,10 +255,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);
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);
await this.update( {"data.sante": sante } );
}
@ -290,7 +320,7 @@ export class RdDActor extends Actor {
"carac": this.data.data.carac,
"bonusmalusTable": CONFIG.RDD.bonusmalus,
"etat": this.data.data.compteurs.etat.value,
"bmValue": 0,
"bmValue": (attackerRoll) ? attackerRoll.bmValue : 0,
"attackerRoll": attackerRoll,
"finalLevel": 0
}
@ -344,29 +374,7 @@ export class RdDActor extends Actor {
/** @override */
getRollData() {
const data = super.getRollData();
const shorthand = game.settings.get("foundryvtt-reve-de-dragon", "macroShorthand");
// Re-map all attributes onto the base roll data
if ( !!shorthand ) {
for ( let [k, v] of Object.entries(data.attributes) ) {
if ( !(k in data) ) data[k] = v.value;
}
delete data.attributes;
}
// Map all items data using their slugified names
data.items = this.data.items.reduce((obj, i) => {
let key = i.name.slugify({strict: true});
let itemData = duplicate(i.data);
if ( !!shorthand ) {
for ( let [k, v] of Object.entries(itemData.attributes) ) {
if ( !(k in itemData) ) itemData[k] = v.value;
}
delete itemData["attributes"];
}
obj[key] = itemData;
return obj;
}, {});
return data;
}
}

View File

@ -377,7 +377,25 @@ export class RdDUtility {
}
}
}
/* -------------------------------------------- */
static getArmeCategory( arme )
{
let compname = arme.data.competence.toLowerCase();
if ( compname.match("hache") ) return "hache";
if ( compname.match("hast") ) return "hast";
if ( compname.match("lance") ) return "lance";
if ( compname.match("bouclier") ) return "bouclier";
if ( compname.match("masse") ) return "masse";
if ( compname.match("fléau") ) return "fleau";
if ( compname.match("epée") ) {
let armename = arme.name.toLowerCase();
if (armename == "dague" || armename.match("gnome") )
return "epee_courte";
}
return "epee_longue";
}
/* -------------------------------------------- */
static isArmeMelee( compName)
{

View File

@ -7,18 +7,31 @@
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name"/></h1>
<div class="flexrow">
<div class="flex-group-center">
Vie <a id="vie-plus">+</a> / <a id="vie-moins">-</a>
<input class="resource-content" type="text" name="data.sante.vie.value" value="{{data.sante.vie.value}}" data-dtype="Number"/>/{{data.sante.vie.max}}
</div>
<div class="flex-group-center">
Endurance <a id="endurance-plus">+</a> / <a id="endurance-moins">-</a>
<input class="resource-content" type="text" name="data.sante.endurance.value" value="{{data.sante.endurance.value}}" data-dtype="Number"/>/{{data.sante.endurance.max}}
<div>
<span>Vie <a id="vie-plus">+</a> / <a id="vie-moins">-</a></span>
<input class="resource-content" type="text" name="data.sante.vie.value" value="{{data.sante.vie.value}}" data-dtype="Number"/>/{{data.sante.vie.max}}
</div>
<div>
<span>Endurance <a id="endurance-plus">+</a> / <a id="endurance-moins">-</a></span>
<input class="resource-content" type="text" name="data.sante.endurance.value" value="{{data.sante.endurance.value}}" data-dtype="Number"/>/{{data.sante.endurance.max}}
</div>
<div>
<span>Sonné :</span>
<input class="resource-content" type="checkbox" name="data.sante.sonne.value" value="{{data.sante.sonne.value}} {{#if data.sante.sonne.value}}checked{{/if}}"/>
</div>
</div>
<div class="flex-group-center flex-fatigue">
Fatigue <a id="fatigue-plus">+</a> / <a id="fatigue-moins">-</a>
<span>{{{data.fatigueHTML}}}</span>
</div>
</div>
<div class="flexrow">
<div class="flexrow">
<div class="flex-group-center">Blessures légères : {{data.blessures.legeres.nombre}}</div>
<div class="flex-group-center">Blessures graves : {{data.blessures.graves.nombre}}</div>
<div class="flex-group-center">Blessure critique : {{data.blessures.critiques.nombre}}</div>
</div>
</div>
<div class="flexrow">
{{#each data.compteurs as |compteur key|}}
<div class="flexcol flex-group-center">