elgringo+calamity janet fix
This commit is contained in:
parent
9998da688a
commit
174a0a376a
@ -1,5 +1,6 @@
|
|||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
import json
|
import json
|
||||||
|
from random import randrange
|
||||||
import socketio
|
import socketio
|
||||||
from cards import Mancato
|
from cards import Mancato
|
||||||
|
|
||||||
@ -290,15 +291,18 @@ class Player:
|
|||||||
|
|
||||||
def barrel_pick(self):
|
def barrel_pick(self):
|
||||||
pickable_cards = 1 + self.character.pick_mod
|
pickable_cards = 1 + self.character.pick_mod
|
||||||
|
if len([c for c in self.equipment if isinstance(c, cards.Barile)]) > 0 and isinstance(self.character, characters.Jourdonnais):
|
||||||
|
pickable_cards = 2
|
||||||
while pickable_cards > 0:
|
while pickable_cards > 0:
|
||||||
pickable_cards -= 1
|
pickable_cards -= 1
|
||||||
picked: cards.Card = self.game.deck.pick_and_scrap()
|
picked: cards.Card = self.game.deck.pick_and_scrap()
|
||||||
print(f'Did pick {picked}')
|
print(f'Did pick {picked}')
|
||||||
|
self.sio.emit('chat_message', room=self.game.name, data=f'{self.name} ha estratto {picked}.')
|
||||||
if picked.suit == cards.Suit.HEARTS:
|
if picked.suit == cards.Suit.HEARTS:
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
self.game.responders_did_respond()
|
self.game.responders_did_respond()
|
||||||
return
|
return
|
||||||
if len([c for c in self.hand if isinstance(c, cards.Mancato)]) == 0:
|
if len([c for c in self.hand if isinstance(c, cards.Mancato) or (isinstance(self.character, characters.CalamityJanet) and isinstance(c, cards.Bang))]) == 0:
|
||||||
self.take_damage_response()
|
self.take_damage_response()
|
||||||
self.game.responders_did_respond()
|
self.game.responders_did_respond()
|
||||||
else:
|
else:
|
||||||
@ -314,7 +318,7 @@ class Player:
|
|||||||
self.take_damage_response()
|
self.take_damage_response()
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
if len([c for c in self.equipment if isinstance(c, cards.Barile)]) > 0:
|
if len([c for c in self.equipment if isinstance(c, cards.Barile)]) > 0 or isinstance(self.character, characters.Jourdonnais):
|
||||||
print('has barrel')
|
print('has barrel')
|
||||||
self.pending_action = PendingAction.PICK
|
self.pending_action = PendingAction.PICK
|
||||||
self.on_pick_cb = self.barrel_pick
|
self.on_pick_cb = self.barrel_pick
|
||||||
@ -358,9 +362,13 @@ class Player:
|
|||||||
|
|
||||||
def take_damage_response(self):
|
def take_damage_response(self):
|
||||||
self.lives -= 1
|
self.lives -= 1
|
||||||
|
if self.lives > 0:
|
||||||
|
if isinstance(self.character, characters.BartCassidy):
|
||||||
|
self.hand.append(self.game.deck.draw())
|
||||||
|
elif isinstance(self.character, characters.ElGringo) and self.attacker and len(self.attacker.hand) > 0:
|
||||||
|
self.hand.append(self.attacker.hand.pop(randrange(0, len(self.attacker.hand))))
|
||||||
|
self.attacker.notify_self()
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
if isinstance(self.character, characters.BartCassidy):
|
|
||||||
self.hand.append(self.game.deck.draw())
|
|
||||||
self.attacker = None
|
self.attacker = None
|
||||||
|
|
||||||
def respond(self, hand_index):
|
def respond(self, hand_index):
|
||||||
|
Loading…
Reference in New Issue
Block a user