Skip to content

Commit

Permalink
Revert "Fix various teambuffs that relied on specific active characte…
Browse files Browse the repository at this point in the history
…r assumptions (frzyc#1672)"

This reverts commit 279b675.
  • Loading branch information
RobberToe committed Mar 13, 2024
1 parent 72ae076 commit 618c1c3
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 47 deletions.
48 changes: 27 additions & 21 deletions apps/frontend/src/app/Data/Characters/HuTao/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CharacterKey, ElementKey } from '@genshin-optimizer/gi/consts'
import { allElementWithPhyKeys } from '@genshin-optimizer/gi/consts'
import { allStats } from '@genshin-optimizer/gi/stats'
import { input, target } from '../../../Formula'
import { input } from '../../../Formula'
import {
equal,
equalStr,
Expand Down Expand Up @@ -111,18 +111,20 @@ const atk = equal(
const infusion = equalStr('on', condAfterlife, elementKey)

const [condA1Path, condA1] = cond(key, 'FlutterBy')
const critRateTeam_1Disp = greaterEq(
const critRateTeam_1 = greaterEq(
input.asc,
1,
equal('on', condA1, percent(dm.passive1.critRateInc), {
...KeyMap.info('critRate_'),
isTeamBuff: true,
})
equal(
'on',
condA1,
unequal(
input.activeCharKey,
input.charKey,
percent(dm.passive1.critRateInc),
{ ...KeyMap.info('critRate_'), isTeamBuff: true }
)
)
)
const critRateTeam_1 = unequal(key, target.charKey, critRateTeam_1Disp, {
...KeyMap.info('critRate_'),
isTeamBuff: true,
})
const [condA4Path, condA4] = cond(key, 'SanguineRouge')
const pyro_dmg_ = greaterEq(
input.asc,
Expand All @@ -131,18 +133,20 @@ const pyro_dmg_ = greaterEq(
)

const [condC4Path, condC4] = cond(key, 'GardenOfEternalRest')
const critRateTeam_2Disp = greaterEq(
const critRateTeam_2 = greaterEq(
input.constellation,
4,
equal('on', condC4, percent(dm.constellation4.critRateInc), {
...KeyMap.info('critRate_'),
isTeamBuff: true,
})
equal(
'on',
condC4,
unequal(
input.activeCharKey,
input.charKey,
percent(dm.constellation4.critRateInc),
{ ...KeyMap.info('critRate_'), isTeamBuff: true }
)
)
)
const critRateTeam_2 = unequal(key, target.charKey, critRateTeam_2Disp, {
...KeyMap.info('critRate_'),
isTeamBuff: true,
})

const [condC6Path, condC6] = cond(key, 'ButterflysEmbrace')
const critRate_ = greaterEq(
Expand Down Expand Up @@ -401,12 +405,13 @@ const sheet: ICharacterSheet = {
value: condA1,
path: condA1Path,
teamBuff: true,
canShow: unequal(input.activeCharKey, input.charKey, 1),
name: ct.ch('paramita.end'),
states: {
on: {
fields: [
{
node: critRateTeam_1Disp,
node: critRateTeam_1,
},
{
text: stg('duration'),
Expand Down Expand Up @@ -445,12 +450,13 @@ const sheet: ICharacterSheet = {
value: condC4,
path: condC4Path,
teamBuff: true,
canShow: unequal(input.activeCharKey, input.charKey, 1),
name: ct.ch('constellation4.condName'),
states: {
on: {
fields: [
{
node: critRateTeam_2Disp,
node: critRateTeam_2,
},
{
text: stg('duration'),
Expand Down
22 changes: 9 additions & 13 deletions apps/frontend/src/app/Data/Characters/RaidenShogun/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { objKeyMap } from '@genshin-optimizer/common/util'
import type { CharacterKey } from '@genshin-optimizer/gi/consts'
import { allStats } from '@genshin-optimizer/gi/stats'
import { input, target } from '../../../Formula'
import { input } from '../../../Formula'
import {
constant,
equal,
Expand All @@ -15,7 +15,6 @@ import {
sum,
unequal,
} from '../../../Formula/utils'
import KeyMap from '../../../KeyMap'
import { cond, st, stg } from '../../SheetUtil'
import CharacterSheet from '../CharacterSheet'
import type { ICharacterSheet } from '../ICharacterSheet.d'
Expand Down Expand Up @@ -125,7 +124,9 @@ function skillDmg(atkType: number[]) {

const energyCosts = [40, 50, 60, 70, 80, 90]
const [condSkillEyeTeamPath, condSkillEyeTeam] = cond(key, 'skillEyeTeam')
const skillEyeTeamBurstDmgIncDisp = infoMut(
const skillEyeTeamBurstDmgInc = unequal(
input.activeCharKey,
input.charKey,
prod(
lookup(
condSkillEyeTeam,
Expand All @@ -136,13 +137,7 @@ const skillEyeTeamBurstDmgIncDisp = infoMut(
fixed: 2,
unit: '%',
})
),
{ ...KeyMap.info('burst_dmg_'), isTeamBuff: true }
)
const skillEyeTeamBurstDmgInc = unequal(
key,
target.charKey,
skillEyeTeamBurstDmgIncDisp
)
)

const resolveStacks = [10, 20, 30, 40, 50, 60]
Expand Down Expand Up @@ -211,7 +206,7 @@ const c4AtkBonus_ = greaterEq(
equal(
'c4',
condC4,
unequal(input.activeCharKey, target.charKey, dm.constellation4.atk_bonus)
unequal(input.activeCharKey, input.charKey, dm.constellation4.atk_bonus)
)
)

Expand Down Expand Up @@ -392,6 +387,7 @@ const sheet: ICharacterSheet = {
value: condSkillEyeTeam,
path: condSkillEyeTeamPath,
teamBuff: true,
canShow: unequal(input.activeCharKey, input.charKey, 1),
name: ct.ch('skill.partyCost'),
states: Object.fromEntries(
energyCosts.map((c) => [
Expand All @@ -400,7 +396,7 @@ const sheet: ICharacterSheet = {
name: `${c}`,
fields: [
{
node: skillEyeTeamBurstDmgIncDisp,
node: skillEyeTeamBurstDmgInc,
},
],
},
Expand Down Expand Up @@ -583,7 +579,7 @@ const sheet: ICharacterSheet = {
value: condC4,
path: condC4Path,
teamBuff: true,
canShow: unequal(input.activeCharKey, target.charKey, 1),
canShow: unequal(input.activeCharKey, input.charKey, 1),
name: ct.ch('c4.expires'),
states: {
c4: {
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/app/Data/SheetUtil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ function NameTrans({
}

export function activeCharBuff(
buffTargetKey: string | StrNode,
key: string | StrNode,
node: NumNode,
info: Info
) {
return [
infoMut(node, { ...info, isTeamBuff: true }),
equal(input.activeCharKey, buffTargetKey, node),
equal(input.activeCharKey, key, node),
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const team_eleMasDisp = equal(
subscript(input.weapon.refinement, team_eleMasArr),
{ ...KeyMap.info('eleMas'), isTeamBuff: true }
)
// Apply to non-equipped character
const team_eleMas = unequal(input.charKey, target.charKey, team_eleMasDisp)

export const data = dataObjForWeaponSheet(key, data_gen, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const sheet: IWeaponSheet = {
value: condPassive,
path: condPassivePath,
name: trm('condName'),
canShow: unequal(input.activeCharKey, input.charKey, 1),
teamBuff: true,
header: headerTemplate(key, st('conditional')),
states: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const selfAtk = equal(
)
)
const teamAtkDisp = equal(input.weapon.key, key, prod(percent(0.3), selfAtk))
// Apply to non-equipped character
const teamAtk = unequal(input.activeCharKey, input.charKey, teamAtkDisp)

const data = dataObjForWeaponSheet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const selfAtk = equal(
)
)
const teamAtkDisp = equal(input.weapon.key, key, prod(percent(0.3), selfAtk))
// Apply to non-equipped character
const teamAtk = unequal(input.activeCharKey, input.charKey, teamAtkDisp)

const data = dataObjForWeaponSheet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
lookup,
prod,
subscript,
unequal,
} from '../../../../Formula/utils'
import { cond, st, trans } from '../../../SheetUtil'
import type { IWeaponSheet } from '../../IWeaponSheet'
Expand All @@ -21,6 +22,7 @@ const data_gen = allStats.weapon.data[key]
const [, trm] = trans('weapon', key)

const [condStackPath, condStack] = cond(key, 'stack')
const [condOffFieldPath, condOffField] = cond(key, 'offField')

const dmg_ = [-1, 0.12, 0.15, 0.18, 0.21, 0.24]
const atk_ = [-1, 0.032, 0.04, 0.048, 0.056, 0.064]
Expand All @@ -33,10 +35,10 @@ const dmg_Nodes = Object.fromEntries(
)
const atkInc = prod(
compareEq(
input.charKey,
input.activeCharKey,
constant(1, { name: trm('active') }),
constant(2, { name: trm('inactive') })
condOffField,
'on',
constant(2, { name: trm('inactive') }),
constant(1, { name: trm('active') })
),
lookup(
condStack,
Expand Down Expand Up @@ -78,6 +80,19 @@ const sheet: IWeaponSheet = {
])
),
},
{
canShow: unequal(condStack, undefined, 1),
value: condOffField,
path: condOffFieldPath,
teamBuff: true,
header: headerTemplate(key, st('conditional')),
name: st('charOffField'),
states: {
on: {
fields: [],
},
},
},
],
}
export default new WeaponSheet(key, sheet, data_gen, data)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { dataObjForWeaponSheet } from '../../util'
const key: WeaponKey = 'SwordOfDescension'
const data_gen = allStats.weapon.data[key]

// Check equipped character is Traveler
const atk = lookup(
input.charKey,
objKeyMap(allTravelerKeys, (_) => constant(66)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { WeaponKey } from '@genshin-optimizer/gi/consts'
import { allStats } from '@genshin-optimizer/gi/stats'
import { input, target } from '../../../../Formula'
import { input } from '../../../../Formula'
import {
equal,
infoMut,
Expand Down Expand Up @@ -35,8 +35,11 @@ const teamEnerRech_disp = equal(
key,
prod(percent(0.3), selfEnerRech_)
)
// Apply to non-equipped character
const teamEnerRech_ = unequal(input.charKey, target.charKey, teamEnerRech_disp)
const teamEnerRech_ = unequal(
input.activeCharKey,
input.charKey,
teamEnerRech_disp
)

const data = dataObjForWeaponSheet(
key,
Expand Down

0 comments on commit 618c1c3

Please sign in to comment.