From 67d7c8005d56b5d8b1f7f551edf5afd608e2d38a Mon Sep 17 00:00:00 2001 From: legonzaur Date: Mon, 6 May 2024 14:57:17 +0200 Subject: [PATCH] Check for faction combos only using locked cards --- src/model/card_behaviour.py | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/model/card_behaviour.py b/src/model/card_behaviour.py index 3ebcc6e..7884254 100644 --- a/src/model/card_behaviour.py +++ b/src/model/card_behaviour.py @@ -121,53 +121,40 @@ card_effect_all_behaviours = { # Effect Times def effect_times_same_faction(effect: Effect, turn: "Turn"): times = 0 - for c in turn.player.board: - if c.faction == effect.card.faction and c in turn.cards_locked: + for c in turn.cards_locked: + if c.faction == effect.card.faction: times += 1 return times def effect_times_other_same_faction(effect: Effect, turn: "Turn"): times = 0 - for c in turn.player.board: - if ( - c.faction == effect.card.faction - and c != effect.card - and c in turn.cards_locked - ): + for c in turn.cards_locked: + if c.faction == effect.card.faction and c != effect.card: times += 1 return times def effect_times_champion(effect: Effect, turn: "Turn"): times = 0 - for c in turn.player.board: - if c.card_type == CardType.CHAMPION and c in turn.cards_locked: + for c in turn.cards_locked: + if c.card_type == CardType.CHAMPION: times += 1 return times def effect_times_other_champion(effect: Effect, turn: "Turn"): times = 0 - for c in turn.player.board: - if ( - c.card_type == CardType.CHAMPION - and c != effect.card - and c in turn.cards_locked - ): + for c in turn.cards_locked: + if c.card_type == CardType.CHAMPION and c != effect.card: times += 1 return times def effect_times_other_guard(effect: Effect, turn: "Turn"): times = 0 - for c in turn.player.board: - if ( - c.card_type == CardType.CHAMPION - and c.guard is True - and c != effect.card - and c in turn.cards_locked - ): + for c in turn.cards_locked: + if c.card_type == CardType.CHAMPION and c.guard is True and c != effect.card: times += 1 return times @@ -183,7 +170,7 @@ effect_times_all_behaviours = { def create_effect_behaviour(effect: EffectParser) -> Awaitable[None]: - async def effect_type_behaviour(_e: Effect, _t: "Turn"): + async def effect_type_behaviour(e: Effect, t: "Turn"): return True if effect.effect_type in effect_types_all_behaviours: