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 = {
talent: this._talent.name,
taw,
mod: modValue,
ergebnis: [
{
eigenschaft: this._talent.system.probe[0],
eigenschaftWert: this._actor.system.attribute[this._talent.system.probe[0].toLowerCase()].aktuell,
wuerfelErgebnis: result.evaluated.terms[0].results[0].result
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,
reduced: taw + modValue < 0
},
{
eigenschaft: this._talent.system.probe[1],
eigenschaftWert: this._actor.system.attribute[this._talent.system.probe[1].toLowerCase()].aktuell,
wuerfelErgebnis: result.evaluated.terms[0].results[1].result
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,
reduced: taw + modValue < 0
},
{
eigenschaft: this._talent.system.probe[2],
eigenschaftWert: this._actor.system.attribute[this._talent.system.probe[2].toLowerCase()].aktuell,
wuerfelErgebnis: result.evaluated.terms[0].results[2].result
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,
reduced: taw + modValue < 0
}
],
patzer: result.patzer,

View File

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

View File

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

View File

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

View File

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