#16 Gestion des critiques en combat
This commit is contained in:
parent
a7ac184ca3
commit
09cfdf922e
@ -124,6 +124,29 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async performRoll(rollData) {
|
async performRoll(rollData) {
|
||||||
|
|
||||||
|
// Perform the roll
|
||||||
|
let rolled = RdDResolutionTable.rollChances(rollData.rollTarget);
|
||||||
|
//rolled.isPart = true; // Pour tester le particulières
|
||||||
|
rollData.rolled = rolled; // garder le résultat
|
||||||
|
this.currentRollData = rollData;
|
||||||
|
if (rolled.isPart && rollData.arme && !rollData.attackerRoll) { // Réussite particulière avec attaque -> choix !
|
||||||
|
let message = "<strong>Réussite particulière en attaque<strong>";
|
||||||
|
message = message + "<br><a class='chat-card-button' id='particuliere-attaque' data-mode='force' data-attackerid='" + this.data._id + "'>Attaquer en Force</a>";
|
||||||
|
message = message + "<br><a class='chat-card-button' id='particuliere-attaque' data-mode='rapidite' data-attackerid='"+ this.data._id + "'>Attaquer en Rapidité</a>";
|
||||||
|
message = message + "<br><a class='chat-card-button' id='particuliere-attaque' data-mode='finesse' data-attackerid='"+ this.data._id + "'>Attaquer en Finesse</a>";
|
||||||
|
ChatMessage.create( {content : message, whisper: ChatMessage.getWhisperRecipients( this.name ) } );
|
||||||
|
} else {
|
||||||
|
this.continueRoll(rollData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async continueRoll(rollData) {
|
||||||
|
|
||||||
|
let rolled = rollData.rolled;
|
||||||
|
let result = rolled.roll;
|
||||||
|
let quality = rolled.quality
|
||||||
|
|
||||||
// Manage weapon categories when parrying (cf. page 115 )
|
// Manage weapon categories when parrying (cf. page 115 )
|
||||||
let need_resist = false; // Do we need to make resistance roll for defender ?
|
let need_resist = false; // Do we need to make resistance roll for defender ?
|
||||||
if (rollData.arme && rollData.attackerRoll) { // Manage parade depeding on weapon type, and change roll results
|
if (rollData.arme && rollData.attackerRoll) { // Manage parade depeding on weapon type, and change roll results
|
||||||
@ -136,15 +159,10 @@ export class RdDActor extends Actor {
|
|||||||
if (attCategory.match("epee") && (defCategory == "hache" || defCategory == "lance"))
|
if (attCategory.match("epee") && (defCategory == "hache" || defCategory == "lance"))
|
||||||
need_resist = true;
|
need_resist = true;
|
||||||
}
|
}
|
||||||
if (this.data.data.sante.sonne.value)
|
if (this.data.data.sante.sonne.value || rollData.particuliereAttaque == "finesse") {
|
||||||
{
|
|
||||||
rollData.needSignificative = true;
|
rollData.needSignificative = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let rolled = RdDResolutionTable.rollChances(rollData.rollTarget);
|
|
||||||
let result = rolled.roll;
|
|
||||||
let quality = rolled.quality
|
|
||||||
|
|
||||||
console.log(">>> ROLL", rollData, rolled);
|
console.log(">>> ROLL", rollData, rolled);
|
||||||
let xpmsg = RdDResolutionTable.buildXpMessage(rolled, rollData.finalLevel);
|
let xpmsg = RdDResolutionTable.buildXpMessage(rolled, rollData.finalLevel);
|
||||||
|
|
||||||
@ -158,18 +176,17 @@ export class RdDActor extends Actor {
|
|||||||
explications = ""
|
explications = ""
|
||||||
// In case of fight, replace the message per dommages + localization. it indicates if result is OK or not
|
// In case of fight, replace the message per dommages + localization. it indicates if result is OK or not
|
||||||
if (rollData.attackerRoll) { // Defense case !
|
if (rollData.attackerRoll) { // Defense case !
|
||||||
if (rolled.isSuccess) {
|
if (rollData.needSignificative && rolled.isSign ) {
|
||||||
explications += "<br><strong>Attaque parée/esquivée !</strong>";
|
explications += "<br><strong>Attaque parée/esquivée !</strong>";
|
||||||
} else {
|
} else if ( !rollData.needSignificative && rolled.isSuccess) {
|
||||||
|
explications += "<br><strong>Attaque parée/esquivée !</strong>";
|
||||||
|
} else {
|
||||||
explications += "<br><strong>Esquive/Parade échouée, encaissement !</strong>";
|
explications += "<br><strong>Esquive/Parade échouée, encaissement !</strong>";
|
||||||
encaisser = true;
|
encaisser = true;
|
||||||
}
|
}
|
||||||
} else { // This is the attack roll!
|
} else { // This is the attack roll!
|
||||||
if (rolled.isSuccess) {
|
if (rolled.isSuccess) {
|
||||||
if (rolled.isPart) { // Particulière !
|
rollData.domArmePlusDom = this._calculBonusDommages(rollData.selectedCarac, rollData.arme, rollData.particuliereAttaque == "force" );
|
||||||
console.log("TODO Gérer critique!");
|
|
||||||
}
|
|
||||||
rollData.domArmePlusDom = this._calculBonusDommages(rollData.selectedCarac, rollData.arme);
|
|
||||||
rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom;
|
rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom;
|
||||||
rollData.loc = RdDUtility.getLocalisation();
|
rollData.loc = RdDUtility.getLocalisation();
|
||||||
for (let target of game.user.targets) {
|
for (let target of game.user.targets) {
|
||||||
@ -223,8 +240,8 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_calculBonusDommages(carac, arme) {
|
_calculBonusDommages(carac, arme, isForce=false) {
|
||||||
const dmgArme = parseInt(arme.data.dommages);
|
const dmgArme = parseInt(arme.data.dommages) + (isForce)? 5 : 0;
|
||||||
const dmgPerso = parseInt(this.data.data.attributs.plusdom.value);
|
const dmgPerso = parseInt(this.data.data.attributs.plusdom.value);
|
||||||
if (carac.label == "Tir") {
|
if (carac.label == "Tir") {
|
||||||
return dmgArme;
|
return dmgArme;
|
||||||
|
@ -99,7 +99,7 @@ export class RdDRollDialog extends Dialog {
|
|||||||
$("#carac").val(rollData.competence.data.defaut_carac);
|
$("#carac").val(rollData.competence.data.defaut_carac);
|
||||||
}
|
}
|
||||||
// Si sort, for les points de reve à 1
|
// Si sort, for les points de reve à 1
|
||||||
if (!rollData.selectedSort.data.ptreve_reel)
|
if (rollData.selectedSort && !rollData.selectedSort.data.ptreve_reel)
|
||||||
rollData.selectedSort.data.ptreve_reel = 1;
|
rollData.selectedSort.data.ptreve_reel = 1;
|
||||||
$("#bonusmalus").val(rollData.bmValue);
|
$("#bonusmalus").val(rollData.bmValue);
|
||||||
updateRollResult(rollData);
|
updateRollResult(rollData);
|
||||||
|
@ -539,7 +539,6 @@ export class RdDUtility {
|
|||||||
|
|
||||||
html.on("click", '#parer-button', event => {
|
html.on("click", '#parer-button', event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
//let attackerActor = game.actors.get(event.currentTarget.attributes['data-attackerid'].value );
|
|
||||||
let defenderActor = game.actors.get(event.currentTarget.attributes['data-defenderid'].value );
|
let defenderActor = game.actors.get(event.currentTarget.attributes['data-defenderid'].value );
|
||||||
let armeId = event.currentTarget.attributes['data-armeid'].value;
|
let armeId = event.currentTarget.attributes['data-armeid'].value;
|
||||||
let rollData = defenderActor.currentRollData;
|
let rollData = defenderActor.currentRollData;
|
||||||
@ -548,13 +547,21 @@ export class RdDUtility {
|
|||||||
|
|
||||||
html.on("click", '#esquiver-button', event => {
|
html.on("click", '#esquiver-button', event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
//let attackerActor = game.actors.get(event.currentTarget.attributes['data-attackerid'].value );
|
|
||||||
let defenderActor = game.actors.get(event.currentTarget.attributes['data-defenderid'].value );
|
let defenderActor = game.actors.get(event.currentTarget.attributes['data-defenderid'].value );
|
||||||
let rollData = defenderActor.currentRollData;
|
let rollData = defenderActor.currentRollData;
|
||||||
console.log("Esquive !", rollData, defenderActor);
|
console.log("Esquive !", rollData, defenderActor);
|
||||||
defenderActor.esquiverAttaque( rollData );
|
defenderActor.esquiverAttaque( rollData );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
html.on("click", '#particuliere-attaque', event => {
|
||||||
|
event.preventDefault();
|
||||||
|
let attackerActor = game.actors.get(event.currentTarget.attributes['data-attackerid'].value );
|
||||||
|
let rollData = attackerActor.currentRollData;
|
||||||
|
rollData.particuliereAttaque = game.actors.get(event.currentTarget.attributes['data-mode'].value );
|
||||||
|
console.log("Particulère !", rollData);
|
||||||
|
attackerActor.continueRoll( rollData );
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "foundryvtt-reve-de-dragon",
|
"name": "foundryvtt-reve-de-dragon",
|
||||||
"title": "Rêve de Dragon",
|
"title": "Rêve de Dragon",
|
||||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||||
"version": "0.9.40",
|
"version": "0.9.41",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.6",
|
"compatibleCoreVersion": "0.7.6",
|
||||||
"templateVersion": 44,
|
"templateVersion": 44,
|
||||||
|
Loading…
Reference in New Issue
Block a user