From 66ece3ccdf09b3b73355b050ac22d57d1fc03973 Mon Sep 17 00:00:00 2001 From: Wynd Date: Sun, 6 Oct 2024 15:07:05 +0300 Subject: [PATCH] Added more spirits to the list and some small design changes --- input/ddd/abilities/hebby-repp.json | 214 +++++++++++++++++++ input/ddd/abilities/pricklemane.json | 236 ++++++++++++++++++++ input/ddd/abilities/tama-sheep.json | 237 +++++++++++++++++++++ input/ddd/abilities/yoggy-ram.json | 228 ++++++++++++++++++++ src/ddd.rs | 62 ++++-- templates/components/ddd/abilities.html | 17 +- templates/components/ddd/board.html | 5 + templates/components/ddd/dispositions.html | 4 +- templates/pages/ddd-abilities.html | 16 +- 9 files changed, 991 insertions(+), 28 deletions(-) create mode 100644 input/ddd/abilities/hebby-repp.json create mode 100644 input/ddd/abilities/pricklemane.json create mode 100644 input/ddd/abilities/tama-sheep.json create mode 100644 input/ddd/abilities/yoggy-ram.json diff --git a/input/ddd/abilities/hebby-repp.json b/input/ddd/abilities/hebby-repp.json new file mode 100644 index 0000000..e7248bc --- /dev/null +++ b/input/ddd/abilities/hebby-repp.json @@ -0,0 +1,214 @@ +{ + "spirit": "Hebby Repp", + "order": 6, + "routes": [ + { + "id": 0, + "name": "Wheeler", + "color": "purple", + "tips": [ + { + "to": "Salamander", + "tip": "Head" + }, + { + "to": "Serpent", + "tip": "Head" + }, + { + "to": "Hydra", + "tip": "Chest" + } + ] + }, + { + "id": 1, + "name": "Salamander", + "color": "yellow", + "tips": [ + { + "to": "Hydra", + "tip": "Head" + }, + { + "to": "Serpent", + "tip": "Head" + }, + { + "to": "Wheeler", + "tip": "Chest" + } + ] + }, + { + "id": 2, + "name": "Serpent", + "color": "blue", + "tips": [ + { + "to": "Wheeler", + "tip": "Head" + }, + { + "to": "Hydra", + "tip": "Head" + }, + { + "to": "Salamander", + "tip": "Tail" + } + ] + }, + { + "id": 3, + "name": "Hydra", + "color": "green", + "tips": [ + { + "to": "Salamander", + "tip": "Head" + }, + { + "to": "Wheeler", + "tip": "Head" + }, + { + "to": "Serpent", + "tip": "Chest" + } + ] + } + ], + "abilities": [ + { + "name": "Start", + "pos": "A1", + "type": "Start", + "price": "", + "path": ["E"] + }, + { + "name": "Fire Screen", + "pos": "A4", + "type": "Stat", + "price": "60 LP", + "route": 0, + "path": ["E", "S"] + }, + { + "name": "Defense Boost", + "pos": "A5", + "type": "Stat", + "price": "100 LP", + "route": 0, + "path": ["N"] + }, + { + "name": "Fire", + "pos": "B1", + "type": "Magic", + "price": "10 LP", + "path": ["W", "E"] + }, + { + "name": "Fire Screen", + "pos": "B3", + "type": "Stat", + "price": "20 LP", + "path": ["E", "S"] + }, + { + "name": "Fire Boost", + "pos": "B4", + "type": "Stat", + "price": "50 LP", + "path": ["N", "W", "S"] + }, + { + "name": "Fire Screen", + "pos": "B5", + "type": "Stat", + "price": "40 LP", + "path": ["N", "E"] + }, + { + "name": "HP Boost", + "pos": "C1", + "type": "Stat", + "price": "30 LP", + "path": ["W", "E"] + }, + { + "name": "Magic Boost", + "pos": "C3", + "type": "Stat", + "price": "100 LP", + "path": ["W", "E"] + }, + { + "name": "Fire Boost", + "pos": "C5", + "type": "Stat", + "price": "100 LP", + "path": ["W", "E"] + }, + { + "name": "Fire Boost", + "pos": "D1", + "type": "Stat", + "price": "30 LP", + "path": ["W", "S"] + }, + { + "name": "Slow Block", + "pos": "D2", + "type": "Stat", + "price": "30 LP", + "path": ["N", "S"] + }, + { + "name": "Magic Haste", + "pos": "D3", + "type": "Stat", + "price": "30 LP", + "path": ["N", "W", "E"] + }, + { + "name": "Fira", + "pos": "D4", + "type": "Magic", + "price": "100 LP", + "path": ["S"] + }, + { + "name": "Checkpoint", + "pos": "D5", + "type": "Checkpoint", + "price": "Link x3", + "path": ["W", "N", "S"] + }, + { + "name": "Fire Windmill", + "pos": "D6", + "type": "Attack", + "price": "150 LP", + "path": ["N"] + }, + { + "name": "HP Boost", + "pos": "E3", + "type": "Stat", + "price": "50 LP", + "route": 1, + "path": ["W", "E"] + }, + { + "name": "Magic Haste", + "pos": "F3", + "type": "Stat", + "price": "50 LP", + "route": 1, + "path": ["W"] + } + ] +} diff --git a/input/ddd/abilities/pricklemane.json b/input/ddd/abilities/pricklemane.json new file mode 100644 index 0000000..23ac6d8 --- /dev/null +++ b/input/ddd/abilities/pricklemane.json @@ -0,0 +1,236 @@ +{ + "spirit": "Pricklemane", + "order": 5, + "routes": [ + { + "id": 0, + "name": "Intellectual", + "color": "blue", + "tips": [ + { + "to": "Volcano", + "tip": "Feet" + }, + { + "to": "Bouncer", + "tip": "Face" + }, + { + "to": "Scrapper", + "tip": "Feet" + } + ] + }, + { + "id": 1, + "name": "Volcano", + "color": "purple", + "tips": [ + { + "to": "Intellectual", + "tip": "Face" + }, + { + "to": "Bouncer", + "tip": "Face" + }, + { + "to": "Scrapper", + "tip": "Tail" + } + ] + }, + { + "id": 2, + "name": "Scrapper", + "color": "yellow", + "tips": [ + { + "to": "Bouncer", + "tip": "Tail" + }, + { + "to": "Volcano", + "tip": "Face" + }, + { + "to": "Intellectual", + "tip": "Feet" + } + ] + }, + { + "id": 3, + "name": "Bouncer", + "color": "green", + "tips": [ + { + "to": "Scrapper", + "tip": "Face" + }, + { + "to": "Volcano", + "tip": "Face" + }, + { + "to": "Intellectual", + "tip": "Tail" + } + ] + }, + { + "id": 100, + "name": "Secret Route 1", + "color": "secret1", + "tips": [] + } + ], + "abilities": [ + { + "name": "HP Boost", + "pos": "A3", + "type": "Stat", + "price": "30 LP", + "path": ["E"] + }, + { + "name": "Attack Boost", + "pos": "A5", + "type": "Stat", + "price": "100 LP", + "path": ["E"] + }, + { + "name": "HP Boost", + "pos": "A6", + "type": "Stat", + "price": "50 LP", + "route": 100, + "path": ["E"] + }, + { + "name": "Start", + "pos": "B1", + "type": "Start", + "price": "", + "path": ["S"] + }, + { + "name": "Strike Raid", + "pos": "B2", + "type": "Attack", + "price": "10 LP", + "path": ["N", "S"] + }, + { + "name": "Item Boost", + "pos": "B3", + "type": "Stat", + "price": "30 LP", + "path": ["N", "S", "W", "E"] + }, + { + "name": "Time Bomb", + "pos": "B4", + "type": "Magic", + "price": "100 LP", + "path": ["N", "S", "E"] + }, + { + "name": "Attack Haste", + "pos": "B5", + "type": "Stat", + "price": "30 LP", + "path": ["N", "S", "W", "E"] + }, + { + "name": "Secret", + "pos": "B6", + "type": "Secret", + "price": "10 LP", + "path": ["N", "S", "W", "E"] + }, + { + "name": "Poison Block", + "pos": "B7", + "type": "Stat", + "price": "30 LP", + "route": 100, + "path": ["N", "S"] + }, + { + "name": "Circle Raid", + "pos": "B8", + "type": "Attack", + "price": "100 LP", + "route": 100, + "path": ["N"] + }, + { + "name": "Stop Block", + "pos": "C2", + "type": "Stat", + "price": "30 LP", + "route": 0, + "path": ["S", "E"] + }, + { + "name": "Sleep Block", + "pos": "C3", + "type": "Stat", + "price": "30 LP", + "path": ["W", "E", "N"] + }, + { + "name": "Checkpoint", + "pos": "C4", + "type": "Checkpoint", + "price": "Level 10", + "path": ["W", "E"] + }, + { + "name": "Fire Screen", + "pos": "C5", + "type": "Stat", + "price": "20 LP", + "path": ["W"] + }, + { + "name": "Attack Haste", + "pos": "C6", + "type": "Stat", + "price": "50 LP", + "route": 100, + "path": ["W"] + }, + { + "name": "Attack Haste", + "pos": "D2", + "type": "Stat", + "price": "100 LP", + "route": 0, + "path": ["W"] + }, + { + "name": "Checkpoint", + "pos": "D3", + "type": "Checkpoint", + "price": "Link x5", + "path": ["W", "E"] + }, + { + "name": "Defense Boost", + "pos": "D4", + "type": "Stat", + "price": "100 LP", + "path": ["W"] + }, + { + "name": "Combo Plus", + "pos": "E3", + "type": "Support", + "price": "200 LP", + "path": ["W"] + } + ] +} diff --git a/input/ddd/abilities/tama-sheep.json b/input/ddd/abilities/tama-sheep.json new file mode 100644 index 0000000..23ee2c2 --- /dev/null +++ b/input/ddd/abilities/tama-sheep.json @@ -0,0 +1,237 @@ +{ + "spirit": "Tama Sheep", + "order": 2, + "routes": [ + { + "id": 0, + "name": "Mumbler", + "color": "blue", + "tips": [ + { + "to": "Picker-Upper", + "tip": "Face" + }, + { + "to": "Snooze Maker", + "tip": "Face" + }, + { + "to": "Pillow Fluffer", + "tip": "Horn" + } + ] + }, + { + "id": 1, + "name": "Picker-Upper", + "color": "purple", + "tips": [ + { + "to": "Mumbler", + "tip": "Face" + }, + { + "to": "Pillow Fluffer", + "tip": "Face" + }, + { + "to": "Snooze Maker", + "tip": "Horn" + } + ] + }, + { + "id": 2, + "name": "Snooze Maker", + "color": "yellow", + "tips": [ + { + "to": "Pillow Fluffer", + "tip": "Feet" + }, + { + "to": "Picker-Upper", + "tip": "Face" + }, + { + "to": "Mumbler", + "tip": "Feet" + } + ] + }, + { + "id": 3, + "name": "Pillow Fluffer", + "color": "green", + "tips": [ + { + "to": "Snooze Maker", + "tip": "Face" + }, + { + "to": "Picker-Upper", + "tip": "Face" + }, + { + "to": "Mumbler", + "tip": "Feet" + } + ] + }, + { + "id": 100, + "name": "Secret Route 1", + "color": "secret1", + "tips": [] + } + ], + "abilities": [ + { + "name": "Start", + "pos": "A1", + "type": "Start", + "price": "", + "path": ["S"] + }, + { + "name": "Sleep", + "pos": "A2", + "type": "Magic", + "price": "10 LP", + "path": ["N", "S", "E"] + }, + { + "name": "Magic Boost", + "pos": "A3", + "type": "Stat", + "price": "100 LP", + "path": ["N", "S"] + }, + { + "name": "Sleep Block", + "pos": "A4", + "type": "Stat", + "price": "30 LP", + "path": ["N", "E"] + }, + { + "name": "Magic Haste", + "pos": "B2", + "type": "Stat", + "price": "30 LP", + "path": ["E", "W"] + }, + { + "name": "Defense Boost", + "pos": "B4", + "type": "Stat", + "price": "100 LP", + "path": ["E", "W"] + }, + { + "name": "Water Screen", + "pos": "C2", + "type": "Stat", + "price": "20 LP", + "path": ["E", "W"] + }, + { + "name": "Slow Block", + "pos": "C4", + "type": "Stat", + "price": "30 LP", + "path": ["E", "W"] + }, + { + "name": "Secret", + "pos": "D2", + "type": "Secret", + "price": "10 LP", + "path": ["W", "S"] + }, + { + "name": "Balloon", + "pos": "D3", + "type": "Magic", + "price": "50 LP", + "route": 100, + "path": ["N", "E"] + }, + { + "name": "Checkpoint", + "pos": "D4", + "type": "Checkpoint", + "price": "Link x1", + "path": ["E", "W"] + }, + { + "name": "Stop Block", + "pos": "E2", + "type": "Stat", + "price": "30 LP", + "route": 100, + "path": ["S", "E"] + }, + { + "name": "HP Boost", + "pos": "E3", + "type": "Stat", + "price": "30 LP", + "route": 100, + "path": ["W", "N"] + }, + { + "name": "Sleepra", + "pos": "E4", + "type": "Magic", + "price": "100 LP", + "path": ["E", "W"] + }, + { + "name": "Magic Haste", + "pos": "F2", + "type": "Stat", + "price": "50 LP", + "route": 100, + "path": ["E", "W", "S"] + }, + { + "name": "Water Screen", + "pos": "F3", + "type": "Stat", + "price": "40 LP", + "route": 0, + "path": ["N", "E"] + }, + { + "name": "Checkpoint", + "pos": "F4", + "type": "Checkpoint", + "price": "Link x2", + "path": ["E", "W"] + }, + { + "name": "Magic Haste", + "pos": "G2", + "type": "Stat", + "price": "100 LP", + "route": 100, + "path": ["W"] + }, + { + "name": "Support Boost", + "pos": "G3", + "type": "Support", + "price": "200 LP", + "route": 0, + "path": ["W"] + }, + { + "name": "Sleepga", + "pos": "G4", + "type": "Magic", + "price": "150 LP", + "path": ["W"] + } + ] +} diff --git a/input/ddd/abilities/yoggy-ram.json b/input/ddd/abilities/yoggy-ram.json new file mode 100644 index 0000000..a5522ac --- /dev/null +++ b/input/ddd/abilities/yoggy-ram.json @@ -0,0 +1,228 @@ +{ + "spirit": "Yoggy Ram", + "order": 3, + "routes": [ + { + "id": 0, + "name": "Trailblazer", + "color": "yellow", + "tips": [ + { + "to": "Jumper", + "tip": "Face" + }, + { + "to": "Leader", + "tip": "Face" + }, + { + "to": "Powerhouse", + "tip": "Chest" + } + ] + }, + { + "id": 1, + "name": "Powerhouse", + "color": "purple", + "tips": [ + { + "to": "Leader", + "tip": "Chest" + }, + { + "to": "Trailblazer", + "tip": "Face" + }, + { + "to": "Jumper", + "tip": "Chest" + } + ] + }, + { + "id": 2, + "name": "Leader", + "color": "blue", + "tips": [ + { + "to": "Powerhouse", + "tip": "Hind Legs" + }, + { + "to": "Jumper", + "tip": "Face" + }, + { + "to": "Trailblazer", + "tip": "Hind Legs" + } + ] + }, + { + "id": 3, + "name": "Jumper", + "color": "green", + "tips": [ + { + "to": "Trailblazer", + "tip": "Face" + }, + { + "to": "Powerhouse", + "tip": "Face" + }, + { + "to": "Leader", + "tip": "Tail" + } + ] + } + ], + "abilities": [ + { + "name": "Fire Screen", + "pos": "A3", + "type": "Stat", + "price": "80 LP", + "route": 0, + "path": ["E", "S"] + }, + { + "name": "Defense Boost", + "pos": "A4", + "type": "Stat", + "price": "200 LP", + "route": 0, + "path": ["N"] + }, + { + "name": "Start", + "pos": "B2", + "type": "Start", + "price": "", + "path": ["S", "E"] + }, + { + "name": "Esuna", + "pos": "B3", + "type": "Magic", + "price": "10 LP", + "path": ["N", "S", "E", "W"] + }, + { + "name": "Fire Screen", + "pos": "B4", + "type": "Stat", + "price": "20 LP", + "path": ["N", "S"] + }, + { + "name": "Bind Block", + "pos": "B5", + "type": "Stat", + "price": "30 LP", + "path": ["N", "S"] + }, + { + "name": "Fire Screen", + "pos": "B6", + "type": "Stat", + "price": "40 LP", + "path": ["N", "S"] + }, + { + "name": "Fire Screen", + "pos": "B7", + "type": "Stat", + "price": "60 LP", + "path": ["N", "S"] + }, + { + "name": "Defense Boost", + "pos": "B8", + "type": "Stat", + "price": "100 LP", + "path": ["N"] + }, + { + "name": "HP Boost", + "pos": "C1", + "type": "Stat", + "price": "30 LP", + "route": 1, + "path": ["S", "E"] + }, + { + "name": "Fire", + "pos": "C2", + "type": "Magic", + "price": "10 LP", + "path": ["N", "S", "W", "E"] + }, + { + "name": "Checkpoint", + "pos": "C3", + "type": "Checkpoint", + "price": "Link x4", + "path": ["N", "S", "W", "E"] + }, + { + "name": "Treasure Magnet", + "pos": "C4", + "type": "Support", + "price": "50 LP", + "path": ["N"] + }, + { + "name": "Fire Screen", + "pos": "D1", + "type": "Stat", + "price": "100 LP", + "route": 1, + "path": ["W"] + }, + { + "name": "Fire Boost", + "pos": "D2", + "type": "Stat", + "price": "30 LP", + "path": ["W", "E"] + }, + { + "name": "Fire Windmill", + "pos": "D3", + "type": "Attack", + "price": "150 LP", + "path": ["W"] + }, + { + "name": "Checkpoint", + "pos": "E2", + "type": "Checkpoint", + "price": "Level 10", + "path": ["W", "E"] + }, + { + "name": "Fira", + "pos": "F2", + "type": "Magic", + "price": "100 LP", + "path": ["W", "E"] + }, + { + "name": "Checkpoint", + "pos": "G2", + "type": "Checkpoint", + "price": "Level 20", + "path": ["W", "E"] + }, + { + "name": "Firaga", + "pos": "H2", + "type": "Magic", + "price": "150 LP", + "path": ["W"] + } + ] +} diff --git a/src/ddd.rs b/src/ddd.rs index 6fcb1ae..efd2e7e 100644 --- a/src/ddd.rs +++ b/src/ddd.rs @@ -24,16 +24,24 @@ impl Board { pub fn init_routes(&mut self) { self.routes.iter_mut().for_each(|r| { r.interaction = match r.color { - DispositionColor::Blue => Interaction::Poke, - DispositionColor::Purple => Interaction::Poke, - DispositionColor::Yellow => Interaction::Rub, - DispositionColor::Green => Interaction::Rub, + Color::Blue => Interaction::Poke, + 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, } }); - let routes = self.routes.clone(); + let routes = self + .routes + .clone() + .into_iter() + .filter(|r| r.id < 100) + .collect_vec(); - self.routes.iter_mut().for_each(|r| { + self.routes.iter_mut().filter(|r| r.id < 100).for_each(|r| { r.tips.iter_mut().for_each(|t| { let route = routes.iter().find(|r| r.name == t.to); if let Some(route) = route { @@ -115,6 +123,10 @@ impl Board { char::from_u32(64 + *i).unwrap_or('0') } + pub fn get_dispositions(&self) -> Vec<&Route> { + self.routes.iter().filter(|r| r.id < 100).collect_vec() + } + pub fn get_supports(&self) -> Vec<&Ability> { self.abilities .iter() @@ -122,10 +134,14 @@ impl Board { .collect_vec() } - pub fn get_magics(&self) -> Vec<&Ability> { + pub fn get_commands(&self) -> Vec<&Ability> { self.abilities .iter() - .filter(|&ability| ability.r#type == AbilityType::Magic) + .filter(|&ability| { + ability.r#type == AbilityType::Magic + || ability.r#type == AbilityType::Attack + || ability.r#type == AbilityType::Support + }) .collect_vec() } @@ -141,14 +157,14 @@ impl Board { struct Route { id: u32, name: String, - color: DispositionColor, + color: Color, tips: Vec, #[serde(skip_deserializing)] interaction: Interaction, } #[derive(Debug, Deserialize, PartialEq, Eq, Clone)] -enum DispositionColor { +enum Color { #[serde(alias = "blue")] Blue, #[serde(alias = "purple")] @@ -157,15 +173,23 @@ enum DispositionColor { Yellow, #[serde(alias = "green")] Green, + + #[serde(alias = "secret1")] + SecretGreen, + #[serde(alias = "secret2")] + SecretRed, } -impl Display for DispositionColor { +impl Display for Color { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - DispositionColor::Blue => f.write_str("blue"), - DispositionColor::Purple => f.write_str("purple"), - DispositionColor::Yellow => f.write_str("yellow"), - DispositionColor::Green => f.write_str("green"), + Color::Blue => f.write_str("blue"), + Color::Purple => f.write_str("purple"), + Color::Yellow => f.write_str("yellow"), + Color::Green => f.write_str("green"), + + Color::SecretGreen => f.write_str("secret1"), + Color::SecretRed => f.write_str("secret2"), } } } @@ -174,12 +198,12 @@ impl Display for DispositionColor { struct Tip { to: String, #[serde(skip_deserializing, default = "default_disposition_color")] - to_color: DispositionColor, + to_color: Color, tip: String, } -fn default_disposition_color() -> DispositionColor { - DispositionColor::Blue +fn default_disposition_color() -> Color { + Color::Blue } #[derive(Debug, Deserialize, PartialEq, Eq)] @@ -192,6 +216,8 @@ enum AbilityType { Support, Attack, Magic, + Reprisal, + Defense, } type BoardPosition = (u32, u32); diff --git a/templates/components/ddd/abilities.html b/templates/components/ddd/abilities.html index 176af36..d07580e 100644 --- a/templates/components/ddd/abilities.html +++ b/templates/components/ddd/abilities.html @@ -3,7 +3,11 @@

Stats

@@ -30,4 +34,15 @@ {% endif %} + {% let commands = board.get_commands() %} + {% if commands.len() > 0 %} +
+

Commands

+
    + {% for ability in commands %} +
  • {{ ability.name }}
  • + {% endfor %} +
+
+ {% endif %} diff --git a/templates/components/ddd/board.html b/templates/components/ddd/board.html index 8034afa..a6fd35c 100644 --- a/templates/components/ddd/board.html +++ b/templates/components/ddd/board.html @@ -1,5 +1,10 @@

Board

+ + diff --git a/templates/components/ddd/dispositions.html b/templates/components/ddd/dispositions.html index ead0cd3..40f1e4f 100644 --- a/templates/components/ddd/dispositions.html +++ b/templates/components/ddd/dispositions.html @@ -1,6 +1,6 @@

Dispositions

-{% for route in board.routes %} +{% for route in board.get_dispositions() %}
@@ -10,7 +10,7 @@ {% for tip in route.tips %}
  • - {{+ tip.to +}}: {{+ tip.tip +}} + {{+ tip.to +}} ➔ {{+ tip.tip +}}
  • {% endfor %} diff --git a/templates/pages/ddd-abilities.html b/templates/pages/ddd-abilities.html index 32842d2..249203f 100644 --- a/templates/pages/ddd-abilities.html +++ b/templates/pages/ddd-abilities.html @@ -17,7 +17,15 @@ } .yellow { - background-color: #d6cb35; + background-color: #d3c949; + } + + .secret1 { + background-color: #497331; + } + + .secret2 { + background-color: #881a22; } div.abilities { @@ -187,12 +195,6 @@ {% block content %} {% for board in boards %}

    {{+ board.spirit +}}

    - -
      -
    • Total LP Needed: {{+ board.total_lp +}}
    • -
    • Max Level Needed: {{+ board.max_level +}}
    • -
    - {% include "components/ddd/abilities.html" %} {% include "components/ddd/dispositions.html" %} {% include "components/ddd/board.html" %}