add henry block

This commit is contained in:
Alberto Xamin 2023-04-02 17:05:49 +01:00
parent 0d960390be
commit 7692c7818f
No known key found for this signature in database
GPG Key ID: 5ABFCD8A22EA6F5D
3 changed files with 69 additions and 30 deletions

View File

@ -2,75 +2,110 @@ from typing import List
from bang.characters import Character
import bang.cards as cs
class BlackFlower(Character):
"""Una volta nel tuo turno, puoi usare una carta di fiori per sparare un BANG! extra."""
def __init__(self):
super().__init__("Black Flower", max_lives=4)
# Una volta nel tuo turno, puoi usare una carta di fiori per sparare un BANG! extra.
self.icon = '🥀'
self.icon = "🥀"
def special(self, player, data): #fiori = suit.Clubs
if player.special_use_count > 0 or not any((c.suit == cs.Suit.CLUBS for c in player.hand)):
def special(self, player, data): # fiori = suit.Clubs
if player.special_use_count > 0 or not any(
(c.suit == cs.Suit.CLUBS for c in player.hand)
):
return False
if any((player.get_sight() >= p['dist'] for p in player.game.get_visible_players(player))) and super().special(player, data):
if any(
(
player.get_sight() >= p["dist"]
for p in player.game.get_visible_players(player)
)
) and super().special(player, data):
from bang.players import PendingAction
player.available_cards = [c for c in player.hand if c.suit == cs.Suit.CLUBS]
player.special_use_count += 1
player.pending_action = PendingAction.CHOOSE
player.choose_text = 'choose_play_as_bang'
player.choose_text = "choose_play_as_bang"
player.notify_self()
class ColoradoBill(Character):
"""Ogni volta che giochi una carta BANG!, "estrai!": se è Picche, il colpo non può essere evitato.
Whenever you play a BANG! card, "draw!": if it's a Spade, the shot can't be avoided.
"""
def __init__(self):
super().__init__("Colorado Bill", max_lives=4)
# Ogni volta che giochi una carta BANG!, "estrai!": se è Picche, il colpo non può essere evitato.
self.icon = '♠️'
self.icon = "♠️"
class DerSpotBurstRinger(Character):
"""Una volta nel tuo turno, puoi usare una carta BANG! come Gatling.
Once per turn, you can use a BANG! card as a Gatling."""
def __init__(self):
super().__init__("Der Spot Burst Ringer", max_lives=4)
# Una volta nel tuo turno, puoi usare una carta BANG! come Gatling.
self.icon = '🫧'
self.icon = "🫧"
def special(self, player, data):
if player.special_use_count == 0 and \
any((c.name == 'Bang!' for c in player.hand)) and super().special(player, data):
if (
player.special_use_count == 0
and any((c.name == "Bang!" for c in player.hand))
and super().special(player, data)
):
player.special_use_count += 1
#get cards from hand of type Bang and sort them by suit
cards = sorted([c for c in player.hand if c.name == 'Bang!'], key=lambda c: c.suit)
# get cards from hand of type Bang and sort them by suit
cards = sorted(
[c for c in player.hand if c.name == "Bang!"], key=lambda c: c.suit
)
player.hand.remove(cards[0])
player.game.deck.scrap(cards[0], True, player=player)
player.notify_self()
player.game.attack_others(player, cs.Gatling(0,0).name)
player.game.attack_others(player, cs.Gatling(0, 0).name)
class EvelynShebang(Character):
"""Puoi rinunciare a pescare carte nella tua fase di pesca. Per ogni carta non pescata, spari un BANG! a distanza raggiungibile, a un diverso bersaglio."""
def __init__(self):
super().__init__("Evelyn Shebang", max_lives=4)
# Puoi rinunciare a pescare carte nella tua fase di pesca. Per ogni carta non pescata, spari un BANG! a distanza raggiungibile, a un diverso bersaglio.
self.icon = '📵'
self.icon = "📵"
class HenryBlock(Character):
"""Chiunque peschi o scarti una tua cartain gioco o in mano) è bersaglio di un BANG!"""
def __init__(self):
super().__init__("Henry Block", max_lives=4)
# Chiunque peschi o scarti una tua cartain gioco o in mano) è bersaglio di un BANG!.
self.icon = '🚯'
self.icon = "🚯"
class LemonadeJim(Character):
"""Ogni volta che un altro giocatore gioca una Birra, puoi scartare una carta dalla mano per riguadagnare anche tu 1 punto vita."""
def __init__(self):
super().__init__("Lemonade Jim", max_lives=4)
# Ogni volta che un altro giocatore gioca una Birra, puoi scartare una carta dalla mano per riguadagnare anche tu 1 punto vita.
self.icon = '🍋'
self.icon = "🍋"
class MickDefender(Character):
"""Se sei bersaglio di una carta marrone (non BANG!), puoi usare una carta Mancato! evitarne 1 gli effetti."""
def __init__(self):
super().__init__("Mick Defender", max_lives=4)
# Se sei bersaglio di una carta marrone (non BANG!), puoi usare una carta Mancato! evitarne 1 gli effetti.
self.icon = ''
self.icon = ""
class TucoFranziskaner(Character):
"""Durante la tua fase di pesca, se non hai carte blu in gioco, pesca 2 carte extra."""
def __init__(self):
super().__init__("Tuco Franziskaner", max_lives=4)
# Durante la tua fase di pesca, se non hai carte blu in gioco, pesca 2 carte extra.
self.icon = '🥬'
self.icon = "🥬"
def all_characters() -> List[Character]:
cards = [
@ -78,12 +113,14 @@ def all_characters() -> List[Character]:
ColoradoBill(),
DerSpotBurstRinger(),
# EvelynShebang(),
# HenryBlock(),
HenryBlock(),
# LemonadeJim(),
MickDefender(),
TucoFranziskaner(),
]
for c in cards:
c.expansion_icon = '👻️'
c.expansion = 'the_valley_of_shadows'
for card in cards:
card.expansion_icon = "👻️" # pylint: disable=attribute-defined-outside-init
card.expansion = ( # pylint: disable=attribute-defined-outside-init
"the_valley_of_shadows"
)
return cards

View File

@ -530,7 +530,7 @@ class Game:
attacker.pending_action = pl.PendingAction.WAIT
attacker.notify_self()
self.get_player_named(target_username).notify_self()
elif not attacker.is_my_turn:
elif not attacker.is_my_turn or len(self.attack_queue) == 0:
self.players[self.turn].pending_action = pl.PendingAction.PLAY
def steal_discard(self, attacker: pl.Player, target_username: str, card: cs.Card):

View File

@ -1385,6 +1385,8 @@ class Player:
self.target_p = ""
self.choose_action = ""
self.pending_action = PendingAction.PLAY
if target.character.check(self.game, tvosch.HenryBlock):
self.game.attack(target, self.name, card_name="Henry Block")
else:
self.target_p = self.rissa_targets.pop(0).name
print(f"rissa targets: {self.rissa_targets}")