From afa4b25acb84f65d2e9b8aa034340b58e60b5ded Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 7 Jan 2021 00:40:56 +0100 Subject: [PATCH] Cleanup --- module/rdd-bonus.js | 4 +-- module/rdd-resolution-table.js | 1 - module/rdd-roll.js | 2 +- module/rdd-utility.js | 56 ---------------------------------- module/rolldata-ajustements.js | 10 ------ 5 files changed, 2 insertions(+), 71 deletions(-) diff --git a/module/rdd-bonus.js b/module/rdd-bonus.js index 10ecc156..3a8806fd 100644 --- a/module/rdd-bonus.js +++ b/module/rdd-bonus.js @@ -1,5 +1,4 @@ import { RdDCarac } from "./rdd-carac.js"; -import { RdDUtility } from "./rdd-utility.js"; const conditionsTactiques = [ { type: '', descr: '', dmg: 0, attaque: 0, parade: 0, esquive: true }, @@ -67,8 +66,7 @@ export class RdDBonus { if (isCauchemar) { return "cauchemar"; } - return isCauchemar - ? "cauchemar" + return isCauchemar ? "cauchemar" : rollData.dmg?.mortalite ?? rollData.arme?.data.mortalite ?? "mortel"; diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js index 49796b1c..83dff5b7 100644 --- a/module/rdd-resolution-table.js +++ b/module/rdd-resolution-table.js @@ -1,5 +1,4 @@ import { ChatUtility } from "./chat-utility.js"; -import { RollDataAjustements as RollDataAjustements } from "./rolldata-ajustements.js"; import { Misc } from "./misc.js"; import { RdDDice } from "./rdd-dice.js"; diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 66277ce4..2de31f6a 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -1,4 +1,4 @@ -import { referenceAjustements, RollDataAjustements } from "./rolldata-ajustements.js"; +import { RollDataAjustements } from "./rolldata-ajustements.js"; import { HtmlUtility } from "./html-utility.js"; import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemMeditation } from "./item-meditation.js"; diff --git a/module/rdd-utility.js b/module/rdd-utility.js index ad399b93..e80e4adb 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -2,10 +2,8 @@ import { RdDRollTables } from "./rdd-rolltables.js"; import { ChatUtility } from "./chat-utility.js"; -import { RdDItemCompetence } from "./item-competence.js"; import { RdDCombat } from "./rdd-combat.js"; import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js"; -import { RdDItem } from "./item.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { RdDItemArme } from "./item-arme.js"; @@ -695,60 +693,6 @@ export class RdDUtility { return competences; } - /* -------------------------------------------- */ - static buildDefenseChatCard( attacker, target, rollData ) - { - console.log("Attacker.defense", attacker, target, target.actor.isToken, attacker.data._id, rollData.competence.data.categorie ); - let myTarget = target.actor; - let defenseMsg = { title: "Défense en combat", - content: ""+myTarget.name+" doit se défendre :
" + - "Encaisser !", - whisper: ChatMessage.getWhisperRecipients( myTarget.name ), - attackerId: attacker.data._id, - defenderTokenId: target.data._id, - rollMode: true - }; - - if ( rollData.competence.data.categorie == 'melee' || rollData.competence.data.categorie == 'competencecreature') { // Melee attack or creature - let defenderArmes = []; - for (const arme of myTarget.data.items) { - if (arme.type == "arme" && RdDItemCompetence.isCompetenceMelee(arme.data.competence)) { - defenderArmes.push( arme ); - defenseMsg.content += "
Parer avec " + arme.name + ""; - } - if (arme.type == "competencecreature" && arme.data.isparade) { - defenderArmes.push( arme ); - defenseMsg.content += "
Parer avec " + arme.name + ""; - } - } - defenseMsg.content += "
Esquiver"; - } - if ( rollData.competence.data.categorie == "tir" ) { - for (const arme of myTarget.data.items) { // Bouclier for parry - if ( arme.type == "arme" && arme.name.toLowerCase.match("bouclier") ) { - defenderArmes.push( arme ); - defenseMsg.content += "
Parer avec " + arme.name + ""; - } - } - } - if ( rollData.competence.data.categorie == "lancer" ) { - for (const arme of myTarget.data.items) { // Bouclier for parry Dodge/Esquive - if ( arme.type == "arme" && arme.name.toLowerCase.match("bouclier") ) { - defenderArmes.push( arme ); - defenseMsg.content += "
Parer avec " + arme.name + ""; - } - } - defenseMsg.content += "
Esquiver"; - } - - defenseMsg.toSocket = true; // True per default for all players - if (game.user.isGM) { // In GM case, only if target is a player - defenseMsg.toSocket = myTarget.hasPlayerOwner; - } - - return defenseMsg; - } - /* -------------------------------------------- */ static async responseNombreAstral( data ) { let actor = game.actors.get( data.id); diff --git a/module/rolldata-ajustements.js b/module/rolldata-ajustements.js index 9a687a29..5139a5da 100644 --- a/module/rolldata-ajustements.js +++ b/module/rolldata-ajustements.js @@ -125,16 +125,6 @@ export class RollDataAjustements { } } - // /* -------------------------------------------- */ - // static calculListe(ajustements, rollData, actor) { - // let list = []; - // for (var key in referenceAjustements) { - // if (referenceAjustements[key].isUsed(rollData, actor)) { - // list.push(Ajustements._apply(referenceAjustements[key], rollData, actor)); - // } - // } - // return list; - // } /* -------------------------------------------- */ static sum(ajustements) {