Skip to content

Commit

Permalink
JON-535: Update initial decks (#28)
Browse files Browse the repository at this point in the history
* balance decks

* add current hp
  • Loading branch information
dubzn authored Nov 4, 2024
1 parent 17204f7 commit 9333a58
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/constants/card.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const JOKER_CARD: u32 = 52;
const NEON_JOKER_CARD: u32 = 53;
const INVALID_CARD: u32 = 9999;

const SCRIBE_DECK: u8 = 0;
const OVERLORD_DECK: u8 = 0;
const WARRIOR_DECK: u8 = 1;
const WIZARD_DECK: u8 = 2;

Expand Down
24 changes: 12 additions & 12 deletions src/models/data/game_deck.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dojo::world::{IWorld, IWorldDispatcher, IWorldDispatcherTrait};
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,
ACE_CLUBS_ID, ACE_DIAMONDS_ID, ACE_HEARTS_ID, ACE_SPADES_ID, JOKER_CARD, INVALID_CARD, OVERLORD_DECK, WARRIOR_DECK,
traditional_cards_all
};
use jokers_of_neon::constants::modifiers::{POINTS_MODIFIER_4_ID, MULTI_MODIFIER_4_ID};
Expand Down Expand Up @@ -29,29 +29,29 @@ struct DeckCard {
impl GameDeckImpl of IGameDeck {
fn init(ref store: Store, game_id: u32, deck_id: u8) {
// Traditional Deck
let mut game = store.get_game(game_id);
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);
if deck_id == WARRIOR_DECK {
game.player_hp = 120;
game.current_player_hp = 120;
cards.append(MULTI_MODIFIER_4_ID);
} else if deck_id == OVERLORD_DECK {
game.player_hp = 100;
game.current_player_hp = 100;
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
game.player_hp = 80;
game.current_player_hp = 80;
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.set_game(game);
store.create_deck(game_id, cards);
}

Expand Down
1 change: 0 additions & 1 deletion src/systems/game_system.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ mod game_system {

game.substate = GameSubState::DRAFT_ADVENTURER;
store.set_game(game);
// self.create_level(game_id)
}

fn discard_effect_card(ref world: IWorldDispatcher, game_id: u32, card_index: u32) {
Expand Down
6 changes: 3 additions & 3 deletions src/tests/test_game_select_deck.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod test_select_deck {
use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait};
use jokers_of_neon::constants::card::{
ACE_CLUBS_ID, ACE_DIAMONDS_ID, ACE_HEARTS_ID, ACE_SPADES_ID, JOKER_CARD, INVALID_CARD, SCRIBE_DECK,
ACE_CLUBS_ID, ACE_DIAMONDS_ID, ACE_HEARTS_ID, ACE_SPADES_ID, JOKER_CARD, INVALID_CARD, OVERLORD_DECK,
WARRIOR_DECK, WIZARD_DECK, traditional_cards_all
};
use jokers_of_neon::constants::modifiers::{POINTS_MODIFIER_4_ID, MULTI_MODIFIER_4_ID};
Expand All @@ -21,15 +21,15 @@ mod test_select_deck {

#[test]
#[available_gas(30000000000000000)]
fn test_scribe_deck() {
fn test_OVERLORD_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);
systems.game_system.select_deck(game.id, OVERLORD_DECK);

let game_deck = GameDeckStore::get(world, game.id);
assert(game_deck.len == 58, 'wrong len_deck_cards');
Expand Down

0 comments on commit 9333a58

Please sign in to comment.