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": {
"productName": "pokemon-data-displayer",
"version": "0.0.5"
"version": "0.0.6"
},
"tauri": {
"allowlist": {

View File

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

View File

@@ -437,8 +437,8 @@
></td
>
<td class="atai-column"><b>{hp_final}</b></td>
<td class="atai-column"><b>+</b></td>
<td class="atai-column"><b>-</b></td>
<td class="plus-minus-column"><b>+</b></td>
<td class="plus-minus-column"><b>-</b></td>
</tr>
<tr>
<td class="value-column"><b>ATK</b></td>
@@ -482,6 +482,17 @@
/></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.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>
<td class="value-column"><b>DEF</b></td>
@@ -517,143 +528,187 @@
/></b
></td
>
<td class="atai-column"
><b
><input
<td class="atai-column">
<b>
<input
type="checkbox"
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>
<td class="value-column"><b>S.ATK</b></td>
<td class="atai-column"><b>{pokemonData.special_attack}</b></td>
<td class="atai-column"
><b
><input
<td class="atai-column">
<b>
<input
class="vd-input"
type="number"
bind:value={pokemonData.special_attack_v}
min="0"
max="31"
/></b
></td
>
<td class="atai-column"
><b
><input
/>
</b>
</td>
<td class="atai-column">
<b>
<input
class="vd-input"
type="number"
bind:value={pokemonData.special_attack_d}
min="0"
max="252"
/></b
></td
>
/>
</b>
</td>
<td class="atai-column"><b>{spatk_final}</b></td>
<td class="atai-column"
><b
><input
<td class="atai-column">
<b>
<input
type="checkbox"
bind:checked={pokemonData.special_attack_plus}
/></b
></td
>
<td class="atai-column"
><b
><input
/>
</b>
</td>
<td class="atai-column">
<b>
<input
type="checkbox"
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>
<td class="value-column"><b>S.DEF</b></td>
<td class="atai-column"><b>{pokemonData.special_defense}</b></td>
<td class="atai-column"
><b
><input
<td class="atai-column">
<b>
<input
class="vd-input"
type="number"
bind:value={pokemonData.special_defense_v}
min="0"
max="31"
/></b
></td
>
<td class="atai-column"
><b
><input
/>
</b>
</td>
<td class="atai-column">
<b>
<input
class="vd-input"
type="number"
bind:value={pokemonData.special_defense_d}
min="0"
max="252"
/></b
></td
>
/>
</b>
</td>
<td class="atai-column"><b>{spdef_final}</b></td>
<td class="atai-column"
><b
><input
<td class="atai-column">
<b>
<input
type="checkbox"
bind:checked={pokemonData.special_defense_plus}
/></b
></td
>
<td class="atai-column"
><b
><input
/>
</b>
</td>
<td class="atai-column">
<b>
<input
type="checkbox"
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>
<td class="value-column"><b>SPD</b></td>
<td class="atai-column"><b>{pokemonData.speed}</b></td>
<td class="atai-column"
><b
><input
<td class="atai-column">
<b>
<input
class="vd-input"
type="number"
bind:value={pokemonData.speed_v}
min="0"
max="31"
/></b
></td
>
<td class="atai-column"
><b
><input
/>
</b>
</td>
<td class="atai-column">
<b>
<input
class="vd-input"
type="number"
bind:value={pokemonData.speed_d}
min="0"
max="252"
/></b
></td
>
/>
</b>
</td>
<td class="atai-column"><b>{spd_final}</b></td>
<td class="atai-column"
><b
><input
<td class="atai-column">
<b>
<input
type="checkbox"
bind:checked={pokemonData.speed_plus}
/></b
></td
>
<td class="atai-column"
><b
><input
/>
</b>
</td>
<td class="atai-column">
<b>
<input
type="checkbox"
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>
<td class="value-column"><b>TOTAL</b></td>
@@ -756,6 +811,11 @@
padding-left: 10px;
width: 50%;
}
.plus-minus-column {
text-align: center;
padding-left: 10px;
width: 50%;
}
.vd-input {
width: 50px;
padding-left: 0;
@@ -785,6 +845,27 @@
min-height: 25px;
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 {
width: 90%;
}

View File

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

View File

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