Fix: affichage blessures et pertes
Les pertes et la récupération sont correctement gérées (en ne faisant qu'un seul render pour le personnage)
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
- Le malus d'encombrement sur jet d'Agilité avec Natation ou Acrobatie peuvent être changés, et sont correctement arrondis
|
- Le malus d'encombrement sur jet d'Agilité avec Natation ou Acrobatie peuvent être changés, et sont correctement arrondis
|
||||||
- L'ajustement de condition est plus visible sur les résultats de jets de dés
|
- L'ajustement de condition est plus visible sur les résultats de jets de dés
|
||||||
- Les blessures graves soignées ne font pas perdre d'endurance par round
|
- Les blessures graves soignées ne font pas perdre d'endurance par round
|
||||||
|
- Les blessures et pertes correspondantes (vie, endurance, effets sonné, ...) s'affichent correctement
|
||||||
|
- la remise à neuf ne provoque pas d'erreur pour certains effets déjà supprimés
|
||||||
|
|
||||||
## 13.0.31 - Les choix multiples d'Illysis
|
## 13.0.31 - Les choix multiples d'Illysis
|
||||||
|
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
blessures
|
blessures
|
||||||
})));
|
})));
|
||||||
|
|
||||||
await this.supprimerBlessures(it => it.system.gravite <= 0);
|
await this.supprimerBlessures(it => it.system.gravite <= 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@@ -498,18 +498,18 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async remiseANeuf() {
|
async remiseANeuf() {
|
||||||
|
await this.removeEffects(e => !e.statuses?.has(STATUSES.StatusDemiReve), { render: false })
|
||||||
|
await this.supprimerBlessures(it => true, { render: false })
|
||||||
await this.update({
|
await this.update({
|
||||||
'system.sante.endurance.value': this.system.sante.endurance.max,
|
'system.sante.endurance.value': this.system.sante.endurance.max,
|
||||||
'system.sante.vie.value': this.system.sante.vie.max,
|
'system.sante.vie.value': this.system.sante.vie.max,
|
||||||
'system.sante.fatigue.value': 0,
|
'system.sante.fatigue.value': 0,
|
||||||
'system.compteurs.ethylisme': { value: 1, nb_doses: 0, jet_moral: false }
|
'system.compteurs.ethylisme': { value: 1, nb_doses: 0, jet_moral: false }
|
||||||
})
|
}, { render: true })
|
||||||
await this.removeEffects(e => !e.statuses?.has(STATUSES.StatusDemiReve));
|
|
||||||
await this.supprimerBlessures(it => true);
|
|
||||||
await ChatMessage.create({
|
await ChatMessage.create({
|
||||||
whisper: ChatUtility.getOwners(this),
|
whisper: ChatUtility.getOwners(this),
|
||||||
content: 'Remise à neuf de ' + this.name
|
content: 'Remise à neuf de ' + this.name
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@@ -2788,20 +2788,20 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
const guerisonData = { list: [], pointsConsommes: 0 }
|
const guerisonData = { list: [], pointsConsommes: 0 }
|
||||||
for (let blessure of blessures) {
|
for (let blessure of blessures) {
|
||||||
if (pointsGuerison >= blessure.system.gravite) {
|
if (pointsGuerison >= blessure.system.gravite) {
|
||||||
pointsGuerison -= blessure.system.gravite;
|
pointsGuerison -= blessure.system.gravite
|
||||||
guerisonData.list.push(`1 Blessure ${blessure.system.label} (${blessure.system.gravite} points)`);
|
guerisonData.list.push(`1 Blessure ${blessure.system.label} (${blessure.system.gravite} points)`)
|
||||||
ids.push(blessure.id)
|
ids.push(blessure.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ids.length > 0) {
|
if (ids.length > 0) {
|
||||||
await this.supprimerBlessures(it => ids.includes(it.id));
|
await this.supprimerBlessures(it => ids.includes(it.id), { render: blessures.length != ids.length })
|
||||||
}
|
}
|
||||||
if (blessures.length == ids.length) {
|
if (blessures.length == ids.length) {
|
||||||
let pvManquants = this.system.sante.vie.max - this.system.sante.vie.value;
|
let pvManquants = this.system.sante.vie.max - this.system.sante.vie.value;
|
||||||
let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2));
|
let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2));
|
||||||
pointsGuerison -= pvSoignees * 2;
|
pointsGuerison -= pvSoignees * 2;
|
||||||
guerisonData.list.push(pvSoignees + " Points de Vie soignés");
|
guerisonData.list.push(pvSoignees + " Points de Vie soignés");
|
||||||
await this.santeIncDec('vie', +pvSoignees, false);
|
await this.santeIncDec('vie', +pvSoignees, { render: true })
|
||||||
}
|
}
|
||||||
guerisonData.pointsConsommes = pointsGuerisonInitial - pointsGuerison;
|
guerisonData.pointsConsommes = pointsGuerisonInitial - pointsGuerison;
|
||||||
return guerisonData;
|
return guerisonData;
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|||||||
|
|
||||||
computeResumeBlessure() { }
|
computeResumeBlessure() { }
|
||||||
countBlessures(filter = it => !it.isContusion()) { return 0 }
|
countBlessures(filter = it => !it.isContusion()) { return 0 }
|
||||||
async santeIncDec(name, inc, isCritique = false) { }
|
async santeIncDec(name, inc, options = {}) { }
|
||||||
|
|
||||||
async finDeRound(options = { terminer: false }) {
|
async finDeRound(options = { terminer: false }) {
|
||||||
await this.finDeRoundSuppressionEffetsTermines(options)
|
await this.finDeRoundSuppressionEffetsTermines(options)
|
||||||
@@ -577,7 +577,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|||||||
async rollArme(arme, maniement = 'competence', token = undefined) {
|
async rollArme(arme, maniement = 'competence', token = undefined) {
|
||||||
token = token ?? RdDUtility.getSelectedToken(this)
|
token = token ?? RdDUtility.getSelectedToken(this)
|
||||||
const compToUse = RdDItemArme.getCompetenceArme(arme, maniement)
|
const compToUse = RdDItemArme.getCompetenceArme(arme, maniement)
|
||||||
|
|
||||||
if (!RdDItemArme.isUtilisable(arme)) {
|
if (!RdDItemArme.isUtilisable(arme)) {
|
||||||
ui.notifications.warn(`Arme inutilisable: ${arme.name} non équipée ou avec une résistance de 0 ou moins`)
|
ui.notifications.warn(`Arme inutilisable: ${arme.name} non équipée ou avec une résistance de 0 ou moins`)
|
||||||
return
|
return
|
||||||
@@ -656,26 +656,21 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|||||||
jet => this.$onEncaissement(jet, show, attackerToken, defenderToken));
|
jet => this.$onEncaissement(jet, show, attackerToken, defenderToken));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async $onEncaissement(jet, show, attackerToken, defenderToken) {
|
|
||||||
await this.onAppliquerJetEncaissement(jet, attackerToken);
|
|
||||||
await this.$afficherEncaissement(jet, show, defenderToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
async onAppliquerJetEncaissement(encaissement, attackerToken) { }
|
async onAppliquerJetEncaissement(encaissement, attackerToken) { }
|
||||||
|
|
||||||
async $afficherEncaissement(encaissement, show, defenderToken) {
|
async $onEncaissement(encaissement, show, attackerToken, defenderToken) {
|
||||||
|
await this.onAppliquerJetEncaissement(encaissement, attackerToken);
|
||||||
|
|
||||||
foundry.utils.mergeObject(encaissement, {
|
foundry.utils.mergeObject(encaissement, {
|
||||||
alias: defenderToken?.name ?? this.getAlias(),
|
alias: defenderToken?.name ?? this.getAlias(),
|
||||||
hasPlayerOwner: this.hasPlayerOwner,
|
hasPlayerOwner: this.hasPlayerOwner,
|
||||||
show: show ?? {}
|
show: show ?? {}
|
||||||
}, { overwrite: false });
|
}, { overwrite: false });
|
||||||
|
|
||||||
await ChatUtility.createChatWithRollMode(
|
await ChatUtility.createChatWithRollMode({
|
||||||
{
|
roll: encaissement.roll,
|
||||||
roll: encaissement.roll,
|
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.hbs', encaissement)
|
||||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.hbs', encaissement)
|
},
|
||||||
},
|
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -113,9 +113,33 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
|
|
||||||
async onAppliquerJetEncaissement(encaissement, attackerToken) {
|
async onAppliquerJetEncaissement(encaissement, attackerToken) {
|
||||||
const santeOrig = foundry.utils.duplicate(this.system.sante);
|
const santeOrig = foundry.utils.duplicate(this.system.sante);
|
||||||
const blessure = await this.ajouterBlessure(encaissement, attackerToken); // Will update the result table
|
const blessure = this.nouvelleBlessure(encaissement.gravite, {
|
||||||
const perteVie = await this.santeIncDec("vie", -encaissement.vie);
|
localisation: encaissement.dmg?.loc.label ?? '',
|
||||||
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, blessure?.isCritique());
|
origine: attackerToken?.name ?? ''
|
||||||
|
})
|
||||||
|
if (blessure.system.gravite == encaissement.gravite) {
|
||||||
|
blessure.system.vie = encaissement.vie
|
||||||
|
blessure.system.endurance = encaissement.endurance
|
||||||
|
}
|
||||||
|
else { // aggravation du fait du nombre de blessures
|
||||||
|
blessure.system.vie = blessure.system.vie
|
||||||
|
const rollPerteEndurance = new Roll(blessure.system.endurance)
|
||||||
|
await rollPerteEndurance.evaluate()
|
||||||
|
blessure.system.endurance =rollPerteEndurance.total
|
||||||
|
}
|
||||||
|
const isCritique = blessure.system.gravite >= 6;
|
||||||
|
if (isCritique){
|
||||||
|
blessure.system.endurance = this.getEnduranceActuelle()
|
||||||
|
}
|
||||||
|
// Will update the result table
|
||||||
|
if (blessure.system.gravite > 6) {
|
||||||
|
this.setEffect(STATUSES.StatusComma, true)
|
||||||
|
encaissement.mort = "à seconde blessure critique"
|
||||||
|
}
|
||||||
|
|
||||||
|
const perteVie = await this.santeIncDec("vie", -encaissement.vie, { render: false })
|
||||||
|
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, { isCritique, render: false })
|
||||||
|
await this.createEmbeddedDocuments('Item', [blessure])
|
||||||
|
|
||||||
foundry.utils.mergeObject(encaissement, {
|
foundry.utils.mergeObject(encaissement, {
|
||||||
resteEndurance: perteEndurance.newValue,
|
resteEndurance: perteEndurance.newValue,
|
||||||
@@ -124,11 +148,11 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
endurance: perteEndurance.perte,
|
endurance: perteEndurance.perte,
|
||||||
vie: santeOrig.vie.value - perteVie.newValue,
|
vie: santeOrig.vie.value - perteVie.newValue,
|
||||||
blessure: blessure
|
blessure: blessure
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async santeIncDec(name, inc, isCritique = false) {
|
async santeIncDec(name, inc, options = {}) {
|
||||||
if (name == 'fatigue' && !ReglesOptionnelles.isUsing("appliquer-fatigue")) {
|
if (name == 'fatigue' && !ReglesOptionnelles.isUsing("appliquer-fatigue")) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -140,15 +164,16 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
const result = { sonne: false }
|
const result = { sonne: false }
|
||||||
let perteEndurance = 0
|
let perteEndurance = 0
|
||||||
let minValue = name == "vie" ? -this.getSConst() - 1 : 0;
|
let minValue = name == "vie" ? -this.getSConst() - 1 : 0;
|
||||||
|
|
||||||
result.newValue = Math.max(minValue, Math.min(compteur.value + inc, compteur.max));
|
result.newValue = Math.max(minValue, Math.min(compteur.value + inc, compteur.max));
|
||||||
//console.log("New value ", inc, minValue, result.newValue);
|
|
||||||
let fatigue = 0;
|
let fatigue = 0;
|
||||||
|
|
||||||
|
if (name == "endurance" && result.newValue == 0 && inc < 0 && !options.isCritique) { // perte endurance et endurance devient 0 (sauf critique) -> -1 vie
|
||||||
|
sante.vie.value--;
|
||||||
|
result.perteVie = true;
|
||||||
|
}
|
||||||
|
foundry.utils.mergeObject(options, { render: true }, { overwrite: false })
|
||||||
if (name == "endurance") {
|
if (name == "endurance") {
|
||||||
if (result.newValue == 0 && inc < 0 && !isCritique) { // perte endurance et endurance devient 0 (sauf critique) -> -1 vie
|
|
||||||
sante.vie.value--;
|
|
||||||
result.perteVie = true;
|
|
||||||
}
|
|
||||||
result.newValue = Math.max(0, result.newValue);
|
result.newValue = Math.max(0, result.newValue);
|
||||||
if (inc > 0) { // le max d'endurance s'applique seulement à la récupération
|
if (inc > 0) { // le max d'endurance s'applique seulement à la récupération
|
||||||
result.newValue = Math.min(result.newValue, this._computeEnduranceMax())
|
result.newValue = Math.min(result.newValue, this._computeEnduranceMax())
|
||||||
@@ -164,17 +189,17 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
if (ReglesOptionnelles.isUsing("appliquer-fatigue") && sante.fatigue && fatigue > 0) {
|
if (ReglesOptionnelles.isUsing("appliquer-fatigue") && sante.fatigue && fatigue > 0) {
|
||||||
sante.fatigue.value = Math.max(sante.fatigue.value + fatigue, this.getFatigueMin());
|
sante.fatigue.value = Math.max(sante.fatigue.value + fatigue, this.getFatigueMin());
|
||||||
}
|
}
|
||||||
await this.update({ "system.sante": sante }, { render: true })
|
await this.update({ "system.sante": sante }, options)
|
||||||
|
|
||||||
if (perteEndurance > 1) {
|
if (perteEndurance > 1) {
|
||||||
// Peut-être sonné si 2 points d'endurance perdus d'un coup
|
// Peut-être sonné si 2 points d'endurance perdus d'un coup
|
||||||
foundry.utils.mergeObject(result, await this.jetEndurance(result.newValue));
|
foundry.utils.mergeObject(result, await this.jetEndurance(result.newValue, options));
|
||||||
} else if (name == "endurance" && inc > 0) {
|
} else if (name == "endurance" && inc > 0) {
|
||||||
await this.setSonne(false);
|
await this.setSonne(false, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isDead()) {
|
if (this.isDead()) {
|
||||||
await this.setEffect(STATUSES.StatusComma, true);
|
await this.setEffect(STATUSES.StatusComma, true, options)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
@@ -306,32 +331,15 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async ajouterBlessure(encaissement, attackerToken = undefined) {
|
nouvelleBlessure(gravite, options = { origine: undefined, localisation: '' }) {
|
||||||
if (encaissement.gravite < 0) return;
|
if (gravite < 0) return
|
||||||
if (encaissement.gravite > 0) {
|
if (gravite > 0) {
|
||||||
while (this.countBlessures(it => it.system.gravite == encaissement.gravite) >= RdDItemBlessure.maxBlessures(encaissement.gravite) && encaissement.gravite <= 6) {
|
while (this.countBlessures(it => it.system.gravite == gravite) >= RdDItemBlessure.maxBlessures(gravite) && gravite <= 6) {
|
||||||
// Aggravation
|
// Aggravation
|
||||||
encaissement.gravite += 2
|
gravite += 2
|
||||||
if (encaissement.gravite > 2) {
|
|
||||||
encaissement.vie += 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const endActuelle = this.getEnduranceActuelle();
|
return RdDItemBlessure.prepareBlessure(gravite, options);
|
||||||
const blessure = await RdDItemBlessure.createBlessure(this, encaissement.gravite, encaissement.dmg?.loc.label ?? '', attackerToken);
|
|
||||||
if (blessure.isCritique()) {
|
|
||||||
encaissement.endurance = endActuelle
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blessure.isMort()) {
|
|
||||||
this.setEffect(STATUSES.StatusComma, true);
|
|
||||||
encaissement.mort = true;
|
|
||||||
ChatMessage.create({
|
|
||||||
content: `<img class="chat-icon" src="icons/svg/skull.svg" data-tooltip="charge" />
|
|
||||||
<strong>${this.getAlias()} vient de succomber à une seconde blessure critique ! Que les Dragons gardent son Archétype en paix !</strong>`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return blessure;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async supprimerBlessure({ gravite }) {
|
async supprimerBlessure({ gravite }) {
|
||||||
@@ -341,10 +349,10 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async supprimerBlessures(filterToDelete) {
|
async supprimerBlessures(filterToDelete, options = { render: true}) {
|
||||||
const toDelete = this.filterItems(filterToDelete, ITEM_TYPES.blessure)
|
const toDelete = this.filterItems(filterToDelete, ITEM_TYPES.blessure)
|
||||||
.map(it => it.id);
|
.map(it => it.id)
|
||||||
await this.deleteEmbeddedDocuments('Item', toDelete);
|
await this.deleteEmbeddedDocuments('Item', toDelete, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
countBlessures(filter = it => !it.isContusion()) {
|
countBlessures(filter = it => !it.isContusion()) {
|
||||||
@@ -391,11 +399,11 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async jetEndurance(resteEndurance = undefined) {
|
async jetEndurance(resteEndurance = undefined, options) {
|
||||||
const jetEndurance = (await RdDDice.roll("1d20")).total;
|
const jetEndurance = (await RdDDice.roll("1d20")).total;
|
||||||
const sonne = jetEndurance == 20 || jetEndurance > (resteEndurance ?? this.system.sante.endurance.value)
|
const sonne = jetEndurance == 20 || jetEndurance > (resteEndurance ?? this.system.sante.endurance.value)
|
||||||
if (sonne) {
|
if (sonne) {
|
||||||
await this.setSonne();
|
await this.setSonne(true, options)
|
||||||
}
|
}
|
||||||
return { jetEndurance, sonne }
|
return { jetEndurance, sonne }
|
||||||
}
|
}
|
||||||
@@ -409,12 +417,13 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async setSonne(sonne = true) {
|
async setSonne(sonne = true, options = {}) {
|
||||||
if (!game.combat && sonne) {
|
if (!game.combat && sonne) {
|
||||||
|
// TODO: vérifier si comportement toujours valable
|
||||||
ui.notifications.info(`${this.getAlias()} est hors combat, il ne reste donc pas sonné`);
|
ui.notifications.info(`${this.getAlias()} est hors combat, il ne reste donc pas sonné`);
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
await this.setEffect(STATUSES.StatusStunned, sonne)
|
await this.setEffect(STATUSES.StatusStunned, sonne, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
isSonne() {
|
isSonne() {
|
||||||
|
|||||||
@@ -285,14 +285,14 @@ export class RdDBaseActor extends Actor {
|
|||||||
return this.getEffects().filter(it => it.statuses.has(effectId))
|
return this.getEffects().filter(it => it.statuses.has(effectId))
|
||||||
}
|
}
|
||||||
|
|
||||||
async setEffect(effectId, status) {
|
async setEffect(effectId, status, options = {render: true}) {
|
||||||
if (this.isEffectAllowed(effectId)) {
|
if (this.isEffectAllowed(effectId)) {
|
||||||
const effects = this.getEffectsByStatus(effectId)
|
const effects = this.getEffectsByStatus(effectId)
|
||||||
if (!status && effects.length > 0) {
|
if (!status && effects.length > 0) {
|
||||||
await this.deleteEmbeddedDocuments('ActiveEffect', effects.map(it => it.id), { render: true })
|
await this.deleteEmbeddedDocuments('ActiveEffect', effects.map(it => it.id), options)
|
||||||
}
|
}
|
||||||
if (status && effects.length == 0) {
|
if (status && effects.length == 0) {
|
||||||
await this.createEmbeddedDocuments("ActiveEffect", [StatusEffects.prepareActiveEffect(effectId)], { render: true })
|
await this.createEmbeddedDocuments("ActiveEffect", [StatusEffects.prepareActiveEffect(effectId)], options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,13 +301,13 @@ export class RdDBaseActor extends Actor {
|
|||||||
this.removeEffects(it => it.id == id)
|
this.removeEffects(it => it.id == id)
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeEffects(filter = e => true) {
|
async removeEffects(filter = e => true, options = {render: true}) {
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
const ids = this.getEffects(filter)
|
const ids = this.getEffects(filter)
|
||||||
.filter(it => this.canRemoveEffects(it))
|
.filter(it => this.canRemoveEffects(it))
|
||||||
.map(it => it.id)
|
.map(it => it.id)
|
||||||
if (ids.length > 0) {
|
if (ids.length > 0) {
|
||||||
await this.deleteEmbeddedDocuments('ActiveEffect', ids)
|
await this.deleteEmbeddedDocuments('ActiveEffect', ids, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ export class RdDCreature extends RdDBaseActorSang {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async remiseANeuf() {
|
async remiseANeuf() {
|
||||||
await this.removeEffects(e => true);
|
await this.removeEffects(e => true, { render: false })
|
||||||
await this.supprimerBlessures(it => true);
|
await this.supprimerBlessures(it => true, { render: false })
|
||||||
await this.update({
|
await this.update({
|
||||||
'system.sante.endurance.value': this.system.sante.endurance.max,
|
'system.sante.endurance.value': this.system.sante.endurance.max,
|
||||||
'system.sante.vie.value': this.system.sante.vie.max,
|
'system.sante.vie.value': this.system.sante.vie.max,
|
||||||
'system.sante.fatigue.value': 0
|
'system.sante.fatigue.value': 0
|
||||||
});
|
}, { render: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
async finDeRoundBlessures() {
|
async finDeRoundBlessures() {
|
||||||
|
|||||||
@@ -86,11 +86,7 @@ export class RdDEntite extends RdDBaseActorReve {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance);
|
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance);
|
||||||
foundry.utils.mergeObject(encaissement, {
|
foundry.utils.mergeObject(encaissement, { resteEndurance: perteEndurance.newValue, endurance: perteEndurance.perte })
|
||||||
resteEndurance: perteEndurance.newValue,
|
|
||||||
endurance: perteEndurance.perte,
|
|
||||||
blessure: RdDItemBlessure.prepareBlessure(encaissement.gravite, encaissement.dmg?.loc.label ?? '', attackerToken)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isEntiteAccordee(attacker) {
|
isEntiteAccordee(attacker) {
|
||||||
|
|||||||
@@ -103,11 +103,10 @@ export class RdDActorExportSheet extends RdDActorSheet {
|
|||||||
gravite: this.html.find(event.currentTarget).data('gravite')
|
gravite: this.html.find(event.currentTarget).data('gravite')
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
this.html.find('.click-blessure-add').click(async event =>
|
this.html.find('.click-blessure-add').click(async event => {
|
||||||
await this.actor.ajouterBlessure({
|
const blessure = this.actor.nouvelleBlessure(this.html.find(event.currentTarget).data('gravite'))
|
||||||
gravite: this.html.find(event.currentTarget).data('gravite')
|
await actor.createEmbeddedDocuments('Item', [blessure])
|
||||||
})
|
})
|
||||||
)
|
|
||||||
this.html.find('.button-export').click(async event => await
|
this.html.find('.button-export').click(async event => await
|
||||||
ExportScriptarium.INSTANCE.exportActors([this.actor],
|
ExportScriptarium.INSTANCE.exportActors([this.actor],
|
||||||
`${this.actor.uuid}-${this.actor.name}`
|
`${this.actor.uuid}-${this.actor.name}`
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const definitionsBlessures = [
|
|||||||
{ type: "legere", gravite: 2, endurance: "1d6", vie: 0, label: 'Légère', max: 5, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
|
{ type: "legere", gravite: 2, endurance: "1d6", vie: 0, label: 'Légère', max: 5, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
|
||||||
{ type: "grave", gravite: 4, endurance: "2d6", vie: -2, label: 'Grave', max: 2, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
|
{ type: "grave", gravite: 4, endurance: "2d6", vie: -2, label: 'Grave', max: 2, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
|
||||||
{ type: "critique", gravite: 6, endurance: "-100", vie: -4, label: 'Critique', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
|
{ type: "critique", gravite: 6, endurance: "-100", vie: -4, label: 'Critique', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
|
||||||
{ type: "mort", gravite: 8, label: 'Mort', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/mort.webp" }
|
{ type: "mort", gravite: 8, endurance: "-100", vie: 0, label: 'Mort', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/mort.webp" }
|
||||||
]
|
]
|
||||||
|
|
||||||
export class RdDItemBlessure extends RdDItem {
|
export class RdDItemBlessure extends RdDItem {
|
||||||
@@ -71,13 +71,13 @@ export class RdDItemBlessure extends RdDItem {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
static async createBlessure(actor, gravite, localisation = '', attackerToken = undefined) {
|
static async createBlessure(actor, gravite, options = { localisation: '', origine: '', render: true }) {
|
||||||
const blessure = RdDItemBlessure.prepareBlessure(gravite, localisation, attackerToken);
|
const blessure = RdDItemBlessure.prepareBlessure(gravite, options);
|
||||||
const blessures = await actor.createEmbeddedDocuments('Item', [blessure])
|
const blessures = await actor.createEmbeddedDocuments('Item', [blessure], options)
|
||||||
return blessures[0]
|
return blessures[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
static prepareBlessure(gravite, localisation, attackerToken) {
|
static prepareBlessure(gravite, options = { localisation: '', origine: '' }) {
|
||||||
const definition = RdDItemBlessure.getDefinition(gravite);
|
const definition = RdDItemBlessure.getDefinition(gravite);
|
||||||
return {
|
return {
|
||||||
name: definition.label,
|
name: definition.label,
|
||||||
@@ -85,9 +85,11 @@ export class RdDItemBlessure extends RdDItem {
|
|||||||
img: definition.icon,
|
img: definition.icon,
|
||||||
system: {
|
system: {
|
||||||
gravite: gravite,
|
gravite: gravite,
|
||||||
|
vie: definition.vie,
|
||||||
|
endurance: definition.endurance,
|
||||||
difficulte: -gravite,
|
difficulte: -gravite,
|
||||||
localisation: localisation,
|
localisation: options.localisation,
|
||||||
origine: attackerToken?.name ?? ""
|
origine: options.origine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -693,7 +693,9 @@
|
|||||||
"bonus": 0
|
"bonus": 0
|
||||||
},
|
},
|
||||||
"localisation": "",
|
"localisation": "",
|
||||||
"origine": ""
|
"origine": "",
|
||||||
|
"vie": 0,
|
||||||
|
"endurance": "0"
|
||||||
},
|
},
|
||||||
"maladie": {
|
"maladie": {
|
||||||
"templates": ["description", "temporel"],
|
"templates": ["description", "temporel"],
|
||||||
|
|||||||
@@ -1,55 +1,62 @@
|
|||||||
{{#if isGM}}
|
{{#if isGM}}
|
||||||
<span>
|
<span>
|
||||||
{{#if (gt endurance 0)}}
|
{{#if (gt endurance 0)}}
|
||||||
De plus, {{alias}} a perdu {{endurance}} points d'endurance
|
De plus, {{alias}} a perdu {{endurance}} points d'endurance
|
||||||
{{#if (ne vie 0)}}et <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}}
|
{{#if (ne vie 0)}}et <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (and jetEndurance (gt endurance 1))}}Jet d'endurance : {{jetEndurance}} / {{resteEndurance}} {{/if}}
|
{{#if (and jetEndurance (gt endurance 1))}}Jet d'endurance : {{jetEndurance}} / {{resteEndurance}} {{/if}}
|
||||||
</span>
|
</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
<h4>{{alias}} encaisse à
|
<h4>{{alias}} encaisse à
|
||||||
<span>
|
<span>
|
||||||
{{plusMoins dmg.total}}
|
{{plusMoins dmg.total}}
|
||||||
{{#if (eq dmg.mortalite 'non-mortel')~}}(coups non mortels)
|
{{#if (eq dmg.mortalite 'non-mortel')~}}(coups non mortels)
|
||||||
{{~else if (eq dmg.mortalite 'entiteincarnee')}}(entité incarnée)
|
{{~else if (eq dmg.mortalite 'entiteincarnee')}}(entité incarnée)
|
||||||
{{~/if}}
|
{{~/if}}
|
||||||
</span>
|
</span>
|
||||||
</h4>
|
</h4>
|
||||||
<div>
|
<div>
|
||||||
Jet d'encaissement de {{roll.total}}
|
Jet d'encaissement de {{roll.total}}
|
||||||
{{~#unless (eq armure 0)}}, l'armure a protègé de {{armure}}
|
{{~#unless (eq armure 0)}}, l'armure a protègé de {{armure}}
|
||||||
{{~#unless (eq penetration 0)}} (pénétration de {{penetration}}){{/unless}}
|
{{~#unless (eq penetration 0)}} (pénétration de {{penetration}}){{/unless}}
|
||||||
{{~/unless~}}, total: <span class="rdd-roll-echec">{{total}}</span>
|
{{~/unless~}}, total: <span class="rdd-roll-echec">{{total}}</span>
|
||||||
<br>
|
<br>
|
||||||
{{alias}}
|
{{log 'encaissement' this}}
|
||||||
{{log 'encaissement' this}}
|
{{#unless mort}}
|
||||||
{{#if mort}}vient de mourir
|
{{alias}}
|
||||||
{{else if blessure}}
|
{{#if blessure}}
|
||||||
{{#if (gt blessure.system.gravite 0)}}subit une blessure {{blessure.name}}
|
{{#if (gt blessure.system.gravite 0)}}subit une blessure {{blessure.name}}
|
||||||
{{~else~}}subit une éraflure
|
{{~else~}}subit une éraflure
|
||||||
{{~/if~}}
|
{{~/if~}}
|
||||||
{{~else~}}s'en sort sans une égratignure
|
{{~else~}}s'en sort sans une égratignure
|
||||||
{{~/if~}}
|
{{~/if~}}
|
||||||
|
{{/unless}}
|
||||||
|
|
||||||
{{~#unless (eq dmg.mortalite 'entiteincarnee')}}
|
{{~#unless (eq dmg.mortalite 'entiteincarnee')}}
|
||||||
{{#if dmg.loc.label}}
|
{{#if dmg.loc.label}}
|
||||||
{{#if (gt roll.total 0)}}({{dmg.loc.label}}){{/if}}
|
{{#if (gt roll.total 0)}}({{dmg.loc.label}}){{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/unless~}}
|
||||||
|
{{~#if (gt endurance 0)}}
|
||||||
|
{{~#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance
|
||||||
|
{{~#if (ne vie 0)}}, <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if~}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/unless~}}
|
{{#if (ne dmg.mortalite 'entiteincarnee')}}
|
||||||
{{~#if (gt endurance 0)}}
|
{{#if (gt endurance 1)}}et
|
||||||
{{~#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance
|
{{#if sonne}}est <strong>sonné</strong><img class="chat-inline-icon" src="icons/svg/stoned.svg" data-tooltip="sonné" height="16" width="16" /> jusqu'à la fin du prochain round{{else}}n'est pas sonné{{/if}}!
|
||||||
{{~#if (ne vie 0)}}, <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if~}}
|
{{#if hasPlayerOwner}}Jet d'endurance : {{jetEndurance}} / {{resteEndurance}}{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{#if (eq show.recul 'encaisse')}}<div>{{alias}} ne recule pas malgré la violence du coup.</div>
|
||||||
|
{{else if (eq show.recul 'chute')}}<div>Sous la violence du coup, {{alias}} recule et chute au sol ! Il/elle ne pourra plus attaquer ce round.</div>
|
||||||
|
{{else if (eq show.recul 'recul')}}<div>La violence du coup fait reculer {{alias}} de quelques mètres ! Il/elle ne pourra plus attaquer ce round.</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{#if mort}}
|
||||||
|
<div>
|
||||||
|
<img class="chat-icon" src="icons/svg/skull.svg" data-tooltip="mort" />
|
||||||
|
<strong>{{alias}} vient de succomber {{mort}}! Que les Dragons gardent son Archétype en paix !</strong>
|
||||||
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (ne dmg.mortalite 'entiteincarnee')}}
|
|
||||||
{{#if (gt endurance 1)}}et
|
|
||||||
{{#if sonne}}est <strong>sonné</strong><img class="chat-inline-icon" src="icons/svg/stoned.svg" data-tooltip="charge" height="16" width="16" /> jusqu'à la fin du prochain round{{else}}n'est pas sonné{{/if}}!
|
|
||||||
{{#if hasPlayerOwner}}Jet d'endurance : {{jetEndurance}} / {{resteEndurance}}{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq show.recul 'encaisse')}}<div>{{alias}} ne recule pas malgré la violence du coup.</div>
|
|
||||||
{{else if (eq show.recul 'chute')}}<div>Sous la violence du coup, {{alias}} recule et chute au sol ! Il/elle ne pourra plus attaquer ce round.</div>
|
|
||||||
{{else if (eq show.recul 'recul')}}<div>La violence du coup fait reculer {{alias}} de quelques mètres ! Il/elle ne pourra plus attaquer ce round.</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
Reference in New Issue
Block a user