diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 6aed3c2..bcda16a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "pokemon-data-displayer", - "version": "0.0.6" + "version": "0.0.7" }, "tauri": { "allowlist": { diff --git a/src/lib/DamageCalculator.svelte b/src/lib/DamageCalculator.svelte index a294d84..2461db8 100644 --- a/src/lib/DamageCalculator.svelte +++ b/src/lib/DamageCalculator.svelte @@ -9,19 +9,16 @@ export let attackId: number | undefined; let attackData; $: { - if (myValue > 0 && myValue !== currentValue) { - invoke("search_move", { index: myValue }).then((r) => { - currentValue = myValue; + if (moveValue > 0) { + invoke("search_move", { index: moveValue }).then((r) => { attackData = r; - console.log(attackData); + moveValue = undefined; }); } if (!!attackId) { console.log(attackId); invoke("search_move", { index: attackId }).then((r) => { - currentValue = myValue = attackId; attackData = r; - console.log(attackData); attackId = undefined; }); } @@ -44,6 +41,10 @@ (!!attackData && ![1, 2].includes(attackData.category)) ) { // display some message somewhere + total_max_damage = 0; + total_min_damage = 0; + total_max_damage_percentage = 0; + total_min_damage_percentage = 0; console.log("skip"); return; } @@ -353,8 +354,7 @@ return []; } } - let myValue; - let currentValue = 0; + let moveValue;
@@ -392,7 +392,7 @@ localFiltering={false} labelFieldName="name" valueFieldName="id" - bind:value={myValue} + bind:value={moveValue} /> { attackData ? attackData.name : "" } diff --git a/src/lib/DisplayData.svelte b/src/lib/DisplayData.svelte index 478a37f..fd8265a 100644 --- a/src/lib/DisplayData.svelte +++ b/src/lib/DisplayData.svelte @@ -142,31 +142,31 @@ pokemonData.hp_v, pokemonData.hp_d ); - atk_final = other_stats( + attack_final = other_stats( pokemonData.attack, pokemonData.attack_v, pokemonData.attack_d, atk_p ); - def_final = other_stats( + defense_final = other_stats( pokemonData.defense, pokemonData.defense_v, pokemonData.defense_d, def_p ); - spatk_final = other_stats( + special_attack_final = other_stats( pokemonData.special_attack, pokemonData.special_attack_v, pokemonData.special_attack_d, spatk_p ); - spdef_final = other_stats( + special_defense_final = other_stats( pokemonData.special_defense, pokemonData.special_defense_v, pokemonData.special_defense_d, spdef_p ); - spd_final = other_stats( + speed_final = other_stats( pokemonData.speed, pokemonData.speed_v, pokemonData.speed_d, @@ -308,11 +308,11 @@ } export let hp_final = 0; - export let atk_final = 0; - export let def_final = 0; - export let spatk_final = 0; - export let spdef_final = 0; - export let spd_final = 0; + export let attack_final = 0; + export let defense_final = 0; + export let special_attack_final = 0; + export let special_defense_final = 0; + export let speed_final = 0; let level = 50; let selected_terastype = 0; let selected_item = 0; @@ -465,7 +465,7 @@ /> - {atk_final} + {attack_final}      - {#each Array.from({length: 6}, (_, i) => i - 6) as i} + {#each Array.from({ length: 6 }, (_, i) => i - 6) as i} - { pokemonData.attack_buff = i; }}>▼ + { + pokemonData.attack_buff = i; + }} + > + ▼ + {/each} - { pokemonData.attack_buff = 0; }}>・ - {#each Array.from({length: 6}, (_, i) => i) as i} + { + pokemonData.attack_buff = 0; + }} + > + ・ + + {#each Array.from({ length: 6 }, (_, i) => i) as i} - { pokemonData.attack_buff = i+1; }}>▲ + { + pokemonData.attack_buff = i + 1; + }} + > + ▲ + {/each} +      + + ({Math.floor( + attack_final * + (pokemonData.attack_buff > 0 + ? (2 + pokemonData.attack_buff) / 2 + : pokemonData.attack_buff < 0 + ? 2 / (2 - pokemonData.attack_buff) + : 1) + )}) + DEF @@ -519,7 +555,7 @@ /> - {def_final} + {defense_final}      - {#each Array.from({length: 6}, (_, i) => i - 6) as i} + {#each Array.from({ length: 6 }, (_, i) => i - 6) as i} - { pokemonData.defense_buff = i; }}>▼ + { + pokemonData.defense_buff = i; + }} + > + ▼ + {/each} - { pokemonData.defense_buff = 0; }}>・ - {#each Array.from({length: 6}, (_, i) => i) as i} + { + pokemonData.defense_buff = 0; + }} + > + ・ + + {#each Array.from({ length: 6 }, (_, i) => i) as i} - { pokemonData.defense_buff = i+1; }}>▲ + { + pokemonData.defense_buff = i + 1; + }} + > + ▲ + {/each} +      + + ({Math.floor( + defense_final * + (pokemonData.defense_buff > 0 + ? (2 + pokemonData.defense_buff) / 2 + : pokemonData.defense_buff < 0 + ? 2 / (2 - pokemonData.defense_buff) + : 1) + )}) + S.ATK @@ -573,7 +645,7 @@ /> - {spatk_final} + {special_attack_final}      - {#each Array.from({length: 6}, (_, i) => i - 6) as i} + {#each Array.from({ length: 6 }, (_, i) => i - 6) as i} - { pokemonData.special_attack_buff = i; }}>▼ + { + pokemonData.special_attack_buff = i; + }} + > + ▼ + {/each} - { pokemonData.special_attack_buff = 0; }}>・ - {#each Array.from({length: 6}, (_, i) => i) as i} + { + pokemonData.special_attack_buff = 0; + }} + > + ・ + + {#each Array.from({ length: 6 }, (_, i) => i) as i} - { pokemonData.special_attack_buff = i+1; }}>▲ + { + pokemonData.special_attack_buff = i + 1; + }} + > + ▲ + {/each} +      + + ({Math.floor( + special_attack_final * + (pokemonData.special_attack_buff > 0 + ? (2 + pokemonData.special_attack_buff) / 2 + : pokemonData.special_attack_buff < 0 + ? 2 / (2 - pokemonData.special_attack_buff) + : 1) + )}) + S.DEF @@ -627,7 +737,7 @@ /> - {spdef_final} + {special_defense_final}      - {#each Array.from({length: 6}, (_, i) => i - 6) as i} + {#each Array.from({ length: 6 }, (_, i) => i - 6) as i} - { pokemonData.special_defense_buff = i; }}>▼ + { + pokemonData.special_defense_buff = i; + }} + > + ▼ + {/each} - { pokemonData.special_defense_buff = 0; }}>・ - {#each Array.from({length: 6}, (_, i) => i) as i} + { + pokemonData.special_defense_buff = 0; + }} + > + ・ + + {#each Array.from({ length: 6 }, (_, i) => i) as i} - { pokemonData.special_defense_buff = i+1; }}>▲ + { + pokemonData.special_defense_buff = i + 1; + }} + > + ▲ + {/each} +      + + ({Math.floor( + special_defense_final * + (pokemonData.special_defense_buff > 0 + ? (2 + pokemonData.special_defense_buff) / 2 + : pokemonData.special_defense_buff < 0 + ? 2 / (2 - pokemonData.special_defense_buff) + : 1) + )}) + SPD @@ -681,7 +829,7 @@ /> - {spd_final} + {speed_final}      - {#each Array.from({length: 6}, (_, i) => i - 6) as i} + {#each Array.from({ length: 6 }, (_, i) => i - 6) as i} - { pokemonData.speed_buff = i; }}>▼ + { + pokemonData.speed_buff = i; + }} + > + ▼ + {/each} - { pokemonData.speed_buff = 0; }}>・ - {#each Array.from({length: 6}, (_, i) => i) as i} + { + pokemonData.speed_buff = 0; + }} + > + ・ + + {#each Array.from({ length: 6 }, (_, i) => i) as i} - { pokemonData.speed_buff = i+1; }}>▲ + { + pokemonData.speed_buff = i + 1; + }} + > + ▲ + {/each} +      + + ({Math.floor( + speed_final * + (pokemonData.speed_buff > 0 + ? (2 + pokemonData.speed_buff) / 2 + : pokemonData.speed_buff < 0 + ? 2 / (2 - pokemonData.speed_buff) + : 1) + )}) + TOTAL - {pokemonData.hp + + + + {pokemonData.hp + pokemonData.attack + pokemonData.defense + pokemonData.special_attack + pokemonData.special_defense + - pokemonData.speed} + pokemonData.speed} + + @@ -747,7 +931,9 @@ console.log("passing" + learnset.name); attackId = learnset.learnset_id; await invoke("increase_attack_usage", { index: learnset.id }); - pokemonData.learnset = await invoke("search_learnset", { index: pokemonData.id }); + pokemonData.learnset = await invoke("search_learnset", { + index: pokemonData.id, + }); }} > 0) { invoke("search", { index: myValue }).then((r: PokemonDBData) => { @@ -59,11 +59,11 @@ types: pokemonData ? pokemonData.types : [], terastype: pokemonData ? pokemonData.terastype : [0], hp: hp_final, - attack: atk_final, - defense: def_final, - special_attack: spatk_final, - special_defense: spdef_final, - speed: spd_final, + attack: attack_final, + defense: defense_final, + special_attack: special_attack_final, + special_defense: special_defense_final, + speed: speed_final, attack_buff: pokemonData ? pokemonData.attack_buff : 0, defense_buff: pokemonData ? pokemonData.defense_buff : 0, special_attack_buff: pokemonData ? pokemonData.special_attack_buff : 0, @@ -79,11 +79,11 @@ let pokemonData: PokemonData | undefined; let pokemonDataArray: PokemonData[] = []; let hp_final = 0; - let atk_final = 0; - let def_final = 0; - let spatk_final = 0; - let spdef_final = 0; - let spd_final = 0; + let attack_final = 0; + let defense_final = 0; + let special_attack_final = 0; + let special_defense_final = 0; + let speed_final = 0; export let pokemonStatus: PokemonStatus = { types: [], terastype: [0], @@ -174,11 +174,11 @@