|
|
|
@ -16,6 +16,7 @@ import { RdDDice } from "./rdd-dice.js";
|
|
|
|
|
import { RdDRollTables } from "./rdd-rolltables.js";
|
|
|
|
|
import { ChatUtility } from "./chat-utility.js";
|
|
|
|
|
import { RdDItemSort } from "./item-sort.js";
|
|
|
|
|
import { Grammar } from "./grammar.js";
|
|
|
|
|
|
|
|
|
|
export class RdDActor extends Actor {
|
|
|
|
|
|
|
|
|
@ -90,7 +91,6 @@ export class RdDActor extends Actor {
|
|
|
|
|
if (actorData.type === 'personnage') this._prepareCharacterData(actorData);
|
|
|
|
|
if (actorData.type === 'creature') this.computeEtatGeneral(actorData);
|
|
|
|
|
if (actorData.type === 'humanoide') this.computeEtatGeneral(actorData);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
@ -141,14 +141,8 @@ export class RdDActor extends Actor {
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async performRoll(rollData, attacker = undefined) {
|
|
|
|
|
|
|
|
|
|
// Cas des bonus de cases pour les sorts
|
|
|
|
|
let sortBonus = 0;
|
|
|
|
|
if (rollData.selectedSort) {
|
|
|
|
|
sortBonus = RdDItemSort.getCaseBonus( rollData.selectedSort, rollData.coord );
|
|
|
|
|
}
|
|
|
|
|
// garder le résultat
|
|
|
|
|
rollData.rolled = await RdDResolutionTable.roll(rollData.caracValue, rollData.finalLevel, sortBonus);
|
|
|
|
|
rollData.rolled = await RdDResolutionTable.rollData(rollData);
|
|
|
|
|
|
|
|
|
|
//console.log("performRoll", rollData)
|
|
|
|
|
if ( !rollData.attackerRoll) {// Store in the registry if not a defense roll
|
|
|
|
@ -206,7 +200,7 @@ export class RdDActor extends Actor {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
computeRecul( rollData ) { // Calcul du recul (p. 132)
|
|
|
|
|
computeRecul( rollData, encaisser = undefined ) { // 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);
|
|
|
|
@ -271,7 +265,6 @@ 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!
|
|
|
|
@ -303,12 +296,6 @@ export class RdDActor extends Actor {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Sort management
|
|
|
|
|
if (rollData.selectedSort) { // Lancement de sort !
|
|
|
|
|
resumeCompetence = rollData.selectedDraconic.name + "/" + rollData.selectedSort.name;
|
|
|
|
|
explications = await this._rollLancementDeSort(rollData, rolled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Save it for fight in the flags area
|
|
|
|
|
game.system.rdd.rollDataHandler[this.data._id] = duplicate(rollData);
|
|
|
|
|
|
|
|
|
@ -370,68 +357,6 @@ export class RdDActor extends Actor {
|
|
|
|
|
return dmgArme + dmgPerso;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async _rollLancementDeSort(rollData, rolled) {
|
|
|
|
|
|
|
|
|
|
let sort = duplicate(rollData.selectedSort);
|
|
|
|
|
|
|
|
|
|
let closeTMR = true;
|
|
|
|
|
let coutReve = sort.data.ptreve_reel; // toujours positionné par cas de sort à ptreve variables
|
|
|
|
|
|
|
|
|
|
let explications = "<br>Lancement du sort <strong>" + sort.name + "</strong> : " + Misc.upperFirst(sort.data.draconic)
|
|
|
|
|
+ " pour " + coutReve + " points de Rêve"
|
|
|
|
|
+ "<br>Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
|
|
|
|
|
|
|
|
|
|
let myReve = duplicate(this.data.data.reve.reve);
|
|
|
|
|
if (rolled.isSuccess) { // Réussite du sort !
|
|
|
|
|
sort.ptreve_reel = coutReve;
|
|
|
|
|
if (rolled.isPart) {
|
|
|
|
|
coutReve = Math.max(Math.ceil(coutReve / 2), 1);
|
|
|
|
|
}
|
|
|
|
|
// Incrémenter/gére le bonus de case
|
|
|
|
|
RdDItemSort.incrementBonusCase(this, sort, rollData.coord);
|
|
|
|
|
|
|
|
|
|
if (myReve.value > coutReve){
|
|
|
|
|
explications += "<br>Réussite du sort: " + coutReve + " points de Rêve sont dépensés (Bonus de case : +" + rolled.bonus + "%)";
|
|
|
|
|
|
|
|
|
|
if (rollData.isSortReserve) {
|
|
|
|
|
// Mise en réserve
|
|
|
|
|
myReve.value--;
|
|
|
|
|
await this.sortMisEnReserve(rollData, sort);
|
|
|
|
|
closeTMR = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Todo 0 pts de reve !!!!
|
|
|
|
|
explications += "<br>Pas assez de rêve";
|
|
|
|
|
mergeObject(rollData, RdDResolutionTable.getResultat("echec"));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (rolled.isETotal) { // Echec total !
|
|
|
|
|
coutReve *= 2;
|
|
|
|
|
myReve.value = myReve.value - coutReve;
|
|
|
|
|
explications += "<br><strong>Echec TOTAL</strong> du sort : " + coutReve + " Points de Rêve";
|
|
|
|
|
} else {
|
|
|
|
|
coutReve = 0
|
|
|
|
|
explications += "<br>Echec du sort !";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
myReve.value = Math.max(myReve.value - coutReve, 0);
|
|
|
|
|
await this.update({ "data.reve.reve": myReve });
|
|
|
|
|
|
|
|
|
|
if (myReve.value == 0) { // 0 points de reve
|
|
|
|
|
ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
|
|
|
|
|
closeTMR = true;
|
|
|
|
|
}
|
|
|
|
|
if (closeTMR) {
|
|
|
|
|
this.currentTMR.close(); // Close TMR !
|
|
|
|
|
} else {
|
|
|
|
|
this.currentTMR.maximize(); // Re-display TMR
|
|
|
|
|
}
|
|
|
|
|
return explications
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async dormirChateauDormant() {
|
|
|
|
|
let message = {
|
|
|
|
@ -1324,38 +1249,6 @@ export class RdDActor extends Actor {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollUnSort(coord) {
|
|
|
|
|
let draconicList = this.getDraconicList();
|
|
|
|
|
let sortList = duplicate(this.getSortList()); // Duplication car les pts de reve sont modifiés dans le sort
|
|
|
|
|
|
|
|
|
|
let rollData = {
|
|
|
|
|
selectedCarac: this.data.data.carac.reve,
|
|
|
|
|
etat: this.data.data.compteurs.etat.value,
|
|
|
|
|
draconicList: draconicList,
|
|
|
|
|
sortList: sortList,
|
|
|
|
|
selectedDraconic: this.getBestDraconic(),
|
|
|
|
|
selectedSort: sortList[0],
|
|
|
|
|
coord: coord,
|
|
|
|
|
coordLabel: TMRUtility.getTMRDescription( coord).label,
|
|
|
|
|
finalLevel: 0,
|
|
|
|
|
diffConditions: 0,
|
|
|
|
|
diffLibre: sortList[0].data.difficulte, // Per default at startup
|
|
|
|
|
coutreve: Array(20).fill().map((item, index) => 1 + index),
|
|
|
|
|
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
|
|
|
|
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
|
|
|
|
malusArmureValue: 0,
|
|
|
|
|
surencMalusFlag: false, // A ne pas utiliser pour les sorts
|
|
|
|
|
surencMalusValue: 0,
|
|
|
|
|
surencMalusApply: false,
|
|
|
|
|
isNatation: false,
|
|
|
|
|
useEncForNatation: false
|
|
|
|
|
}
|
|
|
|
|
if ( this.currentTMR) this.currentTMR.minimize(); // Hide
|
|
|
|
|
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html', rollData);
|
|
|
|
|
new RdDRollDialog("sort", html, rollData, this ).render(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
_createCallbackExperience() {
|
|
|
|
|
return {
|
|
|
|
@ -1374,16 +1267,137 @@ export class RdDActor extends Actor {
|
|
|
|
|
ChatMessage.create(message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollUnSort(coord) {
|
|
|
|
|
let sortList = duplicate(this.getSortList()); // Duplication car les pts de reve sont modifiés dans le sort
|
|
|
|
|
if (!sortList || sortList.length == 0)
|
|
|
|
|
{
|
|
|
|
|
ui.notifications.info("Aucun sort disponible!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let rollData = {
|
|
|
|
|
selectedCarac: this.data.data.carac.reve,
|
|
|
|
|
draconicList: this.getDraconicList(),
|
|
|
|
|
sortList: sortList,
|
|
|
|
|
selectedDraconic: this.getBestDraconic(),
|
|
|
|
|
selectedSort: sortList[0],
|
|
|
|
|
coord: coord,
|
|
|
|
|
coordLabel: TMRUtility.getTMRDescription( coord).label,
|
|
|
|
|
diffLibre: sortList[0].data.difficulte, // Per default at startup
|
|
|
|
|
coutreve: Array(20).fill().map((item, index) => 1 + index)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( this.currentTMR) this.currentTMR.minimize(); // Hide
|
|
|
|
|
const dialog = await RdDRoll.create(this, rollData,
|
|
|
|
|
{html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html'},
|
|
|
|
|
{
|
|
|
|
|
name: 'lancer-un-sort',
|
|
|
|
|
label: 'Lancer un sort',
|
|
|
|
|
callbacks: [
|
|
|
|
|
this._createCallbackExperience(),
|
|
|
|
|
{ action: r => this._rollUnSortResult(r, false) }
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'mettre-en-reserve',
|
|
|
|
|
label: 'Mettre un sort en réserve',
|
|
|
|
|
callbacks: [
|
|
|
|
|
this._createCallbackExperience(),
|
|
|
|
|
{ action: r => this._rollUnSortResult(r, true) }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
dialog.render(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async _rollUnSortResult(rollData, isSortReserve = false) {
|
|
|
|
|
rollData.isSortReserve = isSortReserve;
|
|
|
|
|
let rolled = rollData.rolled;
|
|
|
|
|
let sort = rollData.selectedSort;
|
|
|
|
|
let closeTMR = !rollData.isSortReserve;
|
|
|
|
|
|
|
|
|
|
let explications = rollData.isSortReserve
|
|
|
|
|
? ("<br>Mise en réserve du sort en " + rollData.coordLabel + "(" + rollData.coord + ")<strong>")
|
|
|
|
|
: "<br>Lancement du sort <strong>";
|
|
|
|
|
explications += sort.name + "</strong> : " + Misc.upperFirst(sort.data.draconic)
|
|
|
|
|
+ " pour " + sort.data.ptreve_reel + " points de Rêve"
|
|
|
|
|
+ "<br>Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
|
|
|
|
|
|
|
|
|
|
let depenseReve = sort.data.ptreve_reel;
|
|
|
|
|
let myReve = duplicate(this.data.data.reve.reve);
|
|
|
|
|
if (rolled.isSuccess) { // Réussite du sort !
|
|
|
|
|
//sort.ptreve_reel = coutReve;
|
|
|
|
|
if (rolled.isPart) {
|
|
|
|
|
depenseReve = Math.max(Math.floor(depenseReve / 2), 1);
|
|
|
|
|
}
|
|
|
|
|
if (rollData.isSortReserve) {
|
|
|
|
|
depenseReve++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (myReve.value > depenseReve) {
|
|
|
|
|
explications += "<br>Réussite du sort: " + depenseReve + " points de Rêve sont dépensés (Bonus de case en " + rollData.coord + ": +" + rolled.bonus + "%)";
|
|
|
|
|
|
|
|
|
|
// Incrémenter/gére le bonus de case
|
|
|
|
|
RdDItemSort.incrementBonusCase(this, sort, rollData.coord);
|
|
|
|
|
|
|
|
|
|
if (rollData.isSortReserve) {
|
|
|
|
|
await this.sortMisEnReserve(rollData, sort);
|
|
|
|
|
closeTMR = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Todo 0 pts de reve !!!!
|
|
|
|
|
depenseReve = 0;
|
|
|
|
|
explications += "<br>Pas assez de rêve";
|
|
|
|
|
mergeObject(rollData, RdDResolutionTable.getResultat("echec"));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (rolled.isETotal) { // Echec total !
|
|
|
|
|
depenseReve = Math.max(myReve.value, Math.floor(depenseReve * 1.5))
|
|
|
|
|
explications += "<br><strong>Echec TOTAL</strong> du sort : " + depenseReve + " Points de Rêve";
|
|
|
|
|
// TODO: mise en réserve d'un échec total...
|
|
|
|
|
} else {
|
|
|
|
|
depenseReve = 0
|
|
|
|
|
explications += "<br>Echec du sort !";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
myReve.value = Math.max(myReve.value - depenseReve, 0);
|
|
|
|
|
await this.update({ "data.reve.reve": myReve });
|
|
|
|
|
|
|
|
|
|
if (myReve.value == 0) { // 0 points de reve
|
|
|
|
|
ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
|
|
|
|
|
closeTMR = true;
|
|
|
|
|
}
|
|
|
|
|
if (closeTMR) {
|
|
|
|
|
this.currentTMR.close(); // Close TMR !
|
|
|
|
|
} else {
|
|
|
|
|
this.currentTMR.maximize(); // Re-display TMR
|
|
|
|
|
}
|
|
|
|
|
// Final chat message
|
|
|
|
|
let chatOptions = {
|
|
|
|
|
content: "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.selectedDraconic.name + " / " + rollData.selectedSort.name + "</strong>"
|
|
|
|
|
+ "<br>Difficultés <strong>libre : " + rollData.diffLibre + "</strong> / conditions : " + Misc.toSignedString(rollData.diffConditions) +" / état : " + rollData.etat
|
|
|
|
|
+ RdDResolutionTable.explain(rolled)
|
|
|
|
|
+ explications
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ChatUtility.chatWithRollMode(chatOptions, this.name)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollCarac( caracName )
|
|
|
|
|
{
|
|
|
|
|
let rollData = { selectedCarac: this.getCaracByName(caracName) };
|
|
|
|
|
async rollCarac( caracName ) {
|
|
|
|
|
let rollData = {
|
|
|
|
|
selectedCarac: this.getCaracByName(caracName),
|
|
|
|
|
needSignificative : !this.isEntiteCauchemar() && this.data.data.sante.sonne.value
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const dialog = await RdDRoll.create(this, rollData,
|
|
|
|
|
{html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html'},
|
|
|
|
|
{
|
|
|
|
|
name: 'jet-'+caracName,
|
|
|
|
|
label: 'Lancer : '+rollData.selectedCarac.label,
|
|
|
|
|
label: 'Jet ' + Grammar.apostrophe('de', rollData.selectedCarac.label),
|
|
|
|
|
callbacks: [
|
|
|
|
|
this._createCallbackExperience(),
|
|
|
|
|
{ action: this._rollCaracResult }
|
|
|
|
@ -1410,6 +1424,45 @@ export class RdDActor extends Actor {
|
|
|
|
|
ChatUtility.chatWithRollMode(chatOptions, this.name)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollCompetence( name ) {
|
|
|
|
|
let rollData = {
|
|
|
|
|
competence: duplicate(RdDUtility.findCompetence( this.data.items, name)),
|
|
|
|
|
needSignificative : !this.isEntiteCauchemar() && this.data.data.sante.sonne.value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rollData.competence.type == 'competencecreature') {
|
|
|
|
|
// Fake competence pour créature
|
|
|
|
|
mergeObject(rollData.competence, { data : { defaut_carac: "carac_creature", categorie: "creature" } });
|
|
|
|
|
rollData.carac = { carac_creature: { label: competence.name, value: competence.data.carac_value } };
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
rollData.carac = this.data.data.carac;
|
|
|
|
|
}
|
|
|
|
|
console.log("rollCompetence !!!", rollData.competence);
|
|
|
|
|
|
|
|
|
|
const dialog = await RdDRoll.create(this, rollData,
|
|
|
|
|
{html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html'},
|
|
|
|
|
{
|
|
|
|
|
name: 'jet-competence',
|
|
|
|
|
label: 'Jet ' +Grammar.apostrophe('de', name),
|
|
|
|
|
callbacks: [
|
|
|
|
|
this._createCallbackExperience(),
|
|
|
|
|
{ action: this._competenceResult }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
dialog.render(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_competenceResult(rollData) {
|
|
|
|
|
ChatUtility.chatWithRollMode({
|
|
|
|
|
content: "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong>"
|
|
|
|
|
+ "<br>Difficultés <strong>libre : " + rollData.diffLibre + "</strong> / conditions : " + Misc.toSignedString(rollData.diffConditions) +" / état : " + rollData.etat
|
|
|
|
|
+ RdDResolutionTable.explain(rollData.rolled)
|
|
|
|
|
+ "<br>Points de taches : " + rollData.rolled.ptTache + ", ajustement qualité: " + rollData.rolled.ptQualite
|
|
|
|
|
}, this.name)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollAppelChance( )
|
|
|
|
@ -1525,29 +1578,52 @@ export class RdDActor extends Actor {
|
|
|
|
|
this.currentTMR = new RdDTMRDialog(html, this, data, mode);
|
|
|
|
|
this.currentTMR.render(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
rollArme( armeName, competenceName=undefined ) {
|
|
|
|
|
let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName));
|
|
|
|
|
if (armeItem ) {
|
|
|
|
|
if ( competenceName == undefined) competenceName = armeItem.data.competence;
|
|
|
|
|
this.rollCompetence( competenceName, armeItem );
|
|
|
|
|
} else {
|
|
|
|
|
this.rollCompetence( armeName ); //Bypass mode!
|
|
|
|
|
async rollCompetenceCreature( compName ) {
|
|
|
|
|
let competence = RdDUtility.findCompetence( this.data.items, compName);
|
|
|
|
|
|
|
|
|
|
if ( competence.type == 'competencecreature' && competence.data.iscombat ) {
|
|
|
|
|
armeItem = { name: compName, data: { dommages: competence.data.dommages, dommagesReels: competence.data.dommages} };
|
|
|
|
|
this.rollCompetenceCombat(competence, armeItem);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.rollCompetence(name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollCompetence( name, armeItem=undefined, attackerRoll=undefined, attacker = undefined) {
|
|
|
|
|
rollArme(competenceName, armeName) {
|
|
|
|
|
let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName));
|
|
|
|
|
if (armeItem && competenceName == undefined) competenceName = armeItem.data.competence;
|
|
|
|
|
let competence = RdDUtility.findCompetence(this.data.items, competenceName == undefined? armeName : competenceName);
|
|
|
|
|
|
|
|
|
|
if (armeItem==undefined && competence.type == 'competencecreature' && competence.data.iscombat ) {
|
|
|
|
|
armeItem = { name: name, data: { dommages: competence.data.dommages, dommagesReels: competence.data.dommages} };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (armeItem || armeName) {
|
|
|
|
|
this.rollCompetenceCombat( competenceName, armeItem );
|
|
|
|
|
} else {
|
|
|
|
|
this.rollCompetence( competence.name );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollCompetenceCombat( name, armeItem=undefined, attackerRoll=undefined, attacker = undefined) {
|
|
|
|
|
let competence = RdDUtility.findCompetence( this.data.items, name);
|
|
|
|
|
console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
|
|
|
|
|
if ( competence.type == 'competencecreature' && competence.data.iscombat ) {
|
|
|
|
|
armeItem = { name: name, data: { dommages: competence.data.dommages, dommagesReels: competence.data.dommages} };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("rollCompetenceCombat !!!", competence, armeItem, attackerRoll);
|
|
|
|
|
// Common rollData values
|
|
|
|
|
let rollData = {
|
|
|
|
|
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
|
|
|
|
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
|
|
|
|
etat: this.data.data.compteurs.etat.value,
|
|
|
|
|
diffConditions: 0,
|
|
|
|
|
forceValue : (this.data.data.carac.force) ? this.data.data.carac.force.value : 0, // Utilisé pour le jet de recul
|
|
|
|
|
forceValue : attackerRoll ? (this.data.data.carac.force ? this.data.data.carac.force.value : this.data.data.carac.reve.value) : 0, // Utilisé pour le jet de recul
|
|
|
|
|
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
|
|
|
|
|
attackerRoll: attackerRoll,
|
|
|
|
|
finalLevel: 0,
|
|
|
|
@ -1561,7 +1637,7 @@ export class RdDActor extends Actor {
|
|
|
|
|
encValueForNatation: 0
|
|
|
|
|
}
|
|
|
|
|
if ( this.type == 'personnage ') {
|
|
|
|
|
rollData.malusArmureValue = (this.data.data.attributs) ? this.data.data.attributs.malusarmure.value : 0;
|
|
|
|
|
rollData.malusArmureValue = (this.data.data.attributs && this.data.data.attributs.malusarmure) ? this.data.data.attributs.malusarmure.value : 0,
|
|
|
|
|
rollData.surencMalusFlag = (this.data.data.compteurs.surenc.value < 0);
|
|
|
|
|
rollData.surencMalusValue = this.data.data.compteurs.surenc.value;
|
|
|
|
|
rollData.surencMalusApply = false;
|
|
|
|
@ -1571,9 +1647,6 @@ export class RdDActor extends Actor {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( competence.type == 'competencecreature') { // Specific case for Creatures
|
|
|
|
|
if ( competence.data.iscombat ) {
|
|
|
|
|
armeItem = { name: name, data: { dommages: competence.data.dommages, dommagesReels: competence.data.dommages} };
|
|
|
|
|
}
|
|
|
|
|
competence.data.defaut_carac = "carac_creature"; // Fake default competence
|
|
|
|
|
competence.data.categorie = "creature"; // Fake default competence
|
|
|
|
|
rollData.competence = competence;
|
|
|
|
@ -1705,17 +1778,21 @@ export class RdDActor extends Actor {
|
|
|
|
|
{
|
|
|
|
|
let armeItem = this.getOwnedItem(armeId); // Item.data.data !
|
|
|
|
|
console.log("Going to PARY !!!!!!!!!", armeItem, attackerRoll.diffLibre);
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
if (armeItem.type == 'competencecreature') {
|
|
|
|
|
this.rollCompetence( armeItem.name, armeItem.data, attackerRoll, attacker);
|
|
|
|
|
} else {
|
|
|
|
|
this.rollCompetence( armeItem.data.data.competence, armeItem.data, attackerRoll, attacker);
|
|
|
|
|
}
|
|
|
|
|
=======
|
|
|
|
|
this.rollCompetenceCombat( armeItem.data.data.competence, armeItem.data, attackerRoll, attacker);
|
|
|
|
|
>>>>>>> e2644f1 (Séparation compétences/combat)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
esquiverAttaque( attackerRoll, attacker = undefined )
|
|
|
|
|
{
|
|
|
|
|
this.rollCompetence( "esquive", undefined, attackerRoll, attacker );
|
|
|
|
|
this.rollCompetenceCombat( "esquive", undefined, attackerRoll, attacker );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|