Merge branch 'dev' into main

This commit is contained in:
Giulio 2021-06-08 12:25:04 +02:00
commit c446a02aac
5 changed files with 18 additions and 13 deletions

View File

@ -561,6 +561,7 @@ class Game:
self.is_handling_death = False self.is_handling_death = False
self.waiting_for = 0 self.waiting_for = 0
self.incremental_turn = 0 self.incremental_turn = 0
self.turn = 0
self.pending_winners = [] self.pending_winners = []
for p in self.players: for p in self.players:
p.reset() p.reset()
@ -587,6 +588,7 @@ class Game:
'cards': len(pls[j].hand)+len(pls[j].equipment), 'cards': len(pls[j].hand)+len(pls[j].equipment),
'is_ghost': pls[j].is_ghost, 'is_ghost': pls[j].is_ghost,
'is_bot': pls[j].is_bot, 'is_bot': pls[j].is_bot,
'icon': pls[j].role.icon if (pls[j].role is not None) else '🤠',
} for j in range(len(pls)) if i != j] } for j in range(len(pls)) if i != j]
def get_alive_players(self): def get_alive_players(self):

View File

@ -65,6 +65,7 @@ class Player:
self.death_turn = 0 self.death_turn = 0
self.is_ghost = False self.is_ghost = False
self.not_chosen_character = None self.not_chosen_character = None
self.noStar = False
def reset(self): def reset(self):
self.hand: cs.Card = [] self.hand: cs.Card = []
@ -101,6 +102,7 @@ class Player:
self.is_dead = False self.is_dead = False
self.is_ghost = False self.is_ghost = False
self.death_turn = 0 self.death_turn = 0
self.noStar = False
def join_game(self, game): def join_game(self, game):
self.game = game self.game = game
@ -146,6 +148,7 @@ class Player:
self.hand = [] self.hand = []
self.equipment = [] self.equipment = []
self.pending_action = PendingAction.WAIT self.pending_action = PendingAction.WAIT
self.noStar = (self.game.initial_players == 3)
def set_available_character(self, available): def set_available_character(self, available):
self.available_characters = available self.available_characters = available
@ -340,6 +343,7 @@ class Player:
self.special_use_count = 0 self.special_use_count = 0
self.bang_used = 0 self.bang_used = 0
if self.game.check_event(ceh.MezzogiornoDiFuoco): if self.game.check_event(ceh.MezzogiornoDiFuoco):
self.attacker = None
self.lives -= 1 self.lives -= 1
if self.character.check(self.game, chars.BartCassidy) and self.lives > 0: if self.character.check(self.game, chars.BartCassidy) and self.lives > 0:
self.hand.append(self.game.deck.draw(True)) self.hand.append(self.game.deck.draw(True))
@ -352,8 +356,9 @@ class Player:
if self.game.check_event(ce.FratelliDiSangue) and self.lives > 1 and not self.is_giving_life and len([p for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives]): if self.game.check_event(ce.FratelliDiSangue) and self.lives > 1 and not self.is_giving_life and len([p for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives]):
self.available_cards = [{ self.available_cards = [{
'name': p.name, 'name': p.name,
'icon': '⭐️' if isinstance(p.role, r.Sheriff) else '🤠', 'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if p['is_sheriff'] else '🤠',
'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)) 'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)),
'noDesc': True
} for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives] } for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives]
self.available_cards.append({'icon': '', 'noDesc': True}) self.available_cards.append({'icon': '', 'noDesc': True})
self.choose_text = 'choose_fratelli_di_sangue' self.choose_text = 'choose_fratelli_di_sangue'
@ -379,7 +384,7 @@ class Player:
self.is_using_checchino = True self.is_using_checchino = True
self.available_cards = [{ self.available_cards = [{
'name': p['name'], 'name': p['name'],
'icon': '⭐️' if p['is_sheriff'] else '🤠', 'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if p['is_sheriff'] else '🤠',
'alt_text': ''.join(['❤️']*p['lives'])+''.join(['💀']*(p['max_lives']-p['lives'])) 'alt_text': ''.join(['❤️']*p['lives'])+''.join(['💀']*(p['max_lives']-p['lives']))
} for p in self.game.get_visible_players(self) if p['dist'] <= self.get_sight()] } for p in self.game.get_visible_players(self) if p['dist'] <= self.get_sight()]
self.available_cards.append({'icon': '', 'noDesc': True}) self.available_cards.append({'icon': '', 'noDesc': True})
@ -389,7 +394,8 @@ class Player:
elif self.is_my_turn and self.pending_action == PendingAction.PLAY and pile == 'event' and self.game.check_event(ce.Rimbalzo) and len([c for c in self.hand if c.name == cs.Bang(0,0).name]) > 0: elif self.is_my_turn and self.pending_action == PendingAction.PLAY and pile == 'event' and self.game.check_event(ce.Rimbalzo) and len([c for c in self.hand if c.name == cs.Bang(0,0).name]) > 0:
self.available_cards = [{ self.available_cards = [{
'name': p.name, 'name': p.name,
'icon': '⭐️' if isinstance(p.role, r.Sheriff) else '🤠' 'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if p['is_sheriff'] else '🤠',
'noDesc': True
} for p in self.game.get_alive_players() if len(p.equipment) > 0 and p != self] } for p in self.game.get_alive_players() if len(p.equipment) > 0 and p != self]
self.available_cards.append({'icon': '', 'noDesc': True}) self.available_cards.append({'icon': '', 'noDesc': True})
self.choose_text = 'choose_rimbalzo_player' self.choose_text = 'choose_rimbalzo_player'
@ -530,11 +536,6 @@ class Player:
playable_cards.append(i) playable_cards.append(i)
return playable_cards return playable_cards
def get_public_description(self):
s = f"{self.name} {'Sheriff ⭐️' if isinstance(self.role, r.Sheriff) else ''} ({self.lives}/{self.max_lives} ⁍) {len(self.hand)} Cards in hand, "
s += f"equipment {[str(c) for c in self.equipment]}"
return s
def play_card(self, hand_index: int, against=None, _with=None): def play_card(self, hand_index: int, against=None, _with=None):
if not self.is_my_turn or self.pending_action != PendingAction.PLAY or self.game.is_handling_death: if not self.is_my_turn or self.pending_action != PendingAction.PLAY or self.game.is_handling_death:
return return

View File

@ -116,6 +116,7 @@ export default {
eventCard: false, eventCard: false,
emporioCards: {}, emporioCards: {},
spectator: false, spectator: false,
noStar: false,
}), }),
sockets: { sockets: {
role(role) { role(role) {
@ -163,6 +164,7 @@ export default {
this.cancelChooseCardFromPlayer() this.cancelChooseCardFromPlayer()
this.shouldChooseCard = false this.shouldChooseCard = false
} }
this.noStar = self.noStar
}, },
self_vis(vis) { self_vis(vis) {
// console.log('received visibility update') // console.log('received visibility update')
@ -196,7 +198,7 @@ export default {
return { return {
name: player.name, name: player.name,
number: player.dist !== undefined ? `${player.dist}` : '', number: player.dist !== undefined ? `${player.dist}` : '',
icon: player.is_sheriff ? '⭐' : '🤠', icon: this.noStar ? player.icon : player.is_sheriff ? '⭐' : '🤠',
is_character: true, is_character: true,
}}) }})
return vis return vis
@ -212,7 +214,7 @@ export default {
return { return {
name: player.name, name: player.name,
number: player.dist !== undefined ? `${player.dist}` : '', number: player.dist !== undefined ? `${player.dist}` : '',
icon: player.is_sheriff ? '⭐' : '🤠', icon: this.noStar ? player.icon : player.is_sheriff ? '⭐' : '🤠',
alt_text: Array(player.lives+1).join('❤️')+Array(player.max_lives-player.lives+1).join('💀'), alt_text: Array(player.lives+1).join('❤️')+Array(player.max_lives-player.lives+1).join('💀'),
is_character: true, is_character: true,
}}) }})

View File

@ -413,7 +413,7 @@
"desc": "Instead of drawing he can steal a card from the equipment of another player. (click on the enemy player if you want to use the ability)" "desc": "Instead of drawing he can steal a card from the equipment of another player. (click on the enemy player if you want to use the ability)"
}, },
"José Delgado": { "José Delgado": {
"name": "José Delgrado", "name": "José Delgado",
"desc": "On his turn he can discard a blue card to draw 2 cards, up to twice per turn." "desc": "On his turn he can discard a blue card to draw 2 cards, up to twice per turn."
}, },
"Doc Holyday": { "Doc Holyday": {

View File

@ -413,7 +413,7 @@
"desc": "Invece di pescare può prendere una carta dall'equipaggiamento di un altro giocatore. (clicca sul giocatore avversario se vuoi usare l'abilità)" "desc": "Invece di pescare può prendere una carta dall'equipaggiamento di un altro giocatore. (clicca sul giocatore avversario se vuoi usare l'abilità)"
}, },
"José Delgado": { "José Delgado": {
"name": "José Delgrado", "name": "José Delgado",
"desc": "Nel suo turno può scartare una carta blu per pescare 2 carte, fino a due volte per turno." "desc": "Nel suo turno può scartare una carta blu per pescare 2 carte, fino a due volte per turno."
}, },
"Doc Holyday": { "Doc Holyday": {