reflect attack automatically

This commit is contained in:
2023-02-05 20:06:01 +09:00
parent fbea5ac8e5
commit 8b73b7f952
6 changed files with 53 additions and 10 deletions

View File

@@ -6,6 +6,7 @@
export let player1Data: PokemonData | undefined;
export let player2Data: PokemonData | undefined;
export let attackId: number | undefined;
let attackData;
$: {
if (myValue > 0 && myValue !== currentValue) {
@@ -15,6 +16,14 @@
console.log(attackData);
});
}
if (!!attackId) {
invoke("search_move", { index: attackId }).then((r) => {
currentValue = myValue = attackId;
attackData = r;
console.log(attackData);
attackId = undefined;
});
}
}
let attack_direction = "p1p2";
let total_max_damage = 0;