fix logica per un pugno di carte
This commit is contained in:
parent
ea74a7f910
commit
323bd80179
@ -22,15 +22,14 @@ class Deck:
|
||||
self.event_cards: List[ce.CardEvent] = []
|
||||
if 'fistful_of_cards' in game.expansions:
|
||||
self.event_cards.extend(ce.get_all_events())
|
||||
random.shuffle(self.event_cards)
|
||||
random.shuffle(self.cards)
|
||||
self.scrap_pile: List[cs.Card] = []
|
||||
print(f'Deck initialized with {len(self.cards)} cards')
|
||||
|
||||
def flip_event(self):
|
||||
if len(self.event_cards) > 0:
|
||||
if len(self.event_cards) > 0 and not isinstance(self.event_cards[0], ce.PerUnPugnoDiCarte):
|
||||
self.event_cards.append(self.event_cards.pop(0))
|
||||
self.game.notify_event_card()
|
||||
self.game.notify_event_card()
|
||||
|
||||
def peek(self, n_cards: int) -> list:
|
||||
return self.cards[:n_cards]
|
||||
|
@ -1,4 +1,5 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import random
|
||||
|
||||
class CardEvent(ABC):
|
||||
def __init__(self, name, icon):
|
||||
@ -96,7 +97,7 @@ class Vendetta(CardEvent):
|
||||
self.desc_eng = "When ending the turn, the player flips a card from the deck, if it's ♥️ he plays another turn (but he does not flip another card)"
|
||||
|
||||
def get_all_events():
|
||||
return [
|
||||
cards = [
|
||||
Agguato(),
|
||||
# Cecchino(),
|
||||
DeadMan(),
|
||||
@ -106,10 +107,12 @@ def get_all_events():
|
||||
LeggeDelWest(),
|
||||
LiquoreForte(),
|
||||
MinieraAbbandonata(),
|
||||
PerUnPugnoDiCarte(),
|
||||
Peyote(),
|
||||
# Ranch(),
|
||||
# Rimbalzo(),
|
||||
RouletteRussa(),
|
||||
Vendetta(),
|
||||
]
|
||||
]
|
||||
random.shuffle(cards)
|
||||
cards.append(PerUnPugnoDiCarte())
|
||||
return cards
|
@ -266,7 +266,7 @@ class Game:
|
||||
else:
|
||||
self.responders_did_respond_resume_turn(did_lose=True)
|
||||
return
|
||||
if self.check_event(ce.PerUnPugnoDiCarte):
|
||||
if self.check_event(ce.PerUnPugnoDiCarte) and len(self.players[self.turn].hand) > 0:
|
||||
self.player_bangs = len(self.players[self.turn].hand)
|
||||
if self.players[self.turn].get_banged(self.deck.event_cards[0]):
|
||||
self.players[self.turn].notify_self()
|
||||
|
@ -671,9 +671,9 @@ class Player:
|
||||
def respond(self, hand_index):
|
||||
if self.pending_action != PendingAction.RESPOND: return
|
||||
self.pending_action = PendingAction.WAIT
|
||||
if hand_index != -1 and (
|
||||
if hand_index != -1 and hand_index < (len(self.hand)+len(self.equipment)) and (
|
||||
((hand_index < len(self.hand) and self.hand[hand_index].name in self.expected_response)) or
|
||||
self.equipment[hand_index-len(self.hand)].name in self.expected_response):
|
||||
(hand_index-len(self.hand) < len(self.equipment) and self.equipment[hand_index-len(self.hand)].name in self.expected_response)):
|
||||
card = self.hand.pop(hand_index) if hand_index < len(self.hand) else self.equipment.pop(hand_index-len(self.hand))
|
||||
if isinstance(self.character, chd.MollyStark) and hand_index < len(self.hand)+1 and not self.is_my_turn and self.event_type != 'duel':
|
||||
self.hand.append(self.game.deck.draw())
|
||||
|
Loading…
Reference in New Issue
Block a user