Skip to content

Commit

Permalink
add special hand thief beast (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpinones authored Nov 4, 2024
1 parent 9333a58 commit 6b7485e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/models/status/round/beast.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
9 changes: 9 additions & 0 deletions src/systems/game_system.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/utils/packs.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6b7485e

Please sign in to comment.