-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JON-465: Rewards + refactor Game
substates
(#18)
* add rewards logic * upgrade events flow * initialize reward * update substate directly from `select_reward`
- Loading branch information
Showing
13 changed files
with
2,634 additions
and
1,073 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const REWARD_HP_POTION: u32 = 1; | ||
const REWARD_BLISTER_PACK: u32 = 2; | ||
const REWARD_SPECIAL_CARDS: u32 = 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use jokers_of_neon::constants::reward::{REWARD_HP_POTION, REWARD_BLISTER_PACK, REWARD_SPECIAL_CARDS}; | ||
|
||
#[derive(Copy, Drop, Serde)] | ||
#[dojo::model] | ||
struct Reward { | ||
#[key] | ||
game_id: u32, | ||
rewards_ids: Span<u32> | ||
} | ||
|
||
#[derive(Serde, Copy, Drop, IntrospectPacked, PartialEq)] | ||
enum RewardType { | ||
HP_POTION, | ||
BLISTER_PACK, | ||
SPECIAL_CARDS, | ||
NONE | ||
} | ||
|
||
impl u32IntoRewardType of Into<u32, RewardType> { | ||
fn into(self: u32) -> RewardType { | ||
if self == REWARD_HP_POTION { | ||
RewardType::HP_POTION | ||
} else if self == REWARD_BLISTER_PACK { | ||
RewardType::BLISTER_PACK | ||
} else if self == REWARD_SPECIAL_CARDS { | ||
RewardType::SPECIAL_CARDS | ||
} else { | ||
RewardType::NONE | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.