use card
This commit is contained in:
parent
41ca3b2747
commit
bf5af1d025
@ -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,6 +27,19 @@ class Pugno(Card):
|
||||
return True
|
||||
return False
|
||||
|
||||
class Schivata(Mancato):
|
||||
def __init__(self,suit,number):
|
||||
super().__init__(suit, 'Schivata', number)
|
||||
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
|
||||
@ -49,4 +62,6 @@ def get_starting_deck() -> List[Card]:
|
||||
Mancato(Suit.DIAMONDS, 8),
|
||||
Panico(Suit.HEARTS, 'J'),
|
||||
Pugno(Suit.SPADES, 10),
|
||||
Schivata(Suit.DIAMONDS, 7),
|
||||
Schivata(Suit.HEARTS, 'K'),
|
||||
]
|
||||
|
@ -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):
|
||||
@ -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