Skip to content

Commit 5acecc1

Browse files
committed
fix: reset target if invalid due to a change in character key
1 parent b998ac8 commit 5acecc1

2 files changed

Lines changed: 10 additions & 51 deletions

File tree

src/routes/optimize/+page.svelte

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -277,53 +277,3 @@
277277
{/each}
278278
</div>
279279
{/if}
280-
281-
<!--{#if results.length === 0}-->
282-
<!-- {#if optimizer_running}-->
283-
<!-- <div class="my-2">-->
284-
<!-- <div>Tested 0 builds out of <LoaderCircle class="inline-flex animate-spin" /></div>-->
285-
<!-- <Progress value={tested_count} max={total_builds} />-->
286-
<!-- </div>-->
287-
288-
<!-- <div class="my-2">-->
289-
<!-- <div class="flex items-center gap-4">-->
290-
<!-- <Skeleton class="size-12 rounded-full" />-->
291-
<!-- <div class="gap-2">-->
292-
<!-- <Skeleton class="h-4 w-[250px]" />-->
293-
<!-- <Skeleton class="h-4 w-[200px]" />-->
294-
<!-- </div>-->
295-
<!-- </div>-->
296-
<!-- </div>-->
297-
<!-- {/if}-->
298-
<!--{:else}-->
299-
<!-- {@const percentage = total_builds > 0 ? (tested_count / total_builds) * 100 : 0}-->
300-
<!-- <div class="my-2">-->
301-
<!-- <div>Tested {tested_count} builds out of {total_builds} ({percentage.toFixed(2)} %)</div>-->
302-
<!-- <Progress value={tested_count} max={total_builds} />-->
303-
<!-- </div>-->
304-
305-
<!-- <div class="my-2">-->
306-
<!-- <RadioGroup.Root orientation="horizontal" bind:value={damage_selection} required class="mx-4 flex flex-row gap-2 justify-end">-->
307-
<!-- <div>-->
308-
<!-- <RadioGroup.Item id="non-crit" value="non-crit" />-->
309-
<!-- <Label for="non-crit">non-crit</Label>-->
310-
<!-- </div>-->
311-
312-
<!-- <div>-->
313-
<!-- <RadioGroup.Item id="average" value="average" />-->
314-
<!-- <Label for="average">average</Label>-->
315-
<!-- </div>-->
316-
317-
<!-- <div>-->
318-
<!-- <RadioGroup.Item id="forced-crit" value="forced-crit" />-->
319-
<!-- <Label for="forced-crit">forced crit</Label>-->
320-
<!-- </div>-->
321-
<!-- </RadioGroup.Root>-->
322-
<!-- </div>-->
323-
<!-- <div class="px-2 flex flex-col gap-4 divide-y-2">-->
324-
<!-- {#each results as result, i (i)}-->
325-
<!-- <OptimizerResult {result} {i} total_results={results.length} {damage_selection} target={target_key} />-->
326-
<!-- {/each}-->
327-
<!-- </div>-->
328-
<!--{/if}-->
329-

src/routes/optimize/optimizer-selector.svelte

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import type { CharacterKey } from '$lib/data/characters/types';
2+
import type { CharacterKey, SkillType } from '$lib/data/characters/types';
33
import type { DamageSelection, Target } from '$lib/data/optimizer/types';
44
55
import { Badge } from '$lib/components/ui/badge';
@@ -27,6 +27,15 @@
2727
target = new_target;
2828
open = false;
2929
}
30+
31+
$effect(() => {
32+
if (target.kind === 'motion') {
33+
const { skill, motion } = target;
34+
if (!Object.values(character.skills).some(s => s.key === skill && s.motions.some(m => m.key === motion))) {
35+
target = { kind: 'stat', stat: 'atk' };
36+
}
37+
}
38+
})
3039
</script>
3140

3241
<div class="flex flex-row gap-1">

0 commit comments

Comments
 (0)