Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic end turn when run out of energy #27

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/models/status/round/beast.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ impl BeastImpl of BeastTrait {
_ => Option::None
}.unwrap();
IRageSystemDispatcher { contract_address: rage_system_address.try_into().unwrap() }.calculate(game.id);
// create_level(world, ref store, game); TODO:
} else if player_beast.energy.is_zero() {
_attack_beast(world, ref store, ref game, ref player_beast, ref beast, ref game_mode_beast);
} else {
let mut cards = array![];
let mut idx = 0;
Expand Down Expand Up @@ -152,6 +149,9 @@ impl BeastImpl of BeastTrait {
}
}
store.set_game(game);
if player_beast.energy.is_zero() && game.substate != GameSubState::CREATE_REWARD {
Self::end_turn(world, game_id);
}
}

fn discard(world: IWorldDispatcher, game_id: u32, cards_index: Array<u32>, modifiers_index: Array<u32>) {
Expand Down Expand Up @@ -207,8 +207,7 @@ impl BeastImpl of BeastTrait {
}

if player_beast.energy.is_zero() {
let mut beast = BeastStore::get(world, game.id);
_attack_beast(world, ref store, ref game, ref player_beast, ref beast, ref game_mode_beast);
Self::end_turn(world, game_id);
}
}

Expand Down
Loading