fix disconnect bug and treno for more cases

This commit is contained in:
Alberto Xamin 2020-12-27 21:52:03 +01:00
parent b3daa8d958
commit ee953c660d
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
3 changed files with 8 additions and 5 deletions

View File

@ -415,9 +415,6 @@ class Game:
if not self.started: if not self.started:
self.players.remove(player) self.players.remove(player)
elif disconnected: elif disconnected:
index = self.players.index(player)
if self.started and index <= self.turn:
self.turn -= 1
self.players.remove(player) self.players.remove(player)
self.players_map = {c.name: i for i, c in enumerate(self.players)} self.players_map = {c.name: i for i, c in enumerate(self.players)}
player.lives = 0 player.lives = 0

View File

@ -406,6 +406,8 @@ class Player:
self.hand.append(self.game.deck.draw_from_scrap_pile()) self.hand.append(self.game.deck.draw_from_scrap_pile())
if not self.game.check_event(ceh.Sete): if not self.game.check_event(ceh.Sete):
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
if self.game.check_event(ceh.IlTreno) or (self.is_ghost and self.game.ceck_event(ceh.CittaFantasma)):
self.hand.append(self.game.deck.draw())
self.sio.emit('chat_message', room=self.game.name, self.sio.emit('chat_message', room=self.game.name,
data=f'_draw_from_scrap|{self.name}') data=f'_draw_from_scrap|{self.name}')
elif type(pile) == str and pile != self.name and pile in self.game.players_map and self.character.check(self.game, chars.JesseJones) and len(self.game.get_player_named(pile).hand) > 0: elif type(pile) == str and pile != self.name and pile in self.game.players_map and self.character.check(self.game, chars.JesseJones) and len(self.game.get_player_named(pile).hand) > 0:
@ -416,11 +418,15 @@ class Player:
data=f'_draw_from_player|{self.name}|{pile}') data=f'_draw_from_player|{self.name}|{pile}')
if not self.game.check_event(ceh.Sete): if not self.game.check_event(ceh.Sete):
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
if self.game.check_event(ceh.IlTreno) or (self.is_ghost and self.game.ceck_event(ceh.CittaFantasma)):
self.hand.append(self.game.deck.draw())
elif self.character.check(self.game, chd.BillNoface): elif self.character.check(self.game, chd.BillNoface):
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
if not self.game.check_event(ceh.Sete): if not self.game.check_event(ceh.Sete):
for i in range(self.max_lives-self.lives): for i in range(self.max_lives-self.lives):
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
if self.game.check_event(ceh.IlTreno):
self.hand.append(self.game.deck.draw())
else: else:
for i in range(2): for i in range(2):
card: cs.Card = self.game.deck.draw() card: cs.Card = self.game.deck.draw()
@ -435,7 +441,7 @@ class Player:
return self.notify_self() return self.notify_self()
if self.character.check(self.game, chd.PixiePete): if self.character.check(self.game, chd.PixiePete):
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
if self.game.check_event(ceh.IlTreno): if self.game.check_event(ceh.IlTreno) or (self.is_ghost and self.game.ceck_event(ceh.CittaFantasma)):
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
self.notify_self() self.notify_self()

View File

@ -14,7 +14,7 @@
<transition-group v-if="lives > 0 || is_ghost" name="list" tag="div" style="margin: 0 0 0 10pt; display:flex;"> <transition-group v-if="lives > 0 || is_ghost" 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" <Card v-for="card in equipment" v-bind:key="card.name+card.number" :card="card"
@pointerenter.native="desc=($i18n.locale=='it'?card.desc:card.desc_eng)" @pointerleave.native="desc=''" @pointerenter.native="desc=($i18n.locale=='it'?card.desc:card.desc_eng)" @pointerleave.native="desc=''"
@click.native="play_card(card, true)" :class="{'cant-play':(eventCard && eventCard.name == 'Lazo')}"/> @click.native="play_card(card, true)" :class="{'cant-play':((eventCard && eventCard.name == 'Lazo') || !card.can_be_used_now)}"/>
</transition-group> </transition-group>
</div> </div>
<transition name="list"> <transition name="list">