diff --git a/lang/de.json b/lang/de.json index 25cb5e3..ca5ef6b 100644 --- a/lang/de.json +++ b/lang/de.json @@ -197,6 +197,8 @@ "midgard5.enduranceBonus": "Ausdauerbonus", "midgard5.lpProtection": "Rüstungsschutz (LP)", "midgard5.apProtection": "Rüstungsschutz (AP)", + "midgard5.perception" : "Wahrnehmung", + "midgard5.drinking" : "Trinken", "midgard5.new-skill": "Neue Fertigkeit", "midgard5.special": "Spezial", @@ -305,6 +307,8 @@ "midgard5.mod-stat-ap": "Ausdauerpunkte", "midgard5.mod-stat-lpProtection": "Rüstungsschutz (LP)", "midgard5.mod-stat-apProtection": "Rüstungsschutz (AP)", + "midgard.mod-stat-perception" : "Wahrnehmung", + "midgard.mod-stat-drinking" : "Trinken", "midgard5.mod-type": "Typ der Modifikation", "midgard5.mod-id": "Was soll modifiziert werden", diff --git a/source/module/M5Base.ts b/source/module/M5Base.ts index 60c64fa..60619c4 100644 --- a/source/module/M5Base.ts +++ b/source/module/M5Base.ts @@ -84,6 +84,8 @@ export enum M5Stats { AP = "ap", PROTECTION_LP = "lpProtection", PROTECTION_AP = "apProtection", + PERCEPTION = "perception", + DRINKING = "Trinken" } export enum M5ModType { @@ -166,6 +168,10 @@ export interface M5CharacterCalculatedData { brawlEw: number; poisonResistance: M5ModResult; enduranceBonus: number; + perception: M5ModResult; + perceptionEW: number; + drinking: M5ModResult; + drinkingEW: number; }; skillMods: {}; skills: { diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index 91e2543..fd4dcc8 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -67,6 +67,10 @@ export class M5Character extends Actor { brawlEw: 0, poisonResistance: { value: 0, mods: [] }, enduranceBonus: 0, + perception: {value: 0, mods: []}, + perceptionEW: 0, + drinking: {value: 0, mods: []}, + drinkingEW: 0, }, skillMods: {}, skills: { @@ -135,6 +139,10 @@ export class M5Character extends Actor { ret.stats.brawlEw = ret.stats.brawl.value + ret.stats.attackBonus.value + (data.info.race === "Zwerg" ? 1 : 0); ret.stats.poisonResistance = this.modResult(30 + Math.floor(ret.attributes.ko.value / 2)); ret.stats.enduranceBonus = Math.floor(ret.attributes.ko.value / 10) + Math.floor(ret.attributes.st.value / 20); + ret.stats.perception = this.modResult(0); + ret.stats.perceptionEW = 6; + ret.stats.drinking = this.modResult(Math.floor(ret.attributes.ko.value / 10)); + ret.stats.drinkingEW = ret.stats.drinking.value; if (!skip?.mods) { const aggregate = new M5ModAggregate(data, ret); diff --git a/source/module/actors/M5ModAggregate.ts b/source/module/actors/M5ModAggregate.ts index 702d52b..63350eb 100644 --- a/source/module/actors/M5ModAggregate.ts +++ b/source/module/actors/M5ModAggregate.ts @@ -41,6 +41,8 @@ export default class M5ModAggregate { this.push({ type: M5ModType.STAT, id: M5Stats.AP, operation: M5ModOperation.SET, value: calc.stats.ap.value }, characterString); this.push({ type: M5ModType.STAT, id: M5Stats.PROTECTION_LP, operation: M5ModOperation.SET, value: calc.stats.lpProtection.value }, characterString); this.push({ type: M5ModType.STAT, id: M5Stats.PROTECTION_AP, operation: M5ModOperation.SET, value: calc.stats.apProtection.value }, characterString); + this.push({ type: M5ModType.STAT, id: M5Stats.PERCEPTION, operation: M5ModOperation.SET, value: calc.stats.perception.value }, characterString); + this.push({ type: M5ModType.STAT, id: M5Stats.DRINKING, operation: M5ModOperation.SET, value: calc.stats.drinking.value }, characterString); } push(mod: M5ItemMod, source: string) { diff --git a/source/module/rolls/M5Roll.ts b/source/module/rolls/M5Roll.ts index 141fb7e..e5f2a14 100644 --- a/source/module/rolls/M5Roll.ts +++ b/source/module/rolls/M5Roll.ts @@ -1,6 +1,7 @@ import { Evaluated } from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/client/dice/roll"; import { M5Character } from "../actors/M5Character"; -import { M5EwResult, M5RollData, M5RollResult, M5SkillUnlearned } from "../M5Base"; +import { M5EwResult, M5RollData, M5RollResult, M5SkillUnlearned, M5Stats } from "../M5Base"; +import { stat } from "fs"; export class M5Roll { // extends Roll @@ -205,6 +206,48 @@ export class M5Roll { return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.brawl")); } + static perception(actor: any) { + const rollData = actor.getRollData() as M5RollData; + rollData.i = { + fw: 6, + Bonus: 0, + }; + + rollData.rolls["0"] = { + formula: "1d20 + @c.calc.stats.perceptionEW + @i.bonus", + enabled: true, + label: (game as Game).i18n.localize("midgard5.perception"), + result: "", + total: 0, + totalStr: "", + dice: {}, + css: "", + } as M5RollResult; + + return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.perception")); + } + + static drinking(actor: any) { + const rollData = actor.getRollData() as M5RollData; + rollData.i = { + fw: M5Stats.DRINKING, + Bonus: 0, + }; + + rollData.rolls["0"] = { + formula: "1d20 + @c.calc.stats.drinkingEW + @i.bonus", + enabled: true, + label: (game as Game).i18n.localize("midgard5.drinking"), + result: "", + total: 0, + totalStr: "", + dice: {}, + css: "", + } as M5RollResult; + + return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.drinking")); + } + static defense(actor: any) { const rollData = actor.getRollData() as M5RollData; rollData.i = { diff --git a/source/module/sheets/M5CharacterSheet.ts b/source/module/sheets/M5CharacterSheet.ts index 338faed..d847e42 100644 --- a/source/module/sheets/M5CharacterSheet.ts +++ b/source/module/sheets/M5CharacterSheet.ts @@ -168,6 +168,16 @@ export default class M5CharacterSheet extends ActorSheet { await roll.toMessage(); }); + html.find(".roll-perception-button").on("click", async (event) => { + const roll = M5Roll.perception(this.actor); + await roll.toMessage(); + }); + + html.find(".roll-drinking-button").on("click", async (event) => { + const roll = M5Roll.drinking(this.actor); + await roll.toMessage(); + }); + html.find(".roll-defense-button").on("click", async (event) => { const roll = M5Roll.defense(this.actor); await roll.toMessage(); diff --git a/source/template.json b/source/template.json index 180f4ba..c48ea3d 100644 --- a/source/template.json +++ b/source/template.json @@ -36,7 +36,7 @@ "ep": 0, "gg": 0, "sg": 0, - "gp": 2 + "gp": 0 }, "attributes": { "attributes": { diff --git a/templates/sheets/character/skills.hbs b/templates/sheets/character/skills.hbs index e740565..c711f08 100644 --- a/templates/sheets/character/skills.hbs +++ b/templates/sheets/character/skills.hbs @@ -74,6 +74,23 @@ {{/each}} + + {{localize "midgard5.perception"}} + {{stats.fw}} + {{stats.calc.bonus}} + {{data.calc.stats.perceptionEW}} + + + + + + {{localize "midgard5.drinking"}} + {{stats.drinking.value}} + {{stats.calc.bonus}} + {{data.calc.stats.drinkingEW}} + + +