fix: additional check for prepare effect
release-tag / release-image (push) Successful in 20s

This commit is contained in:
2024-05-13 11:59:58 +02:00
parent 69b249a9f9
commit 8e4e2f0821
3 changed files with 19 additions and 6 deletions
+3 -3
View File
@@ -42,9 +42,9 @@ class LobbyClientController:
lobby_controller: "LobbyController"
track_connection: Callable
discord_uid: str | None
username: str | None
discord_avatar: str | None
discord_uid: str
username: str
discord_avatar: str
game_client: Union["ClientController", None]
+1 -1
View File
@@ -59,7 +59,7 @@ async def effect_heal(effect: Effect, turn: "Turn", _target: str):
async def effect_prepare(effect: Effect, turn: "Turn", target: str):
return turn.prepare(target)
return await turn.prepare(target)
async def effect_stun(effect: Effect, turn: "Turn", target: str):
+14 -1
View File
@@ -174,7 +174,7 @@ class Turn(Serializable):
self.effects_availables.append(e)
await self.player.game.notify_controller(MessageType.UPDATE, self.serialize())
def prepare(self, card_id: str) -> bool:
async def prepare(self, card_id: str) -> bool:
card = next(
(e for e in self.cards_locked if str(e.uuid) == card_id),
None,
@@ -182,11 +182,24 @@ class Turn(Serializable):
if card is None:
print("Card is not locked")
return False
if card.card_type != CardType.CHAMPION:
print("Card is not a Champion ")
return False
for e in card.effects:
if e.effect_type != EffectType.CHAMPION_ACTION:
continue
if e in self.effects_availables:
continue
if e.effect in [
CardEffects.DAMAGE,
CardEffects.GOLD,
CardEffects.HEAL,
]:
self.effects_availables.append(e)
if len(e.mutex) == 0 and e.times is None:
await self.use_effect_with_check(effect_id=str(e.uuid))
else:
for _ in range(e.amount):
self.effects_availables.append(e)
return True