Fix #19 - Horoscope majeur

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

View File

@ -475,6 +475,7 @@
"BOL.chat.applydamagetotarget": "Appliquer les dommages à la cible", "BOL.chat.applydamagetotarget": "Appliquer les dommages à la cible",
"BOL.chat.fightoption": "Option de combat", "BOL.chat.fightoption": "Option de combat",
"BOL.chat.reroll": "Relancer (1 P. Heroisme)", "BOL.chat.reroll": "Relancer (1 P. Heroisme)",
"BOL.chat.heroicreminder": "En plus des actions indiquées sur les boutons ci-dessous, vous pouvez : <ul><li>Carnage : Attaquer une seconde fois le même adversaire</li><li>Coup précis : Un dé de malus à votre adversaire sur une localisation choisie</li><li>Désarmement</li><li>Massacrer la piétaille</li><li>Renversement : Renversez votre adversaire (1 taille de plus max)</li></ul>Si vous dépensez un Point dh'Eheoisme en plus, tout ces effets peuvent être doublés",
"BOL.chat.toheroic": "Transformer en succés Héroïque (1 P. Héroisme/Vilainie)", "BOL.chat.toheroic": "Transformer en succés Héroïque (1 P. Héroisme/Vilainie)",
"BOL.chat.tolegend": "Transformer en succes Légendaire (1 P. Heroisme/Vilainie)", "BOL.chat.tolegend": "Transformer en succes Légendaire (1 P. Heroisme/Vilainie)",
"BOL.chat.hurttitle": "{name} va encaisser {damageTotal} dégats !", "BOL.chat.hurttitle": "{name} va encaisser {damageTotal} dégats !",
@ -518,8 +519,8 @@
"BOL.chat.horoscopepoints": "Coût : {points} Points d'Astrologie", "BOL.chat.horoscopepoints": "Coût : {points} Points d'Astrologie",
"BOL.chat.horoscopeminorsuccess": "Votre horoscope mineur est un succès : éditez le nom de l'horoscope sur votre fiche. Vous bénéficiez d'1 dé Bonus pour cette situation.", "BOL.chat.horoscopeminorsuccess": "Votre horoscope mineur est un succès : éditez le nom de l'horoscope sur votre fiche. Vous bénéficiez d'1 dé Bonus pour cette situation.",
"BOL.chat.horoscopeminorfailure": "Votre horoscope mineur est un échec : éditez le nom de l'horoscope sur votre fiche. Vous souffrez d'1 dé Malus pour cette situation.", "BOL.chat.horoscopeminorfailure": "Votre horoscope mineur est un échec : éditez le nom de l'horoscope sur votre fiche. Vous souffrez d'1 dé Malus pour cette situation.",
"BOL.chat.horoscopemajorsuccess": "Votre horoscope majeur est un succès : vous bénéficiez d'1 point d'Héroisme pour cette aventure. Ce point a été ajouté automatiquement.", "BOL.chat.horoscopemajorsuccess": "Votre horoscope majeur est un succès : {horoscopeName} bénéficie d'1 point d'Héroisme de plus pour cette aventure. Ce point a été ajouté automatiquement.",
"BOL.chat.horoscopemajorfailure": "Votre horoscope majeur est un échec : vous perdez 1 point d'Héroisme pour cette aventure. Ce point a été enlevé automatiquement.", "BOL.chat.horoscopemajorfailure": "Votre horoscope majeur est un échec : {horoscopeName} a perdu 1 point d'Héroisme pour cette aventure. Ce point a été enlevé automatiquement.",
"BOL.chat.horoscopemajorgroupsuccess": "Votre horoscope majeur de groupe est un succès. Vous et vos amis bénéficiez de {careerBonus} dés bonus pendant cette aventure.", "BOL.chat.horoscopemajorgroupsuccess": "Votre horoscope majeur de groupe est un succès. Vous et vos amis bénéficiez de {careerBonus} dés bonus pendant cette aventure.",
"BOL.chat.horoscopemajorgroupfailure": "Votre horoscope majeur de groupe est un échec. Vous et vos amis souffrez de {careerBonus} dés malus pendant cette aventure.", "BOL.chat.horoscopemajorgroupfailure": "Votre horoscope majeur de groupe est un échec. Vous et vos amis souffrez de {careerBonus} dés malus pendant cette aventure.",
"BOL.chat.usedhoroscope": "Horoscope utilisé", "BOL.chat.usedhoroscope": "Horoscope utilisé",
@ -535,7 +536,7 @@
"BOL.chat.criticalinfo": "C'est un succès Héroïque ou Légendaire ! Choisissez vos options et effets !", "BOL.chat.criticalinfo": "C'est un succès Héroïque ou Légendaire ! Choisissez vos options et effets !",
"BOL.chat.criticalbuttonjournal": "Succès Héroïque/Légendaire", "BOL.chat.criticalbuttonjournal": "Succès Héroïque/Légendaire",
"BOL.chat.losshp": "{name}} a perdu {lossHP} points de Vitalité. Si il se repose quelques minutes, il peut récupérer {recupHP} points de Vitalité.", "BOL.chat.losshp": "{{name}} a perdu {lossHP} points de Vitalité. Si il se repose quelques minutes, il peut récupérer {recupHP} points de Vitalité.",
"BOL.chat.applyrecup": "Récupérer pendant quelques minutes (+{recupHP} Vitalité)", "BOL.chat.applyrecup": "Récupérer pendant quelques minutes (+{recupHP} Vitalité)",
"BOL.chat.inforecup": "{name} vient de récupérer {recupHP} points de Vitalité après quelques minutes de repos.", "BOL.chat.inforecup": "{name} vient de récupérer {recupHP} points de Vitalité après quelques minutes de repos.",

