show the right icon when playing with three players
This commit is contained in:
parent
069236286c
commit
5979221478
@ -588,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):
|
||||||
|
@ -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
|
||||||
@ -352,7 +355,7 @@ 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
|
'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]
|
||||||
@ -380,7 +383,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})
|
||||||
@ -390,7 +393,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'
|
||||||
|
@ -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,
|
||||||
}})
|
}})
|
||||||
|
Loading…
Reference in New Issue
Block a user