Skip to content

Commit

Permalink
Fix src for char, lightCone and relic
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyentvan7 committed Jan 1, 2024
1 parent 6b04f40 commit 06868dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions libs/sr-formula/src/data/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const data: TagMapNodeEntries = [
reader.withTag({ src: 'iso', et: 'self' }).reread(reader.src('custom')),
reader.withTag({ src: 'agg', et: 'self' }).reread(reader.src('custom')),

// convert src:char to src:total for accumulation
// convert src:char, lightCone, relic to src:agg for accumulation
reader.src('agg').add(reader.sum.src('char')),
// convert src:lightCone to src:total for accumulation
reader.src('agg').add(reader.sum.src('lightCone')),
reader.src('agg').add(reader.sum.src('relic')),

// Final <= Premod <= Base
reader
Expand Down
6 changes: 3 additions & 3 deletions libs/sr-formula/src/formula.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ describe('lightCone test', () => {
const calc = new Calculator(keys, values, compileTagMapValues(keys, data))

const member0 = convert(selfTag, { member: 'member0', et: 'self' })
expect(calc.compute(member0.base.atk.src(lcKey)).val).toBeCloseTo(atk)
expect(calc.compute(member0.base.def.src(lcKey)).val).toBeCloseTo(def)
expect(calc.compute(member0.base.hp.src(lcKey)).val).toBeCloseTo(hp)
expect(calc.compute(member0.base.atk.src('lightCone')).val).toBeCloseTo(atk)
expect(calc.compute(member0.base.def.src('lightCone')).val).toBeCloseTo(def)
expect(calc.compute(member0.base.hp.src('lightCone')).val).toBeCloseTo(hp)
})
})

Expand Down
6 changes: 3 additions & 3 deletions libs/sr-formula/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function charData(data: ICharacter): TagMapNodeEntries {
const { lvl, basic, skill, ult, talent, ascension, eidolon } = selfBuff.char

return [
reader.src('agg').reread(reader.src(data.key)),
reader.src('char').reread(reader.src(data.key)),
reader.withTag({ src: 'iso', et: 'self' }).reread(reader.src(data.key)),

lvl.add(data.level),
Expand Down Expand Up @@ -55,7 +55,7 @@ export function lightConeData(data: ILightCone | undefined): TagMapNodeEntries {
const { lvl, ascension, superimpose } = selfBuff.lightCone

return [
reader.src('agg').reread(reader.src(data.key)),
reader.src('lightCone').reread(reader.src(data.key)),

lvl.add(data.level),
ascension.add(data.ascension),
Expand Down Expand Up @@ -87,7 +87,7 @@ export function relicsData(
}
return [
// Opt-in for artifact buffs, instead of enabling it by default to reduce `read` traffic
reader.src('agg').reread(reader.src('relic')),
reader.src('relic').reread(reader.src('relic')),

// Add `src:dyn` between the stat and the buff so that we can `detach` them easily
reader.withTag({ src: 'relic', qt: 'premod' }).reread(reader.src('dyn')),
Expand Down

0 comments on commit 06868dd

Please sign in to comment.