add lemat

This commit is contained in:
Alberto Xamin 2023-02-09 11:45:32 +00:00
parent 8d06cc2a77
commit 621739546e
8 changed files with 36 additions and 14 deletions

View File

@ -16,6 +16,7 @@ class Suit(IntEnum):
CLUBS = 1 # ♣
HEARTS = 2 # ♥
SPADES = 3 # ♠
GOLD = 4 # 🤑
class Card(ABC):
@ -52,14 +53,14 @@ class Card(ABC):
def __str__(self):
if str(self.suit).isnumeric():
char = ['♦️', '♣️', '♥️', '♠️'][int(self.suit)]
char = ['♦️', '♣️', '♥️', '♠️', '🤑'][int(self.suit)]
else:
char = self.suit
return f'{self.name} {char}{self.number}'
return super().__str__()
def num_suit(self):
return f"{['♦️', '♣️', '♥️', '♠️'][int(self.suit)]}{self.number}"
return f"{['♦️', '♣️', '♥️', '♠️', '🤑'][int(self.suit)]}{self.number}"
def reset_card(self):
if self.usable_next_turn:
@ -231,7 +232,7 @@ class Bang(Card):
elif against is not None:
import bang.characters as chars
super().play_card(player, against=against)
if not self.number == 42: # 42 gold rush
if not (self.number == 42 and self.suit == Suit.GOLD): # 42 gold rush
player.bang_used += 1
player.has_played_bang = True if not player.game.check_event(ceh.Sparatoria) else player.bang_used > 1
if player.character.check(player.game, chars.WillyTheKid):

View File

@ -58,7 +58,7 @@ class Bottiglia(ShopCard):
def play_card(self, player, against=None, _with=None):
# bang, birra, panico
player.available_cards = [Bang(1,42), Birra(1,42), Panico(1,42)]
player.available_cards = [Bang(4,42), Birra(4,42), Panico(4,42)]
for i in range(len(player.available_cards)):
player.available_cards[i].must_be_used = True
player.choose_text = 'choose_bottiglia'
@ -73,7 +73,7 @@ class Complice(ShopCard):
def play_card(self, player, against=None, _with=None):
# emporio, duello, Cat balou
player.available_cards = [Emporio(1,42), Duello(1,42), CatBalou(1,42)]
player.available_cards = [Emporio(4,42), Duello(4,42), CatBalou(4,42)]
for i in range(len(player.available_cards)):
player.available_cards[i].must_be_used = True
player.choose_text = 'choose_complice'

View File

@ -33,7 +33,24 @@ class Lemat(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Lemat', number, is_equipment=True, is_weapon=True, range=1)
self.icon = '🔫' # ogni carta può essere usata come bang, conta per il conteggio dei bang per turno
#TODO
def play_card(self, player, against, _with=None):
if (player.game.check_event(ce.IlGiudice) and self.can_be_used_now) or (not self.can_be_used_now and player.game.check_event(ce.Lazo)):
return False
if self.can_be_used_now:
self.can_be_used_now = False
G.sio.emit('chat_message', room=player.game.name,
data=f'_play_card|{player.name}|{self.name}')
player.equipment.append(self)
player.notify_self()
return True
elif not player.has_played_bang:
from bang.players import PendingAction
player.available_cards = player.hand.copy()
player.pending_action = PendingAction.CHOOSE
player.choose_text = 'choose_play_as_bang'
player.notify_self()
return False
class SerpenteASonagli(Card):
def __init__(self, suit, number):
@ -165,7 +182,7 @@ class Mira(Card):
def play_card(self, player, against, _with=None):
if against is not None and _with is not None:
super().play_card(player, against=against)
super().play_card(player, against=against, _with=_with)
player.game.attack(player, against, card_name=self.name)
return True
return False
@ -218,7 +235,7 @@ def get_starting_deck() -> List[Card]:
cards = [
Fantasma(Suit.SPADES, 9),
Fantasma(Suit.SPADES, 10),
# Lemat(Suit.DIAMONDS, 4),
Lemat(Suit.DIAMONDS, 4),
SerpenteASonagli(Suit.HEARTS, 7),
Shotgun(Suit.SPADES, 'K'),
Taglia(Suit.CLUBS, 9),

View File

@ -716,6 +716,7 @@ class Player:
print('which is a gold rush black card')
card: grc.ShopCard = self.gold_rush_equipment[hand_index - len(self.hand) - len(self.equipment)]
return card.play_card(self)
from_hand = hand_index < len(self.hand)
card: cs.Card = self.hand.pop(hand_index) if hand_index < len(self.hand) else self.equipment.pop(hand_index-len(self.hand))
withCard: cs.Card = None
if _with is not None:
@ -743,7 +744,10 @@ class Player:
self.equipment.insert(hand_index-len(self.hand), card)
elif card.is_equipment or (card.usable_next_turn and not card.can_be_used_now):
if not did_play_card:
if from_hand:
self.hand.insert(hand_index, card)
else:
self.equipment.insert(hand_index-len(self.hand), card)
else:
did_play_card = True
if not self.game.is_replay:
@ -873,7 +877,7 @@ class Player:
if card_index <= len(self.available_cards):
self.hand.remove(self.available_cards[card_index])
self.game.deck.scrap(self.available_cards[card_index], player=self)
self.hand.append(cs.Bang(cs.Suit.CLUBS, 42))
self.hand.append(cs.Bang(self.available_cards[card_index].suit, 42))
self.pending_action = PendingAction.PLAY
self.notify_self()
elif 'choose_tornado' in self.choose_text:

View File

@ -32,7 +32,7 @@ export default {
},
suit() {
if (this.card && !isNaN(this.card.suit)) {
let x = ['♦️','♣️','♥️','♠️']
let x = ['♦️','♣️','♥️','♠️','🤑']
return x[this.card.suit];
} else if (this.card.suit) {
return this.card.suit;

View File

@ -390,7 +390,7 @@ export default {
},
play_card(card, from_equipment) {
console.log('play ' + card.name)
if (from_equipment && (!card.can_be_used_now || (this.eventCard && this.eventCard.name == "Lazo"))) return;
if (from_equipment && ((!card.can_be_used_now && !card.name == 'Lemat') || (this.eventCard && this.eventCard.name == "Lazo"))) return;
else if (card.usable_next_turn && !card.can_be_used_now) return this.really_play_card(card, null);
let calamity_special = (card.name === 'Mancato!' && this.character.name === 'Calamity Janet')
let cant_play_bang = (this.has_played_bang && card.number !==42 && this.equipment.filter(x => x.name == 'Volcanic').length == 0)

View File

@ -695,7 +695,7 @@
},
"Lemat": {
"name": "Lemat",
"desc": "During your turn you can use any card as BANG!."
"desc": "During your turn you can use any card as BANG! (Click on the card once equipped)."
},
"SerpenteASonagli": {
"name": "Serpente a Sonagli",

View File

@ -695,7 +695,7 @@
},
"Lemat": {
"name": "Lemat",
"desc": "Puoi usare ogni carta in mano come BANG!."
"desc": "Puoi usare ogni carta in mano come BANG! (Clicca la carta una volta equipaggiata)."
},
"SerpenteASonagli": {
"name": "Serpente a Sonagli",