feat : update mutilple apply
CI / Verify (push) Failing after 45s
CI / Build immutable images and deploy (push) Has been skipped

This commit is contained in:
2026-09-04 17:50:40 +07:00 Unverified
parent 45c1567dff
commit dc96ff0036
6 changed files with 119 additions and 43 deletions
+29 -2
View File
@@ -19,6 +19,20 @@ export interface TeamToolValue {
export const teamApplyFields = ["loadout", "damage", "rotation", "combo"] as const;
export type TeamApplyField = (typeof teamApplyFields)[number];
export const teamMemberApplyFields = [
"characterKey",
"weaponKey",
"artifactKey",
"secondArtifactKey",
"constellation",
"refinement",
"damage",
] as const;
export type TeamMemberApplyField = (typeof teamMemberApplyFields)[number];
export type TeamApplySelection =
| TeamApplyField
| `member:${number}:${TeamMemberApplyField}`;
export interface TeamPreset {
id: string;
name: string;
@@ -38,7 +52,7 @@ export function applyTeamFields(
teams: readonly TeamToolValue[],
sourceId: string,
targetIds: ReadonlySet<string>,
fields: readonly TeamApplyField[],
fields: readonly TeamApplySelection[],
): TeamToolValue[] {
const source = teams.find((team) => team.clientId === sourceId);
if (!source) return teams.map(cloneTeam);
@@ -53,6 +67,19 @@ export function applyTeamFields(
}));
}
if (selected.has("damage")) next.members = source.members.map(cloneMember);
for (const field of fields) {
const match = /^member:(\d+):(.+)$/.exec(field);
if (!match) continue;
const memberIndex = Number(match[1]);
const memberField = match[2] as TeamMemberApplyField;
const sourceMember = source.members[memberIndex];
const targetMember = next.members[memberIndex];
if (!sourceMember || !targetMember || !teamMemberApplyFields.includes(memberField)) continue;
next.members[memberIndex] = {
...targetMember,
[memberField]: sourceMember[memberField],
};
}
if (selected.has("rotation")) next.rotationSeconds = source.rotationSeconds;
if (selected.has("combo")) next.combo = source.combo;
return next;
@@ -63,7 +90,7 @@ export function applyPresetFields(
teams: readonly TeamToolValue[],
preset: TeamPreset,
targetIds: ReadonlySet<string>,
fields: readonly TeamApplyField[],
fields: readonly TeamApplySelection[],
): TeamToolValue[] {
return applyTeamFields(
[