This commit is contained in:
Vincent Vandemeulebrouck 2021-01-07 00:40:56 +01:00
parent 47fb2d511e
commit afa4b25acb
5 changed files with 2 additions and 71 deletions

View File

@ -1,5 +1,4 @@
import { RdDCarac } from "./rdd-carac.js"; import { RdDCarac } from "./rdd-carac.js";
import { RdDUtility } from "./rdd-utility.js";
const conditionsTactiques = [ const conditionsTactiques = [
{ type: '', descr: '', dmg: 0, attaque: 0, parade: 0, esquive: true }, { type: '', descr: '', dmg: 0, attaque: 0, parade: 0, esquive: true },
@ -67,8 +66,7 @@ export class RdDBonus {
if (isCauchemar) { if (isCauchemar) {
return "cauchemar"; return "cauchemar";
} }
return isCauchemar return isCauchemar ? "cauchemar"
? "cauchemar"
: rollData.dmg?.mortalite : rollData.dmg?.mortalite
?? rollData.arme?.data.mortalite ?? rollData.arme?.data.mortalite
?? "mortel"; ?? "mortel";

View File

@ -1,5 +1,4 @@
import { ChatUtility } from "./chat-utility.js"; import { ChatUtility } from "./chat-utility.js";
import { RollDataAjustements as RollDataAjustements } from "./rolldata-ajustements.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js"; import { RdDDice } from "./rdd-dice.js";

View File

@ -1,4 +1,4 @@
import { referenceAjustements, RollDataAjustements } from "./rolldata-ajustements.js"; import { RollDataAjustements } from "./rolldata-ajustements.js";
import { HtmlUtility } from "./html-utility.js"; import { HtmlUtility } from "./html-utility.js";
import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
import { RdDItemMeditation } from "./item-meditation.js"; import { RdDItemMeditation } from "./item-meditation.js";

View File

@ -2,10 +2,8 @@
import { RdDRollTables } from "./rdd-rolltables.js"; import { RdDRollTables } from "./rdd-rolltables.js";
import { ChatUtility } from "./chat-utility.js"; import { ChatUtility } from "./chat-utility.js";
import { RdDItemCompetence } from "./item-competence.js";
import { RdDCombat } from "./rdd-combat.js"; import { RdDCombat } from "./rdd-combat.js";
import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js"; import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js";
import { RdDItem } from "./item.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
import { RdDItemArme } from "./item-arme.js"; import { RdDItemArme } from "./item-arme.js";
@ -695,60 +693,6 @@ export class RdDUtility {
return competences; 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: "<strong>"+myTarget.name+"</strong> doit se défendre : <br><span class='chat-card-button-area'>" +
"<a class='chat-card-button' id='encaisser-button' data-attackerId='"+attacker.data._id + "' data-defenderTokenId='" + target.data._id + "'>Encaisser !</a></span>",
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 += "<br><a class='chat-card-button' id='parer-button' data-attackerId='"+attacker.data._id + "' data-defenderTokenId='" + target.data._id + "' data-armeid='"+arme._id+"'>Parer avec " + arme.name + "</a></span>";
}
if (arme.type == "competencecreature" && arme.data.isparade) {
defenderArmes.push( arme );
defenseMsg.content += "<br><a class='chat-card-button' id='parer-button' data-attackerId='"+attacker.data._id + "' data-defenderTokenId='" + target.data._id + "' data-armeid='"+arme._id+"'>Parer avec " + arme.name + "</a></span>";
}
}
defenseMsg.content += "<br><a class='chat-card-button' id='esquiver-button' data-attackerId='"+attacker.data._id + "' data-defenderTokenId='" + target.data._id + "'>Esquiver</a></span>";
}
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 += "<br><a class='chat-card-button' id='parer-button' data-attackerId='"+attacker.data._id + "' data-defenderTokenId='" + target.data._id + "' data-armeid='"+arme._id+"'>Parer avec " + arme.name + "</a></span>";
}
}
}
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 += "<br><a class='chat-card-button' id='parer-button' data-attackerId='"+attacker.data._id + "' data-defenderTokenId='" + target.data._id + "' data-armeid='"+arme._id+"'>Parer avec " + arme.name + "</a></span>";
}
}
defenseMsg.content += "<br><a class='chat-card-button' id='esquiver-button' data-attackerId='"+attacker.data._id + "' data-defenderTokenId='" + target.data._id + "'>Esquiver</a></span>";
}
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 ) { static async responseNombreAstral( data ) {
let actor = game.actors.get( data.id); let actor = game.actors.get( data.id);

View File

@ -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) { static sum(ajustements) {