From 6b7485ebc49926b947bfd326878d3ee61093fe58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Pi=C3=B1ones?= <30808181+dpinones@users.noreply.github.com> Date: Mon, 4 Nov 2024 01:38:29 -0300 Subject: [PATCH] add special hand thief beast (#29) --- src/models/status/round/beast.cairo | 3 +-- src/systems/game_system.cairo | 9 +++++++++ src/utils/packs.cairo | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/models/status/round/beast.cairo b/src/models/status/round/beast.cairo index e1c29d0..d48157b 100644 --- a/src/models/status/round/beast.cairo +++ b/src/models/status/round/beast.cairo @@ -49,8 +49,7 @@ impl BeastImpl of BeastTrait { } store.set_game(game); - let game_mode_beast = GameModeBeast { game_id, cost_discard: 1, cost_play: 2, energy_max_player: 3 }; - GameModeBeastStore::set(@game_mode_beast, world); + let game_mode_beast = GameModeBeastStore::get(world, game.id); _create_beast(world, game_id, game.level.try_into().unwrap()); diff --git a/src/systems/game_system.cairo b/src/systems/game_system.cairo index dc89e92..b2df573 100644 --- a/src/systems/game_system.cairo +++ b/src/systems/game_system.cairo @@ -77,6 +77,9 @@ mod game_system { use jokers_of_neon::models::status::game::game::{Game, GameStore, GameState, GameSubState}; use jokers_of_neon::models::status::game::rage::{RageRound, RageRoundStore}; use jokers_of_neon::models::status::round::adventurer::AdventurerTrait; + use jokers_of_neon::models::data::beast::{ + GameModeBeast, GameModeBeastStore + }; use jokers_of_neon::models::status::round::beast::BeastTrait; use jokers_of_neon::models::status::round::challenge::ChallengeTrait; use jokers_of_neon::models::status::round::current_hand_card::{CurrentHandCard, CurrentHandCardTrait}; @@ -142,6 +145,9 @@ mod game_system { world ); + let game_mode_beast = GameModeBeast { game_id, cost_discard: 1, cost_play: 2, energy_max_player: 3 }; + GameModeBeastStore::set(@game_mode_beast, world); + let create_game_event = CreateGameEvent { player: get_caller_address(), game_id }; emit!(world, (create_game_event)); game_id @@ -446,6 +452,9 @@ mod game_system { if remove_special_card.effect_card_id == SPECIAL_HAND_THIEF_ID { game.max_hands -= 1; game.max_discard -= 1; + let mut game_mode_beast = GameModeBeastStore::get(world, game.id); + game_mode_beast.energy_max_player += 1; + GameModeBeastStore::set(@game_mode_beast, world); } if remove_special_card.effect_card_id == SPECIAL_EXTRA_HELP_ID { game.len_hand -= 2; diff --git a/src/utils/packs.cairo b/src/utils/packs.cairo index 8020305..8fe7128 100644 --- a/src/utils/packs.cairo +++ b/src/utils/packs.cairo @@ -3,6 +3,9 @@ use jokers_of_neon::constants::card::{JOKER_CARD, NEON_JOKER_CARD}; use jokers_of_neon::constants::specials::{SPECIAL_HAND_THIEF_ID, SPECIAL_EXTRA_HELP_ID}; use jokers_of_neon::models::data::game_deck::{GameDeckStore, GameDeckImpl}; use jokers_of_neon::models::status::game::game::{Game, CurrentSpecialCards, CurrentSpecialCardsStore, GameState}; +use jokers_of_neon::models::data::beast::{ + GameModeBeast, GameModeBeastStore +}; use jokers_of_neon::store::{Store, StoreTrait}; use jokers_of_neon::utils::constants::{is_special_card, is_modifier_card}; use jokers_of_neon::utils::random::{Random, RandomImpl, RandomTrait}; @@ -78,6 +81,9 @@ fn select_cards_from_blister( if card_id == SPECIAL_HAND_THIEF_ID { game.max_hands += 1; game.max_discard += 1; + let mut game_mode_beast = GameModeBeastStore::get(world, game.id); + game_mode_beast.energy_max_player += 1; + GameModeBeastStore::set(@game_mode_beast, world); } if card_id == SPECIAL_EXTRA_HELP_ID { game.len_hand += 2;