Android build v1.1.23
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import { IWT2_INFUSION_ABILITIES, type Iwt2InfusionAbility } from '../content/infusionAbilities'
|
||||
import type { Iwt2GearProgress } from '../content/gear'
|
||||
import type { Iwt2ArenaState, Iwt2PartyEntityState } from './types'
|
||||
|
||||
export function applyIwt2InfusionLoadout<TState extends Pick<Iwt2ArenaState, 'party'>>(
|
||||
state: TState,
|
||||
gearProgress: Iwt2GearProgress,
|
||||
): TState {
|
||||
return {
|
||||
...state,
|
||||
party: state.party.map((member) => {
|
||||
const ability = selectedInfusionForMember(member, gearProgress)
|
||||
return ability ? applyInfusionToMember(member, ability) : member
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
export function selectedInfusionForMember(
|
||||
member: Pick<Iwt2PartyEntityState, 'classId'>,
|
||||
gearProgress: Iwt2GearProgress,
|
||||
): Iwt2InfusionAbility | null {
|
||||
const abilityId = gearProgress[member.classId].infusionAbilityId
|
||||
if (!abilityId) return null
|
||||
const ability = IWT2_INFUSION_ABILITIES[abilityId]
|
||||
return ability?.classId === member.classId ? ability : null
|
||||
}
|
||||
|
||||
function applyInfusionToMember(
|
||||
member: Iwt2PartyEntityState,
|
||||
ability: Iwt2InfusionAbility,
|
||||
): Iwt2PartyEntityState {
|
||||
const baseMember = {
|
||||
...member,
|
||||
infusionAbilityId: ability.id,
|
||||
}
|
||||
if (ability.effectKey === 'unbreakable') {
|
||||
return {
|
||||
...baseMember,
|
||||
stunTakenScale: 0,
|
||||
}
|
||||
}
|
||||
return baseMember
|
||||
}
|
||||
Reference in New Issue
Block a user