#19 : Gestion des entités dans les combats

This commit is contained in:
sladecraven 2020-11-15 11:15:36 +01:00
parent f73f00fd4e
commit 5ee0daccc7
6 changed files with 50 additions and 32 deletions

View File

@ -195,6 +195,9 @@ export class RdDActor extends Actor {
rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom; rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom;
rollData.loc = RdDUtility.getLocalisation(); rollData.loc = RdDUtility.getLocalisation();
for (let target of game.user.targets) { for (let target of game.user.targets) {
rollData.mortalite = (rollData.mortalite) ? rollData.mortalite : "mortel";// Force default
rollData.mortalite = (target.actor.data.type == 'entite') ? "cauchemar" : rollData.mortalite;
console.log("Mortalité : ", rollData.mortalite, target.actor.data.type);
defenseMsg = RdDUtility.buildDefenseChatCard(this, target, rollData); defenseMsg = RdDUtility.buildDefenseChatCard(this, target, rollData);
explications += "<br><strong>Cible</strong> : " + target.actor.data.name; explications += "<br><strong>Cible</strong> : " + target.actor.data.name;
} }
@ -246,6 +249,7 @@ export class RdDActor extends Actor {
} }
} }
/* -------------------------------------------- */
_calculBonusDommages(carac, arme, isForce=false) { _calculBonusDommages(carac, arme, isForce=false) {
const dmgArme = parseInt(arme.data.dommages) + (isForce)? 5 : 0; const dmgArme = parseInt(arme.data.dommages) + (isForce)? 5 : 0;
const dmgPerso = parseInt(this.data.data.attributs.plusdom.value); const dmgPerso = parseInt(this.data.data.attributs.plusdom.value);
@ -258,6 +262,7 @@ export class RdDActor extends Actor {
return dmgArme + dmgPerso; return dmgArme + dmgPerso;
} }
/* -------------------------------------------- */
async _rollLancementDeSort(rollData, rolled) { async _rollLancementDeSort(rollData, rolled) {
let sort = duplicate(rollData.selectedSort); let sort = duplicate(rollData.selectedSort);
@ -314,6 +319,7 @@ export class RdDActor extends Actor {
return explications return explications
} }
/* -------------------------------------------- */
async sortMisEnReserve(rollData, sort) { async sortMisEnReserve(rollData, sort) {
let reserve = duplicate(this.data.data.reve.reserve); let reserve = duplicate(this.data.data.reve.reserve);
reserve.list.push({ coord: rollData.coord, sort: sort, draconic: duplicate(rollData.selectedDraconic) }); reserve.list.push({ coord: rollData.coord, sort: sort, draconic: duplicate(rollData.selectedDraconic) });
@ -469,6 +475,12 @@ export class RdDActor extends Actor {
computeEtatGeneral( ) computeEtatGeneral( )
{ {
let data = this.data.data; let data = this.data.data;
// Pas d'état général pour les entités forçage à 0
if ( this.data.type == 'entite') {
data.compteurs.etat.value = 0;
return;
}
// Pour les autres
let state = 0; let state = 0;
state = state - (data.sante.vie.max - data.sante.vie.value); state = state - (data.sante.vie.max - data.sante.vie.value);
if (data.sante.fatigue) // Creatures n'ont pas de fatigue if (data.sante.fatigue) // Creatures n'ont pas de fatigue
@ -576,7 +588,7 @@ export class RdDActor extends Actor {
if ( data.value > data.max ) data.value = data.max; if ( data.value > data.max ) data.value = data.max;
if ( data.value < 0 ) data.value = 0; if ( data.value < 0 ) data.value = 0;
if (name == "endurance") { if (name == "endurance" && this.data.type != 'entite' ) {
if ( sante.fatigue && inc < 0 ) // Each endurance lost -> fatigue lost if ( sante.fatigue && inc < 0 ) // Each endurance lost -> fatigue lost
sante.fatigue.value = sante.fatigue.value - inc sante.fatigue.value = sante.fatigue.value - inc
@ -638,11 +650,11 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
manageBlessures( blessuresData ) manageBlessures( blessuresData )
{ {
let workData = duplicate(blessuresData);
// Fast exit // Fast exit
if ( this.data.type == 'entite') return; // Une entité n'a pas de blessures
if ( blessuresData.legeres + blessuresData.graves + blessuresData.critiques == 0 ) return; if ( blessuresData.legeres + blessuresData.graves + blessuresData.critiques == 0 ) return;
let workData = duplicate(blessuresData);
let blessures = duplicate(this.data.data.blessures); let blessures = duplicate(this.data.data.blessures);
// Manage blessures // Manage blessures
if ( workData.legeres > 0 ) { if ( workData.legeres > 0 ) {
@ -813,23 +825,23 @@ export class RdDActor extends Actor {
this.rollCompetence( armeName ); //Bypass mode! this.rollCompetence( armeName ); //Bypass mode!
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollCompetence( name, armeItem=undefined, attackerRoll=undefined ) async rollCompetence( name, armeItem=undefined, attackerRoll=undefined ) {
{ let competence = RdDUtility.findCompetence( this.data.items, name);
let competence = RdDUtility.findCompetence( this.data.items, name); console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
console.log("rollCompetence !!!", competence, armeItem, attackerRoll); // Common rollData values
// Common rollData values let rollData = {
let rollData = { ajustementsConditions: CONFIG.RDD.ajustementsConditions,
ajustementsConditions: CONFIG.RDD.ajustementsConditions, difficultesLibres: CONFIG.RDD.difficultesLibres,
difficultesLibres: CONFIG.RDD.difficultesLibres, etat: this.data.data.compteurs.etat.value,
etat: this.data.data.compteurs.etat.value, diffConditions: 0,
diffConditions: 0, diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0, attackerRoll: attackerRoll,
attackerRoll: attackerRoll, finalLevel: 0,
finalLevel: 0 coupsNonMortels: false
} }
if ( competence.type == 'competencecreature') { // Specific case for Creatures if ( competence.type == 'competencecreature') { // Specific case for Creatures
if ( competence.data.iscombat ) { if ( competence.data.iscombat ) {
armeItem = { name: name, data: { dommages: competence.data.dommages} }; armeItem = { name: name, data: { dommages: competence.data.dommages} };
} }
@ -898,7 +910,8 @@ export class RdDActor extends Actor {
let degatsReel = attackerRoll.degats - armure; let degatsReel = attackerRoll.degats - armure;
let result = RdDUtility.computeBlessuresSante(degatsReel, attackerRoll.mortalite); let result = RdDUtility.computeBlessuresSante(degatsReel, attackerRoll.mortalite);
this.santeIncDec("vie", result.vie); if ( this.data.type != 'entite') // Pas de PV chez les entités
this.santeIncDec("vie", result.vie);
this.santeIncDec("endurance", result.endurance); this.santeIncDec("endurance", result.endurance);
result.locName = attackerRoll.loc.label; result.locName = attackerRoll.loc.label;

View File

@ -141,6 +141,9 @@ export class RdDRollDialog extends Dialog {
console.log("RdDRollDialog - Cout reve", ptreve); console.log("RdDRollDialog - Cout reve", ptreve);
updateRollResult(rollData); updateRollResult(rollData);
}); });
html.find('#coupsNonMortels').change((event) => {
this.rollData.mortalite = event.currentTarget.checked ? "non-mortel" : "non-mortel";
});
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -1,17 +1,11 @@
{"name":"Esquive","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_esquive.png","effects":[],"_id":"0Ms9iKxqigNNpZEx"} {"name":"Esquive","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_esquive.png","effects":[],"_id":"0Ms9iKxqigNNpZEx"}
{"_id":"18wcei5hlEInsBFO","name":"Attaque","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]} {"_id":"18wcei5hlEInsBFO","name":"Attaque","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]}
{"_id":"3Crwg8cx2JOb697T","name":"Parade","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_saut.png","effects":[]} {"_id":"3Crwg8cx2JOb697T","name":"Parade","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_saut.png","effects":[]}
{"_id":"9Y83OsQgeyR5oCdH","name":"Griffes","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.BjqRrGtHtTzuNpZB"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]}
{"_id":"QGULMUoC9JXFze0r","name":"Bouclier Lourd","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_bouclier.png","effects":[]} {"_id":"QGULMUoC9JXFze0r","name":"Bouclier Lourd","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_bouclier.png","effects":[]}
{"_id":"WsYnwR8GcOxfuCI0","name":"Bras-Galet","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_course.png","effects":[]} {"_id":"WsYnwR8GcOxfuCI0","name":"Bras-Galet","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_course.png","effects":[]}
{"name":"Corps à Corps","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.png","effects":[],"_id":"c0I93Q53i4ZmxpyT"} {"name":"Corps à Corps","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.png","effects":[],"_id":"c0I93Q53i4ZmxpyT"}
{"name":"Morsure","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-morsure.png","effects":[],"_id":"j1xHCzfIeYKgXxoH"}
{"name":"Bec","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.os88Rsp7mBkahqmh"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-beak.png","effects":[],"_id":"d5SZ09sFaG3cL2Rg"} {"name":"Bec","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.os88Rsp7mBkahqmh"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-beak.png","effects":[],"_id":"d5SZ09sFaG3cL2Rg"}
{"name":"Griffes et Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.BjqRrGtHtTzuNpZB"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[],"_id":"9Y83OsQgeyR5oCdH"}
{"_id":"9Y83OsQgeyR5oCdH","name":"Griffes","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.BjqRrGtHtTzuNpZB"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]}
{"_id":"3Crwg8cx2JOb697T","name":"Parade","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_saut.png","effects":[]}
{"name":"Epée Sorde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[],"_id":"gPOQd9NI7AFH0whX"}
{"_id":"gPOQd9NI7AFH0whX","name":"Epée Bâtarde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[]}
{"_id":"gPOQd9NI7AFH0whX","name":"Epée Bâtarde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[]}
{"name":"Bras-bouches","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.NctG7suzvGE7ZZzj"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","effects":[],"_id":"db8E8HwROw1ZcwRR"}
{"_id":"db8E8HwROw1ZcwRR","name":"Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.NctG7suzvGE7ZZzj"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","effects":[]}
{"_id":"db8E8HwROw1ZcwRR","name":"Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.NctG7suzvGE7ZZzj"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","effects":[]} {"_id":"db8E8HwROw1ZcwRR","name":"Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.NctG7suzvGE7ZZzj"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","effects":[]}
{"_id":"gPOQd9NI7AFH0whX","name":"Epée Bâtarde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"<p>Morsure de la créature</p>","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[]}
{"name":"Morsure","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"<p>Morsure de la créature</p>"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-morsure.png","effects":[],"_id":"j1xHCzfIeYKgXxoH"}

View File

@ -2,10 +2,10 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "0.9.44", "version": "0.9.45",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6", "compatibleCoreVersion": "0.7.6",
"templateVersion": 45, "templateVersion": 46,
"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

@ -50,6 +50,12 @@
"derivee": false "derivee": false
} }
}, },
"compteurs": {
"etat": {
"value": 0,
"label": "Etat général"
}
},
"attributs": { "attributs": {
"plusdom": { "plusdom": {
"type": "number", "type": "number",

View File

@ -19,7 +19,7 @@
{{/each}} {{/each}}
{{/select}} {{/select}}
</select> </select>
<label for="categorie">conditions</label> <label for="categorie">&nbsp;&nbsp;Conditions</label>
<select name="diffConditions" id="diffConditions" data-dtype="number"> <select name="diffConditions" id="diffConditions" data-dtype="number">
{{#select diffConditions}} {{#select diffConditions}}
{{#each ajustementsConditions as |key|}} {{#each ajustementsConditions as |key|}}
@ -33,6 +33,8 @@
<div> <div>
<label>Arme : {{arme.name}}</label> <label>Arme : {{arme.name}}</label>
<label>Degats : {{arme.data.dommages}}</label> <label>Degats : {{arme.data.dommages}}</label>
<label for="xp">Coups Non Mortels ? </label>
<input class="attribute-value" type="checkbox" id="coupsNonMortels" name="coupsNonMortels" {{#if coupsNonMortels}}checked{{/if}}/>
</div> </div>
{{/if}} {{/if}}
<div class="form-group"> <div class="form-group">