diff --git a/manifests/dev/deployment/manifest.json b/manifests/dev/deployment/manifest.json index 9d917d2..5f661b6 100644 --- a/manifests/dev/deployment/manifest.json +++ b/manifests/dev/deployment/manifest.json @@ -1256,8 +1256,8 @@ { "kind": "DojoContract", "address": "0x6a41badee85305fa1aac33488860360c66b60d7f3b204d6e2cd84071dc3c394", - "class_hash": "0x6ad9936a7fc685dfcae8a15c782d32db93b55c2296c8406652e982418f7caed", - "original_class_hash": "0x6ad9936a7fc685dfcae8a15c782d32db93b55c2296c8406652e982418f7caed", + "class_hash": "0x58feb428c2692bda09414a95336a6f566852ff95338fe1760f21f53e520eba0", + "original_class_hash": "0x58feb428c2692bda09414a95336a6f566852ff95338fe1760f21f53e520eba0", "base_class_hash": "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2", "abi": [ { @@ -1466,6 +1466,22 @@ ], "state_mutability": "external" }, + { + "type": "function", + "name": "select_deck", + "inputs": [ + { + "name": "game_id", + "type": "core::integer::u32" + }, + { + "name": "deck_id", + "type": "core::integer::u8" + } + ], + "outputs": [], + "state_mutability": "external" + }, { "type": "function", "name": "play", @@ -1649,6 +1665,7 @@ "init_calldata": [], "tag": "jokers_of_neon-game_system", "systems": [ + "select_deck", "play", "discard", "discard_effect_card", @@ -1983,8 +2000,8 @@ { "kind": "DojoContract", "address": "0x75602558fd679c49be1a6ccb73e3d6d842f0558e1f41c4013ce109d05a5790f", - "class_hash": "0x3dd4a1244136cde97126bb75b820cc0f134fb8af5f4916c030f12bac06e3dec", - "original_class_hash": "0x3dd4a1244136cde97126bb75b820cc0f134fb8af5f4916c030f12bac06e3dec", + "class_hash": "0xe1327a50fe39d93f025e0a84e7ce9ccd46c1acd1f575c50acd881e3d4e23b7", + "original_class_hash": "0xe1327a50fe39d93f025e0a84e7ce9ccd46c1acd1f575c50acd881e3d4e23b7", "base_class_hash": "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2", "abi": [ { @@ -8374,8 +8391,8 @@ "key": false } ], - "class_hash": "0x62a66a5fb4ec621dba3f4179c6e338a380a8a95797ac4e4e3c8060f5e8c94f4", - "original_class_hash": "0x62a66a5fb4ec621dba3f4179c6e338a380a8a95797ac4e4e3c8060f5e8c94f4", + "class_hash": "0xd231a89d484f9ce343542808702a69ff45ecd316470ea746e8de8e889d6f8", + "original_class_hash": "0xd231a89d484f9ce343542808702a69ff45ecd316470ea746e8de8e889d6f8", "abi": [ { "type": "impl", @@ -8749,13 +8766,25 @@ "name": "jokers_of_neon::models::status::game::game::GameState", "variants": [ { - "name": "IN_GAME", + "name": "SELECT_DECK", + "type": "()" + }, + { + "name": "SELECT_SPECIAL_CARDS", + "type": "()" + }, + { + "name": "SELECT_MODIFIER_CARDS", "type": "()" }, { "name": "AT_SHOP", "type": "()" }, + { + "name": "IN_GAME", + "type": "()" + }, { "name": "FINISHED", "type": "()" diff --git a/manifests/dev/deployment/manifest.toml b/manifests/dev/deployment/manifest.toml index 88d75c7..9d4ae09 100644 --- a/manifests/dev/deployment/manifest.toml +++ b/manifests/dev/deployment/manifest.toml @@ -24,8 +24,8 @@ manifest_name = "dojo-base" [[contracts]] kind = "DojoContract" address = "0x6a41badee85305fa1aac33488860360c66b60d7f3b204d6e2cd84071dc3c394" -class_hash = "0x6ad9936a7fc685dfcae8a15c782d32db93b55c2296c8406652e982418f7caed" -original_class_hash = "0x6ad9936a7fc685dfcae8a15c782d32db93b55c2296c8406652e982418f7caed" +class_hash = "0x58feb428c2692bda09414a95336a6f566852ff95338fe1760f21f53e520eba0" +original_class_hash = "0x58feb428c2692bda09414a95336a6f566852ff95338fe1760f21f53e520eba0" base_class_hash = "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2" abi = "manifests/dev/deployment/abis/contracts/jokers_of_neon-game_system-7a205bbc.json" reads = [] @@ -33,6 +33,7 @@ writes = ["ns:jokers_of_neon"] init_calldata = [] tag = "jokers_of_neon-game_system" systems = [ + "select_deck", "play", "discard", "discard_effect_card", @@ -57,8 +58,8 @@ manifest_name = "jokers_of_neon-poker_hand_system-25bae3ed" [[contracts]] kind = "DojoContract" address = "0x75602558fd679c49be1a6ccb73e3d6d842f0558e1f41c4013ce109d05a5790f" -class_hash = "0x3dd4a1244136cde97126bb75b820cc0f134fb8af5f4916c030f12bac06e3dec" -original_class_hash = "0x3dd4a1244136cde97126bb75b820cc0f134fb8af5f4916c030f12bac06e3dec" +class_hash = "0xe1327a50fe39d93f025e0a84e7ce9ccd46c1acd1f575c50acd881e3d4e23b7" +original_class_hash = "0xe1327a50fe39d93f025e0a84e7ce9ccd46c1acd1f575c50acd881e3d4e23b7" base_class_hash = "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2" abi = "manifests/dev/deployment/abis/contracts/jokers_of_neon-rage_system-601fc835.json" reads = [] @@ -497,8 +498,8 @@ key = false [[models]] kind = "DojoModel" -class_hash = "0x62a66a5fb4ec621dba3f4179c6e338a380a8a95797ac4e4e3c8060f5e8c94f4" -original_class_hash = "0x62a66a5fb4ec621dba3f4179c6e338a380a8a95797ac4e4e3c8060f5e8c94f4" +class_hash = "0xd231a89d484f9ce343542808702a69ff45ecd316470ea746e8de8e889d6f8" +original_class_hash = "0xd231a89d484f9ce343542808702a69ff45ecd316470ea746e8de8e889d6f8" abi = "manifests/dev/deployment/abis/models/jokers_of_neon-Game-162de85b.json" tag = "jokers_of_neon-Game" qualified_path = "jokers_of_neon::models::status::game::game::game" diff --git a/src/constants/card.cairo b/src/constants/card.cairo index 9c6e267..ace2a04 100644 --- a/src/constants/card.cairo +++ b/src/constants/card.cairo @@ -58,6 +58,10 @@ const JOKER_CARD: u32 = 52; const NEON_JOKER_CARD: u32 = 53; const INVALID_CARD: u32 = 9999; +const SCRIBE_DECK: u8 = 0; +const WARRIOR_DECK: u8 = 1; +const WIZARD_DECK: u8 = 2; + // TRADITIONALS fn TWO_CLUBS() -> Card { Card { id: TWO_CLUBS_ID, suit: Suit::Clubs, value: Value::Two, points: 2, multi_add: 0 } @@ -218,3 +222,60 @@ fn KING_SPADES() -> Card { fn ACE_SPADES() -> Card { Card { id: ACE_SPADES_ID, suit: Suit::Spades, value: Value::Ace, points: 11, multi_add: 0 } } + +fn traditional_cards_all() -> Array { + array![ + TWO_CLUBS_ID, + THREE_CLUBS_ID, + FOUR_CLUBS_ID, + FIVE_CLUBS_ID, + SIX_CLUBS_ID, + SEVEN_CLUBS_ID, + EIGHT_CLUBS_ID, + NINE_CLUBS_ID, + TEN_CLUBS_ID, + JACK_CLUBS_ID, + QUEEN_CLUBS_ID, + KING_CLUBS_ID, + ACE_CLUBS_ID, + TWO_DIAMONDS_ID, + THREE_DIAMONDS_ID, + FOUR_DIAMONDS_ID, + FIVE_DIAMONDS_ID, + SIX_DIAMONDS_ID, + SEVEN_DIAMONDS_ID, + EIGHT_DIAMONDS_ID, + NINE_DIAMONDS_ID, + TEN_DIAMONDS_ID, + JACK_DIAMONDS_ID, + QUEEN_DIAMONDS_ID, + KING_DIAMONDS_ID, + ACE_DIAMONDS_ID, + TWO_HEARTS_ID, + THREE_HEARTS_ID, + FOUR_HEARTS_ID, + FIVE_HEARTS_ID, + SIX_HEARTS_ID, + SEVEN_HEARTS_ID, + EIGHT_HEARTS_ID, + NINE_HEARTS_ID, + TEN_HEARTS_ID, + JACK_HEARTS_ID, + QUEEN_HEARTS_ID, + KING_HEARTS_ID, + ACE_HEARTS_ID, + TWO_SPADES_ID, + THREE_SPADES_ID, + FOUR_SPADES_ID, + FIVE_SPADES_ID, + SIX_SPADES_ID, + SEVEN_SPADES_ID, + EIGHT_SPADES_ID, + NINE_SPADES_ID, + TEN_SPADES_ID, + JACK_SPADES_ID, + QUEEN_SPADES_ID, + KING_SPADES_ID, + ACE_SPADES_ID + ] +} diff --git a/src/lib.cairo b/src/lib.cairo index 1717fde..589e2a4 100644 --- a/src/lib.cairo +++ b/src/lib.cairo @@ -51,6 +51,7 @@ mod tests { mod test_game_discard_effect_card; mod test_game_discard_special_card; mod test_game_play; + mod test_game_select_deck; mod utils; } diff --git a/src/models/data/game_deck.cairo b/src/models/data/game_deck.cairo index 912a4a0..802d9af 100644 --- a/src/models/data/game_deck.cairo +++ b/src/models/data/game_deck.cairo @@ -1,5 +1,10 @@ use dojo::world::{IWorld, IWorldDispatcher, IWorldDispatcherTrait}; -use jokers_of_neon::constants::card::INVALID_CARD; +use jokers_of_neon::constants::card::{ + ACE_CLUBS_ID, ACE_DIAMONDS_ID, ACE_HEARTS_ID, ACE_SPADES_ID, JOKER_CARD, INVALID_CARD, SCRIBE_DECK, WARRIOR_DECK, + traditional_cards_all +}; +use jokers_of_neon::constants::modifiers::{POINTS_MODIFIER_4_ID, MULTI_MODIFIER_4_ID}; +use jokers_of_neon::store::{Store, StoreTrait}; #[derive(Copy, Drop, IntrospectPacked, Serde)] #[dojo::model] @@ -22,67 +27,33 @@ struct DeckCard { #[generate_trait] impl GameDeckImpl of IGameDeck { - fn init(world: IWorldDispatcher, game_id: u32) { - set!( - world, - ( - GameDeck { game_id, len: 54, round_len: 54 }, - DeckCard { game_id, index: 0, card_id: 0 }, - DeckCard { game_id, index: 1, card_id: 1 }, - DeckCard { game_id, index: 2, card_id: 2 }, - DeckCard { game_id, index: 3, card_id: 3 }, - DeckCard { game_id, index: 4, card_id: 4 }, - DeckCard { game_id, index: 5, card_id: 5 }, - DeckCard { game_id, index: 6, card_id: 6 }, - DeckCard { game_id, index: 7, card_id: 7 }, - DeckCard { game_id, index: 8, card_id: 8 }, - DeckCard { game_id, index: 9, card_id: 9 }, - DeckCard { game_id, index: 10, card_id: 10 }, - DeckCard { game_id, index: 11, card_id: 11 }, - DeckCard { game_id, index: 12, card_id: 12 }, - DeckCard { game_id, index: 13, card_id: 13 }, - DeckCard { game_id, index: 14, card_id: 14 }, - DeckCard { game_id, index: 15, card_id: 15 }, - DeckCard { game_id, index: 16, card_id: 16 }, - DeckCard { game_id, index: 17, card_id: 17 }, - DeckCard { game_id, index: 18, card_id: 18 }, - DeckCard { game_id, index: 19, card_id: 19 }, - DeckCard { game_id, index: 20, card_id: 20 }, - DeckCard { game_id, index: 21, card_id: 21 }, - DeckCard { game_id, index: 22, card_id: 22 }, - DeckCard { game_id, index: 23, card_id: 23 }, - DeckCard { game_id, index: 24, card_id: 24 }, - DeckCard { game_id, index: 25, card_id: 25 }, - DeckCard { game_id, index: 26, card_id: 26 }, - DeckCard { game_id, index: 27, card_id: 27 }, - DeckCard { game_id, index: 28, card_id: 28 }, - DeckCard { game_id, index: 29, card_id: 29 }, - DeckCard { game_id, index: 30, card_id: 30 }, - DeckCard { game_id, index: 31, card_id: 31 }, - DeckCard { game_id, index: 32, card_id: 32 }, - DeckCard { game_id, index: 33, card_id: 33 }, - DeckCard { game_id, index: 34, card_id: 34 }, - DeckCard { game_id, index: 35, card_id: 35 }, - DeckCard { game_id, index: 36, card_id: 36 }, - DeckCard { game_id, index: 37, card_id: 37 }, - DeckCard { game_id, index: 38, card_id: 38 }, - DeckCard { game_id, index: 39, card_id: 39 }, - DeckCard { game_id, index: 40, card_id: 40 }, - DeckCard { game_id, index: 41, card_id: 41 }, - DeckCard { game_id, index: 42, card_id: 42 }, - DeckCard { game_id, index: 43, card_id: 43 }, - DeckCard { game_id, index: 44, card_id: 44 }, - DeckCard { game_id, index: 45, card_id: 45 }, - DeckCard { game_id, index: 46, card_id: 46 }, - DeckCard { game_id, index: 47, card_id: 47 }, - DeckCard { game_id, index: 48, card_id: 48 }, - DeckCard { game_id, index: 49, card_id: 49 }, - DeckCard { game_id, index: 50, card_id: 50 }, - DeckCard { game_id, index: 51, card_id: 51 }, - DeckCard { game_id, index: 52, card_id: 52 }, - DeckCard { game_id, index: 53, card_id: 52 }, - ) - ); + fn init(ref store: Store, game_id: u32, deck_id: u8) { + + // Traditional Deck + let mut cards = traditional_cards_all(); + cards.append(JOKER_CARD); + cards.append(JOKER_CARD); + + if deck_id == SCRIBE_DECK { + cards.append(JOKER_CARD); + cards.append(JOKER_CARD); + cards.append(JOKER_CARD); + cards.append(JOKER_CARD); + } else if deck_id == WARRIOR_DECK { + cards.append(JOKER_CARD); + cards.append(POINTS_MODIFIER_4_ID); + cards.append(POINTS_MODIFIER_4_ID); + cards.append(MULTI_MODIFIER_4_ID); + cards.append(MULTI_MODIFIER_4_ID); + } else { // WIZARD_DECK + cards.append(JOKER_CARD); + cards.append(JOKER_CARD); + cards.append(ACE_CLUBS_ID); + cards.append(ACE_DIAMONDS_ID); + cards.append(ACE_HEARTS_ID); + cards.append(ACE_SPADES_ID); + } + store.create_deck(game_id, cards); } fn add(ref self: GameDeck, world: IWorldDispatcher, card_id: u32) { diff --git a/src/models/status/game/game.cairo b/src/models/status/game/game.cairo index bb2e722..a031b11 100644 --- a/src/models/status/game/game.cairo +++ b/src/models/status/game/game.cairo @@ -2,8 +2,11 @@ use starknet::ContractAddress; #[derive(Serde, Copy, Drop, IntrospectPacked, PartialEq)] enum GameState { - IN_GAME, + SELECT_DECK, + SELECT_SPECIAL_CARDS, + SELECT_MODIFIER_CARDS, AT_SHOP, + IN_GAME, FINISHED, OPEN_BLISTER_PACK } diff --git a/src/store.cairo b/src/store.cairo index 0969a74..57dee0a 100644 --- a/src/store.cairo +++ b/src/store.cairo @@ -80,6 +80,7 @@ use jokers_of_neon::models::data::blister_pack::BlisterPack; use jokers_of_neon::models::data::card::{Card, Suit, Value, SuitEnumerableImpl, ValueEnumerableImpl,}; use jokers_of_neon::models::data::effect_card::{EffectCard, Effect}; use jokers_of_neon::models::data::events::{PokerHandEvent, CreateGameEvent, CardScoreEvent}; +use jokers_of_neon::models::data::game_deck::{DeckCard, GameDeck}; use jokers_of_neon::models::data::poker_hand::{LevelPokerHand, PokerHand}; use jokers_of_neon::models::status::game::game::{Game, CurrentSpecialCards}; @@ -364,6 +365,19 @@ impl StoreImpl of StoreTrait { fn set_blister_pack_result(ref self: Store, blister_pack_result: BlisterPackResult) { set!(self.world, (blister_pack_result)); } + + fn create_deck(ref self: Store, game_id: u32, cards: Array) { + set!(self.world, (GameDeck { game_id, len: cards.len(), round_len: cards.len() })); + + let mut idx = 0; + loop { + if idx == cards.len() { + break; + } + set!(self.world, (DeckCard { game_id, index: idx, card_id: *cards[idx] })); + idx += 1; + } + } } fn get_traditional_card(id: u32) -> Card { diff --git a/src/systems/game_system.cairo b/src/systems/game_system.cairo index 761b722..1b97353 100644 --- a/src/systems/game_system.cairo +++ b/src/systems/game_system.cairo @@ -5,6 +5,7 @@ use jokers_of_neon::models::data::poker_hand::PokerHand; #[dojo::interface] trait IGameSystem { fn create_game(ref world: IWorldDispatcher, player_name: felt252) -> u32; + fn select_deck(ref world: IWorldDispatcher, game_id: u32, deck_id: u8); fn play(ref world: IWorldDispatcher, game_id: u32, cards_index: Array, modifiers_index: Array); fn discard(ref world: IWorldDispatcher, game_id: u32, cards_index: Array, modifiers_index: Array); fn check_hand( @@ -22,7 +23,10 @@ mod errors { const ARRAY_REPEATED_ELEMENTS: felt252 = 'Game: array repeated elements'; const ONLY_EFFECT_CARD: felt252 = 'Game: only effect cards'; const GAME_NOT_IN_GAME: felt252 = 'Game: is not IN_GAME'; + const GAME_NOT_SELECT_SPECIAL_CARDS: felt252 = 'Game:is not SELECT_SPECIAL_CARD'; + const GAME_NOT_SELECT_DECK: felt252 = 'Game:is not SELECT_DECK'; const USE_INVALID_CARD: felt252 = 'Game: use an invalid card'; + const INVALID_DECK_ID: felt252 = 'Game: use an invalid deck'; } #[dojo::contract] @@ -88,32 +92,36 @@ mod game_system { len_max_current_special_cards: 1, len_current_special_cards: 0, current_jokers: 0, - state: GameState::IN_GAME, + state: GameState::SELECT_DECK, cash: 0 }; store.set_game(game); emit!(world, (game)); - GameDeckImpl::init(world, game_id); - create_round(world, game); - - let rage_config = store.get_rage_config(); - RageRoundStore::set( - @RageRound { - game_id, - is_active: false, - current_probability: rage_config.initial_probability, - active_rage_ids: array![].span(), - last_active_level: 0 - }, - world - ); - let create_game_event = CreateGameEvent { player: get_caller_address(), game_id }; emit!(world, (create_game_event)); game_id } + fn select_deck(ref world: IWorldDispatcher, game_id: u32, deck_id: u8) { + let mut store: Store = StoreTrait::new(world); + let mut game = store.get_game(game_id); + // Check that the game exists (if the game has no owner means it does not exists) + assert(game.owner.is_non_zero(), errors::GAME_NOT_FOUND); + + // Check that the owner of the game is the caller + assert(game.owner == get_caller_address(), errors::CALLER_NOT_OWNER); + + // Check that the status of the game + assert(game.state == GameState::SELECT_DECK, errors::GAME_NOT_SELECT_DECK); + + assert(deck_id < 3, errors::INVALID_DECK_ID); + + GameDeckImpl::init(ref store, game_id, deck_id); + game.state = GameState::SELECT_MODIFIER_CARDS; + store.set_game(game); + } + fn play(ref world: IWorldDispatcher, game_id: u32, cards_index: Array, modifiers_index: Array) { let mut store: Store = StoreTrait::new(world); diff --git a/src/tests/test_game_select_deck.cairo b/src/tests/test_game_select_deck.cairo new file mode 100644 index 0000000..a4100e0 --- /dev/null +++ b/src/tests/test_game_select_deck.cairo @@ -0,0 +1,116 @@ +mod test_select_deck { + use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait}; + use jokers_of_neon::models::status::game::game::{Game, GameState}; + use jokers_of_neon::models::data::game_deck::{GameDeck, GameDeckStore, DeckCard, DeckCardStore}; + use jokers_of_neon::constants::card::{ + ACE_CLUBS_ID, ACE_DIAMONDS_ID, ACE_HEARTS_ID, ACE_SPADES_ID, JOKER_CARD, INVALID_CARD, SCRIBE_DECK, WARRIOR_DECK, WIZARD_DECK, + traditional_cards_all + }; + use jokers_of_neon::constants::modifiers::{POINTS_MODIFIER_4_ID, MULTI_MODIFIER_4_ID}; + use jokers_of_neon::store::{Store, StoreTrait}; + use jokers_of_neon::systems::game_system::{game_system, IGameSystemDispatcher, IGameSystemDispatcherTrait}; + use jokers_of_neon::tests::setup::{ + setup, setup::OWNER, setup::IDojoInitDispatcher, setup::IDojoInitDispatcherTrait + }; + use jokers_of_neon::tests::utils::{ + mock_game + }; + use starknet::testing::set_contract_address; + + fn PLAYER() -> starknet::ContractAddress { + starknet::contract_address_const::<'PLAYER'>() + } + + #[test] + #[available_gas(30000000000000000)] + fn test_scribe_deck() { + let (world, systems) = setup::spawn_game(); + let mut store = StoreTrait::new(world); + let mut game = mock_game(ref store, PLAYER()); + game.state = GameState::SELECT_DECK; + store.set_game(game); + + set_contract_address(PLAYER()); + systems.game_system.select_deck(game.id, SCRIBE_DECK); + + let game_deck = GameDeckStore::get(world, game.id); + assert(game_deck.len == 58, 'wrong len_deck_cards'); + + let card_54 = DeckCardStore::get(world, game.id, 54); + assert(card_54.card_id == JOKER_CARD, 'wrong 54 common card'); + + let card_55 = DeckCardStore::get(world, game.id, 55); + assert(card_55.card_id == JOKER_CARD, 'wrong 55 common card'); + + let card_56 = DeckCardStore::get(world, game.id, 56); + assert(card_56.card_id == JOKER_CARD, 'wrong 56 common card'); + + let card_57 = DeckCardStore::get(world, game.id, 57); + assert(card_57.card_id == JOKER_CARD, 'wrong 57 common card'); + } + + #[test] + #[available_gas(30000000000000000)] + fn test_warrior_deck() { + let (world, systems) = setup::spawn_game(); + let mut store = StoreTrait::new(world); + let mut game = mock_game(ref store, PLAYER()); + game.state = GameState::SELECT_DECK; + store.set_game(game); + + set_contract_address(PLAYER()); + systems.game_system.select_deck(game.id, WARRIOR_DECK); + + let game_deck = GameDeckStore::get(world, game.id); + assert(game_deck.len == 59, 'wrong len_deck_cards'); + + let card_54 = DeckCardStore::get(world, game.id, 54); + assert(card_54.card_id == JOKER_CARD, 'wrong 54 common card'); + + let card_55 = DeckCardStore::get(world, game.id, 55); + assert(card_55.card_id == POINTS_MODIFIER_4_ID, 'wrong 55 common card'); + + let card_56 = DeckCardStore::get(world, game.id, 56); + assert(card_56.card_id == POINTS_MODIFIER_4_ID, 'wrong 56 common card'); + + let card_57 = DeckCardStore::get(world, game.id, 57); + assert(card_57.card_id == MULTI_MODIFIER_4_ID, 'wrong 57 common card'); + + let card_58 = DeckCardStore::get(world, game.id, 58); + assert(card_58.card_id == MULTI_MODIFIER_4_ID, 'wrong 58 common card'); + } + + #[test] + #[available_gas(30000000000000000)] + fn test_wizard_deck() { + let (world, systems) = setup::spawn_game(); + let mut store = StoreTrait::new(world); + let mut game = mock_game(ref store, PLAYER()); + game.state = GameState::SELECT_DECK; + store.set_game(game); + + set_contract_address(PLAYER()); + systems.game_system.select_deck(game.id, WIZARD_DECK); + + let game_deck = GameDeckStore::get(world, game.id); + assert(game_deck.len == 60, 'wrong len_deck_cards'); + + let card_54 = DeckCardStore::get(world, game.id, 54); + assert(card_54.card_id == JOKER_CARD, 'wrong 54 common card'); + + let card_55 = DeckCardStore::get(world, game.id, 55); + assert(card_55.card_id == JOKER_CARD, 'wrong 55 common card'); + + let card_56 = DeckCardStore::get(world, game.id, 56); + assert(card_56.card_id == ACE_CLUBS_ID, 'wrong 56 common card'); + + let card_57 = DeckCardStore::get(world, game.id, 57); + assert(card_57.card_id == ACE_DIAMONDS_ID, 'wrong 57 common card'); + + let card_58 = DeckCardStore::get(world, game.id, 58); + assert(card_58.card_id == ACE_HEARTS_ID, 'wrong 58 common card'); + + let card_59 = DeckCardStore::get(world, game.id, 59); + assert(card_59.card_id == ACE_SPADES_ID, 'wrong 59 common card'); + } +}