mods are now displayed correctly

main
macniel 2026-01-25 23:12:38 +01:00
parent 53806e620f
commit f56f0be0b2
5 changed files with 22 additions and 13 deletions

View File

@ -102,21 +102,25 @@ export class TalentDialog extends HandlebarsApplicationMixin(ApplicationV2) {
const context = { const context = {
talent: this._talent.name, talent: this._talent.name,
taw, taw,
mod: modValue,
ergebnis: [ ergebnis: [
{ {
eigenschaft: this._talent.system.probe[0], eigenschaft: this._talent.system.probe[0],
eigenschaftWert: this._actor.system.attribute[this._talent.system.probe[0].toLowerCase()].aktuell, eigenschaftWert: taw + modValue < 0 ? this._actor.system.attribute[this._talent.system.probe[0].toLowerCase()].aktuell + (taw + modValue) : this._actor.system.attribute[this._talent.system.probe[0].toLowerCase()].aktuell,
wuerfelErgebnis: result.evaluated.terms[0].results[0].result wuerfelErgebnis: result.evaluated.terms[0].results[0].result,
reduced: taw + modValue < 0
}, },
{ {
eigenschaft: this._talent.system.probe[1], eigenschaft: this._talent.system.probe[1],
eigenschaftWert: this._actor.system.attribute[this._talent.system.probe[1].toLowerCase()].aktuell, eigenschaftWert: taw + modValue < 0 ? this._actor.system.attribute[this._talent.system.probe[1].toLowerCase()].aktuell + (taw + modValue) : this._actor.system.attribute[this._talent.system.probe[1].toLowerCase()].aktuell,
wuerfelErgebnis: result.evaluated.terms[0].results[1].result wuerfelErgebnis: result.evaluated.terms[0].results[1].result,
reduced: taw + modValue < 0
}, },
{ {
eigenschaft: this._talent.system.probe[2], eigenschaft: this._talent.system.probe[2],
eigenschaftWert: this._actor.system.attribute[this._talent.system.probe[2].toLowerCase()].aktuell, eigenschaftWert: taw + modValue < 0 ? this._actor.system.attribute[this._talent.system.probe[2].toLowerCase()].aktuell + (taw + modValue) : this._actor.system.attribute[this._talent.system.probe[2].toLowerCase()].aktuell,
wuerfelErgebnis: result.evaluated.terms[0].results[2].result wuerfelErgebnis: result.evaluated.terms[0].results[2].result,
reduced: taw + modValue < 0
} }
], ],
patzer: result.patzer, patzer: result.patzer,

View File

@ -23,7 +23,7 @@ const evaluateRoll = async (rolledDice, {
countToMeisterlich = 3, countToMeisterlich = 3,
countToPatzer = 3, countToPatzer = 3,
}, rollObject = Roll) => { }, rollObject = Roll) => {
let tap = value - mod; let tap = value + mod;
let meisterlichCounter = 0; let meisterlichCounter = 0;
let patzerCounter = 0; let patzerCounter = 0;
let failCounter = 0; let failCounter = 0;

View File

@ -96,14 +96,14 @@ describe('Attribute Checks', () => {
describe('Skill Checks', () => { describe('Skill Checks', () => {
it('should yield positive TAP when the die roll matches values of used attributes', async () => { it('should yield positive TAP when the die roll matches values of used attributes', async () => {
let taw = 5
let actual = await evaluateRoll("3d20",{ let actual = await evaluateRoll("3d20",{
value: 1, value: taw,
werte: [12, 12, 12], werte: [12, 12, 12],
owner owner
}, RollWithMockResults(12, 12, 12)) }, RollWithMockResults(12, 12, 12))
expect(actual.tap).toBeGreaterThan(0) expect(actual.tap).toBe(taw)
}) })
it('should succeed with a TaP* of 1 when the die roll are exactly the values of used attributes', async () => { it('should succeed with a TaP* of 1 when the die roll are exactly the values of used attributes', async () => {
@ -114,7 +114,7 @@ describe('Skill Checks', () => {
owner owner
}, RollWithMockResults(12, 12, 12)) }, RollWithMockResults(12, 12, 12))
expect(actual.tap).toBe(0) expect(actual.tap).toBe(1)
expect(actual.patzer).toBe(false) expect(actual.patzer).toBe(false)
}) })
@ -201,7 +201,7 @@ describe('Skill Checks', () => {
mod: -3, mod: -3,
werte: [12, 12, 12], werte: [12, 12, 12],
owner owner
}, RollWithMockResults(13, 13, 13)) }, RollWithMockResults(10, 10, 10))
expect(actual.tap).toBe(-3) expect(actual.tap).toBe(-3)
}) })

View File

@ -22,6 +22,10 @@
line-height: 16px; line-height: 16px;
height: 16px; height: 16px;
vertical-align: middle; vertical-align: middle;
&.modified {
color: red;
}
} }
span.value { span.value {

View File

@ -2,11 +2,12 @@
<div> <div>
<div>{{talent}} (TaW: {{taw}})</div> <div>{{talent}} (TaW: {{taw}})</div>
<div>Modifiziert: {{mod}}</div>
<div>Gewürfelt:</div> <div>Gewürfelt:</div>
<section class="die"> <section class="die">
{{#each ergebnis}} {{#each ergebnis}}
<div> <div>
<span class="provided">{{eigenschaft}} ({{eigenschaftWert}})</span> <span class="provided {{#if reduced}}modified{{/if}}">{{eigenschaft}} ({{eigenschaftWert}})</span>
<span class="value">{{wuerfelErgebnis}}</span> <span class="value">{{wuerfelErgebnis}}</span>
</div> </div>
{{/each}} {{/each}}