Added "add a void point" checkbox, and some fixes
This commit is contained in:
@@ -95,7 +95,8 @@
|
||||
"dicepicker": {
|
||||
"difficulty_title": "Difficulty",
|
||||
"difficulty_hidden_label": "Hide TN",
|
||||
"use_void_point_label": "Spend a Void point",
|
||||
"use_void_point_label": "Spend a",
|
||||
"void_point_tooltip": "Void point",
|
||||
"roll_label": "Roll",
|
||||
"bt_add_macro": "Add a macro"
|
||||
},
|
||||
|
||||
@@ -95,7 +95,8 @@
|
||||
"dicepicker": {
|
||||
"difficulty_title": "Difficulty",
|
||||
"difficulty_hidden_label": "Hide TN",
|
||||
"use_void_point_label": "Spend a Void point",
|
||||
"use_void_point_label": "Spend a",
|
||||
"void_point_tooltip": "Void point",
|
||||
"roll_label": "Roll",
|
||||
"bt_add_macro": "Add a macro"
|
||||
},
|
||||
|
||||
@@ -95,7 +95,8 @@
|
||||
"dicepicker": {
|
||||
"difficulty_title": "Difficulté",
|
||||
"difficulty_hidden_label": "ND Caché",
|
||||
"use_void_point_label": "Dépenser un point de Vide",
|
||||
"use_void_point_label": "Dépenser un",
|
||||
"void_point_tooltip": "Point de Vide",
|
||||
"roll_label": "Lancer",
|
||||
"bt_add_macro": "Ajouter une macro"
|
||||
},
|
||||
|
||||
@@ -26,6 +26,7 @@ export class DicePickerDialog extends FormApplication {
|
||||
difficulty: {
|
||||
value: 2,
|
||||
hidden: false,
|
||||
add_void_point: true,
|
||||
},
|
||||
useVoidPoint: false,
|
||||
};
|
||||
@@ -136,6 +137,7 @@ export class DicePickerDialog extends FormApplication {
|
||||
this._actor = actor;
|
||||
if (this.object.ring.id === null) {
|
||||
this.ringId = this._actor.data.data.stance;
|
||||
this.object.ring.value = this._actor.data.data.rings[this.object.ring.id];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +242,7 @@ export class DicePickerDialog extends FormApplication {
|
||||
actor: this._actor,
|
||||
actorIsPc: !this._actor || this._actor.data?.type === "character",
|
||||
canUseVoidPoint:
|
||||
this.object.difficulty.hidden || !this._actor || this._actor.data.data.void_points.value > 0,
|
||||
this.object.difficulty.add_void_point || !this._actor || this._actor.data.data.void_points.value > 0,
|
||||
disableSubmit: this.object.skill.value < 1 && this.object.ring.value < 1,
|
||||
};
|
||||
}
|
||||
@@ -275,7 +277,7 @@ export class DicePickerDialog extends FormApplication {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.object.ring.id = event.target.dataset.ringid;
|
||||
this.object.ring.value = event.target.value;
|
||||
this.object.ring.value = parseInt(event.target.value) + (this.object.useVoidPoint ? 1 : 0);
|
||||
this.render(false);
|
||||
});
|
||||
|
||||
@@ -310,15 +312,17 @@ export class DicePickerDialog extends FormApplication {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.object.difficulty.hidden = !this.object.difficulty.hidden;
|
||||
if (
|
||||
this.object.useVoidPoint &&
|
||||
!this.object.difficulty.hidden &&
|
||||
!!this._actor &&
|
||||
this._actor.data.data.void_points.value < 1
|
||||
) {
|
||||
this.object.useVoidPoint = false;
|
||||
this._quantityChange("ring", -1);
|
||||
}
|
||||
this.object.difficulty.add_void_point = this.object.difficulty.hidden;
|
||||
this._updateVoidPointUsage();
|
||||
this.render(false);
|
||||
});
|
||||
|
||||
// Difficulty Add a void point
|
||||
html.find("#diff_add_void_point").on("click", async (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.object.difficulty.add_void_point = !this.object.difficulty.add_void_point;
|
||||
this._updateVoidPointUsage();
|
||||
this.render(false);
|
||||
});
|
||||
}
|
||||
@@ -390,6 +394,22 @@ export class DicePickerDialog extends FormApplication {
|
||||
this.object[element].value = Math.max(Math.min(parseInt(this.object[element].value) + add, 9), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the use of void point if actor don't have any and use of vp is un checked
|
||||
* @private
|
||||
*/
|
||||
_updateVoidPointUsage() {
|
||||
if (
|
||||
this.object.useVoidPoint &&
|
||||
!this.object.difficulty.add_void_point &&
|
||||
!!this._actor &&
|
||||
this._actor.data.data.void_points.value < 1
|
||||
) {
|
||||
this.object.useVoidPoint = false;
|
||||
this._quantityChange("ring", -1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a macro on the first empty space in player's bar
|
||||
* @private
|
||||
|
||||
@@ -79,7 +79,12 @@
|
||||
{{!-- Third line--}}
|
||||
<tr>
|
||||
<td>
|
||||
{{^if data.difficulty.hidden}}
|
||||
{{#if data.difficulty.hidden}}
|
||||
<label>
|
||||
<input type="checkbox" id="diff_add_void_point" name="difficulty.add_void_point" value="1" {{checked data.difficulty.add_void_point}}>
|
||||
+1 <i class="i_void" title="{{localize 'l5r5e.dicepicker.void_point_tooltip'}}"></i>
|
||||
</label>
|
||||
{{else}}
|
||||
<div id="difficulty_picker">
|
||||
<div class="third">
|
||||
<i class="quantity pointer-choice fa fa-minus-square" data-item="difficulty" data-value="-1"></i>
|
||||
@@ -152,7 +157,7 @@
|
||||
{{#if canUseVoidPoint}}
|
||||
<label>
|
||||
<input type="checkbox" id="use_void_point" name="useVoidPoint" value="1" {{checked data.useVoidPoint}}>
|
||||
{{localize 'l5r5e.dicepicker.use_void_point_label'}}
|
||||
{{localize 'l5r5e.dicepicker.use_void_point_label'}} <i class="i_void" title="{{localize 'l5r5e.dicepicker.void_point_tooltip'}}"></i>
|
||||
</label>
|
||||
{{/if}}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user