Esempio n. 1
0
def sort_players_by_warriors_in_clearing(
        players: list[Player],
        clearing: Clearing,
        descending: bool = True) -> list[Player]:
    return sorted(players,
                  key=lambda p: clearing.get_warrior_count_for_player(p),
                  reverse=descending)
Esempio n. 2
0
 def get_bonus_hits(self, clearing: Clearing, opponent: Player, is_attacker: bool = True) -> int:
     bonus_hits = 0
     # Automated Ambush
     if clearing.get_warrior_count_for_player(self) > 0:
         bonus_hits += 1
     elif self.has_trait(TRAIT_INFORMANTS) and clearing.get_token_count_for_player(self) > 0:
         bonus_hits += 1
     return bonus_hits
Esempio n. 3
0
 def get_warriors_to_move(self, origin_clearing: Clearing,
                          suit: Suit) -> list[Warrior]:
     own_rule_value = self.get_rule_value(origin_clearing)
     max_enemy_rule_value = self.get_max_enemy_rule_value_in_clearing(
         origin_clearing)
     warrior_count_to_move_and_keep_rule = own_rule_value - max_enemy_rule_value
     # Move the minimum between (most you can without losing rule) and (X - #cards in column)
     warrior_count_to_move = min(
         warrior_count_to_move_and_keep_rule,
         (origin_clearing.get_warrior_count_for_player(self) -
          self.decree.get_count_of_suited_cards_in_decree(suit)))
     return origin_clearing.get_warriors_for_player(
         self)[:warrior_count_to_move]