#111 Gestion armes magiques
This commit is contained in:
parent
f15067fff8
commit
543f6c2658
@ -32,7 +32,7 @@ export class RdDBonus {
|
|||||||
let dmg = { total: 0 };
|
let dmg = { total: 0 };
|
||||||
if (rollData.arme && rollData.arme.name.toLowerCase() == "esquive") {
|
if (rollData.arme && rollData.arme.name.toLowerCase() == "esquive") {
|
||||||
// Specific case management
|
// Specific case management
|
||||||
ui.notifications.warn("Calcul de bonus dégats sur eswquive");
|
ui.notifications.warn("Calcul de bonus dégats sur esquive !");
|
||||||
} else {
|
} else {
|
||||||
dmg.dmgArme = RdDBonus._dmgArme(rollData);
|
dmg.dmgArme = RdDBonus._dmgArme(rollData);
|
||||||
dmg.penetration = RdDBonus._peneration(rollData);
|
dmg.penetration = RdDBonus._peneration(rollData);
|
||||||
@ -74,9 +74,15 @@ export class RdDBonus {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static _dmgArme(rollData) {
|
static _dmgArme(rollData) {
|
||||||
return rollData.arme == undefined ? 0 : (rollData.arme.data.dommagesReels ?? Number(rollData.arme.data.dommages ?? 0));
|
let dmg1 = 0;
|
||||||
|
if ( rollData.arme) {
|
||||||
|
dmg1 = rollData.arme.data.dommagesReels ?? Number(rollData.arme.data.dommages ?? 0);
|
||||||
|
dmg1 += (rollData.arme.data.magique) ? rollData.arme.data.ecaille_efficacite : 0;
|
||||||
|
}
|
||||||
|
return dmg1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static _peneration(rollData) {
|
static _peneration(rollData) {
|
||||||
return parseInt(rollData.arme?.data.penetration ?? 0);
|
return parseInt(rollData.arme?.data.penetration ?? 0);
|
||||||
}
|
}
|
||||||
|
@ -756,8 +756,29 @@ export class RdDCombat {
|
|||||||
defenderRoll.show = defenderRoll.show || {}
|
defenderRoll.show = defenderRoll.show || {}
|
||||||
|
|
||||||
const dmg = attackerRoll.dmg.dmgArme + attackerRoll.dmg.dmgActor;
|
const dmg = attackerRoll.dmg.dmgArme + attackerRoll.dmg.dmgActor;
|
||||||
let resistance = Misc.toInt(defenderRoll.arme.data.resistance);
|
let arme = defenderRoll.arme;
|
||||||
let msg = "";
|
let msg = "";
|
||||||
|
if ( arme.data.magique ) {
|
||||||
|
defenderRoll.show.deteriorationArme = 'resiste'; // Par défaut
|
||||||
|
if (arme.data.resistance_magique == undefined) arme.data.resistance_magique = 0; // Quick fix
|
||||||
|
if ( dmg > arme.data.resistance_magique) { // Jet uniquement si dommages supérieur à résistance magique (cf. 274)
|
||||||
|
let resistance = Misc.toInt(arme.data.resistance);
|
||||||
|
// Jet de résistance de l'arme de parade (p.132)
|
||||||
|
let resistRoll = await RdDResolutionTable.rollData({
|
||||||
|
caracValue: resistance,
|
||||||
|
finalLevel: - dmg,
|
||||||
|
showDice: false
|
||||||
|
});
|
||||||
|
if ( !resistRoll.rolled.isSuccess) {
|
||||||
|
let perteResistance = ( dmg - arme.data.resistance_magique)
|
||||||
|
resistance -= perteResistance;
|
||||||
|
defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise': 'perte';
|
||||||
|
defenderRoll.show.perteResistance = perteResistance;
|
||||||
|
this.defender.updateEmbeddedEntity("OwnedItem", { _id: defenderRoll.arme._id, 'data.resistance': resistance });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let resistance = Misc.toInt(arme.data.resistance);
|
||||||
// Jet de résistance de l'arme de parade (p.132)
|
// Jet de résistance de l'arme de parade (p.132)
|
||||||
let resistRoll = await RdDResolutionTable.rollData({
|
let resistRoll = await RdDResolutionTable.rollData({
|
||||||
caracValue: resistance,
|
caracValue: resistance,
|
||||||
@ -772,6 +793,7 @@ export class RdDCombat {
|
|||||||
defenderRoll.show.perteResistance = dmg;
|
defenderRoll.show.perteResistance = dmg;
|
||||||
this.defender.updateEmbeddedEntity("OwnedItem", { _id: defenderRoll.arme._id, 'data.resistance': resistance });
|
this.defender.updateEmbeddedEntity("OwnedItem", { _id: defenderRoll.arme._id, 'data.resistance': resistance });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Si l'arme de parade n'est pas un bouclier, jet de désarmement (p.132)
|
// Si l'arme de parade n'est pas un bouclier, jet de désarmement (p.132)
|
||||||
if (ReglesOptionelles.isUsing('defenseurDesarme') && resistance > 0 && RdDItemArme.getCategorieParade(defenderRoll.arme) != 'boucliers') {
|
if (ReglesOptionelles.isUsing('defenseurDesarme') && resistance > 0 && RdDItemArme.getCategorieParade(defenderRoll.arme) != 'boucliers') {
|
||||||
let desarme = await RdDResolutionTable.rollData({
|
let desarme = await RdDResolutionTable.rollData({
|
||||||
|
@ -191,6 +191,7 @@ export class RdDRoll extends Dialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
async updateRollResult() {
|
async updateRollResult() {
|
||||||
let rollData = this.rollData;
|
let rollData = this.rollData;
|
||||||
|
|
||||||
@ -235,6 +236,7 @@ export class RdDRoll extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
async buildAjustements(rollData){
|
async buildAjustements(rollData){
|
||||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ajustements.html`, rollData);
|
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ajustements.html`, rollData);
|
||||||
return html;
|
return html;
|
||||||
@ -244,7 +246,6 @@ export class RdDRoll extends Dialog {
|
|||||||
_computeFinalLevel(rollData) {
|
_computeFinalLevel(rollData) {
|
||||||
return RollDataAjustements.sum(rollData.ajustements);
|
return RollDataAjustements.sum(rollData.ajustements);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_computeDiffCompetence(rollData) {
|
_computeDiffCompetence(rollData) {
|
||||||
if (rollData.competence) {
|
if (rollData.competence) {
|
||||||
@ -265,6 +266,7 @@ export class RdDRoll extends Dialog {
|
|||||||
return diffLibre;
|
return diffLibre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
_computeMalusArmure(rollData) {
|
_computeMalusArmure(rollData) {
|
||||||
let malusArmureValue = 0;
|
let malusArmureValue = 0;
|
||||||
if (rollData.malusArmureValue && (rollData.selectedCarac.label == "Agilité" || rollData.selectedCarac.label == "Dérobée")) {
|
if (rollData.malusArmureValue && (rollData.selectedCarac.label == "Agilité" || rollData.selectedCarac.label == "Dérobée")) {
|
||||||
|
@ -93,6 +93,12 @@ export const referenceAjustements = {
|
|||||||
getLabel: (rollData, actor) => Misc.getFractionHtml(rollData.diviseurSignificative),
|
getLabel: (rollData, actor) => Misc.getFractionHtml(rollData.diviseurSignificative),
|
||||||
getDescr: (rollData, actor) => rollData.diviseurSignificative > 1 ? `Facteur significative <span class="rdd-diviseur">×${Misc.getFractionHtml(rollData.diviseurSignificative)}</span>` : ''
|
getDescr: (rollData, actor) => rollData.diviseurSignificative > 1 ? `Facteur significative <span class="rdd-diviseur">×${Misc.getFractionHtml(rollData.diviseurSignificative)}</span>` : ''
|
||||||
},
|
},
|
||||||
|
isEcaille: {
|
||||||
|
isVisible: (rollData, actor) => rollData.arme && rollData.arme.data.magique && Number(rollData.arme.data.ecaille_efficacite) > 0,
|
||||||
|
isUsed: (rollData, actor) => rollData.arme && rollData.arme.data.magique && Number(rollData.arme.data.ecaille_efficacite) > 0,
|
||||||
|
getLabel: (rollData, actor) => "Ecaille d'Efficacité: ",
|
||||||
|
getValue: (rollData, actor) => (rollData.arme && rollData.arme.data.magique && Number(rollData.arme.data.ecaille_efficacite) > 0) ? rollData.arme.data.ecaille_efficacite : 0,
|
||||||
|
},
|
||||||
finesse: {
|
finesse: {
|
||||||
isUsed: (rollData, actor) => RdDBonus.isDefenseAttaqueFinesse(rollData),
|
isUsed: (rollData, actor) => RdDBonus.isDefenseAttaqueFinesse(rollData),
|
||||||
getDescr: (rollData, actor) => 'Attaque particulière en finesse',
|
getDescr: (rollData, actor) => 'Attaque particulière en finesse',
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
"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": "1.3.5",
|
"version": "1.3.6",
|
||||||
"manifestPlusVersion": "1.0.0",
|
"manifestPlusVersion": "1.0.0",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.9",
|
"compatibleCoreVersion": "0.7.9",
|
||||||
"templateVersion": 85,
|
"templateVersion": 86,
|
||||||
"author": "LeRatierBretonnien",
|
"author": "LeRatierBretonnien",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@ -595,6 +595,9 @@
|
|||||||
"competence": "",
|
"competence": "",
|
||||||
"cout": 0,
|
"cout": 0,
|
||||||
"portee_courte": 0,
|
"portee_courte": 0,
|
||||||
|
"magique": false,
|
||||||
|
"ecaille_efficacite": 0,
|
||||||
|
"resistance_magique": 0,
|
||||||
"portee_moyenne": 0,
|
"portee_moyenne": 0,
|
||||||
"portee_extreme": 0,
|
"portee_extreme": 0,
|
||||||
"rapide": false,
|
"rapide": false,
|
||||||
|
@ -21,4 +21,5 @@
|
|||||||
Significative requise <span class="rdd-diviseur">×{{{ajustements.facteurSign.label}}}</span>!
|
Significative requise <span class="rdd-diviseur">×{{{ajustements.facteurSign.label}}}</span>!
|
||||||
</span>
|
</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
</div>
|
</div>
|
@ -72,6 +72,18 @@
|
|||||||
<label for="xp">Prix (sols) </label>
|
<label for="xp">Prix (sols) </label>
|
||||||
<input class="attribute-value" type="text" name="data.cout" value="{{data.cout}}" data-dtype="Number"/>
|
<input class="attribute-value" type="text" name="data.cout" value="{{data.cout}}" data-dtype="Number"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="xp">Magique ? </label>
|
||||||
|
<input class="attribute-value" type="checkbox" name="data.magique" {{#if data.magique}}checked{{/if}}/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="penetration">Résistance magique </label>
|
||||||
|
<input class="attribute-value" type="text" name="data.resistance_magique" value="{{data.resistance_magique}}" data-dtype="Number"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="penetration">Nombre d'Ecailles d'Efficacité </label>
|
||||||
|
<input class="attribute-value" type="text" name="data.ecaille_efficacite" value="{{data.ecaille_efficacite}}" data-dtype="Number"/>
|
||||||
|
</div>
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
<span><label>Description : </label></span>
|
<span><label>Description : </label></span>
|
||||||
<div class="form-group editor">
|
<div class="form-group editor">
|
||||||
|
Loading…
Reference in New Issue
Block a user