Amélioration usage armes
Décompter uniquemlent si le jet n'est pas une particulière Sur attaque particulière, décompter si le choix n'est pas une attaque en rapidité
This commit is contained in:
parent
620b34443d
commit
300419cbad
@ -2788,19 +2788,11 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async decItemUse( itemId ) {
|
async incDecItemUse( itemId, inc = 1 ) {
|
||||||
let itemUse = duplicate(this.getFlag('foundryvtt-reve-de-dragon', 'itemUse') ?? {});
|
let itemUse = duplicate(this.getFlag('foundryvtt-reve-de-dragon', 'itemUse') ?? {});
|
||||||
itemUse[itemId] = (itemUse[itemId] ?? 0) - 1;
|
itemUse[itemId] = (itemUse[itemId] ?? 0) + inc;
|
||||||
await this.setFlag( 'foundryvtt-reve-de-dragon', 'itemUse', itemUse);
|
await this.setFlag( 'foundryvtt-reve-de-dragon', 'itemUse', itemUse);
|
||||||
console.log("ITEM USE DEC", itemUse);
|
console.log("ITEM USE INC", inc, itemUse);
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async incItemUse( itemId ) {
|
|
||||||
let itemUse = duplicate(this.getFlag('foundryvtt-reve-de-dragon', 'itemUse') ?? {});
|
|
||||||
itemUse[itemId] = (itemUse[itemId] ?? 0) + 1;
|
|
||||||
await this.setFlag( 'foundryvtt-reve-de-dragon', 'itemUse', itemUse);
|
|
||||||
console.log("ITEM USE INC", itemUse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -50,10 +50,10 @@ export class RdDCombatManager extends Combat {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
cleanSonne() {
|
cleanSonne() {
|
||||||
for (let combatant of this.data.combatants) {
|
for (let combatant of this.data.combatants) {
|
||||||
if (combatant.actor){
|
if (combatant.actor) {
|
||||||
combatant.actor.verifierSonneRound(this.current.round);
|
combatant.actor.verifierSonneRound(this.current.round);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur!`)
|
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur!`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,7 +686,6 @@ export class RdDCombat {
|
|||||||
let rollData = this._prepareAttaque(competence, arme);
|
let rollData = this._prepareAttaque(competence, arme);
|
||||||
console.log("RdDCombat.attaque >>>", rollData);
|
console.log("RdDCombat.attaque >>>", rollData);
|
||||||
if (arme) {
|
if (arme) {
|
||||||
this.attacker.incItemUse(arme._id); // Usage
|
|
||||||
this.attacker.verifierForceMin(arme);
|
this.attacker.verifierForceMin(arme);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,6 +699,7 @@ export class RdDCombat {
|
|||||||
callbacks: [
|
callbacks: [
|
||||||
this.attacker.createCallbackExperience(),
|
this.attacker.createCallbackExperience(),
|
||||||
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
|
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
|
||||||
|
{ condition: r => arme && !RdDCombat.isParticuliere(r), action: r => this.attacker.incDecItemUse(arme._id) },
|
||||||
{ condition: r => (RdDCombat.isReussite(r) && !RdDCombat.isParticuliere(r)), action: r => this._onAttaqueNormale(r) },
|
{ condition: r => (RdDCombat.isReussite(r) && !RdDCombat.isParticuliere(r)), action: r => this._onAttaqueNormale(r) },
|
||||||
{ condition: RdDCombat.isParticuliere, action: r => this._onAttaqueParticuliere(r) },
|
{ condition: RdDCombat.isParticuliere, action: r => this._onAttaqueParticuliere(r) },
|
||||||
{ condition: RdDCombat.isEchec, action: r => this._onAttaqueEchec(r) },
|
{ condition: RdDCombat.isEchec, action: r => this._onAttaqueEchec(r) },
|
||||||
@ -738,7 +738,6 @@ export class RdDCombat {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _onAttaqueParticuliere(rollData) {
|
async _onAttaqueParticuliere(rollData) {
|
||||||
RdDCombat._storeAttaque(this.attackerId, rollData);
|
RdDCombat._storeAttaque(this.attackerId, rollData);
|
||||||
this.attacker.decItemUse( rollData.arme._id ); // Usage décrémenté sur particulière
|
|
||||||
|
|
||||||
// Finesse et Rapidité seulement en mêlée et si la difficulté libre est de -1 minimum
|
// Finesse et Rapidité seulement en mêlée et si la difficulté libre est de -1 minimum
|
||||||
const isMeleeDiffNegative = rollData.selectedCarac.label == "Mêlée" && rollData.diffLibre < 0;
|
const isMeleeDiffNegative = rollData.selectedCarac.label == "Mêlée" && rollData.diffLibre < 0;
|
||||||
@ -909,6 +908,10 @@ export class RdDCombat {
|
|||||||
async choixParticuliere(rollData, choix) {
|
async choixParticuliere(rollData, choix) {
|
||||||
console.log("RdDCombat.choixParticuliere >>>", rollData, choix);
|
console.log("RdDCombat.choixParticuliere >>>", rollData, choix);
|
||||||
|
|
||||||
|
if (choix != "rapidite") {
|
||||||
|
this.attacker.incDecItemUse(rollData.arme._id);
|
||||||
|
}
|
||||||
|
|
||||||
this.removeChatMessageActionsPasseArme(rollData.passeArme);
|
this.removeChatMessageActionsPasseArme(rollData.passeArme);
|
||||||
rollData.particuliere = choix;
|
rollData.particuliere = choix;
|
||||||
await this._onAttaqueNormale(rollData);
|
await this._onAttaqueNormale(rollData);
|
||||||
@ -919,7 +922,6 @@ export class RdDCombat {
|
|||||||
let arme = this.defender.getArmeParade(armeParadeId);
|
let arme = this.defender.getArmeParade(armeParadeId);
|
||||||
|
|
||||||
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
|
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
|
||||||
this.defender.incItemUse(armeParadeId); // Usage
|
|
||||||
|
|
||||||
let rollData = this._prepareParade(attackerRoll, arme);
|
let rollData = this._prepareParade(attackerRoll, arme);
|
||||||
|
|
||||||
@ -933,6 +935,7 @@ export class RdDCombat {
|
|||||||
callbacks: [
|
callbacks: [
|
||||||
this.defender.createCallbackExperience(),
|
this.defender.createCallbackExperience(),
|
||||||
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
|
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
|
||||||
|
{ condition: r => !RdDCombat.isParticuliere(r), action: r => this.defender.incDecItemUse(armeParadeId) },
|
||||||
{ condition: RdDCombat.isReussite, action: r => this._onParadeNormale(r) },
|
{ condition: RdDCombat.isReussite, action: r => this._onParadeNormale(r) },
|
||||||
{ condition: RdDCombat.isParticuliere, action: r => this._onParadeParticuliere(r) },
|
{ condition: RdDCombat.isParticuliere, action: r => this._onParadeParticuliere(r) },
|
||||||
{ condition: RdDCombat.isEchec, action: r => this._onParadeEchec(r) },
|
{ condition: RdDCombat.isEchec, action: r => this._onParadeEchec(r) },
|
||||||
@ -946,7 +949,7 @@ export class RdDCombat {
|
|||||||
const compName = armeParade.data.competence;
|
const compName = armeParade.data.competence;
|
||||||
const armeAttaque = attackerRoll.arme;
|
const armeAttaque = attackerRoll.arme;
|
||||||
|
|
||||||
let rollData = {
|
let defenderRoll = {
|
||||||
passeArme: attackerRoll.passeArme,
|
passeArme: attackerRoll.passeArme,
|
||||||
diffLibre: attackerRoll.diffLibre,
|
diffLibre: attackerRoll.diffLibre,
|
||||||
attackerRoll: attackerRoll,
|
attackerRoll: attackerRoll,
|
||||||
@ -958,13 +961,13 @@ export class RdDCombat {
|
|||||||
carac: this.defender.data.data.carac,
|
carac: this.defender.data.data.carac,
|
||||||
show: {}
|
show: {}
|
||||||
};
|
};
|
||||||
rollData.diviseurSignificative = this._getDiviseurSignificative(rollData);
|
defenderRoll.diviseurSignificative = this._getDiviseurSignificative(defenderRoll);
|
||||||
|
|
||||||
if (this.defender.isCreature()) {
|
if (this.defender.isCreature()) {
|
||||||
RdDItemCompetenceCreature.setRollDataCreature(rollData);
|
RdDItemCompetenceCreature.setRollDataCreature(defenderRoll);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rollData;
|
return defenderRoll;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1027,7 +1030,6 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
console.log("RdDCombat.esquive >>>", attackerRoll, esquive);
|
console.log("RdDCombat.esquive >>>", attackerRoll, esquive);
|
||||||
let rollData = this._prepareEsquive(attackerRoll, esquive);
|
let rollData = this._prepareEsquive(attackerRoll, esquive);
|
||||||
this.defender.incItemUse(esquive._id); // Usage
|
|
||||||
|
|
||||||
const dialog = await RdDRoll.create(this.defender, rollData,
|
const dialog = await RdDRoll.create(this.defender, rollData,
|
||||||
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html' }, {
|
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html' }, {
|
||||||
@ -1035,6 +1037,7 @@ export class RdDCombat {
|
|||||||
label: 'Esquiver',
|
label: 'Esquiver',
|
||||||
callbacks: [
|
callbacks: [
|
||||||
this.defender.createCallbackExperience(),
|
this.defender.createCallbackExperience(),
|
||||||
|
{ condition: r => !RdDCombat.isParticuliere(r), action: r => this.defender.incDecItemUse(esquive._id) },
|
||||||
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
|
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
|
||||||
{ condition: RdDCombat.isReussite, action: r => this._onEsquiveNormale(r) },
|
{ condition: RdDCombat.isReussite, action: r => this._onEsquiveNormale(r) },
|
||||||
{ condition: RdDCombat.isParticuliere, action: r => this._onEsquiveParticuliere(r) },
|
{ condition: RdDCombat.isParticuliere, action: r => this._onEsquiveParticuliere(r) },
|
||||||
|
Loading…
Reference in New Issue
Block a user