#53 : Gestion des détériorations et du recul
This commit is contained in:
parent
be73c51b97
commit
3d6d00e96f
@ -166,7 +166,58 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeDeteriorationArme( rollData ) {
|
computeDeteriorationArme( rollData ) {
|
||||||
if ( rollData.arme && rollData.attackerRoll) { // C'est une parade
|
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)
|
if (rollData.needSignificative)
|
||||||
explications += " Significative nécessaire!";
|
explications += " Significative nécessaire!";
|
||||||
}
|
}
|
||||||
|
this.computeRecul( rollData );
|
||||||
encaisser = rollData.needSignificative ? !rolled.isSign : !rolled.isSuccess;
|
encaisser = rollData.needSignificative ? !rolled.isSign : !rolled.isSuccess;
|
||||||
|
this.computeRecul( rollData, encaisser );
|
||||||
} else { // This is the attack roll!
|
} else { // This is the attack roll!
|
||||||
if (rolled.isSuccess) {
|
if (rolled.isSuccess) {
|
||||||
let target = this.getTarget();
|
let target = this.getTarget();
|
||||||
@ -226,7 +279,7 @@ export class RdDActor extends Actor {
|
|||||||
whisper: ChatMessage.getWhisperRecipients( this.name ) } );
|
whisper: ChatMessage.getWhisperRecipients( this.name ) } );
|
||||||
}
|
}
|
||||||
rollData.domArmePlusDom = this._calculBonusDommages(rollData.selectedCarac, rollData.arme, rollData.particuliereAttaque == 'force' );
|
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();
|
rollData.loc = RdDUtility.getLocalisation();
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
@ -1286,6 +1339,7 @@ export class RdDActor extends Actor {
|
|||||||
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
||||||
etat: this.data.data.compteurs.etat.value,
|
etat: this.data.data.compteurs.etat.value,
|
||||||
diffConditions: 0,
|
diffConditions: 0,
|
||||||
|
forceValue :this.data.data.carac.force.value, // Utilisé pour le jet de recul
|
||||||
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
|
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
|
||||||
attackerRoll: attackerRoll,
|
attackerRoll: attackerRoll,
|
||||||
finalLevel: 0,
|
finalLevel: 0,
|
||||||
|
@ -31,13 +31,13 @@ export class RdDRollDialog extends Dialog {
|
|||||||
// Select proper roll dialog template and stuff
|
// Select proper roll dialog template and stuff
|
||||||
if (mode == "competence") {
|
if (mode == "competence") {
|
||||||
dialogConf.title = "Test de compétence"
|
dialogConf.title = "Test de compétence"
|
||||||
dialogOptions.height = 420
|
dialogOptions.height = 430
|
||||||
} else if (mode == "arme") {
|
} else if (mode == "arme") {
|
||||||
dialogConf.title = "Test de combat/arme"
|
dialogConf.title = "Test de combat/arme"
|
||||||
dialogOptions.height = 440
|
dialogOptions.height = 460
|
||||||
} else if (mode == "carac") {
|
} else if (mode == "carac") {
|
||||||
dialogConf.title = "Test de caractéristique"
|
dialogConf.title = "Test de caractéristique"
|
||||||
dialogOptions.height = 400
|
dialogOptions.height = 420
|
||||||
} else if (mode == "sort") {
|
} else if (mode == "sort") {
|
||||||
dialogConf.title = "Lancer un sort"
|
dialogConf.title = "Lancer un sort"
|
||||||
dialogOptions.height = 460
|
dialogOptions.height = 460
|
||||||
@ -154,6 +154,9 @@ export class RdDRollDialog extends Dialog {
|
|||||||
html.find('#coupsNonMortels').change((event) => {
|
html.find('#coupsNonMortels').change((event) => {
|
||||||
this.rollData.mortalite = event.currentTarget.checked ? "non-mortel" : "non-mortel";
|
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) => {
|
html.find('#surencMalusApply').change((event) => {
|
||||||
this.rollData.surencMalusApply = event.currentTarget.checked;
|
this.rollData.surencMalusApply = event.currentTarget.checked;
|
||||||
updateRollResult(rollData);
|
updateRollResult(rollData);
|
||||||
@ -171,6 +174,7 @@ export class RdDRollDialog extends Dialog {
|
|||||||
let malusEnc = (rollData.surencMalusApply ) ? rollData.surencMalusValue : 0;
|
let malusEnc = (rollData.surencMalusApply ) ? rollData.surencMalusValue : 0;
|
||||||
let diffLibre = Misc.toInt(rollData.diffLibre);
|
let diffLibre = Misc.toInt(rollData.diffLibre);
|
||||||
let malusEncNatation = (rollData.useEncForNatation) ? -rollData.encValueForNatation : 0;
|
let malusEncNatation = (rollData.useEncForNatation) ? -rollData.encValueForNatation : 0;
|
||||||
|
let chargeBonus = (rollData.isCharge) ? 4 : 0; // gestion de la charge en mélée
|
||||||
|
|
||||||
// Gestion malus armure
|
// Gestion malus armure
|
||||||
let malusArmureValue = 0;
|
let malusArmureValue = 0;
|
||||||
@ -190,7 +194,7 @@ export class RdDRollDialog extends Dialog {
|
|||||||
diffLibre = RdDItemSort.getDifficulte(rollData.selectedSort, diffLibre);
|
diffLibre = RdDItemSort.getDifficulte(rollData.selectedSort, diffLibre);
|
||||||
}
|
}
|
||||||
|
|
||||||
return etat + diffCompetence + diffLibre + diffConditions + malusEnc + malusEncNatation + malusArmureValue;
|
return etat + diffCompetence + diffLibre + diffConditions + malusEnc + malusEncNatation + malusArmureValue + chargeBonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -93,8 +93,8 @@
|
|||||||
{"_id":"Sm28dG9isppoQzPQ","name":"Bas de lin","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0,"equipe":false,"resistance":0,"qualite":0,"cout":0.3},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bas_lin.webp","effects":[]}
|
{"_id":"Sm28dG9isppoQzPQ","name":"Bas de lin","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0,"equipe":false,"resistance":0,"qualite":0,"cout":0.3},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bas_lin.webp","effects":[]}
|
||||||
{"_id":"SrV0r5hnGdKeSIHR","name":"Cuillère de bois","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.03,"equipe":false,"resistance":0,"qualite":0,"cout":0.03},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/cuillere_bois.webp","effects":[]}
|
{"_id":"SrV0r5hnGdKeSIHR","name":"Cuillère de bois","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.03,"equipe":false,"resistance":0,"qualite":0,"cout":0.03},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/cuillere_bois.webp","effects":[]}
|
||||||
{"_id":"SsnGNjTekvB50uWa","name":"Chapeau de cuir souple","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.08,"equipe":false,"resistance":0,"qualite":0,"cout":0.5},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/chapeau_cuir.webp","effects":[]}
|
{"_id":"SsnGNjTekvB50uWa","name":"Chapeau de cuir souple","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.08,"equipe":false,"resistance":0,"qualite":0,"cout":0.5},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/chapeau_cuir.webp","effects":[]}
|
||||||
{"_id":"TY6Ft8a6WfxD6pD9","name":"Bobineau de fil","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.01,"equipe":false,"resistance":0,"qualite":0,"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bobineau.webp","effects":[]}
|
|
||||||
{"_id":"T9UiLcJonuHmGNwq","name":"Sols (pièces d'argent)","permission":{"default":0,"Q2G6GTdrotKzYGUC":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.005,"equipe":false,"resistance":0,"qualite":0,"cout":1},"flags":{},"img":"icons/commodities/currency/coins-assorted-mix-silver.webp","effects":[]}
|
{"_id":"T9UiLcJonuHmGNwq","name":"Sols (pièces d'argent)","permission":{"default":0,"Q2G6GTdrotKzYGUC":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.005,"equipe":false,"resistance":0,"qualite":0,"cout":1},"flags":{},"img":"icons/commodities/currency/coins-assorted-mix-silver.webp","effects":[]}
|
||||||
|
{"_id":"TY6Ft8a6WfxD6pD9","name":"Bobineau de fil","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.01,"equipe":false,"resistance":0,"qualite":0,"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bobineau.webp","effects":[]}
|
||||||
{"_id":"U6qli6TPbzj8tUdH","name":"Arme d’hast","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":4,"equipe":false,"dommages":"4","force":"12","resistance":8,"competence":"Dague","cout":10,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/hast.webp","effects":[]}
|
{"_id":"U6qli6TPbzj8tUdH","name":"Arme d’hast","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":4,"equipe":false,"dommages":"4","force":"12","resistance":8,"competence":"Dague","cout":10,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/hast.webp","effects":[]}
|
||||||
{"_id":"UDmq6CY3NsttcHe4","name":"Peigne en corne","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.04,"equipe":false,"resistance":0,"qualite":0,"cout":0.4},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/peigne.webp","effects":[]}
|
{"_id":"UDmq6CY3NsttcHe4","name":"Peigne en corne","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.04,"equipe":false,"resistance":0,"qualite":0,"cout":0.4},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/peigne.webp","effects":[]}
|
||||||
{"_id":"UICiMF3wBeLsqm8L","name":"Pipe en bois","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.04,"equipe":false,"resistance":0,"qualite":0,"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/pipe.webp","effects":[]}
|
{"_id":"UICiMF3wBeLsqm8L","name":"Pipe en bois","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.04,"equipe":false,"resistance":0,"qualite":0,"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/pipe.webp","effects":[]}
|
||||||
|
@ -36,6 +36,10 @@
|
|||||||
<label for="xp">Coups Non Mortels ? </label>
|
<label for="xp">Coups Non Mortels ? </label>
|
||||||
<input class="attribute-value" type="checkbox" id="coupsNonMortels" name="coupsNonMortels" {{#if coupsNonMortels}}checked{{/if}}/>
|
<input class="attribute-value" type="checkbox" id="coupsNonMortels" name="coupsNonMortels" {{#if coupsNonMortels}}checked{{/if}}/>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Est une charge ?</label>
|
||||||
|
<input class="attribute-value" type="checkbox" id="isCharge" name="isCharge" {{#if isCharge}}checked{{/if}}/>
|
||||||
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-natation.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-natation.html"}}
|
||||||
|
Loading…
Reference in New Issue
Block a user