forked from public/foundryvtt-reve-de-dragon
Liste des ajustements
Après le travail sur les ChatMessage, centraliser les difficultés pour les dialog-roll afin d'afficher tous les ajustements sous forme de tooltips Les ajustements à améliorer: * malus armure * sur-encombrement * encombrement total + fix regression tâches + fix méditation isisPuritication
This commit is contained in:
@ -18,7 +18,7 @@ export class RdDCombat {
|
||||
static createUsingTarget(attacker) {
|
||||
const target = RdDCombat.getTarget();
|
||||
if (target == undefined) {
|
||||
ui.notifications.warn( (game.user.targets?.size ??0) > 1
|
||||
ui.notifications.warn((game.user.targets?.size ?? 0) > 1
|
||||
? "Vous devez choisir <strong>une seule</strong> cible à attaquer!"
|
||||
: "Vous devez choisir une cible à attaquer!");
|
||||
}
|
||||
@ -86,7 +86,7 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _callJetDeVie( event ) {
|
||||
static _callJetDeVie(event) {
|
||||
let actorId = event.currentTarget.attributes['data-actorId'].value;
|
||||
let actor = game.actors.get(actorId);
|
||||
actor.jetVie();
|
||||
@ -103,7 +103,7 @@ export class RdDCombat {
|
||||
html.on("click", '#chat-jet-vie', event => {
|
||||
event.preventDefault();
|
||||
RdDCombat._callJetDeVie(event);
|
||||
} );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ export class RdDCombat {
|
||||
}
|
||||
else {
|
||||
// sans armes: à mains nues
|
||||
rollData.arme = RdDItemArme.mainsNues({niveau: competence.data.niveau});
|
||||
rollData.arme = RdDItemArme.mainsNues({ niveau: competence.data.niveau });
|
||||
}
|
||||
return rollData;
|
||||
}
|
||||
@ -247,7 +247,7 @@ export class RdDCombat {
|
||||
cible: this.target ? this.defender.data.name : 'la cible',
|
||||
isRecul: (rollData.particuliere == 'force' || rollData.tactique == 'charge')
|
||||
}
|
||||
await RdDResolutionTable.displayRollData(rollData, this.attacker.name, 'chat-resultat-attaque.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this.attacker, 'chat-resultat-attaque.html');
|
||||
|
||||
if (!await this.accorderEntite('avant-defense')) {
|
||||
return;
|
||||
@ -304,7 +304,7 @@ export class RdDCombat {
|
||||
return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers')
|
||||
default:
|
||||
// Le fléau ne peut être paré qu’au bouclier p115
|
||||
if (competence.name == "Fléau"){
|
||||
if (competence.name == "Fléau") {
|
||||
return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers')
|
||||
}
|
||||
return items.filter(item => RdDItemArme.getCategorieParade(item));
|
||||
@ -327,8 +327,8 @@ export class RdDCombat {
|
||||
/* -------------------------------------------- */
|
||||
async _onAttaqueEchec(rollData) {
|
||||
console.log("RdDCombat.onAttaqueEchec >>>", rollData);
|
||||
await RdDResolutionTable.displayRollData(rollData, this.attacker.name, 'chat-resultat-attaque.html');
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.attacker, 'chat-resultat-attaque.html');
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -376,12 +376,12 @@ export class RdDCombat {
|
||||
competence: this.defender.getCompetence(compName),
|
||||
arme: armeParade,
|
||||
surprise: this.defender.getSurprise(),
|
||||
needParadeSignificative: this.needParadeSignificative(attackerRoll, armeParade),
|
||||
diviseur: this._getDiviseurSignificative(attackerRoll, armeParade),
|
||||
needResist: this._needArmeResist(armeAttaque, armeParade),
|
||||
needParadeSignificative: RdDItemArme.needParadeSignificative(armeAttaque, armeParade),
|
||||
needResist: RdDItemArme.needArmeResist(armeAttaque, armeParade),
|
||||
carac: this.defender.data.data.carac,
|
||||
show: {}
|
||||
};
|
||||
rollData.diviseur = this._getDiviseurSignificative(rollData);
|
||||
if (isCreature) {
|
||||
RdDItemCompetence.setRollDataCreature(rollData);
|
||||
}
|
||||
@ -389,34 +389,12 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_getDiviseurSignificative(attackerRoll, armeParade = undefined) {
|
||||
let facteurSign = this.defender.getDiviseurSignificative();
|
||||
if (RdDCombat.isAttaqueFinesse(attackerRoll)) {
|
||||
_getDiviseurSignificative(rollData) {
|
||||
let facteurSign = (this.defender.isDemiSurprise() || rollData.needParadeSignificative) ? 2 : 1;
|
||||
if (RdDBonus.isDefenseAttaqueFinesse(rollData)) {
|
||||
facteurSign *= 2;
|
||||
}
|
||||
if (this.needParadeSignificative(attackerRoll, armeParade)) {
|
||||
facteurSign *= 2;
|
||||
}
|
||||
return Math.min(4, facteurSign);
|
||||
|
||||
}
|
||||
|
||||
static isAttaqueFinesse(attackerRoll) {
|
||||
return attackerRoll && attackerRoll.particuliere == 'finesse';
|
||||
}
|
||||
|
||||
needParadeSignificative(attackerRoll, armeParade) {
|
||||
return attackerRoll.arme && armeParade &&
|
||||
RdDItemArme.needParadeSignificative(attackerRoll.arme, armeParade);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_needArmeResist(armeAttaque, armeParade) {
|
||||
// Epées parant une arme de bois (cf. page 115 ), une résistance est nécessaire
|
||||
let attCategory = RdDItemArme.getCategorieParade(armeAttaque);
|
||||
let defCategory = RdDItemArme.getCategorieParade(armeParade);
|
||||
|
||||
return attCategory.match(/epees-/) && defCategory.match(/(haches|lances)/);
|
||||
return facteurSign;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -437,7 +415,7 @@ export class RdDCombat {
|
||||
await this.computeRecul(rollData);
|
||||
await this.computeDeteriorationArme(rollData);
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender.name, 'chat-resultat-parade.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-parade.html');
|
||||
|
||||
}
|
||||
|
||||
@ -459,7 +437,7 @@ export class RdDCombat {
|
||||
|
||||
await this.computeRecul(rollData);
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender.name, 'chat-resultat-parade.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-parade.html');
|
||||
|
||||
this._sendMessageEncaisser(rollData.attackerRoll);
|
||||
}
|
||||
@ -498,10 +476,10 @@ export class RdDCombat {
|
||||
competence: competence,
|
||||
surprise: this.defender.getSurprise(),
|
||||
surpriseDefenseur: this.defender.getSurprise(),
|
||||
diviseur: this._getDiviseurSignificative(attackerRoll),
|
||||
carac: this.defender.data.data.carac,
|
||||
show: {}
|
||||
};
|
||||
rollData.diviseur = this._getDiviseurSignificative(rollData);
|
||||
|
||||
if (this.defender.isCreature()) {
|
||||
RdDItemCompetence.setRollDataCreature(rollData);
|
||||
@ -522,7 +500,7 @@ export class RdDCombat {
|
||||
async _onEsquiveNormale(rollData) {
|
||||
console.log("RdDCombat._onEsquiveNormal >>>", rollData);
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender.name, 'chat-resultat-esquive.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-esquive.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -542,7 +520,7 @@ export class RdDCombat {
|
||||
|
||||
await this.computeRecul(rollData);
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender.name, 'chat-resultat-esquive.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-esquive.html');
|
||||
|
||||
this._sendMessageEncaisser(rollData.attackerRoll);
|
||||
}
|
||||
@ -600,7 +578,9 @@ export class RdDCombat {
|
||||
if (this._isAttaqueCauseRecul(attaque)) {
|
||||
|
||||
let impactRecul = this._computeImpactRecul(attaque);
|
||||
const agilite = this.defender.data.data.carac.agilite.value;
|
||||
const agilite = this.defender.isEntiteCauchemar()
|
||||
? this.defender.data.data.carac.reve.value
|
||||
: this.defender.data.data.carac.agilite.value;
|
||||
|
||||
let rollRecul = await RdDResolutionTable.rollData({ caracValue: 10, finalLevel: impactRecul, showDice: false });
|
||||
|
||||
@ -679,34 +659,34 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async displayActorCombatStatus( actor ) {
|
||||
static async displayActorCombatStatus(actor) {
|
||||
let rollMode = game.settings.get("core", "rollMode");
|
||||
let rollData = {
|
||||
alias: actor.name,
|
||||
let rollData = {
|
||||
alias: actor.name,
|
||||
etatGeneral: actor.getEtatGeneral(),
|
||||
isSonne: actor.getSonne(),
|
||||
isSonne: actor.getSonne(),
|
||||
blessuresStatus: actor.computeResumeBlessure(),
|
||||
SConst: actor.getSConst(),
|
||||
actorId: actor.data._id,
|
||||
isGrave: false,
|
||||
isCritique: false
|
||||
}
|
||||
if ( actor.countBlessuresByName("critiques") > 0 ) { // Pour éviter le cumul grave + critique
|
||||
if (actor.countBlessuresByName("critiques") > 0) { // Pour éviter le cumul grave + critique
|
||||
rollData.isCritique = true;
|
||||
} else if ( actor.countBlessuresByName("graves") > 0) {
|
||||
} else if (actor.countBlessuresByName("graves") > 0) {
|
||||
rollData.isGrave = true;
|
||||
}
|
||||
let content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, rollData);
|
||||
ChatUtility.createChatMessage({ content: content }, rollMode, actor.name);
|
||||
ChatUtility.createChatMessage({ content: content }, rollMode, actor.name);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateCombatRound( combat, data) {
|
||||
static updateCombatRound(combat, data) {
|
||||
if (combat.data.round != 0 && combat.turns && combat.data.active) {
|
||||
let turn = combat.turns.find(t => t.tokenId == combat.current.tokenId);
|
||||
this.displayActorCombatStatus( turn.actor );
|
||||
this.displayActorCombatStatus(turn.actor);
|
||||
// TODO Playaudio ??
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user