#139 Jet d'Endurance
This commit is contained in:
parent
e8af4ac813
commit
f15067fff8
@ -483,6 +483,10 @@ export class RdDActorSheet extends ActorSheet {
|
||||
this.actor.jetVie();
|
||||
this.render(true);
|
||||
});
|
||||
html.find('#jet-endurance').click((event) => {
|
||||
this.actor.jetEndurance();
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
html.find('.monnaie-plus').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
|
@ -1107,7 +1107,6 @@ export class RdDActor extends Actor {
|
||||
getSonne() {
|
||||
return !this.isEntiteCauchemar() && (this.data.data.sante.sonne?.value ?? false);
|
||||
}
|
||||
|
||||
async setSonne(sonne = true) {
|
||||
if (this.isEntiteCauchemar()) {
|
||||
return;
|
||||
@ -1115,7 +1114,6 @@ export class RdDActor extends Actor {
|
||||
await this.setStatusSonne(sonne);
|
||||
await this.setStateSonne(sonne);
|
||||
}
|
||||
|
||||
async setStateSonne(sonne) {
|
||||
if (this.isEntiteCauchemar()) {
|
||||
return;
|
||||
@ -1162,6 +1160,32 @@ export class RdDActor extends Actor {
|
||||
return this.countBlessures(this.data.data.blessures[name].liste);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async jetEndurance() {
|
||||
let myRoll = new Roll("1d20").roll();
|
||||
myRoll.showDice = true;
|
||||
await RdDDice.show(myRoll);
|
||||
|
||||
let msgText = "Jet d'Endurance : " + myRoll.total + " / " + this.data.data.sante.endurance.value + "<br>";
|
||||
if (myRoll.total == 1 || (myRoll.total != 20 && myRoll.total <= this.data.data.sante.endurance.value) ) {
|
||||
msgText += `${this.name} a réussi son Jet d'Endurance !`;
|
||||
if (myRoll.total == 1) {
|
||||
msgText += `et gagne 1 Point d'Experience en Constitution`;
|
||||
let constit = duplicate(this.data.data.carac.constitution)
|
||||
constit.xp += 1;
|
||||
await this.update({ "data.carac.constitution": constit });
|
||||
}
|
||||
} else {
|
||||
msgText += `${this.name} a échoué son Jet d'Endurance et devient Sonné`;
|
||||
await this.setSonne();
|
||||
}
|
||||
const message = {
|
||||
content: msgText,
|
||||
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||
};
|
||||
ChatMessage.create(message);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async jetVie() {
|
||||
let myRoll = new Roll("1d20").roll();
|
||||
|
@ -21,7 +21,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<label class="ctn-endu">
|
||||
Endurance
|
||||
<a id="jet-endurance">Endurance</a>
|
||||
<a id="endurance-moins">-</a>
|
||||
<input class="resource-content" type="text" name="data.sante.endurance.value" value="{{data.sante.endurance.value}}" data-dtype="Number"/>
|
||||
<span>/ {{data.sante.endurance.max}}</span>
|
||||
|
Loading…
Reference in New Issue
Block a user