Skip to content

Commit

Permalink
change special reward pack
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzn committed Nov 4, 2024
1 parent fcf860b commit c53b18e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 17 deletions.
34 changes: 26 additions & 8 deletions src/constants/packs.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const EMPTY_PACK_ID: u32 = 999;
const SPECIAL_CARDS_PACK_ID: u32 = 20;
const MODIFIER_CARDS_PACK_ID: u32 = 21;
const REWARD_CARDS_PACK_ID: u32 = 22;
const REWARD_SPECIAL_CARDS_PACK_ID: u32 = 23;


fn blister_packs_ids_all() -> Array<u32> {
array![
Expand All @@ -34,7 +36,8 @@ fn blister_packs_ids_all() -> Array<u32> {
FIGURES_BLISTER_PACK_ID,
DECEITFUL_JOKER_BLISTER_PACK_ID,
LOVERS_BLISTER_PACK_ID,
SPECIAL_BET_BLISTER_PACK_ID
SPECIAL_BET_BLISTER_PACK_ID,
REWARD_SPECIAL_CARDS_PACK_ID
]
}

Expand Down Expand Up @@ -235,6 +238,26 @@ fn SPECIAL_CARDS_PACK() -> BlisterPack {
}
}

fn REWARD_SPECIAL_CARDS_PACK() -> BlisterPack {
BlisterPack {
id: SPECIAL_CARDS_PACK_ID,
cost: 0,
name: 'special_cards_pack',
probability: 100,
size: 3,
cards: array![
array![].span(),
legendary_specials_ids().span(),
epic_specials_ids().span(),
rare_specials_ids().span(),
uncommon_specials_ids().span(),
common_specials_ids().span()
]
.span(),
probs: array![100, 5, 10, 15, 25, 45].span(),
}
}

fn MODIFIER_CARDS_PACK() -> BlisterPack {
BlisterPack {
id: MODIFIER_CARDS_PACK_ID,
Expand All @@ -248,19 +271,14 @@ fn MODIFIER_CARDS_PACK() -> BlisterPack {
}

fn REWARD_PACK() -> BlisterPack {

BlisterPack {
id: REWARD_CARDS_PACK_ID,
cost: 0,
name: 'reward_cards_pack',
probability: 100,
size: 8,
cards: array![
array![].span(),
common_cards_all().span(),
array![JOKER_CARD].span(),
modifiers_ids_all().span()
].span(),
cards: array![array![].span(), common_cards_all().span(), array![JOKER_CARD].span(), modifiers_ids_all().span()]
.span(),
probs: array![100, 75, 5, 20].span(),
}
}
11 changes: 5 additions & 6 deletions src/systems/game_system.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ mod game_system {
use dojo::world::Resource::Contract;
use jokers_of_neon::constants::card::{JOKER_CARD, NEON_JOKER_CARD, INVALID_CARD};
use jokers_of_neon::constants::packs::{
SPECIAL_CARDS_PACK_ID, MODIFIER_CARDS_PACK_ID, REWARD_CARDS_PACK_ID, SPECIALS_BLISTER_PACK_ID
SPECIAL_CARDS_PACK_ID, MODIFIER_CARDS_PACK_ID, REWARD_CARDS_PACK_ID, REWARD_SPECIAL_CARDS_PACK_ID,
SPECIALS_BLISTER_PACK_ID
};
use jokers_of_neon::constants::reward::{REWARD_HP_POTION, REWARD_BLISTER_PACK, REWARD_SPECIAL_CARDS};
use jokers_of_neon::constants::specials::{
Expand All @@ -62,6 +63,7 @@ mod game_system {
SPECIAL_ALL_CARDS_TO_HEARTS_ID, SPECIAL_HAND_THIEF_ID, SPECIAL_EXTRA_HELP_ID, SPECIAL_LUCKY_SEVEN_ID,
SPECIAL_NEON_BONUS_ID, SPECIAL_DEADLINE_ID, SPECIAL_INITIAL_ADVANTAGE_ID, SPECIAL_LUCKY_HAND_ID
};
use jokers_of_neon::models::data::beast::{GameModeBeast, GameModeBeastStore};
use jokers_of_neon::models::data::card::{Card, CardTrait, Suit, Value, SuitEnumerableImpl, ValueEnumerableImpl,};
use jokers_of_neon::models::data::effect_card::Effect;
use jokers_of_neon::models::data::events::{
Expand All @@ -77,9 +79,6 @@ 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 @@ -161,7 +160,7 @@ mod game_system {
assert(game.state == GameState::IN_GAME, errors::GAME_NOT_IN_GAME);
assert(game.substate == GameSubState::CREATE_LEVEL, errors::WRONG_SUBSTATE_CREATE_LEVEL);

game.substate = LevelTrait::calculate(world, game_id);
game.substate = GameSubState::BEAST;
match game.substate {
GameSubState::BEAST => { BeastTrait::create(world, ref store, game_id); },
GameSubState::OBSTACLE => { ChallengeTrait::create(world, ref store, game_id); },
Expand Down Expand Up @@ -243,7 +242,7 @@ mod game_system {
game.substate = GameSubState::REWARD_SPECIALS;

let mut store = StoreTrait::new(world);
let cards = open_blister_pack(world, ref store, game, SPECIAL_CARDS_PACK_ID);
let cards = open_blister_pack(world, ref store, game, REWARD_SPECIAL_CARDS_PACK_ID);
let blister_pack_result = BlisterPackResult { game_id, cards_picked: false, cards };
emit!(world, (blister_pack_result));
store.set_blister_pack_result(blister_pack_result);
Expand Down
4 changes: 1 addition & 3 deletions src/utils/packs.cairo
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use dojo::world::{IWorld, IWorldDispatcher, IWorldDispatcherTrait};
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::beast::{GameModeBeast, GameModeBeastStore};
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

0 comments on commit c53b18e

Please sign in to comment.