This commit is contained in:
Alberto Xamin 2020-12-20 22:21:58 +01:00
parent 2589bf20c9
commit ee26ff5d01
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
2 changed files with 27 additions and 2 deletions

View File

@ -73,7 +73,7 @@ class Peyote(CardEvent):
self.desc_eng = "Instead of drawing, the player tries to guess the color of the suit, if he's right he adds the card to the hand and continues trying to guess the next card" self.desc_eng = "Instead of drawing, the player tries to guess the color of the suit, if he's right he adds the card to the hand and continues trying to guess the next card"
class Ranch(CardEvent): class Ranch(CardEvent):
def __init__(self):#TODO def __init__(self):
super().__init__("Ranch", "🐮") super().__init__("Ranch", "🐮")
self.desc = "Dopo aver pescato il giocatore può scartare quante carte vuole dalla mano e pescarne altrettante dal mazzo" self.desc = "Dopo aver pescato il giocatore può scartare quante carte vuole dalla mano e pescarne altrettante dal mazzo"
self.desc_eng = "After drawing, the player can discard as many cards as he wants from his hand and draw as many from the deck" self.desc_eng = "After drawing, the player can discard as many cards as he wants from his hand and draw as many from the deck"
@ -108,7 +108,7 @@ def get_all_events():
LiquoreForte(), LiquoreForte(),
MinieraAbbandonata(), MinieraAbbandonata(),
Peyote(), Peyote(),
# Ranch(), Ranch(),
# Rimbalzo(), # Rimbalzo(),
RouletteRussa(), RouletteRussa(),
Vendetta(), Vendetta(),

View File

@ -50,6 +50,8 @@ class Player:
self.is_drawing = False self.is_drawing = False
self.can_play_vendetta = True self.can_play_vendetta = True
self.is_giving_life = False self.is_giving_life = False
self.can_play_ranch = True
self.is_playing_ranch = False
self.mancato_needed = 0 self.mancato_needed = 0
self.molly_discarded_cards = 0 self.molly_discarded_cards = 0
self.is_bot = bot self.is_bot = bot
@ -66,6 +68,8 @@ class Player:
self.is_my_turn = False self.is_my_turn = False
self.is_waiting_for_action = True self.is_waiting_for_action = True
self.has_played_bang = False self.has_played_bang = False
self.can_play_ranch = True
self.is_playing_ranch = False
self.pending_action: PendingAction = None self.pending_action: PendingAction = None
self.available_characters = [] self.available_characters = []
self.was_shot = False self.was_shot = False
@ -156,6 +160,13 @@ class Player:
}] }]
self.is_drawing = True self.is_drawing = True
self.pending_action = PendingAction.CHOOSE self.pending_action = PendingAction.CHOOSE
elif self.can_play_ranch and self.pending_action == PendingAction.PLAY and self.game.check_event(ce.Ranch):
self.can_play_ranch = False
self.available_cards = [c for c in self.hand]
self.discarded_cards = []
self.available_cards.append({'icon': ''})
self.is_playing_ranch = True
self.pending_action = PendingAction.CHOOSE
elif isinstance(self.character, chars.SuzyLafayette) and len(self.hand) == 0: elif isinstance(self.character, chars.SuzyLafayette) and len(self.hand) == 0:
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
ser = self.__dict__.copy() ser = self.__dict__.copy()
@ -293,6 +304,8 @@ class Player:
if self.lives == 0: if self.lives == 0:
return self.end_turn(forced=True) return self.end_turn(forced=True)
self.scrapped_cards = 0 self.scrapped_cards = 0
self.can_play_ranch = True
self.is_playing_ranch = False
self.can_play_vendetta = can_play_vendetta self.can_play_vendetta = can_play_vendetta
self.sio.emit('chat_message', room=self.game.name, self.sio.emit('chat_message', room=self.game.name,
data=f'_turn|{self.name}') data=f'_turn|{self.name}')
@ -515,6 +528,18 @@ class Player:
self.sio.emit('chat_message', room=self.game.name, data=f'_fratelli_sangue|{self.name}|{player.name}') self.sio.emit('chat_message', room=self.game.name, data=f'_fratelli_sangue|{self.name}|{player.name}')
except: pass except: pass
self.play_turn() self.play_turn()
elif self.is_playing_ranch and self.game.check_event(ce.Ranch):
if card_index == len(self.available_cards) - 1:
self.hand = [c for c in self.hand if c not in self.discarded_cards]
for i in range(len(self.discarded_cards)):
self.game.deck.scrap(self.discarded_cards[i])
self.hand.append(self.game.deck.draw())
self.discarded_cards = []
self.is_playing_ranch = False
self.pending_action = PendingAction.PLAY
else:
self.discarded_cards.append(self.available_cards.pop(card_index))
self.notify_self()
elif self.is_drawing and self.game.check_event(ce.Peyote): elif self.is_drawing and self.game.check_event(ce.Peyote):
self.is_drawing = False self.is_drawing = False
card = self.game.deck.draw() card = self.game.deck.draw()