View File

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

View File

@ -122,7 +122,7 @@ Hooks.once('ready', async function () {
BoLUtility.ready() BoLUtility.ready()
BoLCharacterSummary.ready() BoLCharacterSummary.ready()
registerUsageCount('bol') registerUsageCount(game.system.id)
welcomeMessage() welcomeMessage()

View File

@ -220,6 +220,9 @@ export class BoLRoll {
/* -------------------------------------------- */ /* -------------------------------------------- */
static horoscopeCheck(actor, event, horoscopeType) { static horoscopeCheck(actor, event, horoscopeType) {
let target = BoLUtility.getTarget()
let cost = (horoscopeType == "minor") ? 1 : 2 let cost = (horoscopeType == "minor") ? 1 : 2
if (cost > actor.getAstrologyPoints()) { if (cost > actor.getAstrologyPoints()) {
ui.notifications.warn(game.i18n.localize("BOL.ui.astrologyNoPoints")) ui.notifications.warn(game.i18n.localize("BOL.ui.astrologyNoPoints"))
@ -233,6 +236,7 @@ export class BoLRoll {
rollData.astrologyPointsCost = cost rollData.astrologyPointsCost = cost
rollData.label = game.i18n.localize('BOL.ui.makeHoroscope') rollData.label = game.i18n.localize('BOL.ui.makeHoroscope')
rollData.description = game.i18n.localize('BOL.ui.makeHoroscope') + " " + game.i18n.localize(rollData.horoscopeTypeLabel) rollData.description = game.i18n.localize('BOL.ui.makeHoroscope') + " " + game.i18n.localize(rollData.horoscopeTypeLabel)
rollData.targetId = target?.id
console.log("HOROSCOPE!", rollData); console.log("HOROSCOPE!", rollData);
return this.displayRollDialog(rollData); return this.displayRollDialog(rollData);
@ -685,6 +689,7 @@ export class BoLDefaultRoll {
flavor: msgFlavor, flavor: msgFlavor,
speaker: ChatMessage.getSpeaker({ actor: actor }), speaker: ChatMessage.getSpeaker({ actor: actor }),
}) })
this.rollData.roll = duplicate(this.rollData.roll) // Remove object, keep data (v111 ready)
msg.setFlag("world", "bol-roll-data", this.rollData) msg.setFlag("world", "bol-roll-data", this.rollData)
}) })
} }

View File

@ -33,6 +33,7 @@ export class BoLCombatManager extends Combat {
/************************************************************************************/ /************************************************************************************/
nextRound() { nextRound() {
if (game.user.isGM) {
let combatants = this.combatants.contents let combatants = this.combatants.contents
let autoRemoveDead = game.settings.get("bol", "auto-remove-dead") // Optionnal auto-removal of dead char. let autoRemoveDead = game.settings.get("bol", "auto-remove-dead") // Optionnal auto-removal of dead char.
for (let c of combatants) { for (let c of combatants) {
@ -40,34 +41,39 @@ export class BoLCombatManager extends Combat {
c.actor.clearRoundModifiers() c.actor.clearRoundModifiers()
let toRemove = [] let toRemove = []
if (autoRemoveDead && c.actor.type == "encounter" && (c.actor.system.chartype == "tough" || c.actor.system.chartype == "creature" || c.actor.system.chartype == "base") && c.actor.system.resources.hp.value <= 0) { if (autoRemoveDead && c.actor.type == "encounter" && (c.actor.system.chartype == "tough" || c.actor.system.chartype == "creature" || c.actor.system.chartype == "base") && c.actor.system.resources.hp.value <= 0) {
toRemove.push( c.id || c._id) toRemove.push(c.id || c._id)
} }
//console.log("REM", autoRemoveDead, toRemove, c.actor) //console.log("REM", autoRemoveDead, toRemove, c.actor)
if (toRemove.length>0) { if (toRemove.length > 0) {
this.deleteEmbeddedDocuments('Combatant', toRemove) this.deleteEmbeddedDocuments('Combatant', toRemove)
} }
} }
}
super.nextRound() super.nextRound()
} }
/************************************************************************************/ /************************************************************************************/
startCombat() { startCombat() {
if (game.user.isGM) {
let combatants = this.combatants.contents let combatants = this.combatants.contents
for (let c of combatants) { for (let c of combatants) {
let actor = game.actors.get(c.actorId) let actor = game.actors.get(c.actorId)
actor.storeVitaliteCombat() actor.storeVitaliteCombat()
} }
}
return super.startCombat() return super.startCombat()
} }
/************************************************************************************/ /************************************************************************************/
_onDelete() { _onDelete() {
if (game.user.isGM) {
let combatants = this.combatants.contents let combatants = this.combatants.contents
for (let c of combatants) { for (let c of combatants) {
let actor = game.actors.get(c.actorId) let actor = game.actors.get(c.actorId)
actor.clearInitiative() actor.clearInitiative()
actor.displayRecuperation() actor.displayRecuperation()
} }
}
super._onDelete() super._onDelete()
} }

View File

@ -27,8 +27,8 @@ export class BoLUtility {
onChange: lang => window.location.reload() onChange: lang => window.location.reload()
}) })
game.settings.register("bol", "auto-remove-dead", { game.settings.register("bol", "auto-remove-dead", {
name: "Enlever les PNJs morts automatiquement", name: "Enlever les PNJs morts automatiquement au round suivant",
hint: "Supprime les PNJ (piétaille, créatures, coriaces) automatiquement du combat lorsqu'ils sont à 0 Vitalité ou moins", hint: "Supprime les PNJ (piétaille, créatures, coriaces) automatiquement du combat lorsqu'ils sont à 0 Vitalité ou moins, lors du passage au round suivant",
scope: "world", scope: "world",
config: true, config: true,
default: false, default: false,

View File

@ -14,7 +14,7 @@
], ],
"url": "https://www.uberwald.me/gitea/public/bol", "url": "https://www.uberwald.me/gitea/public/bol",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"version": "10.5.14", "version": "10.5.15",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"verified": "10" "verified": "10"
@ -202,7 +202,7 @@
], ],
"socket": true, "socket": true,
"manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json", "manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.5.14.zip", "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.5.15.zip",
"background": "systems/bol/ui/page_accueil.webp", "background": "systems/bol/ui/page_accueil.webp",
"gridDistance": 1.5, "gridDistance": 1.5,
"gridUnits": "m", "gridUnits": "m",

