Auto formatting

This commit is contained in:
Vincent Vandemeulebrouck 2021-01-10 02:28:45 +01:00
parent 3f62582af5
commit 3ee1b593c8

View File

@ -695,14 +695,14 @@ export class RdDActor extends Actor {
return true; return true;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
buildSubConteneurObjetList( conteneurId, deleteList ) { buildSubConteneurObjetList(conteneurId, deleteList) {
let conteneur = this.items.find( conteneur => conteneurId == conteneur._id); // recup conteneur let conteneur = this.items.find(conteneur => conteneurId == conteneur._id); // recup conteneur
if ( conteneur && conteneur.type =='conteneur' ) { // Si présent if (conteneur && conteneur.type == 'conteneur') { // Si présent
for ( let subId of conteneur.data.data.contenu ) { for (let subId of conteneur.data.data.contenu) {
let subObj = this.items.find( subobjet => subId == subobjet._id); // recup conteneur let subObj = this.items.find(subobjet => subId == subobjet._id); // recup conteneur
if ( subObj && subObj.type == 'conteneur') { if (subObj && subObj.type == 'conteneur') {
this.buildSubConteneurObjetList( subId, deleteList ); this.buildSubConteneurObjetList(subId, deleteList);
} }
if ( subObj) // Robust... if ( subObj) // Robust...
deleteList.push( {id: subId, conteneurId: conteneurId } ); deleteList.push( {id: subId, conteneurId: conteneurId } );
@ -767,8 +767,8 @@ export class RdDActor extends Actor {
await this.updateOwnedItem(conteneurFixedList); await this.updateOwnedItem(conteneurFixedList);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async moveItemsBetweenActors( itemId, sourceActorId ) { async moveItemsBetweenActors(itemId, sourceActorId) {
let itemsList = [] let itemsList = []
let sourceActor = game.actors.get( sourceActorId ); let sourceActor = game.actors.get( sourceActorId );
itemsList.push( {id: itemId, conteneurId: undefined }); // Init list itemsList.push( {id: itemId, conteneurId: undefined }); // Init list
@ -797,8 +797,8 @@ export class RdDActor extends Actor {
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
detectSurEncombrement( ) { detectSurEncombrement() {
let maxEnc = 0; let maxEnc = 0;
if ( this.data.type == 'vehicule') if ( this.data.type == 'vehicule')
maxEnc = this.data.data.capacite_encombrement; maxEnc = this.data.data.capacite_encombrement;
@ -1155,7 +1155,7 @@ export class RdDActor extends Actor {
} }
result.newValue = Math.max(0, result.newValue); result.newValue = Math.max(0, result.newValue);
if (inc > 0) { // le max d'endurance s'applique seulement à la récupération if (inc > 0) { // le max d'endurance s'applique seulement à la récupération
result.newValue = Math.min(result.newValue, this._computeEnduranceMax()) result.newValue = Math.min(result.newValue, this._computeEnduranceMax())
} }
if (data.value - result.newValue > 1) { if (data.value - result.newValue > 1) {
// Peut-être sonné si 2 points d'endurance perdus d'un coup // Peut-être sonné si 2 points d'endurance perdus d'un coup
@ -2211,24 +2211,24 @@ export class RdDActor extends Actor {
this.ajouterBlessure(encaissement); // Will upate the result table this.ajouterBlessure(encaissement); // Will upate the result table
const perteVie = await this.santeIncDec("vie", - encaissement.vie); const perteVie = await this.santeIncDec("vie", - encaissement.vie);
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, (encaissement.critiques > 0)); const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, (encaissement.critiques > 0));
this.computeEtatGeneral(); this.computeEtatGeneral();
this.sheet.render(false); this.sheet.render(false);
let santeActuelle = duplicate(this.data.data.sante); let santeActuelle = duplicate(this.data.data.sante);
encaissement.alias = this.data.name; encaissement.alias = this.data.name;
encaissement.hasPlayerOwner = this.hasPlayerOwner; encaissement.hasPlayerOwner = this.hasPlayerOwner;
encaissement.resteEndurance = santeActuelle.endurance.value encaissement.resteEndurance = santeActuelle.endurance.value
encaissement.sonne = perteEndurance.sonne; encaissement.sonne = perteEndurance.sonne;
encaissement.jetEndurance = perteEndurance.jetEndurance, encaissement.jetEndurance = perteEndurance.jetEndurance;
encaissement.endurance = santeOrig.endurance.value - perteEndurance.newValue; encaissement.endurance = santeOrig.endurance.value - perteEndurance.newValue;
encaissement.vie = santeOrig.vie.value - perteVie.newValue; encaissement.vie = santeOrig.vie.value - perteVie.newValue;
ChatUtility.createChatWithRollMode(this.name, { ChatUtility.createChatWithRollMode(this.name, {
roll: encaissement.roll, roll: encaissement.roll,
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement) content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
}); });
if (!encaissement.hasPlayerOwner && encaissement.endurance != 0) { if (!encaissement.hasPlayerOwner && encaissement.endurance != 0) {
encaissement = duplicate(encaissement); encaissement = duplicate(encaissement);