chgt endurance ne rend plus inconscient
This commit is contained in:
parent
5402508b26
commit
6d06c96497
@ -368,7 +368,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
});
|
||||
html.find('.enlever-tous-effets').click(async event => {
|
||||
if (game.user.isGM) {
|
||||
this.actor.enleverTousLesEffets();
|
||||
await this.actor.removeEffects();
|
||||
}
|
||||
});
|
||||
html.find('.conteneur-name a').click(async event => {
|
||||
|
@ -44,6 +44,7 @@ const POSSESSION_SANS_DRACONIC = {
|
||||
}
|
||||
};
|
||||
|
||||
const PAS_DE_BLESSURE = { "active": false, "psdone": false, "scdone": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": "" };
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
|
||||
@ -545,7 +546,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_supprimerBlessure(blessure) {
|
||||
mergeObject(blessure, { "active": false, "psdone": false, "scdone": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": "" });
|
||||
mergeObject(blessure, PAS_DE_BLESSURE);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -588,39 +589,30 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async remiseANeuf() {
|
||||
let message = {
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
content: "Remise à neuf de " + this.name
|
||||
};
|
||||
if (this.isEntite([ENTITE_NONINCARNE])) {
|
||||
return;
|
||||
}
|
||||
if (this.isEntite([ENTITE_INCARNE, ENTITE_BLURETTE])) {
|
||||
await this.santeIncDec("endurance", this.system.sante.endurance.max - this.system.sante.endurance.value);
|
||||
}
|
||||
else {
|
||||
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
content: 'Remise à neuf de ' + this.name
|
||||
});
|
||||
const updates = {
|
||||
'system.sante.endurance.value' : this.system.sante.endurance.max
|
||||
};
|
||||
if (!this.isEntite([ENTITE_INCARNE, ENTITE_BLURETTE])) {
|
||||
if (this.system.blessures) {
|
||||
const blessures = duplicate(this.system.blessures);
|
||||
for (let listeBlessures of [blessures.legeres.liste, blessures.graves.liste, blessures.critiques.liste]) {
|
||||
for (let blessure of listeBlessures) {
|
||||
this._supprimerBlessure(blessure);
|
||||
}
|
||||
}
|
||||
await this.update({ "system.blessures": blessures });
|
||||
updates['system.blessures.legeres.liste'] = [PAS_DE_BLESSURE, PAS_DE_BLESSURE, PAS_DE_BLESSURE, PAS_DE_BLESSURE, PAS_DE_BLESSURE];
|
||||
updates['system.blessures.graves.liste'] = [PAS_DE_BLESSURE, PAS_DE_BLESSURE];
|
||||
updates['system.blessures.critiques.liste'] = [PAS_DE_BLESSURE];
|
||||
}
|
||||
updates['system.sante.vie.value'] = this.system.sante.vie.max;
|
||||
updates['system.sante.fatigue.value'] = 0;
|
||||
if (this.isPersonnage()) {
|
||||
await this.setEthylisme(1);
|
||||
}
|
||||
|
||||
await this.santeIncDec("vie", this.system.sante.vie.max - this.system.sante.vie.value);
|
||||
await this.santeIncDec("endurance", this.system.sante.endurance.max - this.system.sante.endurance.value);
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue") && this.system.sante.fatigue) {
|
||||
await this.update({ "system.sante.fatigue.value": 0 });
|
||||
updates['system.compteurs.ethylisme'] = { value:1, nb_doses: 0, jet_moral: false};
|
||||
}
|
||||
}
|
||||
ChatMessage.create(message);
|
||||
this.sheet.render(true);
|
||||
await this.update(updates);
|
||||
await this.removeEffects(e => e.flags.core.statusId !== STATUSES.StatusDemiReve);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -4101,8 +4093,8 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getEffects() {
|
||||
return this.getEmbeddedCollection("ActiveEffect");
|
||||
getEffects(filter = e => true) {
|
||||
return this.getEmbeddedCollection("ActiveEffect").filter(filter);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -4116,10 +4108,12 @@ export class RdDActor extends Actor {
|
||||
return;
|
||||
}
|
||||
console.log("setEffect", statusId, status)
|
||||
await this.removeEffect(statusId);
|
||||
const effect = StatusEffects.status(statusId);
|
||||
if (effect) {
|
||||
await this.createEmbeddedDocuments("ActiveEffect", [effect]);
|
||||
const effect = this.getEffect(statusId);
|
||||
if (!status && effect){
|
||||
await this.deleteEmbeddedDocuments('ActiveEffect', [effect.id]);
|
||||
}
|
||||
if (status && !effect ) {
|
||||
await this.createEmbeddedDocuments("ActiveEffect", [StatusEffects.status(statusId)]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4131,9 +4125,10 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
enleverTousLesEffets() {
|
||||
async removeEffects(filter = e => true) {
|
||||
if (game.user.isGM) {
|
||||
this.deleteEmbeddedDocuments('ActiveEffect', this.getEffects().map(it => it.id));
|
||||
const ids = this.getEffects(filter).map(it => it.id);
|
||||
await this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user