Ajout démons
This commit is contained in:
@@ -96,12 +96,12 @@ export default class MournbladeEnchantementDialog {
|
||||
label: "Enchanter",
|
||||
icon: "fa-solid fa-star",
|
||||
default: true,
|
||||
callback: (event, button, dialog) => {
|
||||
callback: async (event, button, dialog) => {
|
||||
const elems = button.form.elements
|
||||
const ptsAme = parseInt(elems["ptsAme"]?.value ?? 5) || 5
|
||||
const antiChaos = elems["antiChaos"]?.value === "true"
|
||||
const modificateur = parseInt(elems["modificateur"]?.value ?? 0) || 0
|
||||
MournbladeUtility.rollEnchantement({
|
||||
await MournbladeUtility.rollEnchantement({
|
||||
actor,
|
||||
item,
|
||||
ptsAme,
|
||||
|
||||
@@ -104,11 +104,11 @@ export default class MournbladeInvocationDemonDialog {
|
||||
label: "Invoquer",
|
||||
icon: "fa-solid fa-skull",
|
||||
default: true,
|
||||
callback: (event, button, dialog) => {
|
||||
callback: async (event, button, dialog) => {
|
||||
MournbladeInvocationDemonDialog._updateRollData(rollData, button.form.elements, actor, {
|
||||
coercitionComp, hautParlerComp, loiChaosComp
|
||||
})
|
||||
MournbladeUtility.rollInvocationDemon(rollData)
|
||||
await MournbladeUtility.rollInvocationDemon(rollData)
|
||||
}
|
||||
},
|
||||
],
|
||||
|
||||
@@ -80,9 +80,9 @@ export default class MournbladeInvocationDialog {
|
||||
label: "Invoquer",
|
||||
icon: "fa-solid fa-wind",
|
||||
default: true,
|
||||
callback: (event, button, dialog) => {
|
||||
callback: async (event, button, dialog) => {
|
||||
MournbladeInvocationDialog._updateRollData(rollData, button.form.elements, actor, pactes)
|
||||
MournbladeUtility.rollInvocationElementaire(rollData)
|
||||
await MournbladeUtility.rollInvocationElementaire(rollData)
|
||||
}
|
||||
},
|
||||
],
|
||||
|
||||
@@ -82,11 +82,11 @@ export default class MournbladeInvocationEspritDialog {
|
||||
label: "Invoquer",
|
||||
icon: "fa-solid fa-star",
|
||||
default: true,
|
||||
callback: (event, button, dialog) => {
|
||||
callback: async (event, button, dialog) => {
|
||||
MournbladeInvocationEspritDialog._updateRollData(rollData, button.form.elements, actor, {
|
||||
persuasionComp, hautParlerComp, loiChaosComp
|
||||
})
|
||||
MournbladeUtility.rollInvocationEsprit(rollData)
|
||||
await MournbladeUtility.rollInvocationEsprit(rollData)
|
||||
}
|
||||
},
|
||||
],
|
||||
|
||||
@@ -45,20 +45,20 @@ export class MournbladeRollDialog {
|
||||
label: "Lancer 1d10",
|
||||
icon: "fa-solid fa-dice-d10",
|
||||
default: true,
|
||||
callback: (event, button, dialog) => {
|
||||
callback: async (event, button, dialog) => {
|
||||
this._updateRollDataFromForm(rollData, button.form.elements, actor)
|
||||
rollData.mainDice = "1d10"
|
||||
MournbladeUtility.rollMournblade(rollData)
|
||||
await MournbladeUtility.rollMournblade(rollData)
|
||||
}
|
||||
},
|
||||
{
|
||||
action: "rolld20",
|
||||
label: "Lancer 1d20",
|
||||
icon: "fa-solid fa-dice-d20",
|
||||
callback: (event, button, dialog) => {
|
||||
callback: async (event, button, dialog) => {
|
||||
this._updateRollDataFromForm(rollData, button.form.elements, actor)
|
||||
rollData.mainDice = "1d20"
|
||||
MournbladeUtility.rollMournblade(rollData)
|
||||
await MournbladeUtility.rollMournblade(rollData)
|
||||
}
|
||||
},
|
||||
],
|
||||
@@ -108,20 +108,20 @@ export class MournbladeRollDialog {
|
||||
label: "Lancer 1d10",
|
||||
icon: "fa-solid fa-dice-d10",
|
||||
default: true,
|
||||
callback: (event, button, dialog) => {
|
||||
callback: async (event, button, dialog) => {
|
||||
this._updateSortilegeRollData(rollData, button.form.elements, actor)
|
||||
rollData.mainDice = "1d10"
|
||||
MournbladeUtility.rollSortilege(rollData)
|
||||
await MournbladeUtility.rollSortilege(rollData)
|
||||
}
|
||||
},
|
||||
{
|
||||
action: "rolld20",
|
||||
label: "Lancer 1d20",
|
||||
icon: "fa-solid fa-dice-d20",
|
||||
callback: (event, button, dialog) => {
|
||||
callback: async (event, button, dialog) => {
|
||||
this._updateSortilegeRollData(rollData, button.form.elements, actor)
|
||||
rollData.mainDice = "1d20"
|
||||
MournbladeUtility.rollSortilege(rollData)
|
||||
await MournbladeUtility.rollSortilege(rollData)
|
||||
}
|
||||
},
|
||||
],
|
||||
@@ -169,9 +169,9 @@ export class MournbladeRollDialog {
|
||||
label: "Préparer",
|
||||
icon: "fa-solid fa-flask",
|
||||
default: true,
|
||||
callback: (event, button, dialog) => {
|
||||
callback: async (event, button, dialog) => {
|
||||
MournbladeRollDialog._updatePotionRollData(rollData, button.form.elements, actor)
|
||||
MournbladeUtility.rollPotion(rollData)
|
||||
await MournbladeUtility.rollPotion(rollData)
|
||||
}
|
||||
},
|
||||
],
|
||||
|
||||
+19
-12
@@ -294,7 +294,7 @@ export class MournbladeActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getVitesseBase() {
|
||||
return 5 + __vitesseBonus[this.system.attributs.adr.value]
|
||||
return 5 + __vitesseBonus[Math.min(21, Math.max(0, this.system.attributs.adr.value))]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -396,7 +396,7 @@ export class MournbladeActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
incDecSante(type, value, applyArmure = true) {
|
||||
async incDecSante(type, value, applyArmure = true) {
|
||||
value = Number(value)
|
||||
if (value && applyArmure) {
|
||||
let protection = this.getProtectionTotal()
|
||||
@@ -417,19 +417,19 @@ export class MournbladeActor extends Actor {
|
||||
if (value && type == "nonletaux") {
|
||||
newSante["letaux"] += value
|
||||
}
|
||||
this.update({ 'system.sante': newSante })
|
||||
await this.update({ 'system.sante': newSante })
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
incDecAme(value) {
|
||||
async incDecAme(value) {
|
||||
value = Number(value)
|
||||
if (value) {
|
||||
let newAme = foundry.utils.duplicate(this.system.ame)
|
||||
newAme.value += Number(value)
|
||||
newAme.value = Math.max(0, newAme.value)
|
||||
newAme.value = Math.min(newAme.value, newAme.currentmax)
|
||||
this.update({ 'system.ame': newAme })
|
||||
await this.update({ 'system.ame': newAme })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,10 +439,10 @@ export class MournbladeActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
changeBonneAventure(value) {
|
||||
async changeBonneAventure(value) {
|
||||
let newBA = this.system.bonneaventure.actuelle
|
||||
newBA += value
|
||||
this.update({ 'system.bonneaventure.actuelle': newBA })
|
||||
await this.update({ 'system.bonneaventure.actuelle': newBA })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -451,10 +451,10 @@ export class MournbladeActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
changeEclat(value) {
|
||||
async changeEclat(value) {
|
||||
let newE = this.system.eclat.value
|
||||
newE += value
|
||||
this.update({ 'system.eclat.value': newE })
|
||||
await this.update({ 'system.eclat.value': newE })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -485,7 +485,7 @@ export class MournbladeActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getAttribute(attrKey) {
|
||||
return this.system.attributes[attrKey]
|
||||
return this.system.attributs[attrKey]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -493,7 +493,7 @@ export class MournbladeActor extends Actor {
|
||||
if (this.type == "creature") {
|
||||
return 0
|
||||
}
|
||||
return __degatsBonus[this.system.attributs.pui.value]
|
||||
return __degatsBonus[Math.min(21, Math.max(0, this.system.attributs.pui.value))]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -921,7 +921,14 @@ export class MournbladeActor extends Actor {
|
||||
arme = this.prepareBouclier(arme)
|
||||
}
|
||||
//Unused rollData.degatsFormula = arme.system.totalDegats
|
||||
let roll = await new Roll(arme.system.totalDegats).evaluate()
|
||||
let roll
|
||||
try {
|
||||
roll = await new Roll(arme.system.totalDegats).evaluate()
|
||||
} catch (err) {
|
||||
ui.notifications.error(`Formule de dégâts invalide : ${arme.system.totalDegats}`)
|
||||
console.error("rollArmeDegats error:", err)
|
||||
return
|
||||
}
|
||||
await MournbladeUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode"));
|
||||
let rollData = {
|
||||
degatsFormula: arme.system.totalDegats,
|
||||
|
||||
@@ -92,6 +92,7 @@ export class MournbladeConfig {
|
||||
demoniaque: game.i18n.localize("MNBL.typeCapaciteDemoniaque"),
|
||||
automaton: game.i18n.localize("MNBL.typeCapaciteAutomaton"),
|
||||
creature: game.i18n.localize("MNBL.typeCapaciteCreature"),
|
||||
faiblessedemoniaque: game.i18n.localize("MNBL.typeCapaciteFaiblesseDemoniaque"),
|
||||
},
|
||||
creatureTypeOptions: {
|
||||
creature: game.i18n.localize("MNBL.creatureTypeCreature"),
|
||||
|
||||
@@ -16,7 +16,6 @@ export const defaultItemImg = {
|
||||
tendance: "systems/fvtt-mournblade/assets/icons/tendance.webp",
|
||||
traitchaotique: "systems/fvtt-mournblade/assets/icons/traitchaotique.webp",
|
||||
traitespece: "systems/fvtt-mournblade/assets/icons/capacite.webp",
|
||||
potion: "systems/fvtt-mournblade/assets/icons/potion.svg",
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,7 +123,7 @@ async function welcomeMessage() {
|
||||
const templateData = {};
|
||||
const html = await foundry.applications.handlebars.renderTemplate("systems/fvtt-mournblade/templates/chat-welcome-message.hbs", templateData);
|
||||
|
||||
ChatMessage.create({
|
||||
await ChatMessage.create({
|
||||
user: game.user.id,
|
||||
whisper: [game.user.id],
|
||||
content: html
|
||||
@@ -144,7 +144,7 @@ async function importDefaultScene() {
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
Hooks.once("ready", function () {
|
||||
Hooks.once("ready", async function () {
|
||||
|
||||
game.system.mournblade = {
|
||||
config : MournbladeConfig.getConfig(),
|
||||
@@ -154,14 +154,14 @@ Hooks.once("ready", function () {
|
||||
// User warning
|
||||
if (!game.user.isGM && game.user.character == undefined) {
|
||||
ui.notifications.info("Attention ! Aucun personnage n'est relié au joueur !");
|
||||
ChatMessage.create({
|
||||
await ChatMessage.create({
|
||||
content: "<b>ATTENTION</b> Le joueur " + game.user.name + " n'est relié à aucun personnage !",
|
||||
user: game.user.id
|
||||
});
|
||||
}
|
||||
if (!game.user.isGM && game.user.character && !game.user.character.prototypeToken.actorLink) {
|
||||
ui.notifications.info("Le token de du joueur n'est pas connecté à l'acteur !");
|
||||
ChatMessage.create({
|
||||
await ChatMessage.create({
|
||||
content: "<b>ATTENTION</b> Le token du joueur " + game.user.name + " n'est pas connecté à l'acteur !",
|
||||
user: game.user.id
|
||||
});
|
||||
|
||||
@@ -884,7 +884,8 @@ export class MournbladeUtility {
|
||||
let target = MournbladeUtility.getTarget()
|
||||
if (target) {
|
||||
rollData.defenderTokenId = target.id
|
||||
let defender = game.canvas.tokens.get(rollData.defenderTokenId)?.actor
|
||||
let defender = game.canvas?.tokens?.get(rollData.defenderTokenId)?.actor
|
||||
if (!defender) return
|
||||
rollData.defenderCombatValues = defender.getCombatValues()
|
||||
rollData.defender = defender.toObject() // Simpler
|
||||
rollData.defenderDefense = defender.getBestDefenseValue()
|
||||
@@ -1262,11 +1263,11 @@ export class MournbladeUtility {
|
||||
}
|
||||
} else if (rollData.isDramatique) {
|
||||
// All soul lost
|
||||
actor.subPointsAme("prononcer", soulCost)
|
||||
await actor.subPointsAme("prononcer", soulCost)
|
||||
} else {
|
||||
// Simple failure: half soul lost (round up)
|
||||
ameDeduct = Math.ceil(soulCost / 2)
|
||||
actor.subPointsAme("prononcer", ameDeduct)
|
||||
await actor.subPointsAme("prononcer", ameDeduct)
|
||||
}
|
||||
|
||||
rollData.invocationSoulDeducted = rollData.isSuccess || rollData.isHeroique ? soulCost : ameDeduct
|
||||
|
||||
Reference in New Issue
Block a user