Merge pull request #5 from albertoxamin/dev
update from dev with dodge city green cards
This commit is contained in:
commit
004b1d17ca
@ -36,6 +36,8 @@ class Card(ABC):
|
||||
self.desc = desc
|
||||
self.need_target = False
|
||||
self.can_target_self = False
|
||||
self.can_be_used_now = True
|
||||
self.usable_next_turn = False
|
||||
self.need_with = False
|
||||
|
||||
def __str__(self):
|
||||
@ -284,7 +286,7 @@ class Mancato(Card):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, 'Mancato!', number)
|
||||
self.icon = '😅'
|
||||
self.desc = "Usa questa carta per annullare un bang"
|
||||
self.desc = "Usa questa carta per annullare un Bang!"
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
import bang.characters as chars
|
||||
|
@ -6,6 +6,10 @@ class Deck:
|
||||
def __init__(self, game):
|
||||
super().__init__()
|
||||
self.cards: List[cs.Card] = cs.get_starting_deck(game.expansions)
|
||||
self.mancato_cards: List[str] = []
|
||||
for c in self.cards:
|
||||
if isinstance(c, cs.Mancato) and c.name not in self.mancato_cards:
|
||||
self.mancato_cards.append(c.name)
|
||||
self.game = game
|
||||
random.shuffle(self.cards)
|
||||
self.scrap_pile: List[cs.Card] = []
|
||||
@ -46,5 +50,7 @@ class Deck:
|
||||
return self.draw()
|
||||
|
||||
def scrap(self, card: cs.Card):
|
||||
if card.usable_next_turn:
|
||||
card.can_be_used_now = False
|
||||
self.scrap_pile.append(card)
|
||||
self.game.notify_scrap_pile()
|
||||
|
@ -31,7 +31,7 @@ class Schivata(Mancato):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Schivata'
|
||||
self.icon = '🙅♂️'
|
||||
self.desc += " e poi pesca una carta"
|
||||
self.desc = "Usa questa carta per annullare un Bang! e poi pesca una carta"
|
||||
self.alt_text = '☝️🆓'
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
@ -69,9 +69,12 @@ class Rissa(CatBalou):
|
||||
|
||||
def play_card(self, player, against, _with):
|
||||
if _with != None:
|
||||
players_with_cards = [p.name for p in player.game.players if p != player and (len(p.hand)+len(p.equipment)) > 0]
|
||||
if len(players_with_cards) == 0:
|
||||
return False
|
||||
player.game.deck.scrap(_with)
|
||||
player.event_type = 'rissa'
|
||||
super().play_card(player, against=[p.name for p in player.game.players if p != player and (len(p.hand)+len(p.equipment)) > 0][0])
|
||||
super().play_card(player, against=players_with_cards[0])
|
||||
player.sio.emit('chat_message', room=player.game.name, data=f'{player.name} ha giocato {self.name}')
|
||||
return True
|
||||
return False
|
||||
@ -130,6 +133,198 @@ class Whisky(Card):
|
||||
return True
|
||||
return False
|
||||
|
||||
class Bibbia(Schivata):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Bibbia'
|
||||
self.icon = '📖'
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
pass
|
||||
return False
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
def use_card(self, player):
|
||||
player.hand.append(player.game.deck.draw())
|
||||
player.notify_self()
|
||||
|
||||
class Cappello(Mancato):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Cappello'
|
||||
self.icon = '🧢'
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
pass
|
||||
return False
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
class PlaccaDiFerro(Cappello):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Placca Di Ferro'
|
||||
self.icon = '🛡'
|
||||
|
||||
class Sombrero(Cappello):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Sombrero'
|
||||
self.icon = '👒'
|
||||
|
||||
class Pugnale(Pugno):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Pugnale'
|
||||
self.icon = '🗡'
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
return super().play_card(player, against=against)
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
class Derringer(Pugnale):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Derringer'
|
||||
self.icon = '🚬'
|
||||
self.alt_text += ' ☝️🆓'
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
player.hand.append(player.game.deck.draw())
|
||||
return super().play_card(player, against=against)
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
class Borraccia(Birra):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Borraccia'
|
||||
self.icon = '🍼'
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
return super().play_card(player, against)
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
class PonyExpress(WellsFargo):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Pony Express'
|
||||
self.icon = '🦄'
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
return super().play_card(player, against)
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
class Howitzer(Gatling):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Howitzer'
|
||||
self.icon = '📡'
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
return super().play_card(player, against)
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
class CanCan(CatBalou):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Can Can'
|
||||
self.icon = '👯♀️'
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
return super().play_card(player, against)
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
class Conestoga(Panico):
|
||||
def __init__(self, suit, number):
|
||||
Card.__init__(self, suit, 'Conestoga', number)
|
||||
self.icon = '🏕'
|
||||
self.desc = "Ruba 1 carta dalla mano di un giocatore a prescindere dalla distanza"
|
||||
self.need_target = True
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
return super().play_card(player, against)
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
class Pepperbox(Bang):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Pepperbox'
|
||||
self.icon = '🌶'
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
if against != None:
|
||||
Card.play_card(self, player, against=against)
|
||||
player.game.attack(player, against)
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
class FucileDaCaccia(Card):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, 'Fucile Da Caccia', number)
|
||||
self.icon = '🌂'
|
||||
self.desc = "Spara a un giocatore a prescindere dalla distanza"
|
||||
self.need_target = True
|
||||
self.usable_next_turn = True
|
||||
self.can_be_used_now = False
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if self.can_be_used_now:
|
||||
if against != None:
|
||||
super().play_card(player, against=against)
|
||||
player.game.attack(player, against)
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
player.equipment.append(self)
|
||||
return True
|
||||
|
||||
def get_starting_deck() -> List[Card]:
|
||||
return [
|
||||
@ -160,4 +355,18 @@ def get_starting_deck() -> List[Card]:
|
||||
SpringField(Suit.SPADES, 'K'),
|
||||
Tequila(Suit.CLUBS, 9),
|
||||
Whisky(Suit.HEARTS, 'Q'),
|
||||
Bibbia(Suit.HEARTS, 10),
|
||||
Cappello(Suit.DIAMONDS, 'J'),
|
||||
PlaccaDiFerro(Suit.DIAMONDS, 'A'),
|
||||
PlaccaDiFerro(Suit.SPADES, 'Q'),
|
||||
Sombrero(Suit.CLUBS, 7),
|
||||
Pugnale(Suit.HEARTS, 8),
|
||||
Derringer(Suit.SPADES, 7),
|
||||
Borraccia(Suit.HEARTS, 7),
|
||||
CanCan(Suit.CLUBS, 'J'),
|
||||
Conestoga(Suit.DIAMONDS, 9),
|
||||
FucileDaCaccia(Suit.CLUBS, 'Q'),
|
||||
PonyExpress(Suit.DIAMONDS, 'Q'),
|
||||
Pepperbox(Suit.HEARTS, 'A'),
|
||||
Howitzer(Suit.SPADES, 9),
|
||||
]
|
||||
|
@ -23,10 +23,11 @@ class Game:
|
||||
self.expansions = []
|
||||
|
||||
def notify_room(self):
|
||||
if len([p for p in self.players if p.character == None]) != 0:
|
||||
self.sio.emit('room', room=self.name, data={
|
||||
'name': self.name,
|
||||
'started': self.started,
|
||||
'players': [{'name':p.name, 'ready': False} for p in self.players],
|
||||
'players': [{'name':p.name, 'ready': p.character != None} for p in self.players],
|
||||
'password': self.password,
|
||||
'expansions': self.expansions,
|
||||
})
|
||||
|
@ -16,7 +16,6 @@ class PendingAction(IntEnum):
|
||||
WAIT = 4
|
||||
CHOOSE = 5
|
||||
|
||||
|
||||
class Player:
|
||||
|
||||
def __init__(self, name, sid, sio):
|
||||
@ -250,22 +249,28 @@ class Player:
|
||||
return s
|
||||
|
||||
def play_card(self, hand_index: int, against=None, _with=None):
|
||||
if not (0 <= hand_index < len(self.hand)):
|
||||
print('illegal')
|
||||
if not self.is_my_turn or self.pending_action != PendingAction.PLAY:
|
||||
return
|
||||
card: cs.Card = self.hand.pop(hand_index)
|
||||
if not (0 <= hand_index < len(self.hand) + len(self.equipment)):
|
||||
return
|
||||
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 != None:
|
||||
withCard = self.hand.pop(_with) if hand_index > _with else self.hand.pop(_with - 1)
|
||||
print(self.name, 'is playing ', card, ' against:', against, ' with:', _with)
|
||||
did_play_card = card.play_card(self, against, withCard)
|
||||
if not card.is_equipment:
|
||||
if not card.is_equipment and not card.usable_next_turn:
|
||||
if did_play_card:
|
||||
self.game.deck.scrap(card)
|
||||
else:
|
||||
self.hand.insert(hand_index, card)
|
||||
if withCard:
|
||||
self.hand.insert(_with, withCard)
|
||||
elif card.usable_next_turn and card.can_be_used_now:
|
||||
if did_play_card:
|
||||
self.game.deck.scrap(card)
|
||||
else:
|
||||
self.equipment.insert(hand_index-len(self.hand), card)
|
||||
self.notify_self()
|
||||
|
||||
def choose(self, card_index):
|
||||
@ -280,6 +285,8 @@ class Player:
|
||||
card = target.hand.pop(card_index)
|
||||
target.notify_self()
|
||||
if self.choose_action == 'steal':
|
||||
if card.usable_next_turn:
|
||||
card.can_be_used_now = False
|
||||
self.hand.append(card)
|
||||
else:
|
||||
self.game.deck.scrap(card)
|
||||
@ -289,9 +296,8 @@ class Player:
|
||||
self.choose_action = ''
|
||||
self.pending_action = PendingAction.PLAY
|
||||
else:
|
||||
while len(self.game.players[self.game.players_map[self.target_p]+1].hand) + len(self.game.players[self.game.players_map[self.target_p]+1].equipment) == 0:
|
||||
self.target_p = self.game.players[self.game.players_map[self.target_p]+1].name
|
||||
if self.target_p == self.name:
|
||||
while self.target_p == self.name or len(self.game.players[self.game.players_map[self.target_p]].hand) + len(self.game.players[self.game.players_map[self.target_p]].equipment) == 0:
|
||||
self.target_p = self.game.players[self.game.players_map[self.target_p]+1].name
|
||||
self.notify_self()
|
||||
# specifico per personaggio
|
||||
@ -321,19 +327,25 @@ class Player:
|
||||
if self.mancato_needed <= 0:
|
||||
self.game.responders_did_respond_resume_turn()
|
||||
return
|
||||
if len([c for c in self.hand if isinstance(c, cs.Mancato) or (isinstance(self.character, chars.CalamityJanet) and isinstance(c, cs.Bang))]) == 0:
|
||||
if len([c for c in self.hand if isinstance(c, cs.Mancato) or (isinstance(self.character, chars.CalamityJanet) and isinstance(c, cs.Bang))]) == 0\
|
||||
and len([c for c in self.equipment if c.can_be_used_now and isinstance(c, cs.Mancato)]) == 0:
|
||||
self.take_damage_response()
|
||||
self.game.responders_did_respond_resume_turn()
|
||||
else:
|
||||
self.pending_action = PendingAction.RESPOND
|
||||
self.expected_response = [cs.Mancato(0, 0).name, csd.Schivata(0,0).name]
|
||||
self.expected_response = self.game.deck.mancato_cards
|
||||
self.on_failed_response_cb = self.take_damage_response
|
||||
self.notify_self()
|
||||
|
||||
def get_banged(self, attacker, double=False):
|
||||
self.attacker = attacker
|
||||
self.mancato_needed = 1 if not double else 2
|
||||
if len([c for c in self.hand if isinstance(c, cs.Mancato) or (isinstance(self.character, chars.CalamityJanet) and isinstance(c, cs.Bang))]) == 0 and len([c for c in self.equipment if isinstance(c, cs.Barile)]) == 0 and not isinstance(self.character, chars.Jourdonnais):
|
||||
for i in range(len(self.equipment)):
|
||||
if self.equipment[i].can_be_used_now:
|
||||
print('usable', self.equipment[i])
|
||||
if len([c for c in self.equipment if isinstance(c, cs.Barile)]) == 0 and not isinstance(self.character, chars.Jourdonnais)\
|
||||
and len([c for c in self.hand if isinstance(c, cs.Mancato) or (isinstance(self.character, chars.CalamityJanet) and isinstance(c, cs.Bang))]) == 0\
|
||||
and len([c for c in self.equipment if c.can_be_used_now and isinstance(c, cs.Mancato)]) == 0:
|
||||
print('Cant defend')
|
||||
self.take_damage_response()
|
||||
return False
|
||||
@ -345,7 +357,7 @@ class Player:
|
||||
else:
|
||||
print('has mancato')
|
||||
self.pending_action = PendingAction.RESPOND
|
||||
self.expected_response = [cs.Mancato(0, 0).name, csd.Schivata(0,0).name]
|
||||
self.expected_response = self.game.deck.mancato_cards
|
||||
self.on_failed_response_cb = self.take_damage_response
|
||||
self.notify_self()
|
||||
return True
|
||||
@ -402,13 +414,16 @@ class Player:
|
||||
data=f'{self.name} ha usato una birra per recuperare una vita.')
|
||||
break
|
||||
self.mancato_needed = 0
|
||||
self.event_type = ''
|
||||
self.notify_self()
|
||||
self.attacker = None
|
||||
|
||||
def respond(self, hand_index):
|
||||
self.pending_action = PendingAction.WAIT
|
||||
if hand_index != -1 and self.hand[hand_index].name in self.expected_response:
|
||||
card = self.hand.pop(hand_index)
|
||||
if hand_index != -1 and (
|
||||
((hand_index < len(self.hand) and self.hand[hand_index].name in self.expected_response)) or
|
||||
self.equipment[hand_index-len(self.hand)].name in self.expected_response):
|
||||
card = self.hand.pop(hand_index) if hand_index < len(self.hand) else self.equipment.pop(hand_index-len(self.hand))
|
||||
card.use_card(self)
|
||||
self.game.deck.scrap(card)
|
||||
self.notify_self()
|
||||
@ -465,6 +480,9 @@ class Player:
|
||||
f"I {self.name} have to many cards in my hand and I can't end the turn")
|
||||
else:
|
||||
self.is_my_turn = False
|
||||
for i in range(len(self.equipment)):
|
||||
if self.equipment[i].usable_next_turn and not self.equipment[i].can_be_used_now:
|
||||
self.equipment[i].can_be_used_now = True
|
||||
self.pending_action = PendingAction.WAIT
|
||||
self.notify_self()
|
||||
self.game.next_turn()
|
||||
|
@ -16,7 +16,7 @@
|
||||
<div v-else>
|
||||
<div v-if="!isInLobby" >
|
||||
<p>{{$t("online_players")}}{{onlinePlayers}}</p>
|
||||
<Card :card="getSelfCard" style="position:absolute; bottom:10pt; right: 10pt;"/>
|
||||
<Card :card="getSelfCard" style="position:absolute; bottom:10pt; left: 10pt;"/>
|
||||
<h2>{{$t("available_lobbies")}}</h2>
|
||||
<div style="display: flex">
|
||||
<Card v-for="lobby in openLobbies" v-bind:key="lobby.name" :card="getLobbyCard(lobby)" @click.native="joinLobby(lobby)"/>
|
||||
@ -38,10 +38,10 @@
|
||||
</div>
|
||||
<select style="position:absolute;bottom:4pt;right:4pt;" v-model="$i18n.locale">
|
||||
<option
|
||||
v-for="(lang, i) in ['it.🇮🇹', 'en.🇬🇧']"
|
||||
v-for="(lang, i) in ['it.🇮🇹.Italiano', 'en.🇬🇧.English']"
|
||||
:key="`lang-${i}`"
|
||||
:value="lang.split('.')[0]">
|
||||
{{lang.split('.')[1]}} {{lang.split('.')[0]}}
|
||||
{{lang.split('.')[1]}} {{lang.split('.')[2]}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div :class="{ card: true, equipment: card.is_equipment, character:card.is_character, back:card.is_back}">
|
||||
<div :class="{ card: true, equipment: card.is_equipment, character:card.is_character, back:card.is_back, 'usable-next-turn':card.usable_next_turn}">
|
||||
<h4>{{card.name}}</h4>
|
||||
<div class="emoji">{{card.icon}}</div>
|
||||
<div class="alt_text">{{card.alt_text}}</div>
|
||||
@ -68,6 +68,10 @@ export default {
|
||||
0 0 0 6pt white,
|
||||
0 0 5pt 6pt #aaa;
|
||||
}
|
||||
.card.usable-next-turn {
|
||||
box-shadow:
|
||||
0 0 0 3pt rgb(192,192,117), 0 0 0 6pt white, 0 0 5pt 6pt #aaa
|
||||
}
|
||||
.card h4 {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
@ -127,5 +131,9 @@ export default {
|
||||
0 0 0 6pt #181a1b,
|
||||
0 0 5pt 6pt #aaa;
|
||||
}
|
||||
.card.usable-next-turn {
|
||||
box-shadow:
|
||||
0 0 0 3pt rgb(192,192,117), 0 0 0 6pt #181a1b, 0 0 5pt 6pt #aaa
|
||||
}
|
||||
}
|
||||
</style>
|
@ -132,7 +132,7 @@ export default {
|
||||
let rotateAngle = (i) * offsetAngle
|
||||
let size = 130
|
||||
return {
|
||||
card:this.getPlayerCard(x),
|
||||
card: this.getPlayerCard(x),
|
||||
style: `position:absolute;transform: rotate(${rotateAngle}deg) translate(0, -${size}pt) rotate(-${rotateAngle}deg) translate(${size}pt,${size}pt)`,
|
||||
...x
|
||||
}
|
||||
@ -155,10 +155,13 @@ export default {
|
||||
}
|
||||
},
|
||||
getPlayerCard(player) {
|
||||
let icon = ''
|
||||
if (!this.started) icon = '🤠'
|
||||
else icon = player.ready !== undefined ? ((player.ready)?'👍': '🤔') : (player.is_sheriff ? '⭐' : player.icon)
|
||||
return {
|
||||
name: player.name,
|
||||
number: ((this.username == player.name) ? this.$t('you') : (this.players[0].name == player.name) ? this.$t('owner') :'') + (player.dist ? `${player.dist}⛰` : ''),
|
||||
icon: (player.lives === undefined || player.lives > 0) ? (player.is_sheriff ? '⭐' : player.icon || ((player.ready)?'👍': '🤠') ) : '☠️',
|
||||
icon: icon,
|
||||
is_character: true,
|
||||
}
|
||||
},
|
||||
|
@ -12,7 +12,9 @@
|
||||
<span v-for="(n, i) in (max_lives-lives)" v-bind:key="n" :alt="i">💀</span>
|
||||
</transition-group>
|
||||
<transition-group v-if="lives > 0" name="list" tag="div" style="margin: 0 0 0 10pt; display:flex;">
|
||||
<Card v-for="card in equipment" v-bind:key="card.name+card.number" :card="card" @pointerenter.native="desc=card.desc" @pointerleave.native="desc=''" />
|
||||
<Card v-for="card in equipment" v-bind:key="card.name+card.number" :card="card"
|
||||
@pointerenter.native="desc=card.desc" @pointerleave.native="desc=''"
|
||||
@click.native="play_card(card, true)" />
|
||||
</transition-group>
|
||||
</div>
|
||||
<transition name="list">
|
||||
@ -22,7 +24,7 @@
|
||||
<span>{{$t('hand')}}</span>
|
||||
<transition-group name="list" tag="div" class="hand">
|
||||
<Card v-for="card in hand" v-bind:key="card.name+card.number" :card="card"
|
||||
@click.native="play_card(card)"
|
||||
@click.native="play_card(card, false)"
|
||||
@pointerenter.native="hint=card.desc" @pointerleave.native="hint=''"/>
|
||||
</transition-group>
|
||||
</div>
|
||||
@ -192,7 +194,10 @@ export default {
|
||||
icon: '❌',
|
||||
is_equipment: true,
|
||||
}]
|
||||
this.hand.filter(x => this.expected_response.indexOf(x.name) !== -1).forEach(x=>{
|
||||
this.hand.filter(x => x.can_be_used_now && this.expected_response.indexOf(x.name) !== -1).forEach(x=>{
|
||||
cc.push(x)
|
||||
})
|
||||
this.equipment.filter(x => x.can_be_used_now && this.expected_response.indexOf(x.name) !== -1).forEach(x=>{
|
||||
cc.push(x)
|
||||
})
|
||||
return cc
|
||||
@ -220,14 +225,16 @@ export default {
|
||||
scrap(c) {
|
||||
this.$socket.emit('scrap', this.hand.indexOf(c))
|
||||
},
|
||||
play_card(card) {
|
||||
play_card(card, from_equipment) {
|
||||
if (from_equipment && (!card.usable_next_turn || !card.can_be_used_now)) 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 && this.equipment.filter(x => x.name == 'Volcanic').length == 0)
|
||||
if (this.pending_action == 2) {
|
||||
if (card.need_with && !this.card_with) {
|
||||
this.card_with = card
|
||||
} else if ((card.need_target || calamity_special) && !((card.name == 'Bang!' || (calamity_special && card.name=='Mancato!')) && cant_play_bang)) {
|
||||
if (card.name == 'Bang!' || calamity_special)
|
||||
if (card.name == 'Bang!' || card.name == "Pepperbox" || calamity_special)
|
||||
this.range = this.sight
|
||||
else
|
||||
this.range = card.range
|
||||
@ -242,7 +249,12 @@ export default {
|
||||
}
|
||||
},
|
||||
respond(card) {
|
||||
this.$socket.emit('respond', this.hand.indexOf(card))
|
||||
let res = this.hand.indexOf(card)
|
||||
if (res === -1) {
|
||||
res = this.equipment.indexOf(card)
|
||||
if (res !== -1) res += this.hand.length
|
||||
}
|
||||
this.$socket.emit('respond', res)
|
||||
},
|
||||
selectAgainst(player) {
|
||||
this.really_play_card(this.card_against, player.name)
|
||||
@ -268,8 +280,13 @@ export default {
|
||||
this.card_with = null
|
||||
},
|
||||
really_play_card(card, against) {
|
||||
let res = this.hand.indexOf(card)
|
||||
if (res === -1) {
|
||||
res = this.equipment.indexOf(card)
|
||||
if (res !== -1) res += this.hand.length
|
||||
}
|
||||
let card_data = {
|
||||
index: this.hand.indexOf(card),
|
||||
index: res,
|
||||
against: against,
|
||||
with: this.hand.indexOf(this.card_with) > -1 ? this.hand.indexOf(this.card_with):null,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user