fix Lemat
This commit is contained in:
parent
cadabeb5f4
commit
72bb52d037
@ -93,9 +93,9 @@ class Card(ABC):
|
|||||||
return False
|
return False
|
||||||
if self.is_weapon:
|
if self.is_weapon:
|
||||||
has_weapon = False
|
has_weapon = False
|
||||||
for i in range(len(player.equipment)):
|
for i, card in enumerate(player.equipment):
|
||||||
if player.equipment[i].is_weapon:
|
if card.is_weapon:
|
||||||
player.game.deck.scrap(player.equipment[i])
|
player.game.deck.scrap(card, player=player)
|
||||||
player.equipment[i] = self
|
player.equipment[i] = self
|
||||||
has_weapon = True
|
has_weapon = True
|
||||||
break
|
break
|
||||||
|
@ -5,58 +5,75 @@ from bang.cards import Card, Suit, Bang, Mancato
|
|||||||
import bang.expansions.fistful_of_cards.card_events as ce
|
import bang.expansions.fistful_of_cards.card_events as ce
|
||||||
from globals import G
|
from globals import G
|
||||||
|
|
||||||
|
|
||||||
class Fantasma(Card):
|
class Fantasma(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Fantasma', number, is_equipment=True)
|
super().__init__(suit, "Fantasma", number, is_equipment=True)
|
||||||
self.icon = '👻️' #porta in vita i giocatori morti ma non
|
self.icon = "👻️" # porta in vita i giocatori morti ma non
|
||||||
|
|
||||||
def play_card(self, player, against, _with=None):
|
def play_card(self, player, against, _with=None):
|
||||||
if (player.game.check_event(ce.IlGiudice)) or not self.can_be_used_now:
|
if (player.game.check_event(ce.IlGiudice)) or not self.can_be_used_now:
|
||||||
return False
|
return False
|
||||||
if len(player.game.get_dead_players(include_ghosts=False)) > 0:
|
if len(player.game.get_dead_players(include_ghosts=False)) > 0:
|
||||||
player.pending_action = pl.PendingAction.CHOOSE
|
player.pending_action = pl.PendingAction.CHOOSE
|
||||||
player.choose_text = 'choose_fantasma'
|
player.choose_text = "choose_fantasma"
|
||||||
player.available_cards = [{
|
player.available_cards = [
|
||||||
'name': p.name,
|
{
|
||||||
'icon': p.role.icon if(player.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠',
|
"name": p.name,
|
||||||
'avatar': p.avatar,
|
"icon": p.role.icon
|
||||||
'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)),
|
if (player.game.initial_players == 3)
|
||||||
'is_character': True,
|
else "⭐️"
|
||||||
'is_player': True
|
if isinstance(p.role, r.Sheriff)
|
||||||
} for p in player.game.get_dead_players(include_ghosts=False)]
|
else "🤠",
|
||||||
|
"avatar": p.avatar,
|
||||||
|
"alt_text": "".join(["❤️"] * p.lives)
|
||||||
|
+ "".join(["💀"] * (p.max_lives - p.lives)),
|
||||||
|
"is_character": True,
|
||||||
|
"is_player": True,
|
||||||
|
}
|
||||||
|
for p in player.game.get_dead_players(include_ghosts=False)
|
||||||
|
]
|
||||||
self.can_be_used_now = False
|
self.can_be_used_now = False
|
||||||
player.game.deck.scrap(self, True)
|
player.game.deck.scrap(self, True)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Lemat(Card):
|
class Lemat(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Lemat', number, is_equipment=True, is_weapon=True, range=1)
|
super().__init__(
|
||||||
self.icon = '🔫' # ogni carta può essere usata come bang, conta per il conteggio dei bang per turno
|
suit, "Lemat", number, is_equipment=True, is_weapon=True, range=1
|
||||||
|
)
|
||||||
|
self.icon = "🔫" # ogni carta può essere usata come bang, conta per il conteggio dei bang per turno
|
||||||
|
|
||||||
def play_card(self, player, against, _with=None):
|
def play_card(self, player, against, _with=None):
|
||||||
if (player.game.check_event(ce.IlGiudice) and self.can_be_used_now) or (not self.can_be_used_now and player.game.check_event(ce.Lazo)):
|
if not self.can_be_used_now and player.game.check_event(ce.Lazo):
|
||||||
return False
|
return False
|
||||||
if self.can_be_used_now:
|
if self.can_be_used_now:
|
||||||
|
if not super().play_card(player, against, _with):
|
||||||
|
return False
|
||||||
self.can_be_used_now = False
|
self.can_be_used_now = False
|
||||||
G.sio.emit('chat_message', room=player.game.name,
|
|
||||||
data=f'_play_card|{player.name}|{self.name}')
|
|
||||||
player.equipment.append(self)
|
|
||||||
player.notify_self()
|
|
||||||
return True
|
return True
|
||||||
elif not player.has_played_bang and any((player.get_sight() >= p['dist'] for p in player.game.get_visible_players(player))):
|
elif not player.has_played_bang and any(
|
||||||
|
(
|
||||||
|
player.get_sight() >= p["dist"]
|
||||||
|
for p in player.game.get_visible_players(player)
|
||||||
|
)
|
||||||
|
):
|
||||||
from bang.players import PendingAction
|
from bang.players import PendingAction
|
||||||
|
|
||||||
player.available_cards = player.hand.copy()
|
player.available_cards = player.hand.copy()
|
||||||
player.pending_action = PendingAction.CHOOSE
|
player.pending_action = PendingAction.CHOOSE
|
||||||
player.choose_text = 'choose_play_as_bang'
|
player.choose_text = "choose_play_as_bang"
|
||||||
player.notify_self()
|
player.notify_self()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class SerpenteASonagli(Card):
|
class SerpenteASonagli(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'SerpenteASonagli', number, is_equipment=True)
|
super().__init__(suit, "SerpenteASonagli", number, is_equipment=True)
|
||||||
self.need_target = True
|
self.need_target = True
|
||||||
self.icon = '🐍️' # Ogni turno pesca se il seme picche -1hp
|
self.icon = "🐍️" # Ogni turno pesca se il seme picche -1hp
|
||||||
self.alt_text = "♠️ =💔"
|
self.alt_text = "♠️ =💔"
|
||||||
|
|
||||||
def play_card(self, player, against, _with=None):
|
def play_card(self, player, against, _with=None):
|
||||||
@ -64,40 +81,51 @@ class SerpenteASonagli(Card):
|
|||||||
return False
|
return False
|
||||||
if against is not None:
|
if against is not None:
|
||||||
self.can_be_used_now = False
|
self.can_be_used_now = False
|
||||||
G.sio.emit('chat_message', room=player.game.name,
|
G.sio.emit(
|
||||||
data=f'_play_card_against|{player.name}|{self.name}|{against}')
|
"chat_message",
|
||||||
|
room=player.game.name,
|
||||||
|
data=f"_play_card_against|{player.name}|{self.name}|{against}",
|
||||||
|
)
|
||||||
player.game.get_player_named(against).equipment.append(self)
|
player.game.get_player_named(against).equipment.append(self)
|
||||||
player.game.get_player_named(against).notify_self()
|
player.game.get_player_named(against).notify_self()
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Shotgun(Card):
|
class Shotgun(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Shotgun', number, is_equipment=True, is_weapon=True, range=1)
|
super().__init__(
|
||||||
self.icon = '🔫' # Ogni volta che colpisci un giocatore deve scartare una carta
|
suit, "Shotgun", number, is_equipment=True, is_weapon=True, range=1
|
||||||
|
)
|
||||||
|
self.icon = "🔫" # Ogni volta che colpisci un giocatore deve scartare una carta
|
||||||
|
|
||||||
|
|
||||||
class Taglia(Card):
|
class Taglia(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Taglia', number, is_equipment=True)
|
super().__init__(suit, "Taglia", number, is_equipment=True)
|
||||||
self.need_target = True
|
self.need_target = True
|
||||||
self.icon = '💰' # chiunque colpisca il giocatore con la taglia pesca una carta dal mazzo, si toglie solo con panico, cat balou, dalton
|
self.icon = "💰" # chiunque colpisca il giocatore con la taglia pesca una carta dal mazzo, si toglie solo con panico, cat balou, dalton
|
||||||
|
|
||||||
def play_card(self, player, against, _with=None):
|
def play_card(self, player, against, _with=None):
|
||||||
if (player.game.check_event(ce.IlGiudice)) or not self.can_be_used_now:
|
if (player.game.check_event(ce.IlGiudice)) or not self.can_be_used_now:
|
||||||
return False
|
return False
|
||||||
if against is not None:
|
if against is not None:
|
||||||
self.can_be_used_now = False
|
self.can_be_used_now = False
|
||||||
G.sio.emit('chat_message', room=player.game.name,
|
G.sio.emit(
|
||||||
data=f'_play_card_against|{player.name}|{self.name}|{against}')
|
"chat_message",
|
||||||
|
room=player.game.name,
|
||||||
|
data=f"_play_card_against|{player.name}|{self.name}|{against}",
|
||||||
|
)
|
||||||
player.game.get_player_named(against).equipment.append(self)
|
player.game.get_player_named(against).equipment.append(self)
|
||||||
player.game.get_player_named(against).notify_self()
|
player.game.get_player_named(against).notify_self()
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class UltimoGiro(Card):
|
class UltimoGiro(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'UltimoGiro', number)
|
super().__init__(suit, "UltimoGiro", number)
|
||||||
self.icon = '🥂'
|
self.icon = "🥂"
|
||||||
# self.desc = 'Recupera 1 vita'
|
# self.desc = 'Recupera 1 vita'
|
||||||
# self.desc_eng = 'Regain 1 HP'
|
# self.desc_eng = 'Regain 1 HP'
|
||||||
self.alt_text = "🍺"
|
self.alt_text = "🍺"
|
||||||
@ -108,10 +136,11 @@ class UltimoGiro(Card):
|
|||||||
player.notify_self()
|
player.notify_self()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class Tomahawk(Card):
|
class Tomahawk(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Tomahawk', number, range=2)
|
super().__init__(suit, "Tomahawk", number, range=2)
|
||||||
self.icon = '🪓️'
|
self.icon = "🪓️"
|
||||||
self.alt_text = "2🔎 💥"
|
self.alt_text = "2🔎 💥"
|
||||||
# "Spara a un giocatore a distanza 2"
|
# "Spara a un giocatore a distanza 2"
|
||||||
self.need_target = True
|
self.need_target = True
|
||||||
@ -123,21 +152,25 @@ class Tomahawk(Card):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Tornado(Card):
|
class Tornado(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Tornado', number)
|
super().__init__(suit, "Tornado", number)
|
||||||
self.icon = '🌪️'
|
self.icon = "🌪️"
|
||||||
|
|
||||||
def play_card(self, player, against, _with=None):
|
def play_card(self, player, against, _with=None):
|
||||||
super().play_card(player, against=against)
|
super().play_card(player, against=against)
|
||||||
player.game.discard_others(player, card_name=self.name)
|
player.game.discard_others(player, card_name=self.name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class Sventagliata(Bang): # : conta come un normale BANG! del turno. Il BANG! secondario è obbligatorio ed è sparato anche se il primo viene annullato, se si può, tu sei escluso come target
|
|
||||||
|
class Sventagliata(
|
||||||
|
Bang
|
||||||
|
): # : conta come un normale BANG! del turno. Il BANG! secondario è obbligatorio ed è sparato anche se il primo viene annullato, se si può, tu sei escluso come target
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, number)
|
super().__init__(suit, number)
|
||||||
self.name = 'Sventagliata'
|
self.name = "Sventagliata"
|
||||||
self.icon = '🎏'
|
self.icon = "🎏"
|
||||||
self.alt_text = "💥💥" # spara al target e anche, a uno a distanza 1 dal target
|
self.alt_text = "💥💥" # spara al target e anche, a uno a distanza 1 dal target
|
||||||
self.need_target = True
|
self.need_target = True
|
||||||
|
|
||||||
@ -146,20 +179,25 @@ class Sventagliata(Bang): # : conta come un normale BANG! del turno. Il BANG! se
|
|||||||
if player.has_played_bang:
|
if player.has_played_bang:
|
||||||
return False
|
return False
|
||||||
t = player.game.get_player_named(against)
|
t = player.game.get_player_named(against)
|
||||||
player.available_cards = [dict(p, **{'original_target':against}) for p in player.game.get_visible_players(t) if p['name'] != player.name and p['name'] != t.name and p['dist']]
|
player.available_cards = [
|
||||||
|
dict(p, **{"original_target": against})
|
||||||
|
for p in player.game.get_visible_players(t)
|
||||||
|
if p["name"] != player.name and p["name"] != t.name and p["dist"]
|
||||||
|
]
|
||||||
if len(player.available_cards) > 0:
|
if len(player.available_cards) > 0:
|
||||||
player.pending_action = pl.PendingAction.CHOOSE
|
player.pending_action = pl.PendingAction.CHOOSE
|
||||||
player.choose_text = 'choose_sventagliata'
|
player.choose_text = "choose_sventagliata"
|
||||||
else:
|
else:
|
||||||
player.available_cards = []
|
player.available_cards = []
|
||||||
super().play_card(player, against=against)
|
super().play_card(player, against=against)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Salvo(Card): # puoi anche prevenire un danno inferto da te, duello?
|
class Salvo(Card): # puoi anche prevenire un danno inferto da te, duello?
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Salvo', number)
|
super().__init__(suit, "Salvo", number)
|
||||||
self.icon = '😇️'
|
self.icon = "😇️"
|
||||||
self.alt_text = "👤😅"
|
self.alt_text = "👤😅"
|
||||||
self.need_target = True
|
self.need_target = True
|
||||||
|
|
||||||
@ -171,11 +209,12 @@ class Salvo(Card): # puoi anche prevenire un danno inferto da te, duello?
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Mira(Card):
|
class Mira(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Mira', number)
|
super().__init__(suit, "Mira", number)
|
||||||
self.icon = '👌🏻'
|
self.icon = "👌🏻"
|
||||||
self.need_with_only = 'Bang'
|
self.need_with_only = "Bang"
|
||||||
self.alt_text = "💥🃏💔💔"
|
self.alt_text = "💥🃏💔💔"
|
||||||
self.need_target = True
|
self.need_target = True
|
||||||
self.need_with = True
|
self.need_with = True
|
||||||
@ -187,10 +226,11 @@ class Mira(Card):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Bandidos(Card):
|
class Bandidos(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Bandidos', number)
|
super().__init__(suit, "Bandidos", number)
|
||||||
self.icon = '🤠️'
|
self.icon = "🤠️"
|
||||||
self.alt_text = "👤🃏🃏/💔"
|
self.alt_text = "👤🃏🃏/💔"
|
||||||
|
|
||||||
def play_card(self, player, against, _with=None):
|
def play_card(self, player, against, _with=None):
|
||||||
@ -198,19 +238,23 @@ class Bandidos(Card):
|
|||||||
player.game.discard_others(player, card_name=self.name)
|
player.game.discard_others(player, card_name=self.name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class Fuga(Card): #comprende indiani gatling etc, ma solo se carte marroni, le carte verdi valgono, attenzione alla classi ereditate
|
|
||||||
|
class Fuga(
|
||||||
|
Card
|
||||||
|
): # comprende indiani gatling etc, ma solo se carte marroni, le carte verdi valgono, attenzione alla classi ereditate
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Fuga', number)
|
super().__init__(suit, "Fuga", number)
|
||||||
self.icon = '🏃🏻'
|
self.icon = "🏃🏻"
|
||||||
self.alt_text = "❌"
|
self.alt_text = "❌"
|
||||||
|
|
||||||
def play_card(self, player, against, _with=None):
|
def play_card(self, player, against, _with=None):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Poker(Card):
|
class Poker(Card):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, 'Poker', number)
|
super().__init__(suit, "Poker", number)
|
||||||
self.icon = '🃏'
|
self.icon = "🃏"
|
||||||
self.alt_text = "👤🃏 🃏🃏"
|
self.alt_text = "👤🃏 🃏🃏"
|
||||||
|
|
||||||
def play_card(self, player, against, _with=None):
|
def play_card(self, player, against, _with=None):
|
||||||
@ -218,11 +262,12 @@ class Poker(Card):
|
|||||||
player.game.discard_others(player, card_name=self.name)
|
player.game.discard_others(player, card_name=self.name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class RitornoDiFiamma(Mancato):
|
class RitornoDiFiamma(Mancato):
|
||||||
def __init__(self, suit, number):
|
def __init__(self, suit, number):
|
||||||
super().__init__(suit, number)
|
super().__init__(suit, number)
|
||||||
self.name = 'RitornoDiFiamma'
|
self.name = "RitornoDiFiamma"
|
||||||
self.icon = '🔥'
|
self.icon = "🔥"
|
||||||
self.alt_text = "😅 | 💥"
|
self.alt_text = "😅 | 💥"
|
||||||
|
|
||||||
def play_card(self, player, against, _with=None):
|
def play_card(self, player, against, _with=None):
|
||||||
@ -231,25 +276,32 @@ class RitornoDiFiamma(Mancato):
|
|||||||
def use_card(self, player):
|
def use_card(self, player):
|
||||||
player.notify_self()
|
player.notify_self()
|
||||||
|
|
||||||
|
|
||||||
def get_starting_deck() -> List[Card]:
|
def get_starting_deck() -> List[Card]:
|
||||||
cards = [
|
cards = [
|
||||||
Fantasma(Suit.SPADES, 9),
|
Fantasma(Suit.SPADES, 9),
|
||||||
Fantasma(Suit.SPADES, 10),
|
Fantasma(Suit.SPADES, 10),
|
||||||
Lemat(Suit.DIAMONDS, 4),
|
Lemat(Suit.DIAMONDS, 4),
|
||||||
SerpenteASonagli(Suit.HEARTS, 7),
|
SerpenteASonagli(Suit.HEARTS, 7),
|
||||||
Shotgun(Suit.SPADES, 'K'),
|
Shotgun(Suit.SPADES, "K"),
|
||||||
Taglia(Suit.CLUBS, 9),
|
Taglia(Suit.CLUBS, 9),
|
||||||
UltimoGiro(Suit.DIAMONDS, 8),
|
UltimoGiro(Suit.DIAMONDS, 8),
|
||||||
Tomahawk(Suit.DIAMONDS, 'A'),
|
Tomahawk(Suit.DIAMONDS, "A"),
|
||||||
Sventagliata(Suit.SPADES, 2),
|
Sventagliata(Suit.SPADES, 2),
|
||||||
# Salvo(Suit.HEARTS, 5),
|
# Salvo(Suit.HEARTS, 5),
|
||||||
Bandidos(Suit.DIAMONDS,'Q'), # gli altri giocatori scelgono se scartare 2 carte o perdere 1 punto vita
|
Bandidos(
|
||||||
Fuga(Suit.HEARTS, 3), # evita l'effetto di carte marroni (tipo panico cat balou) di cui sei bersaglio
|
Suit.DIAMONDS, "Q"
|
||||||
|
), # gli altri giocatori scelgono se scartare 2 carte o perdere 1 punto vita
|
||||||
|
Fuga(
|
||||||
|
Suit.HEARTS, 3
|
||||||
|
), # evita l'effetto di carte marroni (tipo panico cat balou) di cui sei bersaglio
|
||||||
Mira(Suit.CLUBS, 6),
|
Mira(Suit.CLUBS, 6),
|
||||||
Poker(Suit.HEARTS, 'J'), # tutti gli altri scartano 1 carta a scelta, se non ci sono assi allora pesca 2
|
Poker(
|
||||||
RitornoDiFiamma(Suit.CLUBS, 'Q'), # un mancato che fa bang
|
Suit.HEARTS, "J"
|
||||||
|
), # tutti gli altri scartano 1 carta a scelta, se non ci sono assi allora pesca 2
|
||||||
|
RitornoDiFiamma(Suit.CLUBS, "Q"), # un mancato che fa bang
|
||||||
Tornado(Suit.CLUBS, "A"),
|
Tornado(Suit.CLUBS, "A"),
|
||||||
]
|
]
|
||||||
for c in cards:
|
for c in cards:
|
||||||
c.expansion_icon = '👻️'
|
c.expansion_icon = "👻️"
|
||||||
return cards
|
return cards
|
||||||
|
Loading…
Reference in New Issue
Block a user