Fix #19 - Horoscope majeur

This commit is contained in:
2023-04-29 21:48:51 +02:00
parent 41fbc094bb
commit 59ee6684ab
10 changed files with 66 additions and 38 deletions

View File

@ -505,11 +505,17 @@ export class BoLActor extends Actor {
this.createEmbeddedDocuments('Item', [horoscope])
}
if (rollData.horoscopeType == "major") {
if (rollData.isSuccess) {
this.subHeroPoints(1)
} else {
this.addHeroPoints(1)
let actorHoroscope = this
if(rollData.targetId) {
let token = game.scenes.current.tokens.get(rollData.targetId)
actorHoroscope = token.actor
}
if (rollData.isSuccess) {
actorHoroscope.addHeroPoints(1)
} else {
actorHoroscope.subHeroPoints(1)
}
rollData.horoscopeName = actorHoroscope.name
}
if (rollData.horoscopeType == "majorgroup") {
let rID = randomID(16)
@ -800,6 +806,7 @@ export class BoLActor extends Actor {
whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name),
content: await renderTemplate('systems/bol/templates/chat/chat-recup-information.hbs', {
name: this.name,
img: this.img,
actorId: this.id,
lossHP: lossHP,
recupHP: Math.ceil(lossHP / 2)
@ -811,7 +818,8 @@ export class BoLActor extends Actor {
/*-------------------------------------------- */
async applyRecuperation(recupHP) {
let hp = duplicate(this.system.resources.hp)
hp.value += recupHP
//console.log("RECUP !!!!", hp, recupHP)
hp.value += Number(recupHP)
hp.value = Math.min(hp.value, hp.max)
this.update({ 'system.resources.hp': hp })
let msg = await ChatMessage.create({