fix zaino save

This commit is contained in:
Alberto Xamin 2021-07-10 10:40:42 +02:00
parent 285cd28660
commit cc4975851d
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
2 changed files with 8 additions and 7 deletions

View File

@ -28,7 +28,7 @@ class Game:
self.waiting_for = 0 self.waiting_for = 0
self.initial_players = 0 self.initial_players = 0
self.password = '' self.password = ''
self.expansions = [] self.expansions: List[str] = []
self.available_expansions = ['dodge_city', 'fistful_of_cards', 'high_noon', 'gold_rush'] self.available_expansions = ['dodge_city', 'fistful_of_cards', 'high_noon', 'gold_rush']
self.shutting_down = False self.shutting_down = False
self.is_competitive = False self.is_competitive = False
@ -40,7 +40,7 @@ class Game:
self.incremental_turn = 0 self.incremental_turn = 0
self.did_resuscitate_deadman = False self.did_resuscitate_deadman = False
self.is_handling_death = False self.is_handling_death = False
self.pending_winners = [] self.pending_winners: List[pl.Player] = []
self.someone_won = False self.someone_won = False
self.attack_in_progress = False self.attack_in_progress = False
self.characters_to_distribute = 2 # personaggi da dare a inizio partita self.characters_to_distribute = 2 # personaggi da dare a inizio partita

View File

@ -13,6 +13,7 @@ import bang.expansions.high_noon.card_events as ceh
import bang.expansions.gold_rush.shop_cards as grc import bang.expansions.gold_rush.shop_cards as grc
import bang.expansions.gold_rush.characters as grch import bang.expansions.gold_rush.characters as grch
import eventlet import eventlet
from typing import List
class PendingAction(IntEnum): class PendingAction(IntEnum):
PICK = 0 PICK = 0
@ -35,8 +36,8 @@ class Player:
self.reset() self.reset()
def reset(self): def reset(self):
self.hand: cs.Card = [] self.hand: List[cs.Card] = []
self.equipment: cs.Card = [] self.equipment: List[cs.Card] = []
self.role: r.Role = None self.role: r.Role = None
self.character: chars.Character = None self.character: chars.Character = None
self.real_character: chars.Character = None self.real_character: chars.Character = None
@ -49,7 +50,7 @@ class Player:
self.can_play_ranch = True self.can_play_ranch = True
self.is_playing_ranch = False self.is_playing_ranch = False
self.pending_action: PendingAction = None self.pending_action: PendingAction = None
self.available_characters = [] self.available_characters: List[chars.Character] = []
self.was_shot = False self.was_shot = False
self.on_pick_cb = None self.on_pick_cb = None
self.on_failed_response_cb = None self.on_failed_response_cb = None
@ -78,7 +79,7 @@ class Player:
self.using_rimbalzo = 0 # 0 no, 1 scegli giocatore, 2 scegli carta self.using_rimbalzo = 0 # 0 no, 1 scegli giocatore, 2 scegli carta
self.bang_used = 0 self.bang_used = 0
self.gold_nuggets = 0 self.gold_nuggets = 0
self.gold_rush_equipment = [] self.gold_rush_equipment: List[grc.ShopCard] = []
self.was_player = False self.was_player = False
def join_game(self, game): def join_game(self, game):
@ -178,7 +179,7 @@ class Player:
if self.gold_nuggets >= 2 and len([c for c in self.gold_rush_equipment if isinstance(c, grc.Zaino)]) > 0: if self.gold_nuggets >= 2 and len([c for c in self.gold_rush_equipment if isinstance(c, grc.Zaino)]) > 0:
for i in range(len(self.gold_rush_equipment)): for i in range(len(self.gold_rush_equipment)):
if isinstance(self.gold_rush_equipment[i], grc.Zaino): if isinstance(self.gold_rush_equipment[i], grc.Zaino):
self.play_card(len(self.hand) + len(self.equipment) + i) self.gold_rush_equipment[i].play_card(self, None)
return # play card will notify the player return # play card will notify the player
if self.character.check(self.game, chars.SidKetchum) and len(self.hand) > 1 and self.lives == 0: if self.character.check(self.game, chars.SidKetchum) and len(self.hand) > 1 and self.lives == 0:
if self.game.players[self.game.turn] != self: if self.game.players[self.game.turn] != self: