bottiglia e complice

This commit is contained in:
Alberto Xamin 2021-06-16 22:58:55 +02:00
parent 374e963cec
commit 38b8a40655
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
4 changed files with 37 additions and 22 deletions

View File

@ -103,6 +103,7 @@ class Deck:
return self.draw() return self.draw()
def scrap(self, card: cs.Card, ignore_event = False): def scrap(self, card: cs.Card, ignore_event = False):
if card.number == 42: return
card.reset_card() card.reset_card()
if self.game.check_event(ce.MinieraAbbandonata) and not ignore_event: if self.game.check_event(ce.MinieraAbbandonata) and not ignore_event:
self.put_on_top(card) self.put_on_top(card)

View File

@ -1,4 +1,5 @@
from bang.cards import * from bang.cards import *
import bang.players as pl
class ShopCardKind(IntEnum): class ShopCardKind(IntEnum):
BROWN = 0 # Se lequipaggiamento ha il bordo marrone, applicane subito leffetto e poi scartalo. BROWN = 0 # Se lequipaggiamento ha il bordo marrone, applicane subito leffetto e poi scartalo.
@ -36,7 +37,6 @@ class Bicchierino(ShopCard):
self.icon = '🍸️' self.icon = '🍸️'
def play_card(self, player, against=None, _with=None): def play_card(self, player, against=None, _with=None):
import bang.players as pl
player.available_cards = [{ player.available_cards = [{
'name': p.name, 'name': p.name,
'icon': p.role.icon if(player.game.initial_players == 3) else '⭐️' if p['is_sheriff'] else '🤠', 'icon': p.role.icon if(player.game.initial_players == 3) else '⭐️' if p['is_sheriff'] else '🤠',
@ -54,9 +54,14 @@ class Bottiglia(ShopCard):
self.icon = '🍾️' self.icon = '🍾️'
def play_card(self, player, against=None, _with=None): def play_card(self, player, against=None, _with=None):
if against != None: # bang, birra, panico
pass # bang, birra, panico player.available_cards = [Bang(1,42), Birra(1,42), Panico(1,42)]
return False for i in range(len(player.available_cards)):
player.available_cards[i].must_be_used = True
player.choose_text = 'choose_bottiglia'
player.pending_action = pl.PendingAction.CHOOSE
player.notify_self()
return True
class Complice(ShopCard): class Complice(ShopCard):
def __init__(self): def __init__(self):
@ -64,9 +69,14 @@ class Complice(ShopCard):
self.icon = '😉️' self.icon = '😉️'
def play_card(self, player, against=None, _with=None): def play_card(self, player, against=None, _with=None):
if against != None: # emporio, duello, Cat balou
pass # emporio, duello, Cat balou player.available_cards = [Emporio(1,42), Duello(1,42), CatBalou(1,42)]
return False for i in range(len(player.available_cards)):
player.available_cards[i].must_be_used = True
player.choose_text = 'choose_complice'
player.pending_action = pl.PendingAction.CHOOSE
player.notify_self()
return True
class CorsaAllOro(ShopCard): class CorsaAllOro(ShopCard):
def __init__(self): def __init__(self):
@ -141,7 +151,6 @@ class Ricercato(ShopCard):
self.icon = '🤠️' self.icon = '🤠️'
def play_card(self, player, against=None, _with=None): def play_card(self, player, against=None, _with=None):
import bang.players as pl
player.available_cards = [{ player.available_cards = [{
'name': p.name, 'name': p.name,
'icon': p.role.icon if(player.game.initial_players == 3) else '⭐️' if p['is_sheriff'] else '🤠', 'icon': p.role.icon if(player.game.initial_players == 3) else '⭐️' if p['is_sheriff'] else '🤠',
@ -206,20 +215,8 @@ class Zaino(ShopCard):
def get_cards() -> List[Card]: def get_cards() -> List[Card]:
cards = [ cards = [
Bicchierino(), Bicchierino(),
Bicchierino(), Bottiglia(),
Bicchierino(), Complice(),
Bicchierino(),
Bicchierino(),
Bicchierino(),
Bicchierino(),
Bicchierino(),
Bicchierino(),
Bicchierino(),
Bicchierino(),
Bicchierino(),
Bicchierino(),
# Bottiglia(),
# Complice(),
CorsaAllOro(), CorsaAllOro(),
Rum(), Rum(),
UnionPacific(), UnionPacific(),

View File

@ -626,6 +626,19 @@ class Player:
player.lives = min(player.lives+1, player.max_lives) player.lives = min(player.lives+1, player.max_lives)
self.pending_action = PendingAction.PLAY self.pending_action = PendingAction.PLAY
self.notify_self() self.notify_self()
elif self.choose_text == 'choose_bottiglia':
self.sio.emit('chat_message', room=self.game.name, data=f'_play_card|{self.name}|{"Bottiglia"}')
if isinstance(self.available_cards[card_index], cs.Birra):
self.lives = min(self.lives+1, self.max_lives)
else:
self.hand.append(self.available_cards[card_index])
self.pending_action = PendingAction.PLAY
self.notify_self()
elif self.choose_text == 'choose_complice':
self.sio.emit('chat_message', room=self.game.name, data=f'_play_card|{self.name}|{"Bottiglia"}')
self.hand.append(self.available_cards[card_index])
self.pending_action = PendingAction.PLAY
self.notify_self()
elif self.game.check_event(ceh.NuovaIdentita) and self.choose_text == 'choose_nuova_identita': elif self.game.check_event(ceh.NuovaIdentita) and self.choose_text == 'choose_nuova_identita':
if card_index == 1: # the other character if card_index == 1: # the other character
self.character = self.not_chosen_character self.character = self.not_chosen_character

View File

@ -169,6 +169,10 @@ export default {
this.shouldChooseCard = false this.shouldChooseCard = false
} }
this.noStar = self.noStar this.noStar = self.noStar
let mustplay = this.handComputed.filter(x => x.number == 42);
if (mustplay.length > 0) {
this.play_card(mustplay[0], false)
}
}, },
self_vis(vis) { self_vis(vis) {
// console.log('received visibility update') // console.log('received visibility update')