Switched to toml for DDD since its easier to write and added more spirit boards
parent
66ece3ccdf
commit
39de22388f
|
@ -7,6 +7,7 @@ edition = "2021"
|
|||
askama = "0.12.1"
|
||||
serde = { version = "1.0.203", features = ["derive"] }
|
||||
serde_json = "1.0.118"
|
||||
toml = "0.8.19"
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||
itertools = "0.13.0"
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
spirit = "Sir Kyroo"
|
||||
order = 7
|
||||
|
||||
[[routes]]
|
||||
id = 0
|
||||
name = "Warrior"
|
||||
color = "purple"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Paladin"
|
||||
tip = "Face"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Guardian"
|
||||
tip = "Face"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Knight"
|
||||
tip = "Shield"
|
||||
|
||||
[[routes]]
|
||||
id = 1
|
||||
name = "Paladin"
|
||||
color = "blue"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Warrior"
|
||||
tip = "Shield"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Guardian"
|
||||
tip = "Face"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Knight"
|
||||
tip = "Wings"
|
||||
|
||||
[[routes]]
|
||||
id = 2
|
||||
name = "Knight"
|
||||
color = "yellow"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Guardian"
|
||||
tip = "Shield"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Warrior"
|
||||
tip = "Face"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Paladin"
|
||||
tip = "Shield"
|
||||
|
||||
[[routes]]
|
||||
id = 3
|
||||
name = "Guardian"
|
||||
color = "green"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Knight"
|
||||
tip = "Shield"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Paladin"
|
||||
tip = "Body"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Warrior"
|
||||
tip = "Shield"
|
||||
|
||||
[[abilities]]
|
||||
name = "Start"
|
||||
pos = "A2"
|
||||
type = "Start"
|
||||
price = ""
|
||||
path = ["E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Water Screen"
|
||||
pos = "A6"
|
||||
type = "Stat"
|
||||
price = "60 LP"
|
||||
route = 0
|
||||
path = ["E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Strike Raid"
|
||||
pos = "B2"
|
||||
type = "Attack"
|
||||
price = "10 LP"
|
||||
path = ["W", "E", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Cure Boost"
|
||||
pos = "B3"
|
||||
type = "Stat"
|
||||
price = "50 LP"
|
||||
path = ["N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Water Boost"
|
||||
pos = "B4"
|
||||
type = "Stat"
|
||||
price = "50 LP"
|
||||
path = ["N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Attack Haste"
|
||||
pos = "B5"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
path = ["N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Water Screen"
|
||||
pos = "B6"
|
||||
type = "Stat"
|
||||
price = "40 LP"
|
||||
path = ["N", "S", "W", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Checkpoint"
|
||||
pos = "B7"
|
||||
type = "Checkpoint"
|
||||
price = "Level 20"
|
||||
path = ["N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Blitz"
|
||||
pos = "B8"
|
||||
type = "Attack"
|
||||
price = "100 LP"
|
||||
path = ["N"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Water Boost"
|
||||
pos = "C2"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
path = ["W", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "HP Boost"
|
||||
pos = "C6"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
route = 0
|
||||
path = ["W"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Attack Boost"
|
||||
pos = "D2"
|
||||
type = "Stat"
|
||||
price = "100 LP"
|
||||
path = ["W", "E", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Stop Block"
|
||||
pos = "D3"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
route = 1
|
||||
path = ["N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Cure Boost"
|
||||
pos = "D4"
|
||||
type = "Stat"
|
||||
price = "100 LP"
|
||||
route = 1
|
||||
path = ["N"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Magic Boost"
|
||||
pos = "E1"
|
||||
type = "Stat"
|
||||
price = "100 LP"
|
||||
path = ["S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Water Screen"
|
||||
pos = "E2"
|
||||
type = "Stat"
|
||||
price = "20 LP"
|
||||
path = ["W", "E", "N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Cure Boost"
|
||||
pos = "E3"
|
||||
type = "Stat"
|
||||
price = "100 LP"
|
||||
path = ["N"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Checkpoint"
|
||||
pos = "F2"
|
||||
type = "Checkpoint"
|
||||
price = "Link x3"
|
||||
path = ["W", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Combo Plus"
|
||||
pos = "G2"
|
||||
type = "Support"
|
||||
price = "200 LP"
|
||||
path = ["W"]
|
|
@ -0,0 +1,207 @@
|
|||
spirit = "Toximander"
|
||||
order = 8
|
||||
|
||||
[[routes]]
|
||||
id = 0
|
||||
name = "Hunter"
|
||||
color = "purple"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Basilisk"
|
||||
tip = "Tail"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Loose Cannon"
|
||||
tip = "Face"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Bane"
|
||||
tip = "Tail"
|
||||
|
||||
[[routes]]
|
||||
id = 1
|
||||
name = "Basilisk"
|
||||
color = "blue"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Hunter"
|
||||
tip = "Body"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Bane"
|
||||
tip = "Face"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Loose Cannon"
|
||||
tip = "Body"
|
||||
|
||||
[[routes]]
|
||||
id = 2
|
||||
name = "Loose Cannon"
|
||||
color = "yellow"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Bane"
|
||||
tip = "Legs"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Hunter"
|
||||
tip = "Face"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Basilisk"
|
||||
tip = "Body"
|
||||
|
||||
[[routes]]
|
||||
id = 3
|
||||
name = "Bane"
|
||||
color = "green"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Loose Cannon"
|
||||
tip = "Body"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Basilisk"
|
||||
tip = "Face"
|
||||
|
||||
[[routes.tips]]
|
||||
to = "Hunter"
|
||||
tip = "Body"
|
||||
|
||||
[[abilities]]
|
||||
name = "Start"
|
||||
pos = "A3"
|
||||
type = "Start"
|
||||
price = ""
|
||||
path = ["E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Bind Block"
|
||||
pos = "B2"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
path = ["S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Poison"
|
||||
pos = "B3"
|
||||
type = "Magic"
|
||||
price = "10 LP"
|
||||
path = ["W", "E", "N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Confusion Block"
|
||||
pos = "B4"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
path = ["N"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Treasure Magnet"
|
||||
pos = "C1"
|
||||
type = "Support"
|
||||
price = "50 LP"
|
||||
path = ["S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Checkpoint"
|
||||
pos = "C2"
|
||||
type = "Checkpoint"
|
||||
price = "Link x2"
|
||||
path = ["N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Blindness Block"
|
||||
pos = "C3"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
path = ["W", "E", "N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Attack Haste"
|
||||
pos = "C4"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
route = 0
|
||||
path = ["N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Attack Boost"
|
||||
pos = "C5"
|
||||
type = "Stat"
|
||||
price = "100 LP"
|
||||
route = 0
|
||||
path = ["N"]
|
||||
|
||||
[[abilities]]
|
||||
name = "HP Boost"
|
||||
pos = "D2"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
path = ["S", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Poison Block"
|
||||
pos = "D3"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
path = ["W", "N", "S"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Dark Screen"
|
||||
pos = "D4"
|
||||
type = "Stat"
|
||||
price = "20 LP"
|
||||
path = ["N", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Dark Screen"
|
||||
pos = "E2"
|
||||
type = "Stat"
|
||||
price = "40 LP"
|
||||
path = ["W", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Gravity Strike"
|
||||
pos = "E4"
|
||||
type = "Attack"
|
||||
price = "100 LP"
|
||||
path = ["W", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Checkpoint"
|
||||
pos = "F2"
|
||||
type = "Checkpoint"
|
||||
price = "Level 15"
|
||||
path = ["W", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Mini Block"
|
||||
pos = "F4"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
path = ["W", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Poison Dive"
|
||||
pos = "G2"
|
||||
type = "Attack"
|
||||
price = "200 LP"
|
||||
path = ["W"]
|
||||
|
||||
[[abilities]]
|
||||
name = "Magic Haste"
|
||||
pos = "G4"
|
||||
type = "Stat"
|
||||
price = "30 LP"
|
||||
route = 1
|
||||
path = ["W", "E"]
|
||||
|
||||
[[abilities]]
|
||||
name = "HP Boost"
|
||||
pos = "H4"
|
||||
type = "Stat"
|
||||
price = "50 LP"
|
||||
route = 1
|
||||
path = ["W"]
|
28
src/ddd.rs
28
src/ddd.rs
|
@ -1,4 +1,4 @@
|
|||
use std::{fmt::Display, panic};
|
||||
use std::{fmt::Display, panic, path::PathBuf};
|
||||
|
||||
use askama::Template;
|
||||
use itertools::Itertools;
|
||||
|
@ -28,9 +28,8 @@ impl Board {
|
|||
Color::Purple => Interaction::Poke,
|
||||
Color::Yellow => Interaction::Rub,
|
||||
Color::Green => Interaction::Rub,
|
||||
// Doesn't really matter but I didn't wanna turn this into an Option
|
||||
Color::SecretGreen => Interaction::Poke,
|
||||
Color::SecretRed => Interaction::Poke,
|
||||
|
||||
_ => Interaction::None,
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -140,7 +139,8 @@ impl Board {
|
|||
.filter(|&ability| {
|
||||
ability.r#type == AbilityType::Magic
|
||||
|| ability.r#type == AbilityType::Attack
|
||||
|| ability.r#type == AbilityType::Support
|
||||
|| ability.r#type == AbilityType::Reprisal
|
||||
|| ability.r#type == AbilityType::Defense
|
||||
})
|
||||
.collect_vec()
|
||||
}
|
||||
|
@ -307,6 +307,7 @@ enum Direction {
|
|||
#[derive(Debug, Default, Deserialize, PartialEq, Eq, Clone)]
|
||||
enum Interaction {
|
||||
#[default]
|
||||
None,
|
||||
Poke,
|
||||
Rub,
|
||||
}
|
||||
|
@ -316,6 +317,7 @@ impl Display for Interaction {
|
|||
match self {
|
||||
Interaction::Poke => f.write_str("Poke"),
|
||||
Interaction::Rub => f.write_str("Rub"),
|
||||
_ => f.write_str(""),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -332,10 +334,18 @@ pub fn init() {
|
|||
tracing::info!("Loading ability links json data from {}", ABILITIES_PATH);
|
||||
let mut boards: Vec<Board> = vec![];
|
||||
// Loading multiple files into one vector due to the size of each board
|
||||
let paths = std::fs::read_dir(ABILITIES_PATH).unwrap();
|
||||
for path in paths.flatten() {
|
||||
let board_str = std::fs::read_to_string(path.path()).unwrap();
|
||||
let mut board = serde_json::from_str::<Board>(&board_str).unwrap();
|
||||
let paths = std::fs::read_dir(ABILITIES_PATH)
|
||||
.unwrap()
|
||||
.filter_map(|f| f.ok())
|
||||
.map(|f| f.path())
|
||||
.filter_map(|p| match p.extension().map_or(false, |e| e == "toml") {
|
||||
true => Some(p),
|
||||
false => None,
|
||||
})
|
||||
.collect::<Vec<PathBuf>>();
|
||||
for path in paths {
|
||||
let board_str = std::fs::read_to_string(path).unwrap();
|
||||
let mut board = toml::from_str::<Board>(&board_str).unwrap();
|
||||
|
||||
board.init_routes();
|
||||
board.init_total_lp();
|
||||
|
|
Loading…
Reference in New Issue