Implémentation modif remarques v7

This commit is contained in:
sladecraven 2021-04-22 16:03:51 +02:00
parent 4c1640bb31
commit 2bfc6ed124
12 changed files with 58 additions and 14 deletions

View File

@ -205,8 +205,12 @@ export class VadentisActor extends Actor {
alias: this.name,
img: "systems/foundryvtt-vadentis/images/icons/tchat_dégâts_infligés.webp",
title: `${this.name} encaisse des dégâts !`,
msg: `${this.name} vient de perdre ${damageValue} Points de Vie. Ses Points de Vie actuels sont désormais de ${newValue}.`
msg: `${this.name} encaisse ${damageValue} dégâts !`
}
if ( game.user.isGM) {
msgData.msg += `<br>Ses Points de Vie actuels sont désormais de ${newValue}.`;
}
ChatMessage.create({
//whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-vadentis/templates/chat-generic-result.html`, msgData)
@ -298,12 +302,13 @@ export class VadentisActor extends Actor {
let msgData = {
alias: this.name,
img: competence.img,
rollMode: game.settings.get("core", "rollMode"),
title: `Compétence ${competence.name}`
}
let statValue = competence.data.base + competence.data.malus + competence.data.bonus;
let formulaFull = this.buildTexteFormula( competence.data );
let myRoll = await VadentisUtility.processRoll("1d20+"+statValue );
let myRoll = await VadentisUtility.processRoll("1d20+"+statValue, msgData.rollMode );
msgData.msg = `${formulaFull} => <strong>${myRoll.total}</strong>`;
if (myRoll.results[0] == 1 ) { // Critique ?
@ -315,8 +320,12 @@ export class VadentisActor extends Actor {
msgData.msg += `<br>C'est une <strong>réussite critique</strong> !`;
}
if (["gmroll", "blindroll"].includes(msgData.rollMode)) msgData["whisper"] = ChatMessage.getWhisperRecipients("GM").map(u => u.id);
if (msgData.rollMode === "blindroll") msgData["blind"] = true;
else if (msgData.rollMode === "selfroll") msgData["whisper"] = [game.user];
ChatMessage.create({
//whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
whisper: msgData["whisper"],
content: await renderTemplate(`systems/foundryvtt-vadentis/templates/chat-generic-result.html`, msgData)
});
} else {
@ -365,6 +374,15 @@ export class VadentisActor extends Actor {
this.genericRoll( stat, magieName );
}
/* -------------------------------------------- */
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;
await this.updateOwnedItem( { _id: armeTir._id, 'data.munition': newMunition } );
}
}
/* -------------------------------------------- */
rollArme(armeId) {
let target = VadentisUtility.getTarget();
@ -372,6 +390,10 @@ export class VadentisActor extends Actor {
if ( target ) {
let arme = this.data.items.find( item => (item.type == 'armecc' || item.type == 'tir') && item._id == armeId);
if (arme) {
if ( arme == 'tir' && arme.data.munition <= 0 ) {
ui.notifications.warn("Vous n'avez plus de munitions avec cette arme.");
return;
}
let combatData = {
attackerActorId: this._id,
targetActorId: target.actor._id,

View File

@ -72,7 +72,7 @@ export class VadentisUtility extends Entity {
}
/* -------------------------------------------- */
static async processRoll( formula ) {
static async processRoll( formula, rollMode ) {
let myRoll = new Roll(formula);
myRoll.evaluate();
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
@ -102,6 +102,11 @@ export class VadentisUtility extends Entity {
let degats = `normaux : ${combatData.arme.data.damage}`;
let formula = combatData.arme.data.damage.toLowerCase();
msgData.msg = `${attacker.name} a réussi son attaque sur ${defender.name} (${formulaFull} => ${myRoll.total} / ${defense}) !<br> Les dégâts sont ${degats}.`;
if ( combatData.arme.type == 'tir') {
attacker.decrementeMunition(combatData.arme);
msgData.msg += `<br>C'est un tir, les munitions de l'attaquant ont été décrémentées`;
}
if ( myRoll.results[0] >= combatData.arme.data.valuecritical ) {
degats = `critiques : ${combatData.arme.data.criticaldamage}`;

View File

@ -2,11 +2,11 @@
"name": "foundryvtt-vadentis",
"title": "Vadentis",
"description": "Système Vadentis pour FoundryVTT",
"version": "0.1.1",
"version": "0.1.2",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.9",
"templateVersion": 15,
"templateVersion": 16,
"author": "Uberwald",
"esmodules": [ "modules/vadentis-main.js" ],
"styles": ["styles/simple.css"],

View File

@ -109,6 +109,7 @@
"damagecritical": ""
},
"equipcommun": {
"quantite": 1,
"equipee": false,
"description": "",
"enc": 0,
@ -146,6 +147,7 @@
"base": 0,
"bonus": 0,
"malus": 0,
"competencerole": false,
"description": ""
},
"armecc": {
@ -159,7 +161,7 @@
"type": "",
"damage": "",
"criticaldamage": "",
"munition": "",
"munition": 0,
"distance": "",
"valuecritical": 20,
"templates": [ "equipcommun" ]

View File

@ -194,6 +194,7 @@
<li class="item flexrow list-item" data-item-id="{{competence._id}}">
<img class="sheet-competence-img" src="{{competence.img}}"/>
<span class="competence-label"><a>{{competence.name}}</a></span>
<span>{{#if competence.data.competencerole}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</span>
<select class="competence-base flexrow" type="text" skillname="{{competence.name}}" value="{{competence.data.base}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{selectOptions @root.optionsBase selected=competence.data.base localize=false}}
</select>

View File

@ -23,6 +23,7 @@
<li class="flexrow"><label class="generic-label">Dégâts</label><input type="text" name="data.damage" value="{{data.damage}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Dégâts critique</label><input type="text" name="data.criticaldamage" value="{{data.criticaldamage}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Encombrement</label><input type="text" name="data.enc" value="{{data.enc}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Quantité</label><input type="text" name="data.quantite" value="{{data.quantite}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Coût</label><input type="text" name="data.cost" value="{{data.cost}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Valeur de critique</label>
<input type="text" name="data.valuecritical" value="{{data.valuecritical}}" data-dtype="Number"/></li>

View File

@ -24,6 +24,7 @@
<li class="flexrow"><label class="generic-label">Bonus</label><input type="text" name="data.bonus" value="{{data.bonus}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Malus</label><input type="text" name="data.malus" value="{{data.malus}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Encombrement</label><input type="text" name="data.enc" value="{{data.enc}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Quantité</label><input type="text" name="data.quantite" value="{{data.quantite}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Coût</label><input type="text" name="data.cost" value="{{data.cost}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>

View File

@ -15,6 +15,9 @@
<li class="flexrow"><label class="generic-label">Malus</label><input type="text" name="data.malus" value="{{data.malus}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Bonus</label><input type="text" name="data.bonus" value="{{data.bonus}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">XP</label><input type="text" name="data.xp" value="{{data.xp}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Compétence de rôle</label>
<label class="attribute-value checkbox"><input type="checkbox" name="data.competencerole" {{checked data.competencerole}}/></label>
</li>
</ul>
<label class="generic-label">Description</label>
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}

View File

@ -26,7 +26,8 @@
<li class="flexrow"><label class="generic-label">XP</label><input type="text" name="data.xp" value="{{data.xp}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Dégâts</label><input type="text" name="data.damage" value="{{data.damage}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Dégâts Critiques</label><input type="text" name="data.damagecritical" value="{{data.damagecritical}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Peut être maintenu ?</label><label class="attribute-value checkbox"><input type="checkbox" name="data.ismaintain" {{checked data.ismaintain}}/></label></li>
<li class="flexrow"><label class="generic-label">Peut être maintenu ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="data.ismaintain" {{checked data.ismaintain}}/></label></li>
<li class="flexrow"><label class="generic-label">Actions complexes possibles ?</label><label class="attribute-value checkbox">
<input type="checkbox" name="data.complexactions" {{checked data.complexactions}}/></label></li>
<li class="flexrow"><label class="generic-label">Valeur de critique</label>

View File

@ -12,6 +12,7 @@
<div class="tab" data-group="primary">
<ul>
<li class="flexrow"><label class="generic-label">Encombrement</label><input type="text" name="data.enc" value="{{data.enc}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Quantité</label><input type="text" name="data.quantite" value="{{data.quantite}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Coût</label><input type="text" name="data.cost" value="{{data.cost}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>

View File

@ -33,11 +33,17 @@
<input type="text" name="data.valuecritical" value="{{data.valuecritical}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor content=data.notes target="data.notes" button=true owner=owner editable=editable}}
<div class="form-group small-editor">
{{editor content=data.notes target="data.notes" button=true owner=owner editable=editable}}
</div>
<label class="generic-label">Effets</label>
{{editor content=data.effect target="data.effect" button=true owner=owner editable=editable}}
<div class="form-group small-editor">
{{editor content=data.effect target="data.effect" button=true owner=owner editable=editable}}
</div>
<label class="generic-label">Effets critiques</label>
{{editor content=data.criticaleffect target="data.criticaleffect" button=true owner=owner editable=editable}}
<div class="form-group small-editor">
{{editor content=data.criticaleffect target="data.criticaleffect" button=true owner=owner editable=editable}}
</div>
</div>
</section>

View File

@ -22,10 +22,11 @@
</select>
</li>
<li class="flexrow"><label class="generic-label">Dégâts</label><input type="text" name="data.damage" value="{{data.damage}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Dégâts Critiques</label><input type="text" name="data.critical" value="{{data.critical}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Munitions</label><input type="text" name="data.munition" value="{{data.munition}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Dégâts Critiques</label><input type="text" name="data.criticaldamage" value="{{data.criticaldamage}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Munitions</label><input type="text" name="data.munition" value="{{data.munition}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Distance</label><input type="text" name="data.distance" value="{{data.distance}}" data-dtype="String"/></li>
<li class="flexrow"><label class="generic-label">Encrombrement</label><input type="text" name="data.enc" value="{{data.enc}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Encombrement</label><input type="text" name="data.enc" value="{{data.enc}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Quantité</label><input type="text" name="data.quantite" value="{{data.quantite}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Coût</label><input type="text" name="data.cost" value="{{data.cost}}" data-dtype="Number"/></li>
<li class="flexrow"><label class="generic-label">Valeur de critique</label>
<input type="text" name="data.valuecritical" value="{{data.valuecritical}}" data-dtype="Number"/></li>