forked from public/foundryvtt-reve-de-dragon
#19 : Gestion des entités dans les combats
This commit is contained in:
@ -195,6 +195,9 @@ export class RdDActor extends Actor {
|
||||
rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom;
|
||||
rollData.loc = RdDUtility.getLocalisation();
|
||||
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);
|
||||
explications += "<br><strong>Cible</strong> : " + target.actor.data.name;
|
||||
}
|
||||
@ -246,6 +249,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_calculBonusDommages(carac, arme, isForce=false) {
|
||||
const dmgArme = parseInt(arme.data.dommages) + (isForce)? 5 : 0;
|
||||
const dmgPerso = parseInt(this.data.data.attributs.plusdom.value);
|
||||
@ -258,6 +262,7 @@ export class RdDActor extends Actor {
|
||||
return dmgArme + dmgPerso;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _rollLancementDeSort(rollData, rolled) {
|
||||
|
||||
let sort = duplicate(rollData.selectedSort);
|
||||
@ -314,6 +319,7 @@ export class RdDActor extends Actor {
|
||||
return explications
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async sortMisEnReserve(rollData, sort) {
|
||||
let reserve = duplicate(this.data.data.reve.reserve);
|
||||
reserve.list.push({ coord: rollData.coord, sort: sort, draconic: duplicate(rollData.selectedDraconic) });
|
||||
@ -469,6 +475,12 @@ export class RdDActor extends Actor {
|
||||
computeEtatGeneral( )
|
||||
{
|
||||
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;
|
||||
state = state - (data.sante.vie.max - data.sante.vie.value);
|
||||
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 < 0 ) data.value = 0;
|
||||
|
||||
if (name == "endurance") {
|
||||
if (name == "endurance" && this.data.type != 'entite' ) {
|
||||
if ( sante.fatigue && inc < 0 ) // Each endurance lost -> fatigue lost
|
||||
sante.fatigue.value = sante.fatigue.value - inc
|
||||
|
||||
@ -638,11 +650,11 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
manageBlessures( blessuresData )
|
||||
{
|
||||
let workData = duplicate(blessuresData);
|
||||
|
||||
// Fast exit
|
||||
if ( this.data.type == 'entite') return; // Une entité n'a pas de blessures
|
||||
if ( blessuresData.legeres + blessuresData.graves + blessuresData.critiques == 0 ) return;
|
||||
|
||||
let workData = duplicate(blessuresData);
|
||||
let blessures = duplicate(this.data.data.blessures);
|
||||
// Manage blessures
|
||||
if ( workData.legeres > 0 ) {
|
||||
@ -813,23 +825,23 @@ export class RdDActor extends Actor {
|
||||
this.rollCompetence( armeName ); //Bypass mode!
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCompetence( name, armeItem=undefined, attackerRoll=undefined )
|
||||
{
|
||||
let competence = RdDUtility.findCompetence( this.data.items, name);
|
||||
console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
|
||||
// Common rollData values
|
||||
let rollData = {
|
||||
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
||||
etat: this.data.data.compteurs.etat.value,
|
||||
diffConditions: 0,
|
||||
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
|
||||
attackerRoll: attackerRoll,
|
||||
finalLevel: 0
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async rollCompetence( name, armeItem=undefined, attackerRoll=undefined ) {
|
||||
let competence = RdDUtility.findCompetence( this.data.items, name);
|
||||
console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
|
||||
// Common rollData values
|
||||
let rollData = {
|
||||
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
||||
etat: this.data.data.compteurs.etat.value,
|
||||
diffConditions: 0,
|
||||
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
|
||||
attackerRoll: attackerRoll,
|
||||
finalLevel: 0,
|
||||
coupsNonMortels: false
|
||||
}
|
||||
|
||||
if ( competence.type == 'competencecreature') { // Specific case for Creatures
|
||||
if ( competence.type == 'competencecreature') { // Specific case for Creatures
|
||||
if ( competence.data.iscombat ) {
|
||||
armeItem = { name: name, data: { dommages: competence.data.dommages} };
|
||||
}
|
||||
@ -898,7 +910,8 @@ export class RdDActor extends Actor {
|
||||
let degatsReel = attackerRoll.degats - armure;
|
||||
|
||||
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);
|
||||
result.locName = attackerRoll.loc.label;
|
||||
|
||||
|
@ -141,6 +141,9 @@ export class RdDRollDialog extends Dialog {
|
||||
console.log("RdDRollDialog - Cout reve", ptreve);
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#coupsNonMortels').change((event) => {
|
||||
this.rollData.mortalite = event.currentTarget.checked ? "non-mortel" : "non-mortel";
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user