Archived
This is very ugly Closes legonzaur/heron-realms-front#46
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user