Skip to content

Commit

Permalink
fix battle
Browse files Browse the repository at this point in the history
  • Loading branch information
credence0x committed Dec 11, 2024
1 parent 1d5dc26 commit 2f69731
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions contracts/src/models/combat.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,10 @@ impl TroopsImpl of TroopsTrait {
}

fn assert_minimum_for_battle(self: Troops) {
let total = self.knight_count + self.paladin_count + self.crossbowman_count;
assert!(
self.knight_count >= (100 * RESOURCE_PRECISION).try_into().unwrap(),
"you need to at least have 100 knights to merge or battle"
);

assert!(
self.paladin_count >= (100 * RESOURCE_PRECISION).try_into().unwrap(),
"you need to at least have 100 paladins to merge or battle"
);

assert!(
self.crossbowman_count >= (100 * RESOURCE_PRECISION).try_into().unwrap(),
"you need to at least have 100 crossbowmen to merge or battle"
total >= (100 * RESOURCE_PRECISION).try_into().unwrap(),
"you need to have at least have 100 troops for battle"
);
}

Expand Down

0 comments on commit 2f69731

Please sign in to comment.