some more improvements

This commit is contained in:
2023-02-06 02:34:22 +09:00
parent c35d4d5ce1
commit b709ca838f
5 changed files with 229 additions and 116 deletions

View File

@@ -8,7 +8,7 @@
}, },
"package": { "package": {
"productName": "pokemon-data-displayer", "productName": "pokemon-data-displayer",
"version": "0.0.5" "version": "0.0.6"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@@ -33,8 +33,8 @@
let total_min_damage_percentage = 0; let total_min_damage_percentage = 0;
let item_magnification = 1.0; let item_magnification = 1.0;
function calculate_damage() { function calculate_damage() {
let attacker; let attacker: PokemonStatus;
let defender; let defender: PokemonStatus;
let atk_value; let atk_value;
let def_value; let def_value;
if ( if (
@@ -56,11 +56,11 @@
} }
// 物理or特殊の判定 // 物理or特殊の判定
if (attackData.category === 1) { if (attackData.category === 1) {
atk_value = attacker.atk; atk_value = attacker.attack;
def_value = defender.def; def_value = defender.defense;
} else { } else {
atk_value = attacker.spatk; atk_value = attacker.special_attack;
def_value = defender.spdef; def_value = defender.special_defense;
} }
// debug // debug

View File

@@ -437,8 +437,8 @@
></td ></td
> >
<td class="atai-column"><b>{hp_final}</b></td> <td class="atai-column"><b>{hp_final}</b></td>
<td class="atai-column"><b>+</b></td> <td class="plus-minus-column"><b>+</b></td>
<td class="atai-column"><b>-</b></td> <td class="plus-minus-column"><b>-</b></td>
</tr> </tr>
<tr> <tr>
<td class="value-column"><b>ATK</b></td> <td class="value-column"><b>ATK</b></td>
@@ -482,6 +482,17 @@
/></b /></b
></td ></td
> >
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
{#each Array.from({length: 6}, (_, i) => i - 6) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer minus {pokemonData.attack_buff < i+1 ? "red" : ""}" on:click={() => { pokemonData.attack_buff = i; }}>▼</td>
{/each}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer" on:click={() => { pokemonData.attack_buff = 0; }}>・</td>
{#each Array.from({length: 6}, (_, i) => i) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer plus {pokemonData.attack_buff > i ? "green" : ""}" on:click={() => { pokemonData.attack_buff = i+1; }}>▲</td>
{/each}
</tr> </tr>
<tr> <tr>
<td class="value-column"><b>DEF</b></td> <td class="value-column"><b>DEF</b></td>
@@ -517,143 +528,187 @@
/></b /></b
></td ></td
> >
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
type="checkbox" type="checkbox"
bind:checked={pokemonData.defense_minus} bind:checked={pokemonData.defense_minus}
/></b />
></td </b>
> </td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
{#each Array.from({length: 6}, (_, i) => i - 6) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer minus {pokemonData.defense_buff < i+1 ? "red" : ""}" on:click={() => { pokemonData.defense_buff = i; }}>▼</td>
{/each}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer" on:click={() => { pokemonData.defense_buff = 0; }}>・</td>
{#each Array.from({length: 6}, (_, i) => i) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer plus {pokemonData.defense_buff > i ? "green" : ""}" on:click={() => { pokemonData.defense_buff = i+1; }}>▲</td>
{/each}
</tr> </tr>
<tr> <tr>
<td class="value-column"><b>S.ATK</b></td> <td class="value-column"><b>S.ATK</b></td>
<td class="atai-column"><b>{pokemonData.special_attack}</b></td> <td class="atai-column"><b>{pokemonData.special_attack}</b></td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
class="vd-input" class="vd-input"
type="number" type="number"
bind:value={pokemonData.special_attack_v} bind:value={pokemonData.special_attack_v}
min="0" min="0"
max="31" max="31"
/></b />
></td </b>
> </td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
class="vd-input" class="vd-input"
type="number" type="number"
bind:value={pokemonData.special_attack_d} bind:value={pokemonData.special_attack_d}
min="0" min="0"
max="252" max="252"
/></b />
></td </b>
> </td>
<td class="atai-column"><b>{spatk_final}</b></td> <td class="atai-column"><b>{spatk_final}</b></td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
type="checkbox" type="checkbox"
bind:checked={pokemonData.special_attack_plus} bind:checked={pokemonData.special_attack_plus}
/></b />
></td </b>
> </td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
type="checkbox" type="checkbox"
bind:checked={pokemonData.special_attack_minus} bind:checked={pokemonData.special_attack_minus}
/></b />
></td </b>
> </td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
{#each Array.from({length: 6}, (_, i) => i - 6) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer minus {pokemonData.special_attack_buff < i+1 ? "red" : ""}" on:click={() => { pokemonData.special_attack_buff = i; }}>▼</td>
{/each}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer" on:click={() => { pokemonData.special_attack_buff = 0; }}>・</td>
{#each Array.from({length: 6}, (_, i) => i) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer plus {pokemonData.special_attack_buff > i ? "green" : ""}" on:click={() => { pokemonData.special_attack_buff = i+1; }}>▲</td>
{/each}
</tr> </tr>
<tr> <tr>
<td class="value-column"><b>S.DEF</b></td> <td class="value-column"><b>S.DEF</b></td>
<td class="atai-column"><b>{pokemonData.special_defense}</b></td> <td class="atai-column"><b>{pokemonData.special_defense}</b></td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
class="vd-input" class="vd-input"
type="number" type="number"
bind:value={pokemonData.special_defense_v} bind:value={pokemonData.special_defense_v}
min="0" min="0"
max="31" max="31"
/></b />
></td </b>
> </td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
class="vd-input" class="vd-input"
type="number" type="number"
bind:value={pokemonData.special_defense_d} bind:value={pokemonData.special_defense_d}
min="0" min="0"
max="252" max="252"
/></b />
></td </b>
> </td>
<td class="atai-column"><b>{spdef_final}</b></td> <td class="atai-column"><b>{spdef_final}</b></td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
type="checkbox" type="checkbox"
bind:checked={pokemonData.special_defense_plus} bind:checked={pokemonData.special_defense_plus}
/></b />
></td </b>
> </td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
type="checkbox" type="checkbox"
bind:checked={pokemonData.special_defense_minus} bind:checked={pokemonData.special_defense_minus}
/></b />
></td </b>
> </td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
{#each Array.from({length: 6}, (_, i) => i - 6) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer minus {pokemonData.special_defense_buff < i+1 ? "red" : ""}" on:click={() => { pokemonData.special_defense_buff = i; }}>▼</td>
{/each}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer" on:click={() => { pokemonData.special_defense_buff = 0; }}>・</td>
{#each Array.from({length: 6}, (_, i) => i) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer plus {pokemonData.special_defense_buff > i ? "green" : ""}" on:click={() => { pokemonData.special_defense_buff = i+1; }}>▲</td>
{/each}
</tr> </tr>
<tr> <tr>
<td class="value-column"><b>SPD</b></td> <td class="value-column"><b>SPD</b></td>
<td class="atai-column"><b>{pokemonData.speed}</b></td> <td class="atai-column"><b>{pokemonData.speed}</b></td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
class="vd-input" class="vd-input"
type="number" type="number"
bind:value={pokemonData.speed_v} bind:value={pokemonData.speed_v}
min="0" min="0"
max="31" max="31"
/></b />
></td </b>
> </td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
class="vd-input" class="vd-input"
type="number" type="number"
bind:value={pokemonData.speed_d} bind:value={pokemonData.speed_d}
min="0" min="0"
max="252" max="252"
/></b />
></td </b>
> </td>
<td class="atai-column"><b>{spd_final}</b></td> <td class="atai-column"><b>{spd_final}</b></td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
type="checkbox" type="checkbox"
bind:checked={pokemonData.speed_plus} bind:checked={pokemonData.speed_plus}
/></b />
></td </b>
> </td>
<td class="atai-column" <td class="atai-column">
><b <b>
><input <input
type="checkbox" type="checkbox"
bind:checked={pokemonData.speed_minus} bind:checked={pokemonData.speed_minus}
/></b />
></td </b>
> </td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
{#each Array.from({length: 6}, (_, i) => i - 6) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer minus {pokemonData.speed_buff < i+1 ? "red" : ""}" on:click={() => { pokemonData.speed_buff = i; }}>▼</td>
{/each}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer" on:click={() => { pokemonData.speed_buff = 0; }}>・</td>
{#each Array.from({length: 6}, (_, i) => i) as i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<td class="cursor-pointer plus {pokemonData.speed_buff > i ? "green" : ""}" on:click={() => { pokemonData.speed_buff = i+1; }}>▲</td>
{/each}
</tr> </tr>
<tr> <tr>
<td class="value-column"><b>TOTAL</b></td> <td class="value-column"><b>TOTAL</b></td>
@@ -756,6 +811,11 @@
padding-left: 10px; padding-left: 10px;
width: 50%; width: 50%;
} }
.plus-minus-column {
text-align: center;
padding-left: 10px;
width: 50%;
}
.vd-input { .vd-input {
width: 50px; width: 50px;
padding-left: 0; padding-left: 0;
@@ -785,6 +845,27 @@
min-height: 25px; min-height: 25px;
padding: 2px; padding: 2px;
} }
.cursor-pointer {
cursor: pointer;
}
.minus:hover {
color: pink;
transition: font-size .5s ease;
font-size: 1.1em;
}
.plus:hover {
color: lightgreen;
transition: font-size .5s ease;
font-size: 1.1em;
}
.red {
color: red;
font-weight: bold;
}
.green {
color: green;
font-weight: bold;
}
.learnset { .learnset {
width: 90%; width: 90%;
} }

View File

@@ -6,9 +6,8 @@
import type { PokemonDBData, PokemonData } from "src/model/PokemonData"; import type { PokemonDBData, PokemonData } from "src/model/PokemonData";
import type { ItemData, ItemEffect } from "../model/ItemData"; import type { ItemData, ItemEffect } from "../model/ItemData";
$: { $: {
if (myValue > 0 && myValue !== currentValue) { if (myValue > 0) {
invoke("search", { index: myValue }).then((r: PokemonDBData) => { invoke("search", { index: myValue }).then((r: PokemonDBData) => {
currentValue = myValue;
pokemonData = { pokemonData = {
id: r.id, id: r.id,
name: r.name, name: r.name,
@@ -53,7 +52,6 @@
speed_buff: 0, speed_buff: 0,
}; };
pokemonDataArray[index] = pokemonData; pokemonDataArray[index] = pokemonData;
console.log(currentValue);
myValue = undefined; myValue = undefined;
}); });
} }
@@ -61,11 +59,16 @@
types: pokemonData ? pokemonData.types : [], types: pokemonData ? pokemonData.types : [],
terastype: pokemonData ? pokemonData.terastype : [0], terastype: pokemonData ? pokemonData.terastype : [0],
hp: hp_final, hp: hp_final,
atk: atk_final, attack: atk_final,
def: def_final, defense: def_final,
spatk: spatk_final, special_attack: spatk_final,
spdef: spdef_final, special_defense: spdef_final,
spd: spd_final, speed: spd_final,
attack_buff: pokemonData ? pokemonData.attack_buff : 0,
defense_buff: pokemonData ? pokemonData.defense_buff : 0,
special_attack_buff: pokemonData ? pokemonData.special_attack_buff : 0,
special_defense_buff: pokemonData ? pokemonData.special_defense_buff : 0,
speed_buff: pokemonData ? pokemonData.speed_buff : 0,
item: pokemonData ? pokemonData.item : 0, item: pokemonData ? pokemonData.item : 0,
}; };
} }
@@ -73,7 +76,6 @@
export let items: ItemData[]; export let items: ItemData[];
let myValue; let myValue;
let index = 0; let index = 0;
let currentValue = 0;
let pokemonData: PokemonData | undefined; let pokemonData: PokemonData | undefined;
let pokemonDataArray: PokemonData[] = []; let pokemonDataArray: PokemonData[] = [];
let hp_final = 0; let hp_final = 0;
@@ -86,11 +88,16 @@
types: [], types: [],
terastype: [0], terastype: [0],
hp: 0, hp: 0,
atk: 0, attack: 0,
def: 0, defense: 0,
spatk: 0, special_attack: 0,
spdef: 0, special_defense: 0,
spd: 0, speed: 0,
attack_buff: 0,
defense_buff: 0,
special_attack_buff: 0,
special_defense_buff: 0,
speed_buff: 0,
item: 0, item: 0,
}; };
async function getItems(keyword) { async function getItems(keyword) {
@@ -134,6 +141,7 @@
pokemonData = pokemonDataArray[i]; pokemonData = pokemonDataArray[i];
}} }}
> >
<span class="active-arrow"></span>
{#if pokemonDataArray[i]} {#if pokemonDataArray[i]}
<img <img
src={`data:image/png;base64,${pokemonDataArray[i].thumbnail}`} src={`data:image/png;base64,${pokemonDataArray[i].thumbnail}`}
@@ -149,9 +157,17 @@
</tr> </tr>
{/each} {/each}
</table> </table>
<div> <div class="save-load-clear-group">
<button>Save</button> <button>Load</button><br /> <button>Save</button>
<button on:click={() => {pokemonData = undefined; pokemonDataArray = []; index = 0; myValue = undefined;}}>Clear</button> <button>Load</button><br />
<button
on:click={() => {
pokemonData = undefined;
pokemonDataArray = [];
index = 0;
myValue = undefined;
}}>Clear</button
>
</div> </div>
</div> </div>
<div class="display-data"> <div class="display-data">
@@ -171,6 +187,10 @@
</div> </div>
<style> <style>
.save-load-clear-group {
margin: 15px 0;
line-height: 40px;
}
.row-display { .row-display {
height: 759px; height: 759px;
display: flex; display: flex;
@@ -182,6 +202,13 @@
width: 200px; width: 200px;
border-right: 2px solid white; border-right: 2px solid white;
} }
.active-arrow {
display: none;
}
.active > .active-arrow {
display: block;
margin-right: 5px;
}
.display-data { .display-data {
width: 800px; width: 800px;
height: 759px; height: 759px;
@@ -209,22 +236,22 @@
} }
.odd { .odd {
color: white; color: white;
background-color: #f5453d; background-color: #f7bbb8;
} }
.odd:hover { .odd:hover {
color: white; color: white;
background-color: #f7bbb8; background-color: #f5453d;
transition: background-color .5s ease; transition: background-color 0.5s ease;
cursor: pointer; cursor: pointer;
} }
.even { .even {
color: white; color: white;
background-color: #3d3094; background-color: #b6b4ff;
} }
.even:hover { .even:hover {
color: white; color: white;
background-color: #b6b4ff; background-color: #3d3094;
transition: background-color .5s ease; transition: background-color 0.5s ease;
cursor: pointer; cursor: pointer;
} }
</style> </style>

View File

@@ -4,10 +4,15 @@ export interface PokemonStatus {
types: number[], types: number[],
terastype: number[], terastype: number[],
hp: number, hp: number,
atk: number, attack: number,
def: number, defense: number,
spatk: number, special_attack: number,
spdef: number, special_defense: number,
spd: number, speed: number,
attack_buff: number,
defense_buff: number,
special_attack_buff: number,
special_defense_buff: number,
speed_buff: number,
item: number, item: number,
}; };