ricercato can target self

This commit is contained in:
Giulio 2021-06-27 14:35:37 +02:00
parent 4bb0ac2344
commit 7f81276052
5 changed files with 17 additions and 4 deletions

View File

@ -41,6 +41,7 @@ class Bicchierino(ShopCard):
'name': p.name, 'name': p.name,
'icon': p.role.icon if(player.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠', 'icon': p.role.icon if(player.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠',
'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)), 'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)),
'is_character': True,
'noDesc': True 'noDesc': True
} for p in player.game.get_alive_players()] } for p in player.game.get_alive_players()]
player.choose_text = 'choose_bicchierino' player.choose_text = 'choose_bicchierino'
@ -155,6 +156,7 @@ class Ricercato(ShopCard):
def __init__(self): def __init__(self):
super().__init__("Ricercato", 2, ShopCardKind.BLACK) super().__init__("Ricercato", 2, ShopCardKind.BLACK)
self.icon = '🤠️' self.icon = '🤠️'
self.can_target_self = True
def play_card(self, player, against=None, _with=None): def play_card(self, player, against=None, _with=None):
player.sio.emit('chat_message', room=player.game.name, data=f'_purchase_card|{player.name}|{self.name}') player.sio.emit('chat_message', room=player.game.name, data=f'_purchase_card|{player.name}|{self.name}')
@ -162,8 +164,10 @@ class Ricercato(ShopCard):
'name': p.name, 'name': p.name,
'icon': p.role.icon if(player.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠', 'icon': p.role.icon if(player.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠',
'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)), 'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)),
'is_character': True,
'noDesc': True 'noDesc': True
} for p in player.game.get_alive_players() if p != player] } for p in player.game.get_alive_players() if p != player]
player.available_cards.append({'name': player.name, 'number':0,'icon': 'you', 'is_character': True})
player.choose_text = 'choose_ricercato' player.choose_text = 'choose_ricercato'
player.pending_action = pl.PendingAction.CHOOSE player.pending_action = pl.PendingAction.CHOOSE
player.notify_self() player.notify_self()

View File

@ -362,6 +362,7 @@ class Player:
'name': p.name, 'name': p.name,
'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠', 'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠',
'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)), 'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)),
'is_character': True,
'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]
self.available_cards.append({'icon': '', 'noDesc': True}) self.available_cards.append({'icon': '', 'noDesc': True})
@ -390,6 +391,7 @@ class Player:
'name': p['name'], 'name': p['name'],
'icon': p['role'].icon if(self.game.initial_players == 3) else '⭐️' 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'])),
'is_character': True,
'desc': p['name'] 'desc': p['name']
} 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})
@ -400,6 +402,7 @@ class Player:
self.available_cards = [{ self.available_cards = [{
'name': p.name, 'name': p.name,
'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠', 'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠',
'is_character': True,
'noDesc': True '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})
@ -1138,6 +1141,7 @@ class Player:
self.available_cards = [{ self.available_cards = [{
'name': p.name, 'name': p.name,
'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠', 'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠',
'is_character': True,
'alt_text': ''.join(['🎴️'] * len(p.gold_rush_equipment)), 'alt_text': ''.join(['🎴️'] * len(p.gold_rush_equipment)),
'noDesc': True 'noDesc': True
} for p in self.game.get_alive_players() if p != self and len([e for e in p.gold_rush_equipment if e.number + 1 <= self.gold_nuggets]) > 0] } for p in self.game.get_alive_players() if p != self and len([e for e in p.gold_rush_equipment if e.number + 1 <= self.gold_nuggets]) > 0]

View File

@ -1,7 +1,7 @@
<template> <template>
<div :class="{ card: true, equipment: card.is_equipment, character:card.is_character, back:card.is_back, 'usable-next-turn':card.usable_next_turn, 'must-be-used':card.must_be_used, 'gold-rush': card.expansion === 'gold_rush', 'brown':card.kind === 0, 'black':card.kind === 1,}"> <div :class="{ card: true, equipment: card.is_equipment, character:card.is_character, back:card.is_back, 'usable-next-turn':card.usable_next_turn, 'must-be-used':card.must_be_used, 'gold-rush': card.expansion === 'gold_rush', 'brown':card.kind === 0, 'black':card.kind === 1,}">
<h4>{{cardName}}</h4> <h4>{{cardName}}</h4>
<div class="emoji">{{card.icon}}</div> <div class="emoji">{{emoji}}</div>
<div class="alt_text">{{card.alt_text}}</div> <div class="alt_text">{{card.alt_text}}</div>
<div class="suit">{{number}}{{suit}}</div> <div class="suit">{{number}}{{suit}}</div>
<div class="expansion" v-if="card.expansion_icon">{{card.expansion_icon}}</div> <div class="expansion" v-if="card.expansion_icon">{{card.expansion_icon}}</div>
@ -21,8 +21,14 @@ export default {
if (!this.donotlocalize && this.$t(`cards.${this.card.name}.name`) !== `cards.${this.card.name}.name`) { if (!this.donotlocalize && this.$t(`cards.${this.card.name}.name`) !== `cards.${this.card.name}.name`) {
return this.$t(`cards.${this.card.name}.name`) return this.$t(`cards.${this.card.name}.name`)
} }
if (this.card.name == "you") {
return this.$t('you')
}
return this.card.name return this.card.name
}, },
emoji(){
return this.card.icon != "you" ? this.card.icon : this.$t('you')
},
suit() { suit() {
if (this.card && !isNaN(this.card.suit)) { if (this.card && !isNaN(this.card.suit)) {
let x = ['♦️','♣️','♥️','♠️'] let x = ['♦️','♣️','♥️','♠️']

View File

@ -49,10 +49,10 @@ export default {
//console.log(card) //console.log(card)
if (card.noDesc || card.name == null || card.name == "PewPew!") if (card.noDesc || card.name == null || card.name == "PewPew!")
this.desc = "" this.desc = ""
else if (card.desc)
this.desc = (this.$i18n.locale=='it'?card.desc:card.desc_eng)
else if (card.is_character) else if (card.is_character)
this.desc = card.name this.desc = card.name
else if (card.desc)
this.desc = (this.$i18n.locale=='it'?card.desc:card.desc_eng)
else else
this.desc = this.$t(`cards.${card.name}.desc`) this.desc = this.$t(`cards.${card.name}.desc`)
} }

View File

@ -244,7 +244,6 @@ export default {
name: this.name, name: this.name,
number: 0, number: 0,
icon: this.$t('you'), icon: this.$t('you'),
desc: this.$t('you'),
is_character: true, is_character: true,
}) })
} }