Merge branch 'dev' into main
This commit is contained in:
commit
031cc91082
@ -67,6 +67,9 @@ class Card(ABC):
|
||||
data=f'{player.name} ha giocato {self.name}{contro}.')
|
||||
return True
|
||||
|
||||
def use_card(self, player):
|
||||
pass
|
||||
|
||||
|
||||
class Barile(Card):
|
||||
def __init__(self, suit, number):
|
||||
|
@ -1,17 +1,17 @@
|
||||
from bang.cards import *
|
||||
|
||||
class Riparo(Mustang):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Riparo'
|
||||
self.icon = '⛰'
|
||||
|
||||
class Binocolo(Mirino):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Binocolo'
|
||||
self.icon = '🔍'
|
||||
|
||||
class Riparo(Mustang):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Riparo'
|
||||
self.icon = '⛰'
|
||||
|
||||
class Pugno(Card):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, 'Pugno!', number, range=1)
|
||||
@ -27,10 +27,42 @@ class Pugno(Card):
|
||||
return True
|
||||
return False
|
||||
|
||||
class Schivata(Mancato):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Schivata'
|
||||
self.icon = '🙅♂️'
|
||||
self.desc += " e poi pesca una carta"
|
||||
|
||||
def play_card(self, player, against):
|
||||
return False
|
||||
|
||||
def use_card(self, player):
|
||||
player.hand.append(player.game.deck.draw())
|
||||
player.notify_self()
|
||||
|
||||
def get_starting_deck() -> List[Card]:
|
||||
return [
|
||||
#TODO: aggiungere anche le carte normalmente presenti https://bang.dvgiochi.com/cardslist.php?id=3
|
||||
Riparo(Suit.DIAMONDS, 'K'),
|
||||
Barile(Suit.CLUBS, 'A'),
|
||||
Binocolo(Suit.DIAMONDS, 10),
|
||||
Dinamite(Suit.CLUBS, 10),
|
||||
Mustang(Suit.HEARTS, 5),
|
||||
Remington(Suit.DIAMONDS, 6),
|
||||
RevCarabine(Suit.SPADES, 5),
|
||||
Riparo(Suit.DIAMONDS, 'K'),
|
||||
Bang(Suit.SPADES, 8),
|
||||
Bang(Suit.CLUBS, 5),
|
||||
Bang(Suit.CLUBS, 6),
|
||||
Bang(Suit.CLUBS, 'K'),
|
||||
Birra(Suit.HEARTS, 6),
|
||||
Birra(Suit.SPADES, 6),
|
||||
CatBalou(Suit.CLUBS, 8),
|
||||
Emporio(Suit.SPADES, 'A'),
|
||||
Indiani(Suit.DIAMONDS, 5),
|
||||
Mancato(Suit.DIAMONDS, 8),
|
||||
Panico(Suit.HEARTS, 'J'),
|
||||
Pugno(Suit.SPADES, 10),
|
||||
Schivata(Suit.DIAMONDS, 7),
|
||||
Schivata(Suit.HEARTS, 'K'),
|
||||
]
|
||||
|
@ -183,8 +183,9 @@ class Game:
|
||||
self.players[self.turn].play_turn()
|
||||
|
||||
def next_turn(self):
|
||||
self.turn = (self.turn + 1) % len(self.players)
|
||||
self.play_turn()
|
||||
if len(self.players) > 0:
|
||||
self.turn = (self.turn + 1) % len(self.players)
|
||||
self.play_turn()
|
||||
|
||||
def notify_scrap_pile(self):
|
||||
print('scrap')
|
||||
|
@ -5,6 +5,7 @@ import socketio
|
||||
import bang.deck as deck
|
||||
import bang.roles as r
|
||||
import bang.cards as cs
|
||||
import bang.expansions.dodge_city.cards as csd
|
||||
import bang.characters as chars
|
||||
|
||||
class PendingAction(IntEnum):
|
||||
@ -40,7 +41,7 @@ class Player:
|
||||
self.on_pick_cb = None
|
||||
self.on_failed_response_cb = None
|
||||
self.event_type: str = None
|
||||
self.expected_response = None
|
||||
self.expected_response = []
|
||||
self.attacker = None
|
||||
self.target_p: str = None
|
||||
self.is_drawing = False
|
||||
@ -92,8 +93,10 @@ class Player:
|
||||
|
||||
def notify_self(self):
|
||||
if isinstance(self.character, chars.CalamityJanet):
|
||||
self.expected_response = [
|
||||
cs.Mancato(0, 0).name, cs.Bang(0, 0).name]
|
||||
if cs.Mancato(0, 0).name not in self.expected_response:
|
||||
self.expected_response.append(cs.Mancato(0, 0).name)
|
||||
elif cs.Bang(0, 0).name not in self.expected_response:
|
||||
self.expected_response.append(cs.Bang(0, 0).name)
|
||||
elif isinstance(self.character, chars.SuzyLafayette) and len(self.hand) == 0:
|
||||
self.hand.append(self.game.deck.draw())
|
||||
ser = self.__dict__.copy()
|
||||
@ -310,7 +313,7 @@ class Player:
|
||||
self.game.responders_did_respond_resume_turn()
|
||||
else:
|
||||
self.pending_action = PendingAction.RESPOND
|
||||
self.expected_response = [cs.Mancato(0, 0).name]
|
||||
self.expected_response = [cs.Mancato(0, 0).name, csd.Schivata(0,0).name]
|
||||
self.on_failed_response_cb = self.take_damage_response
|
||||
self.notify_self()
|
||||
|
||||
@ -329,7 +332,7 @@ class Player:
|
||||
else:
|
||||
print('has mancato')
|
||||
self.pending_action = PendingAction.RESPOND
|
||||
self.expected_response = [cs.Mancato(0, 0).name]
|
||||
self.expected_response = [cs.Mancato(0, 0).name, csd.Schivata(0,0).name]
|
||||
self.on_failed_response_cb = self.take_damage_response
|
||||
self.notify_self()
|
||||
return True
|
||||
@ -392,7 +395,9 @@ class Player:
|
||||
def respond(self, hand_index):
|
||||
self.pending_action = PendingAction.WAIT
|
||||
if hand_index != -1 and self.hand[hand_index].name in self.expected_response:
|
||||
self.game.deck.scrap(self.hand.pop(hand_index))
|
||||
card = self.hand.pop(hand_index)
|
||||
card.use_card(self)
|
||||
self.game.deck.scrap(card)
|
||||
self.notify_self()
|
||||
self.mancato_needed -= 1
|
||||
if self.mancato_needed <= 0:
|
||||
|
Loading…
Reference in New Issue
Block a user