Compare commits
2 Commits
42b6f6af20
...
cc6cec5640
| Author | SHA1 | Date | |
|---|---|---|---|
| cc6cec5640 | |||
| 670a01a7fa |
@@ -2,6 +2,7 @@
|
|||||||
all(not(debug_assertions), target_os = "windows"),
|
all(not(debug_assertions), target_os = "windows"),
|
||||||
windows_subsystem = "windows"
|
windows_subsystem = "windows"
|
||||||
)]
|
)]
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
@@ -241,7 +242,7 @@ fn search(index: i64) -> SearchResult {
|
|||||||
name: row.read::<&str, _>("name").to_string(),
|
name: row.read::<&str, _>("name").to_string(),
|
||||||
types: serde_json::from_str(row.read::<&str, _>("types")).unwrap_or(vec![0]),
|
types: serde_json::from_str(row.read::<&str, _>("types")).unwrap_or(vec![0]),
|
||||||
thumbnail: row.read::<&str, _>("thumbnail").to_string(),
|
thumbnail: row.read::<&str, _>("thumbnail").to_string(),
|
||||||
abilities: row.read::<&str, _>("abilities").to_string(),
|
abilities: serde_json::from_str(row.read::<&str, _>("abilities")).unwrap_or(HashMap::new()),
|
||||||
hp: row.read::<i64, _>("hp"),
|
hp: row.read::<i64, _>("hp"),
|
||||||
attack: row.read::<i64, _>("attack"),
|
attack: row.read::<i64, _>("attack"),
|
||||||
defense: row.read::<i64, _>("defense"),
|
defense: row.read::<i64, _>("defense"),
|
||||||
@@ -257,7 +258,7 @@ fn search(index: i64) -> SearchResult {
|
|||||||
name: "Missigno".to_string(),
|
name: "Missigno".to_string(),
|
||||||
types: vec![],
|
types: vec![],
|
||||||
thumbnail: "".to_string(),
|
thumbnail: "".to_string(),
|
||||||
abilities: "{}".to_string(),
|
abilities: HashMap::new(),
|
||||||
hp: 0,
|
hp: 0,
|
||||||
attack: 0,
|
attack: 0,
|
||||||
defense: 0,
|
defense: 0,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
@@ -11,7 +13,7 @@ pub struct SearchResult {
|
|||||||
pub special_attack: i64,
|
pub special_attack: i64,
|
||||||
pub special_defense: i64,
|
pub special_defense: i64,
|
||||||
pub speed: i64,
|
pub speed: i64,
|
||||||
pub abilities: String,
|
pub abilities: HashMap<String, String>,
|
||||||
pub thumbnail: String,
|
pub thumbnail: String,
|
||||||
pub learnset: Vec<PokemonDataLearnset>,
|
pub learnset: Vec<PokemonDataLearnset>,
|
||||||
}
|
}
|
||||||
@@ -82,7 +84,7 @@ pub struct PokemonDataToLoad {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
pub types: Vec<i64>,
|
pub types: Vec<i64>,
|
||||||
pub thumbnail: String,
|
pub thumbnail: String,
|
||||||
pub abilities: String,
|
pub abilities: HashMap<String, String>,
|
||||||
pub hp: i64,
|
pub hp: i64,
|
||||||
pub attack: i64,
|
pub attack: i64,
|
||||||
pub defense: i64,
|
pub defense: i64,
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
console.log("skip");
|
console.log("skip");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log(attackData);
|
||||||
if (attack_direction === "p1p2") {
|
if (attack_direction === "p1p2") {
|
||||||
attacker = player1Data;
|
attacker = player1Data;
|
||||||
defender = player2Data;
|
defender = player2Data;
|
||||||
|
|||||||
@@ -135,8 +135,8 @@
|
|||||||
} else if (!pokemonData.speed_plus && !!pokemonData.speed_minus) {
|
} else if (!pokemonData.speed_plus && !!pokemonData.speed_minus) {
|
||||||
spd_p = 0.9;
|
spd_p = 0.9;
|
||||||
}
|
}
|
||||||
abilities = Object.keys(JSON.parse(pokemonData.abilities));
|
abilities = Object.keys(pokemonData.abilities);
|
||||||
abilities_description = Object.values(JSON.parse(pokemonData.abilities));
|
abilities_description = Object.values(pokemonData.abilities);
|
||||||
hp_final = calculate_hp(
|
hp_final = calculate_hp(
|
||||||
pokemonData.hp,
|
pokemonData.hp,
|
||||||
pokemonData.hp_v,
|
pokemonData.hp_v,
|
||||||
|
|||||||
@@ -179,6 +179,21 @@
|
|||||||
>
|
>
|
||||||
Load
|
Load
|
||||||
</button><br />
|
</button><br />
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
pokemonDataArray.forEach((pd) => {
|
||||||
|
pd.attack_buff = 0;
|
||||||
|
pd.defense_buff = 0;
|
||||||
|
pd.special_attack_buff = 0;
|
||||||
|
pd.special_defense_buff = 0;
|
||||||
|
pd.speed_buff = 0;
|
||||||
|
pd.terastype = [0];
|
||||||
|
});
|
||||||
|
pokemonData = pokemonDataArray[index];
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Reset Battle Status
|
||||||
|
</button><br />
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
pokemonData = undefined;
|
pokemonData = undefined;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export interface PokemonDBData {
|
|||||||
name: string;
|
name: string;
|
||||||
types: number[];
|
types: number[];
|
||||||
thumbnail: string;
|
thumbnail: string;
|
||||||
abilities: string;
|
abilities: Record<string, string>;
|
||||||
hp: number;
|
hp: number;
|
||||||
attack: number;
|
attack: number;
|
||||||
defense: number;
|
defense: number;
|
||||||
@@ -17,7 +17,7 @@ export interface PokemonData {
|
|||||||
name: string;
|
name: string;
|
||||||
types: number[];
|
types: number[];
|
||||||
thumbnail: string;
|
thumbnail: string;
|
||||||
abilities: string;
|
abilities: Record<string, string>;
|
||||||
hp: number;
|
hp: number;
|
||||||
attack: number;
|
attack: number;
|
||||||
defense: number;
|
defense: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user