Initial release

This commit is contained in:
2023-02-01 19:48:35 +01:00
parent 64ce2fcbb9
commit 04909ef841
26 changed files with 287 additions and 671 deletions

View File

@ -155,20 +155,7 @@ export class MaleficesUtility {
const templatePaths = [
'systems/fvtt-malefices/templates/actors/editor-notes-gm.hbs',
'systems/fvtt-malefices/templates/items/partial-item-nav.hbs',
'systems/fvtt-malefices/templates/items/partial-item-description.hbs',
'systems/fvtt-malefices/templates/items/partial-common-item-fields.hbs',
'systems/fvtt-malefices/templates/items/partial-options-damage-types.hbs',
'systems/fvtt-malefices/templates/items/partial-options-weapon-types.hbs',
'systems/fvtt-malefices/templates/items/partial-options-weapon-categories.hbs',
'systems/fvtt-malefices/templates/items/partial-options-attributes.hbs',
'systems/fvtt-malefices/templates/items/partial-options-equipment-types.hbs',
'systems/fvtt-malefices/templates/items/partial-options-armor-types.hbs',
'systems/fvtt-malefices/templates/items/partial-options-spell-types.hbs',
'systems/fvtt-malefices/templates/items/partial-options-spell-levels.hbs',
'systems/fvtt-malefices/templates/items/partial-options-spell-schools.hbs',
'systems/fvtt-malefices/templates/items/partial-options-focus-bond.hbs',
'systems/fvtt-malefices/templates/items/partial-options-focus-treatment.hbs',
'systems/fvtt-malefices/templates/items/partial-options-focus-core.hbs',
'systems/fvtt-malefices/templates/items/partial-item-description.hbs'
]
return loadTemplates(templatePaths);
}
@ -508,26 +495,10 @@ export class MaleficesUtility {
static async rollMalefices(rollData) {
let actor = game.actors.get(rollData.actorId)
// Build the dice formula
let diceFormula = "1d12"
if (rollData.skill) {
diceFormula += "+" + rollData.skill.finalvalue
}
if (rollData.crafting) {
diceFormula += "+" + rollData.crafting.system.level
}
if (rollData.spellAttack) {
diceFormula += "+" + rollData.spellAttack
}
diceFormula += "+" + rollData.bonusMalusRoll
if (rollData.skill && rollData.skill.good) {
diceFormula += "+1d4"
}
if (rollData.weapon ) {
diceFormula += "+" + rollData.weapon.attackBonus
}
let diceFormula = "1d20"
rollData.target = rollData.attr.value + rollData.bonusMalusPerso + rollData.bonusMalusSituation + rollData.bonusMalusDef
rollData.diceFormula = diceFormula
// Performs roll
@ -540,22 +511,26 @@ export class MaleficesUtility {
rollData.roll = myRoll
rollData.isSuccess = false
if (rollData.targetCheck != "none") {
if (myRoll.total >= Number(rollData.targetCheck)) {
rollData.isSuccess = true
}
if (myRoll.total <= rollData.target ) {
rollData.isSuccess = true
}
if (rollData.spell) {
actor.spentFocusPoints(rollData.spell)
if (myRoll.total == 1 ) {
rollData.isSuccess = true
rollData.isCritical = true
}
if (myRoll.total == 20 ) {
rollData.isSuccess = false
rollData.isFumble = true
}
if (myRoll.total <= Math.floor(rollData.target/3) ) {
rollData.isPart = true
}
let msg = await this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-malefices/templates/chat/chat-generic-result.hbs`, rollData)
})
msg.setFlag("world", "rolldata", rollData)
if (rollData.skillKey == "initiative") {
console.log("REGISTERED")
if (rollData.mode == "initiative") {
actor.setFlag("world", "initiative", myRoll.total)
}
@ -649,8 +624,9 @@ export class MaleficesUtility {
static getBasicRollData() {
let rollData = {
rollId: randomID(16),
bonusMalusRoll: 0,
targetCheck: "none",
bonusMalusPerso: 0,
bonusMalusSituation: 0,
bonusMalusDef: 0,
rollMode: game.settings.get("core", "rollMode")
}
MaleficesUtility.updateWithTarget(rollData)