[fix] : add additional checks on stun champion
release-tag / release-image (push) Successful in 12s

This is very ugly
Closes legonzaur/heron-realms-front#46
This commit is contained in:
2024-05-16 14:46:46 +02:00
parent d08e3edba4
commit 17f5b606cc
2 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ async def effect_prepare(effect: Effect, turn: "Turn", target: str):
async def effect_stun(effect: Effect, turn: "Turn", target: str):
return await turn.player.stun(target)
return await turn.stun_champion(target)
async def effect_sacrifice(effect: Effect, turn: "Turn", target: str):
+24
View File
@@ -307,6 +307,30 @@ class Turn(Serializable):
await self.player.game.notify_controller(MessageType.UPDATE, self.serialize())
await self.player.game.notify_controller(MessageType.UPDATE, team.serialize())
async def stun_champion(self, target: str):
for p in self.player.game.players:
if self.player.team == p.team:
continue
for c in p.board:
if str(c.uuid) != target:
continue
if c.card_type != CardType.CHAMPION:
continue
if not c.guard and self.check_for_guard(p.team):
print("You cannot stun this champion if a guard is present")
return
await self.player.stun(str(c.uuid))
await self.player.game.notify_controller(
MessageType.UPDATE, self.serialize()
)
await self.player.game.notify_controller(
MessageType.UPDATE, p.turn.serialize()
)
return
print("card not found")
async def damage_champion(self, target: str):
if self.damage_reserve <= 0:
print("No damage left to attack")