From d9665fdb6c3864a3345551a832f734dd817d9478 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Fri, 17 May 2024 14:13:42 +0200 Subject: [PATCH] Add additional checks for stack_next_action_bought Related to legonzaur/heron-realms-front#61 --- src/model/card_behaviour.py | 2 +- src/model/turn.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/model/card_behaviour.py b/src/model/card_behaviour.py index 910bdc2..06f7dca 100644 --- a/src/model/card_behaviour.py +++ b/src/model/card_behaviour.py @@ -93,7 +93,7 @@ async def effect_restack_discarded(_effect: Effect, turn: "Turn", target: str): async def effect_stack_next_action(_effect: Effect, turn: "Turn", target: str): - return await turn.buy_card(target, turn.player.buy_on_stack) + return await turn.buy_card(target, turn.player.stack_next_action_bought_check) async def effect_stack_next_card(_effect: Effect, turn: "Turn", target: str): diff --git a/src/model/turn.py b/src/model/turn.py index 9671e82..6203f1f 100644 --- a/src/model/turn.py +++ b/src/model/turn.py @@ -230,6 +230,13 @@ class Turn(Serializable): else: return await self.player.put_on_stack_from_discard(str(card.uuid)) + async def stack_next_action_bought_check(self, card: Card) -> bool: + if card.card_type != CardType.ACTION: + print("You can only buy actions with this effect!") + return False + + return await self.stack_next_card_bought_check(card) + async def stack_next_card_bought_check(self, card: Card) -> bool: if card.cost is None: print("You cannot buy a card that doesn't has any cost")