From bccd60645311ce2085ab6870235bb6fed8f761cb Mon Sep 17 00:00:00 2001 From: Hansoo Date: Sun, 29 Jan 2023 15:37:32 +0900 Subject: [PATCH] terastal dropdown added --- src/lib/DisplayData.svelte | 64 ++++++++++++++++++++++++++++++++++---- src/lib/MainWrapper.svelte | 4 +++ 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/src/lib/DisplayData.svelte b/src/lib/DisplayData.svelte index 40d7cfb..b691487 100644 --- a/src/lib/DisplayData.svelte +++ b/src/lib/DisplayData.svelte @@ -13,6 +13,26 @@ } return v; } + const available_type = [ + { id: 1 }, + { id: 2 }, + { id: 3 }, + { id: 4 }, + { id: 5 }, + { id: 6 }, + { id: 7 }, + { id: 8 }, + { id: 9 }, + { id: 10 }, + { id: 11 }, + { id: 12 }, + { id: 13 }, + { id: 14 }, + { id: 15 }, + { id: 16 }, + { id: 17 }, + { id: 18 } + ] function d_validator(d) { if (typeof d !== "number") { return null; @@ -165,6 +185,7 @@ } function generate_weakness(types) { let parsed_types = JSON.parse(types); + console.log(parsed_types) let type_compatibility = defense_types[parsed_types[0] - 1]; if (parsed_types.length > 1) { let second_type_compatibility = defense_types[parsed_types[1] - 1]; @@ -239,7 +260,9 @@ export let spatk_final = 0; export let spdef_final = 0; export let spd_final = 0; + export let terastype = [0]; + let selected_terastype = 0; let atk_plus = false; let def_plus = false; let spatk_plus = false; @@ -264,21 +287,36 @@
{#if pokemonData && pokemonData.id && pokemonData.id > 0}
- {pokemonData.jap_name} -
-
- +
- + + + + + + + +
{pokemonData.name}{pokemonData.jap_name}名前{pokemonData.name}
タイプ {@html generate_type(JSON.parse(pokemonData.types))}
テラスタル + +
- {#each generate_weakness(pokemonData.types) as row, i} + {#each generate_weakness(terastype[0] === 0 ? pokemonData.types : JSON.stringify(terastype)) as row, i}
{generate_damage_value(i)} @@ -369,6 +407,20 @@