diff --git a/src/lang/en.json b/src/lang/en.json index 3fcfaa7..7ec82ec 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -32,6 +32,9 @@ "OSE.roll.exploration": "{exploration} test", "OSE.roll.details.exploration": "Roll 1d6 <= {expl} for success", "OSE.roll.reaction": "Reaction roll", + "OSE.roll.type.result": "Result", + "OSE.roll.type.above": "Above", + "OSE.roll.type.below": "Below", "OSE.details.name": "Name", "OSE.details.class": "Class", @@ -169,6 +172,8 @@ "OSE.items.Quantity": "Qt.", "OSE.items.Roll": "Roll", "OSE.items.BlindRoll": "Blind", + "OSE.items.RollTarget": "Target", + "OSE.items.RollType": "Type", "OSE.items.Damage": "Damage", "OSE.items.Melee": "Melee", "OSE.items.Missile": "Missile", diff --git a/src/lang/es.json b/src/lang/es.json index c36a952..adf3727 100644 --- a/src/lang/es.json +++ b/src/lang/es.json @@ -32,6 +32,9 @@ "OSE.roll.exploration": "Prueba de {exploration}", "OSE.roll.details.exploration": "Tirar 1d6 <= {expl} para éxito", "OSE.roll.reaction": "Tirada de Reacción", + "OSE.roll.type.result": "Resultado", + "OSE.roll.type.above": "Encima", + "OSE.roll.type.below": "Debajo", "OSE.details.name": "Nombre", "OSE.details.class": "Clase", @@ -167,6 +170,8 @@ "OSE.items.Quantity": "Qt.", "OSE.items.Roll": "Tirada", "OSE.items.BlindRoll": "Ciega", + "OSE.items.RollTarget": "Mira", + "OSE.items.RollType": "Tipo", "OSE.items.Damage": "Daño", "OSE.items.Melee": "CC", "OSE.items.Missile": "Distancia", diff --git a/src/lang/fr.json b/src/lang/fr.json index 673d6b0..2354e8b 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -32,6 +32,9 @@ "OSE.roll.exploration": "Test de {exploration}", "OSE.roll.details.exploration": "Lancez 1d6 <= {expl} pour réussir", "OSE.roll.reaction": "Jet de Réaction", + "OSE.roll.type.result": "Resultat", + "OSE.roll.type.above": "Au-Dessus", + "OSE.roll.type.below": "En-Dessous", "OSE.details.name": "Nom", "OSE.details.class": "Classe", @@ -109,9 +112,9 @@ "OSE.MeleeShort": "MEL", "OSE.Melee": "Mêlée", "OSE.MeleeBonus": "Bonus de Mêlée", - "OSE.MissileShort": "PRO", - "OSE.Missile": "Projectiles", - "OSE.MissileBonus": "Bonus de Projectile", + "OSE.MissileShort": "DIS", + "OSE.Missile": "Distance", + "OSE.MissileBonus": "Bonus à Distance", "OSE.Initiative": "Initiative", "OSE.InitiativeBonus": "Bonus d'Initiative", "OSE.InitiativeShort": "INIT", @@ -167,9 +170,11 @@ "OSE.items.Quantity": "Qt.", "OSE.items.Roll": "Jet", "OSE.items.BlindRoll": "Aveugle", + "OSE.items.RollTarget": "Cible", + "OSE.items.RollType": "Type", "OSE.items.Damage": "Dégâts", "OSE.items.Melee": "Mêlée", - "OSE.items.Missile": "Projectile", + "OSE.items.Missile": "Distance", "OSE.items.Slow": "Lent", "OSE.items.ArmorAC": "CA", "OSE.items.ArmorAAC": "CAA", diff --git a/src/module/actor/entity.js b/src/module/actor/entity.js index d8b8efa..7cfbb54 100644 --- a/src/module/actor/entity.js +++ b/src/module/actor/entity.js @@ -71,7 +71,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Above", + type: "above", target: this.data.data.saves[save].value, details: game.i18n.format("OSE.roll.details.save", { save: label }), }, @@ -99,7 +99,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Below", + type: "below", target: this.data.data.details.morale, }, }, @@ -125,7 +125,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Below", + type: "below", target: this.data.data.retainer.loyalty, }, }, @@ -151,7 +151,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Table", + type: "table", table: { 2: game.i18n.format("OSE.reaction.Hostile", { name: this.data.name, @@ -195,7 +195,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Check", + type: "check", target: this.data.data.scores[score].value, details: game.i18n.format("OSE.roll.details.attribute", { score: label, @@ -226,7 +226,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Hit Dice", + type: "hit dice", }, }, }; @@ -257,7 +257,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Appearing", + type: "appearing", }, }, }; @@ -282,7 +282,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Below", + type: "below", target: this.data.data.exploration[expl], details: game.i18n.format("OSE.roll.details.exploration", { expl: label, @@ -312,7 +312,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Damage", + type: "damage", stat: attData.type, scores: data.scores, }, @@ -389,7 +389,7 @@ export class OseActor extends Actor { ...this.data, ...{ rollData: { - type: "Attack", + type: "attack", thac0: thac0, weapon: { parts: dmgParts, diff --git a/src/module/config.js b/src/module/config.js index 496f933..f36530d 100644 --- a/src/module/config.js +++ b/src/module/config.js @@ -7,6 +7,11 @@ export const OSE = { con: "OSE.scores.con.long", cha: "OSE.scores.cha.long", }, + roll_type: { + result: "OSE.roll.type.result", + above: "OSE.roll.type.above", + below: "OSE.roll.type.below" + }, saves_short: { death: "OSE.saves.death.short", wand: "OSE.saves.wand.short", @@ -60,5 +65,10 @@ export const OSE = { "Ogre", "Orcish", "Pixie" - ] + ], + tags: { + melee: "OSE.items.Melee", + missile: "OSE.items.Missile", + slow: "OSE.items.Slow", + } }; diff --git a/src/module/dice.js b/src/module/dice.js index 48ec28c..5c93d24 100644 --- a/src/module/dice.js +++ b/src/module/dice.js @@ -7,28 +7,28 @@ export class OseDice { }; let die = roll.parts[0].total; - if (data.rollData.type == "Above") { + if (data.rollData.type == "above") { // SAVING THROWS if (roll.total >= result.target) { result.isSuccess = true; } else { result.isFailure = true; } - } else if (data.rollData.type == "Below") { + } else if (data.rollData.type == "below") { // MORALE, EXPLORATION if (roll.total <= result.target) { result.isSuccess = true; } else { result.isFailure = true; } - } else if (data.rollData.type == "Check") { + } else if (data.rollData.type == "check") { // SCORE CHECKS (1s and 20s) if (die == 1 || (roll.total <= result.target && die < 20)) { result.isSuccess = true; } else { result.isFailure = true; } - } else if (data.rollData.type == "Table") { + } else if (data.rollData.type == "table") { // Reaction let table = data.rollData.table; let output = ""; @@ -251,7 +251,7 @@ export class OseDice { speaker: speaker }; if (skipDialog) { - return data.rollData.type === "Attack" + return data.rollData.type === "attack" ? OseDice.sendAttackRoll(rollData) : OseDice.sendRoll(rollData); } @@ -264,7 +264,7 @@ export class OseDice { rolled = true; rollData.form = html[0].children[0]; roll = - data.rollData.type === "Attack" + data.rollData.type === "attack" ? OseDice.sendAttackRoll(rollData) : OseDice.sendRoll(rollData); }, diff --git a/src/module/item/entity.js b/src/module/item/entity.js index 624a78c..8fb71b8 100644 --- a/src/module/item/entity.js +++ b/src/module/item/entity.js @@ -102,19 +102,23 @@ export class OseItem extends Item { } async rollFormula(options = {}) { - if (!this.data.data.roll) { + const data = this.data.data; + if (!data.roll) { throw new Error("This Item does not have a formula to roll!"); } const label = `${this.name}`; - const rollParts = [this.data.data.roll]; + const rollParts = [data.roll]; - const data = { + let type = data.rollType; + + const newData = { ...this.data, ...{ rollData: { - type: "Formula", - blindroll: this.data.data.blindroll, + type: type, + target: data.rollTarget, + blindroll: data.blindroll, }, }, }; @@ -123,7 +127,7 @@ export class OseItem extends Item { return OseDice.Roll({ event: options.event, parts: rollParts, - data: data, + data: newData, skipDialog: true, speaker: ChatMessage.getSpeaker({ actor: this }), flavor: game.i18n.format("OSE.roll.formula", { label: label }), @@ -144,8 +148,8 @@ export class OseItem extends Item { getTags() { let formatTag = (tag) => { if (!tag) return ""; - return `