View File

@ -3,5 +3,7 @@
{{#if isCritical}} {{#if isCritical}}
<button class="chat-damage-roll bol-margin-tb-2 " data-damage-mode="damage-plus-6" data-attack-id="{{id}}">{{localize "BOL.chat.rolldamage6"}}</button> <button class="chat-damage-roll bol-margin-tb-2 " data-damage-mode="damage-plus-6" data-attack-id="{{id}}">{{localize "BOL.chat.rolldamage6"}}</button>
{{#if isRealCritical}}
<button class="chat-damage-roll bol-margin-tb-2" data-damage-mode="damage-plus-12" data-attack-id="{{id}}">{{localize "BOL.chat.rolldamage12"}}</button> <button class="chat-damage-roll bol-margin-tb-2" data-damage-mode="damage-plus-12" data-attack-id="{{id}}">{{localize "BOL.chat.rolldamage12"}}</button>
{{/if}} {{/if}}
{{/if}}

View File

@ -60,11 +60,17 @@
<a class="content-link" draggable="true" data-uuid="Compendium.bol.aides-de-jeu.Yl1RKQb0BjVUtilk" data-id="Yl1RKQb0BjVUtilk" data-type="JournalEntry" data-pack="bol.aides-de-jeu" data-tooltip="un journal"> <a class="content-link" draggable="true" data-uuid="Compendium.bol.aides-de-jeu.Yl1RKQb0BjVUtilk" data-id="Yl1RKQb0BjVUtilk" data-type="JournalEntry" data-pack="bol.aides-de-jeu" data-tooltip="un journal">
<i class="fas fa-book-open"></i>{{localize "BOL.chat.criticalbuttonjournal"}}</a> <i class="fas fa-book-open"></i>{{localize "BOL.chat.criticalbuttonjournal"}}</a>
</div> </div>
{{#if (and isCritical weapon)}}
<div>
{{{localize "BOL.chat.heroicreminder"}}}
</div>
{{/if}}
{{/if}} {{/if}}
{{#if (and isSuccess weapon)}} {{#if (and isSuccess weapon)}}
{{> "systems/bol/templates/chat/rolls/attack-damage-card.hbs"}} {{> "systems/bol/templates/chat/rolls/attack-damage-card.hbs"}}
{{/if}} {{/if}}
{{#if (and isSuccess spell)}} {{#if (and isSuccess spell)}}
{{> "systems/bol/templates/chat/rolls/spell-roll-card.hbs"}} {{> "systems/bol/templates/chat/rolls/spell-roll-card.hbs"}}
{{/if}} {{/if}}

View File

@ -11,9 +11,9 @@
{{#if (eq horoscopeType "major")}} {{#if (eq horoscopeType "major")}}
{{#if isSuccess}} {{#if isSuccess}}
{{localize "BOL.chat.horoscopemajorsuccess"}} {{localize "BOL.chat.horoscopemajorsuccess" horoscopeName=horoscopeName}}
{{else}} {{else}}
{{localize "BOL.chat.horoscopemajorfailure"}} {{localize "BOL.chat.horoscopemajorfailure" horoscopeName=horoscopeName}}
{{/if}} {{/if}}
{{/if}} {{/if}}