A card game engine for TCGs, primarily Magic: The Gathering but with support for others
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Moving game module with actual data into managrove-core crate

+21 -20
gdext/src/game/card.rs managrove-core/src/game/card.rs
gdext/src/game/mod.rs managrove-core/src/game/mod.rs
gdext/src/game/player.rs managrove-core/src/game/player.rs
gdext/src/game/state.rs managrove-core/src/game/state.rs
gdext/src/game/zone.rs managrove-core/src/game/zone.rs
+4 -9
gdext/src/lib.rs
··· 1 - use std::collections::HashMap; 2 1 use godot::prelude::*; 3 - use crate::game::{card::{CardDefId, Card}, state::GameState}; 4 - 5 - mod game; 2 + use managrove_core::Game; 6 3 7 4 #[derive(GodotClass)] 8 5 #[class(base=Node)] ··· 10 7 #[base] 11 8 base: Base<Node>, 12 9 // other data 13 - cards: HashMap<CardDefId, Card>, 14 - state: GameState 10 + data: Game 15 11 } 16 12 17 13 #[gdextension] ··· 21 17 impl INode for ManaGroveNode { 22 18 fn init(base: Base<Node>) -> Self { 23 19 Self { 24 - cards: HashMap::new(), 25 - state: GameState::new(), 26 - base 20 + base, 21 + data: Game::new() 27 22 } 28 23 } 29 24 }
+1
managrove-core/Cargo.toml
··· 4 4 edition = "2024" 5 5 6 6 [dependencies] 7 + uuid = { version = "1.23.1", features = ["v4", "v5"] }
+16 -11
managrove-core/src/lib.rs
··· 1 - pub fn add(left: u64, right: u64) -> u64 { 2 - left + right 1 + use std::collections::HashMap; 2 + 3 + use crate::game::{card::{Card, CardDefId}, state::GameState}; 4 + 5 + pub mod game; 6 + 7 + pub struct Game { 8 + state: GameState, 9 + cards: HashMap<CardDefId, Card> 3 10 } 4 11 5 - #[cfg(test)] 6 - mod tests { 7 - use super::*; 8 - 9 - #[test] 10 - fn it_works() { 11 - let result = add(2, 2); 12 - assert_eq!(result, 4); 12 + impl Game { 13 + pub fn new() -> Self { 14 + Self { 15 + state: GameState::new(), 16 + cards: HashMap::new() 17 + } 13 18 } 14 - } 19 + }