#53 : Gestion des détériorations et du recul
This commit is contained in:
@ -166,7 +166,58 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
computeDeteriorationArme( rollData ) {
|
||||
if ( rollData.arme && rollData.attackerRoll) { // C'est une parade
|
||||
// Est-ce que l'attaque est une particulière, en force ou charge et que l'attaque n'en est pas une ?
|
||||
if ( rollData.attackerRoll.rolled.isPart
|
||||
&& ( (rollData.attackerRoll.particuliereAttaque && rollData.attackerRoll.particuliereAttaque == 'force') || rollData.attackerRoll.isCharge)
|
||||
&& !rollData.rolled.isPart ) {
|
||||
// Jet de résistance de l'arme de parade (p.132)
|
||||
let resist = RdDResolutionTable.roll( rollData.arme.data.resistance, rollData.attackerRoll.domArmePlusDom );
|
||||
if (!resist.isSuccess) { // Perte de résistance
|
||||
rollData.arme.data.resistance -= rollData.attackerRoll.domArmePlusDom;
|
||||
if ( rollData.arme.data.resistance <= 0 ) {
|
||||
this.deleteEmbeddedEntity("OwnedItem", rollData.arme._id);
|
||||
ChatMessage.create( { content: "Votre arme s'est brisée sous le coup de la parade : " + rollData.arme.name,
|
||||
user: game.user._id,
|
||||
whisper: [game.user._id, ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
} else {
|
||||
this.updateEmbeddedEntity("OwnedItem", {_id: rollData.arme._id, 'data.resistance': rollData.arme.data.resistance });
|
||||
ChatMessage.create( { content: "Votre arme a perdu de la résistance : " + rollData.arme.name + " - " + rollData.arme.data.resistance,
|
||||
user: game.user._id,
|
||||
whisper: [game.user._id, ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
}
|
||||
}
|
||||
// Jet de désarmement
|
||||
if ( !rollData.arme.includes('Bouclier') ) { // Si l'arme de parade n'est pas un bouclier, jet de désarmement (p.132)
|
||||
let desarme = RdDResolutionTable.roll( this.data.data.carac.force.value, Number(rollData.competence.data.niveau) + Number(rollData.attackerRoll.domArmePlusDom) );
|
||||
if ( !desarme.isSucess) {
|
||||
ChatMessage.create( { content: "Vous êtes désarmé ! Votre arme " + rollData.arme.name + "tombe au sol à vos pieds",
|
||||
user: game.user._id,
|
||||
whisper: [game.user._id, ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeRecul( rollData ) { // Calcul du recul (p. 132)
|
||||
if ( rollData.arme || encaisser ) {
|
||||
if ( (rollData.attackerRoll.particuliereAttaque && rollData.attackerRoll.particuliereAttaque == 'force') || rollData.attackerRoll.isCharge) {
|
||||
let reculNiveau = this.data.data.taille.value - (rollData.attackerRoll.forceValue+rollData.attackerRoll.arme.dommages);
|
||||
let recul = RdDResolutionTable.roll( 10, reculNiveau );
|
||||
if (!recul.isSuccess) {
|
||||
let chute = RdDResolutionTable.roll( this.data.data.carac.agilite.value, reculNiveau );
|
||||
if ( !chute.isSuccess || recul.isETotal ) {
|
||||
ChatMessage( {content:"Vous subissez le recul du coup, et vous chutez au sol ! Vous ne pouvez plus attaquer ce round.",
|
||||
user: game.user._id,
|
||||
whisper: [game.user._id, ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
} else {
|
||||
ChatMessage( {content:"Vous subissez le recul du coup, et vous reculez de quelques mètres ! Vous ne pouvez plus attaquer ce round.",
|
||||
user: game.user._id,
|
||||
whisper: [game.user._id, ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +263,9 @@ export class RdDActor extends Actor {
|
||||
if (rollData.needSignificative)
|
||||
explications += " Significative nécessaire!";
|
||||
}
|
||||
this.computeRecul( rollData );
|
||||
encaisser = rollData.needSignificative ? !rolled.isSign : !rolled.isSuccess;
|
||||
this.computeRecul( rollData, encaisser );
|
||||
} else { // This is the attack roll!
|
||||
if (rolled.isSuccess) {
|
||||
let target = this.getTarget();
|
||||
@ -226,7 +279,7 @@ export class RdDActor extends Actor {
|
||||
whisper: ChatMessage.getWhisperRecipients( this.name ) } );
|
||||
}
|
||||
rollData.domArmePlusDom = this._calculBonusDommages(rollData.selectedCarac, rollData.arme, rollData.particuliereAttaque == 'force' );
|
||||
rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom;
|
||||
rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom + ((rollData.isCharge)?2:0); // Dégats totaux
|
||||
rollData.loc = RdDUtility.getLocalisation();
|
||||
|
||||
if (target)
|
||||
@ -1286,6 +1339,7 @@ export class RdDActor extends Actor {
|
||||
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
||||
etat: this.data.data.compteurs.etat.value,
|
||||
diffConditions: 0,
|
||||
forceValue :this.data.data.carac.force.value, // Utilisé pour le jet de recul
|
||||
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
|
||||
attackerRoll: attackerRoll,
|
||||
finalLevel: 0,
|
||||
|
@ -31,13 +31,13 @@ export class RdDRollDialog extends Dialog {
|
||||
// Select proper roll dialog template and stuff
|
||||
if (mode == "competence") {
|
||||
dialogConf.title = "Test de compétence"
|
||||
dialogOptions.height = 420
|
||||
dialogOptions.height = 430
|
||||
} else if (mode == "arme") {
|
||||
dialogConf.title = "Test de combat/arme"
|
||||
dialogOptions.height = 440
|
||||
dialogOptions.height = 460
|
||||
} else if (mode == "carac") {
|
||||
dialogConf.title = "Test de caractéristique"
|
||||
dialogOptions.height = 400
|
||||
dialogOptions.height = 420
|
||||
} else if (mode == "sort") {
|
||||
dialogConf.title = "Lancer un sort"
|
||||
dialogOptions.height = 460
|
||||
@ -154,6 +154,9 @@ export class RdDRollDialog extends Dialog {
|
||||
html.find('#coupsNonMortels').change((event) => {
|
||||
this.rollData.mortalite = event.currentTarget.checked ? "non-mortel" : "non-mortel";
|
||||
});
|
||||
html.find('#isCharge').change((event) => {
|
||||
this.rollData.isCharge = event.currentTarget.checked;
|
||||
});
|
||||
html.find('#surencMalusApply').change((event) => {
|
||||
this.rollData.surencMalusApply = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
@ -171,6 +174,7 @@ export class RdDRollDialog extends Dialog {
|
||||
let malusEnc = (rollData.surencMalusApply ) ? rollData.surencMalusValue : 0;
|
||||
let diffLibre = Misc.toInt(rollData.diffLibre);
|
||||
let malusEncNatation = (rollData.useEncForNatation) ? -rollData.encValueForNatation : 0;
|
||||
let chargeBonus = (rollData.isCharge) ? 4 : 0; // gestion de la charge en mélée
|
||||
|
||||
// Gestion malus armure
|
||||
let malusArmureValue = 0;
|
||||
@ -190,7 +194,7 @@ export class RdDRollDialog extends Dialog {
|
||||
diffLibre = RdDItemSort.getDifficulte(rollData.selectedSort, diffLibre);
|
||||
}
|
||||
|
||||
return etat + diffCompetence + diffLibre + diffConditions + malusEnc + malusEncNatation + malusArmureValue;
|
||||
return etat + diffCompetence + diffLibre + diffConditions + malusEnc + malusEncNatation + malusArmureValue + chargeBonus;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user