This commit is contained in:
sladecraven 2022-01-12 11:32:08 +01:00
parent c28c7d8c0d
commit e4f8505cc7
4 changed files with 25 additions and 11 deletions

View File

@ -484,8 +484,8 @@ export class YggdrasillActor extends Actor {
/* -------------------------------------------- */
async rollAttribute( attrkey, subAttrKey = 'defaut') {
let attr = duplicate(this.data.data.attributs[attrkey]);
console.log("ATTR : ", attr, attrkey, subAttrKey);
let subAttr = duplicate(this.data.data.attributs[attrkey].values[subAttrKey] );
console.log("ATTR : ", attr, subAttr);
if ( attr ) {
subAttr.label = subAttr.label || "";
let title = `Attribut : ${attr.label} ${subAttr.label} : ${subAttr.value}`;

View File

@ -114,18 +114,31 @@ export class YggdrasillUtility {
rollData.finalBM -= 3;
}
let myRoll = new Roll("2d10+"+niveau+"+"+rollData.finalBM).roll( { async: false} );
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode") );
let rolls = []
rollData.rawDices = []
for (let i=0; i < 2; i++) {
rolls[i] = new Roll("1d10x10").roll( { async: false} );
rollData.rawDices.push({ 'result': rolls[i].total});
}
this.showDiceSoNice(rolls[0], game.settings.get("core", "rollMode") );
await this.showDiceSoNice(rolls[1], game.settings.get("core", "rollMode") );
rollData.bonus = niveau + rollData.finalBM
rollData.finalTotal = 0
for (let i=0; i< 2; i++) {
rollData.finalTotal = rolls[i].dice[0].results[0].result
}
rollData.finalTotal += rollData.bonus
// Compute total SR
rollData.srFinal = rollData.sr;
if ( rollData.srFinal > 0 ) {
isCritical = myRoll.total >= rollData.srFinal*2;
isSuccess = myRoll.total >= rollData.srFinal;
marge = myRoll.total - rollData.srFinal;
isCritical = rollData.finalTotal >= rollData.srFinal*2;
isSuccess = rollData.finalTotal >= rollData.srFinal;
marge = rollData.finalTotal - rollData.srFinal;
}
if (myRoll.dice[0].results[0].result == 1 && myRoll.dice[0].results[1].result == 1) {
if (rolls[0].dice[0].results[0].result == 1 && rolls[1].dice[0].results[0].result == 1) {
isFailure = true;
}
// Dégats
@ -141,7 +154,7 @@ export class YggdrasillUtility {
rollData.isSuccess = isSuccess;
rollData.isCritical = isCritical;
rollData.marge = marge;
rollData.roll = myRoll
rollData.rolls = rolls
console.log("ROLLLL ATTR!!!!", rollData);

View File

@ -2,7 +2,7 @@
"name": "fvtt-yggdrasill",
"title": "Yggdrasill",
"description": "Système non-officiel Yggdrasill (7ièm Cercle) pour FoundryVTT",
"version": "1.1.5",
"version": "1.1.6",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "9",

View File

@ -43,7 +43,8 @@
{{#each attr.values as |value index|}}
{{#if value.label}}
<span class="stat-label flexrow tooltip tooltip-nobottom" name="{{index}}"><a class="attribut-roll" data-attr-sub-key="{{index}}">{{value.label}}</a></span>
<span class="stat-label flexrow tooltip tooltip-nobottom" name="{{index}}">
<a class="attribut-roll" data-attr-sub-key="{{index}}">{{value.label}}</a></span>
{{/if}}
<select class="carac-base flexrow" type="text" name="data.attributs.{{key}}.values.{{index}}.value" value="{{value.value}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select value.value}}