Ajout QoL
This commit is contained in:
@@ -108,6 +108,12 @@ export class VadentisActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
buildListeActionsCombat( ) {
|
||||
let armes = [];
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
calculerSommeStats( ) {
|
||||
for (const key in this.data.data.combat) {
|
||||
@@ -144,7 +150,9 @@ export class VadentisActor extends Actor {
|
||||
let maintain = (devotionSort.data.ismaintain)?"Oui":"Non";
|
||||
let complex = (devotionSort.data.complexactions)?"Oui":"Non";
|
||||
msgData.msg += `<br>Peut être maintenu: ${maintain}<br>Actions complexes : ${complex}`;
|
||||
if ( !devotionSort.data.notes) devotionSort.data.notes = "";
|
||||
msgData.msg += `<br><strong>Description : </strong>${devotionSort.data.notes.replace(/<\/?[^>]+(>|$)/g, "")}`;
|
||||
|
||||
let newEnergie = this.data.data.stats.pointsenergie.value - devotionSort.data.pe;
|
||||
await this.update( {'data.stats.pointsenergie.value': newEnergie });
|
||||
if (myRoll.results[0] >= devotionSort.data.valuecritical ) { // Critique ?
|
||||
@@ -158,10 +166,10 @@ export class VadentisActor extends Actor {
|
||||
if ( devotionSort.data.damage != "") {
|
||||
let formula = devotionSort.data.damage;
|
||||
if (myRoll.results[0] >= devotionSort.data.valuecritical ) { // Critique ?
|
||||
msgData.msg += `<br>Et provoque les dégats critiques suivants : `;
|
||||
msgData.msg += `<br>Et provoque les dégats critiques suivants : [[/roll ${devotionSort.data.damagecritical}]]`;
|
||||
formula = devotionSort.data.damagecritical;
|
||||
} else {
|
||||
msgData.msg += `<br>Et provoque les dégats suivants : `;
|
||||
msgData.msg += `<br>Et provoque les dégats suivants : [[/roll ${devotionSort.data.damage}]]`;
|
||||
}
|
||||
}
|
||||
if ( newEnergie < 0) {
|
||||
@@ -199,6 +207,23 @@ export class VadentisActor extends Actor {
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollSortDevotionDamage( sort, damageType ) {
|
||||
let formula = VadentisUtility.processDamageString( sort.data.data[damageType], this );
|
||||
let degatsRoll = await VadentisUtility.processRoll( formula );
|
||||
let msgData = {
|
||||
alias: this.name,
|
||||
img: "systems/foundryvtt-vadentis/images/icons/tchat_dégâts_infligés.webp",
|
||||
title: `Dégâts de ${sort.name}`,
|
||||
msg: `Le sort ${sort.name} produit <strong>${degatsRoll.total} Points de Dégâts</strong> (${formula}).`
|
||||
}
|
||||
ChatMessage.create({
|
||||
//whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
|
||||
content: await renderTemplate(`systems/foundryvtt-vadentis/templates/chat-generic-result.html`, msgData)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async applyDamage( damageValue ) {
|
||||
let pvData = this.data.data.stats.pointsvie;
|
||||
@@ -278,6 +303,13 @@ export class VadentisActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollSortOuDevotion( sortId ) {
|
||||
let sort = this.data.items.find( item => item._id == sortId );
|
||||
this.processSortDevotion( sort.type, sort);
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollTechnique( techniqueId ) {
|
||||
let technique = this.data.items.find( item => item.type == 'technique' && item._id == techniqueId );
|
||||
@@ -382,12 +414,39 @@ export class VadentisActor extends Actor {
|
||||
let stat = this.data.data.magie[magieName];
|
||||
this.genericRoll( stat, magieName );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incrementeArgent( arme ) {
|
||||
let monnaie = this.data.items.find( item => item.type == 'monnaie' && item.name == arme.name);
|
||||
if (monnaie) {
|
||||
let newValeur = monnaie.data.nombre + 1;
|
||||
await this.updateOwnedItem( { _id: monnaie._id, 'data.nombre': newValeur } );
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async decrementeArgent( arme ) {
|
||||
let monnaie = this.data.items.find( item => item.type == 'monnaie' && item.name == arme.name);
|
||||
if (monnaie) {
|
||||
let newValeur = monnaie.data.nombre - 1;
|
||||
newValeur = (newValeur <= 0) ? 0 : newValeur;
|
||||
await this.updateOwnedItem( { _id: monnaie._id, 'data.nombre': newValeur } );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incrementeMunition( arme ) {
|
||||
let armeTir = this.data.items.find( item => item.type == 'tir' && item.name == arme.name);
|
||||
if (armeTir) {
|
||||
let newMunition = armeTir.data.munition + 1;
|
||||
await this.updateOwnedItem( { _id: armeTir._id, 'data.munition': newMunition } );
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async decrementeMunition( arme ) {
|
||||
let armeTir = this.data.items.find( item => item.type == 'tir' && item.name == arme.name);
|
||||
if (armeTir) {
|
||||
let newMunition = armeTir.data.munition - 1;
|
||||
newMunition = (newMunition <= 0) ? 0 : newMunition;
|
||||
await this.updateOwnedItem( { _id: armeTir._id, 'data.munition': newMunition } );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user