diff --git a/src/models/status/game/game.cairo b/src/models/status/game/game.cairo index c979312..1d8575a 100644 --- a/src/models/status/game/game.cairo +++ b/src/models/status/game/game.cairo @@ -28,11 +28,14 @@ struct Game { owner: ContractAddress, player_name: felt252, player_hp: u32, + player_score: u32, + player_level: u32, + obstacles_cleared: u32, + beasts_defeated: u32, current_player_hp: u32, max_hands: u8, max_discard: u8, max_jokers: u8, - player_score: u32, level: u32, len_hand: u32, len_max_current_special_cards: u32, @@ -40,7 +43,6 @@ struct Game { current_jokers: u8, state: GameState, substate: GameSubState, - cash: u32 } #[derive(Copy, Drop, IntrospectPacked, Serde)] @@ -62,11 +64,14 @@ impl DefaultGame of Default { owner: Zeroable::zero(), player_name: Zeroable::zero(), player_hp: 500, + player_score: 0, + obstacles_cleared: 0, + beasts_defeated: 0, + player_level: 1, current_player_hp: 500, max_hands: 5, max_discard: 5, max_jokers: 5, - player_score: 0, level: 1, len_hand: 8, len_max_current_special_cards: 5, @@ -74,7 +79,6 @@ impl DefaultGame of Default { current_jokers: 0, state: GameState::IN_GAME, substate: GameSubState::CREATE_LEVEL, - cash: 0 } } } diff --git a/src/models/status/round/beast.cairo b/src/models/status/round/beast.cairo index 70fc10e..938b002 100644 --- a/src/models/status/round/beast.cairo +++ b/src/models/status/round/beast.cairo @@ -93,15 +93,18 @@ impl BeastImpl of BeastTrait { player_beast.energy -= game_mode_beast.cost_play; PlayerBeastStore::set(@player_beast, world); - if beast.current_health.is_zero() { let play_win_game_event = PlayWinGameEvent { player: get_caller_address(), game_id, level: game.level, player_score: 0 }; emit!(world, (play_win_game_event)); - game.state = GameState::IN_GAME; + game.player_score += (beast.tier).into() * 500 + (beast.level).into() * 100; + game.beasts_defeated += 1; + game.player_level += 1; + game.player_hp += 10; + game.current_player_hp += 10; + game.substate = GameSubState::CREATE_REWARD; - game.player_score += 1; if is_rage_card_active(@rage_round, RAGE_CARD_DIMINISHED_HOLD) { // return the cards to the deck diff --git a/src/models/status/round/challenge.cairo b/src/models/status/round/challenge.cairo index 71e3373..864e76d 100644 --- a/src/models/status/round/challenge.cairo +++ b/src/models/status/round/challenge.cairo @@ -86,6 +86,9 @@ impl ChallengeImpl of ChallengeTrait { if Self::is_completed(world, game_id) { emit!(world, ChallengeCompleted { player: game.owner, player_name: game.player_name, game_id }); game.substate = GameSubState::CREATE_REWARD; + game.player_score += challenge.active_ids.len() * 100; + game.obstacles_cleared += 1; + GameStore::set(@game, world); } else { challenge_player.plays -= 1; diff --git a/src/systems/game_system.cairo b/src/systems/game_system.cairo index efd4060..00bb1aa 100644 --- a/src/systems/game_system.cairo +++ b/src/systems/game_system.cairo @@ -102,7 +102,10 @@ mod game_system { owner: player_id, player_name, player_hp: 500, // TODO: Obtain HP from adventurer + player_level: 1, current_player_hp: 500, + obstacles_cleared: 0, + beasts_defeated: 0, max_hands: 5, max_discard: 5, max_jokers: 5, @@ -114,7 +117,6 @@ mod game_system { current_jokers: 0, state: GameState::IN_GAME, substate: GameSubState::DRAFT_DECK, - cash: 0 }; store.set_game(game); emit!(world, (game));