Auto formatting
This commit is contained in:
parent
c9cc1de16e
commit
e7b9070cf1
1412
module/actor.js
1412
module/actor.js
File diff suppressed because it is too large
Load Diff
@ -152,7 +152,7 @@ export class RdDCombat {
|
||||
() => this.defenseChanceuse(attackerRoll),
|
||||
() => this.afficherOptionsDefense(attackerRoll, { defenseChance: true }));
|
||||
case '#appel-destinee-attaque': return this.attacker.appelDestinee(
|
||||
() => this.attaqueSignificative(attackerRoll),
|
||||
() => this.attaqueSignificative(attackerRoll),
|
||||
() => { });
|
||||
case '#appel-destinee-defense': return this.defender.appelDestinee(
|
||||
() => this.defenseDestinee(attackerRoll),
|
||||
@ -228,7 +228,7 @@ export class RdDCombat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
removeChatMessageActionsPasseArme(passeArme) {
|
||||
if (game.settings.get("foundryvtt-reve-de-dragon", "supprimer-dialogues-combat-chat")){
|
||||
if (game.settings.get("foundryvtt-reve-de-dragon", "supprimer-dialogues-combat-chat")) {
|
||||
ChatUtility.removeMyChatMessageContaining(`<div data-passearme="${passeArme}">`);
|
||||
}
|
||||
}
|
||||
@ -301,7 +301,7 @@ export class RdDCombat {
|
||||
competence: competence,
|
||||
surprise: this.attacker.getSurprise(),
|
||||
surpriseDefenseur: this.defender.getSurprise(),
|
||||
essais: { }
|
||||
essais: {}
|
||||
};
|
||||
|
||||
if (this.attacker.isCreature()) {
|
||||
@ -364,7 +364,7 @@ export class RdDCombat {
|
||||
console.log("RdDCombat._sendMessageDefense", attackerRoll, essais, " / ", this.attacker, this.target, this.attackerId, attackerRoll.competence.data.categorie);
|
||||
|
||||
this.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
|
||||
mergeObject(attackerRoll.essais, essais, {overwrite: true});
|
||||
mergeObject(attackerRoll.essais, essais, { overwrite: true });
|
||||
const paramDemandeDefense = {
|
||||
passeArme: attackerRoll.passeArme,
|
||||
essais: attackerRoll.essais,
|
||||
@ -494,18 +494,18 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_getDiviseurSignificative(rollData) {
|
||||
let facteurSign = (this.defender.isDemiSurprise() || rollData.needParadeSignificative) ? 2 : 1;
|
||||
if (RdDBonus.isDefenseAttaqueFinesse(rollData)) {
|
||||
_getDiviseurSignificative(defenderRoll) {
|
||||
let facteurSign = (this.defender.isDemiSurprise() || defenderRoll.needParadeSignificative) ? 2 : 1;
|
||||
if (RdDBonus.isDefenseAttaqueFinesse(defenderRoll)) {
|
||||
facteurSign *= 2;
|
||||
}
|
||||
return facteurSign;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_onParadeParticuliere(rollData) {
|
||||
console.log("RdDCombat._onParadeParticuliere >>>", rollData);
|
||||
if (!rollData.attackerRoll.isPart) {
|
||||
_onParadeParticuliere(defenderRoll) {
|
||||
console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll);
|
||||
if (!defenderRoll.attackerRoll.isPart) {
|
||||
// TODO: attaquant doit jouer résistance et peut être désarmé p132
|
||||
ChatUtility.chatWithRollMode({
|
||||
content: `(à gérer) L'attaquant doit jouer résistance et peut être désarmé (p132)`
|
||||
@ -514,25 +514,25 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onParadeNormale(rollData) {
|
||||
console.log("RdDCombat._onParadeNormale >>>", rollData);
|
||||
async _onParadeNormale(defenderRoll) {
|
||||
console.log("RdDCombat._onParadeNormale >>>", defenderRoll);
|
||||
|
||||
this._consumeDefense(rollData.passeArme);
|
||||
await this.computeRecul(rollData);
|
||||
await this.computeDeteriorationArme(rollData);
|
||||
this._consumeDefense(defenderRoll.passeArme);
|
||||
await this.computeRecul(defenderRoll);
|
||||
await this.computeDeteriorationArme(defenderRoll);
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-parade.html');
|
||||
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onParadeEchec(rollData) {
|
||||
console.log("RdDCombat._onParadeEchec >>>", rollData);
|
||||
async _onParadeEchec(defenderRoll) {
|
||||
console.log("RdDCombat._onParadeEchec >>>", defenderRoll);
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-parade.html');
|
||||
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
|
||||
|
||||
this.removeChatMessageActionsPasseArme(rollData.passeArme);
|
||||
this._sendMessageDefense(rollData.attackerRoll, { defense: true });
|
||||
this._storeDefense(rollData);
|
||||
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
|
||||
this._sendMessageDefense(defenderRoll.attackerRoll, { defense: true });
|
||||
this._storeDefense(defenderRoll);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -656,11 +656,11 @@ export class RdDCombat {
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async computeRecul(rollData) { // Calcul du recul (p. 132)
|
||||
const attaque = rollData.attackerRoll;
|
||||
if (this._isAttaqueCauseRecul(attaque)) {
|
||||
async computeRecul(defenderRoll) { // Calcul du recul (p. 132)
|
||||
const attackerRoll = defenderRoll.attackerRoll;
|
||||
if (this._isAttaqueCauseRecul(attackerRoll)) {
|
||||
|
||||
let impactRecul = this._computeImpactRecul(attaque);
|
||||
let impactRecul = this._computeImpactRecul(attackerRoll);
|
||||
const agilite = this.defender.isEntiteCauchemar()
|
||||
? this.defender.data.data.carac.reve.value
|
||||
: this.defender.data.data.carac.agilite.value;
|
||||
@ -668,13 +668,13 @@ export class RdDCombat {
|
||||
let rollRecul = await RdDResolutionTable.rollData({ caracValue: 10, finalLevel: impactRecul, showDice: false });
|
||||
|
||||
if (rollRecul.isSuccess) {
|
||||
rollData.show.recul = 'encaisse';
|
||||
defenderRoll.show.recul = 'encaisse';
|
||||
} else if (rollRecul.isETotal) {
|
||||
rollData.show.recul = 'chute';
|
||||
defenderRoll.show.recul = 'chute';
|
||||
}
|
||||
else {
|
||||
let chute = await RdDResolutionTable.rollData({ caracValue: agilite, finalLevel: impactRecul, showDice: false });
|
||||
rollData.show.recul = (chute.isSuccess)
|
||||
defenderRoll.show.recul = (chute.isSuccess)
|
||||
? 'recul'
|
||||
: 'chute';
|
||||
}
|
||||
@ -701,7 +701,13 @@ export class RdDCombat {
|
||||
console.log("RdDCombat.encaisser >>>", attackerRoll, defenderTokenId);
|
||||
|
||||
let defenderRoll = this._consumeDefense(attackerRoll.passeArme);
|
||||
if (defenderRoll && RdDCombat.isEchecTotal(defenderRoll)) {
|
||||
if (!defenderRoll) {
|
||||
defenderRoll = {
|
||||
attackerRoll: attackerRoll,
|
||||
show: {}
|
||||
};
|
||||
}
|
||||
else if (RdDCombat.isEchecTotal(defenderRoll)) {
|
||||
// TODO: echec total!!!
|
||||
this._onEchecTotal(defenderRoll);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ export class RdDCommands {
|
||||
return;
|
||||
}
|
||||
const term = path[0];
|
||||
fullPath = fullPath+term+' '
|
||||
fullPath = fullPath + term + ' '
|
||||
if (path.length == 1) {
|
||||
command.descr = `<strong>${fullPath}</strong>: ${command.descr}`;
|
||||
targetTable[term] = command;
|
||||
|
@ -15,7 +15,7 @@ export class RdDDice {
|
||||
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
|
||||
let whisper = null;
|
||||
let blind = false;
|
||||
rollMode = rollMode || game.settings.get("core", "rollMode");
|
||||
rollMode = rollMode ?? game.settings.get("core", "rollMode");
|
||||
switch (rollMode) {
|
||||
case "blindroll": //GM only
|
||||
blind = true;
|
||||
|
@ -139,7 +139,7 @@ export class RdDResolutionTable {
|
||||
}
|
||||
}
|
||||
static forceSignificative(chances) {
|
||||
chances.roll = Math.floor(chances.score /2);
|
||||
chances.roll = Math.floor(chances.score / 2);
|
||||
mergeObject(chances, reussites.find(x => x.code == 'sign'), { overwrite: true });
|
||||
}
|
||||
|
||||
|
@ -260,14 +260,14 @@ export class RdDUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async processItemDropEvent( actorSheet, event) {
|
||||
static async processItemDropEvent(actorSheet, event) {
|
||||
let dragData = JSON.parse(event.dataTransfer.getData("text/plain"));
|
||||
console.log(dragData, actorSheet.actor._id);
|
||||
let dropID = $(event.target).parents(".item").attr("data-item-id"); // Only relevant if container drop
|
||||
let objetId = dragData.id || dragData.data._id;
|
||||
if ( dropID ) { // Dropped over an item !!!
|
||||
if ( actorSheet.objetVersConteneur[objetId] != dropID && objetId != dropID) {
|
||||
if ( actorSheet.actor.validateConteneur(objetId, dropID) && actorSheet.actor.testConteneurCapacite(objetId, dropID) ) {
|
||||
if (actorSheet.objetVersConteneur[objetId] != dropID && objetId != dropID) {
|
||||
if (actorSheet.actor.validateConteneur(objetId, dropID) && actorSheet.actor.testConteneurCapacite(objetId, dropID)) {
|
||||
await actorSheet.actor.enleverDeConteneur(objetId, actorSheet.objetVersConteneur[objetId]);
|
||||
await actorSheet.actor.ajouterAConteneur(objetId, dropID);
|
||||
}
|
||||
@ -281,9 +281,9 @@ export class RdDUtility {
|
||||
actorSheet.actor.computeEncombrementTotalEtMalusArmure();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static buildArbreDeConteneur( actorSheet, data ) {
|
||||
static buildArbreDeConteneur(actorSheet, data) {
|
||||
actorSheet.objetVersConteneur = {}; // Table de hash locale pour recupération rapide du conteneur parent (si existant)
|
||||
// Attribution des objets aux conteneurs
|
||||
for (let conteneur of data.data.conteneurs) {
|
||||
@ -551,10 +551,10 @@ export class RdDUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _evaluatePerte(formula, over20) {
|
||||
console.log("_evaluatePerte", formula, over20)
|
||||
let perte = new Roll(formula, { over20: over20 })
|
||||
perte.evaluate()
|
||||
return perte.total
|
||||
console.log("_evaluatePerte", formula, over20);
|
||||
let perte = new Roll(formula, { over20: over20 });
|
||||
perte.evaluate();
|
||||
return perte.total;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user