città fantasma should work
This commit is contained in:
parent
579501e01c
commit
49987b2c5a
@ -272,6 +272,7 @@ class Game:
|
|||||||
if self.players[self.turn].lives <= 0 or self.players[self.turn].is_dead:
|
if self.players[self.turn].lives <= 0 or self.players[self.turn].is_dead:
|
||||||
pl = sorted(self.get_dead_players(), key=lambda x:x.death_turn)[0]
|
pl = sorted(self.get_dead_players(), key=lambda x:x.death_turn)[0]
|
||||||
if self.check_event(ce.DeadMan) and not self.did_resuscitate_deadman and pl != self.players[self.turn]:
|
if self.check_event(ce.DeadMan) and not self.did_resuscitate_deadman and pl != self.players[self.turn]:
|
||||||
|
print(f'{self.players[self.turn]} is dead, revive')
|
||||||
self.did_resuscitate_deadman = True
|
self.did_resuscitate_deadman = True
|
||||||
pl.is_dead = False
|
pl.is_dead = False
|
||||||
pl.is_ghost = False
|
pl.is_ghost = False
|
||||||
@ -280,13 +281,16 @@ class Game:
|
|||||||
pl.hand.append(self.deck.draw())
|
pl.hand.append(self.deck.draw())
|
||||||
pl.notify_self()
|
pl.notify_self()
|
||||||
elif self.check_event(ceh.CittaFantasma):
|
elif self.check_event(ceh.CittaFantasma):
|
||||||
pl.is_ghost = True
|
print(f'{self.players[self.turn]} is dead, event ghost')
|
||||||
pl.notify_self()
|
self.players[self.turn].is_ghost = True
|
||||||
else:
|
else:
|
||||||
|
print(f'{self.players[self.turn]} is dead, next turn')
|
||||||
return self.next_turn()
|
return self.next_turn()
|
||||||
self.player_bangs = 0
|
self.player_bangs = 0
|
||||||
if isinstance(self.players[self.turn].role, roles.Sheriff):
|
if isinstance(self.players[self.turn].role, roles.Sheriff):
|
||||||
self.deck.flip_event()
|
self.deck.flip_event()
|
||||||
|
if len(self.deck.event_cards) > 0:
|
||||||
|
print(f'flip new event {self.deck.event_cards[0].name}')
|
||||||
if self.check_event(ce.DeadMan):
|
if self.check_event(ce.DeadMan):
|
||||||
self.did_resuscitate_deadman = False
|
self.did_resuscitate_deadman = False
|
||||||
elif self.check_event(ce.RouletteRussa):
|
elif self.check_event(ce.RouletteRussa):
|
||||||
@ -323,17 +327,12 @@ class Game:
|
|||||||
else:
|
else:
|
||||||
self.responders_did_respond_resume_turn()
|
self.responders_did_respond_resume_turn()
|
||||||
else:
|
else:
|
||||||
|
print(f'notifying {self.players[self.turn].name} about his turn')
|
||||||
self.players[self.turn].play_turn()
|
self.players[self.turn].play_turn()
|
||||||
|
|
||||||
def next_turn(self):
|
def next_turn(self):
|
||||||
if self.shutting_down: return
|
if self.shutting_down: return
|
||||||
if self.players[self.turn].is_dead and self.players[self.turn].is_ghost and self.check_event(ceh.CittaFantasma):
|
print(f'{self.players[self.turn].name} invoked next turn')
|
||||||
self.players[self.turn].is_ghost = False
|
|
||||||
for i in range(len(self.players[self.turn].attacker.hand)):
|
|
||||||
self.deck.scrap(self.players[self.turn].attacker.hand.pop(), True)
|
|
||||||
for i in range(len(self.players[self.turn].attacker.equipment)):
|
|
||||||
self.deck.scrap(self.players[self.turn].attacker.equipment.pop(), True)
|
|
||||||
self.players[self.turn].notify_self()
|
|
||||||
pls = self.get_alive_players()
|
pls = self.get_alive_players()
|
||||||
if len(pls) > 0:
|
if len(pls) > 0:
|
||||||
if self.check_event(ceh.CorsaAllOro):
|
if self.check_event(ceh.CorsaAllOro):
|
||||||
|
@ -164,6 +164,7 @@ class Player:
|
|||||||
self.sio.emit('notify_card', room=self.sid, data=mess)
|
self.sio.emit('notify_card', room=self.sid, data=mess)
|
||||||
|
|
||||||
def notify_self(self):
|
def notify_self(self):
|
||||||
|
if self.is_ghost: self.lives = 0
|
||||||
if self.pending_action == PendingAction.DRAW and self.game.check_event(ce.Peyote):
|
if self.pending_action == PendingAction.DRAW and self.game.check_event(ce.Peyote):
|
||||||
self.available_cards = [{
|
self.available_cards = [{
|
||||||
'icon': '🔴'
|
'icon': '🔴'
|
||||||
@ -181,9 +182,9 @@ class Player:
|
|||||||
self.is_playing_ranch = True
|
self.is_playing_ranch = True
|
||||||
self.choose_text = 'choose_ranch'
|
self.choose_text = 'choose_ranch'
|
||||||
self.pending_action = PendingAction.CHOOSE
|
self.pending_action = PendingAction.CHOOSE
|
||||||
elif self.character and self.character.check(self.game, chars.SuzyLafayette) and len(self.hand) == 0 and ( not self.is_my_turn or self.pending_action == PendingAction.PLAY):
|
elif self.character and self.character.check(self.game, chars.SuzyLafayette) and self.lives > 0 and len(self.hand) == 0 and ( not self.is_my_turn or self.pending_action == PendingAction.PLAY):
|
||||||
self.hand.append(self.game.deck.draw(True))
|
self.hand.append(self.game.deck.draw(True))
|
||||||
if self.lives <= 0 and self.max_lives > 0 and not self.is_ghost:
|
if self.lives <= 0 and self.max_lives > 0 and not self.is_dead:
|
||||||
print('dying, attacker', self.attacker)
|
print('dying, attacker', self.attacker)
|
||||||
if self.character.check(self.game, chars.SidKetchum) and len(self.hand) > 1:
|
if self.character.check(self.game, chars.SidKetchum) and len(self.hand) > 1:
|
||||||
self.lives += 1
|
self.lives += 1
|
||||||
@ -205,7 +206,7 @@ class Player:
|
|||||||
ser['sight'] = self.get_sight()
|
ser['sight'] = self.get_sight()
|
||||||
ser['lives'] = max(ser['lives'], 0)
|
ser['lives'] = max(ser['lives'], 0)
|
||||||
|
|
||||||
if self.lives <= 0 and self.max_lives > 0 and not self.is_ghost:
|
if self.lives <= 0 and self.max_lives > 0 and not self.is_dead:
|
||||||
self.pending_action = PendingAction.WAIT
|
self.pending_action = PendingAction.WAIT
|
||||||
ser['hand'] = []
|
ser['hand'] = []
|
||||||
ser['equipment'] = []
|
ser['equipment'] = []
|
||||||
@ -959,6 +960,7 @@ class Player:
|
|||||||
self.notify_self()
|
self.notify_self()
|
||||||
|
|
||||||
def end_turn(self, forced=False):
|
def end_turn(self, forced=False):
|
||||||
|
print(f"{self.name} wants to end his turn")
|
||||||
if not self.is_my_turn:
|
if not self.is_my_turn:
|
||||||
return
|
return
|
||||||
maxcards = self.lives if not self.character.check(self.game, chd.SeanMallory) else 10
|
maxcards = self.lives if not self.character.check(self.game, chd.SeanMallory) else 10
|
||||||
@ -976,6 +978,12 @@ class Player:
|
|||||||
for i in range(len(self.equipment)):
|
for i in range(len(self.equipment)):
|
||||||
if self.equipment[i].usable_next_turn and not self.equipment[i].can_be_used_now:
|
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.equipment[i].can_be_used_now = True
|
||||||
|
if self.is_dead and self.is_ghost and self.game.check_event(ceh.CittaFantasma):
|
||||||
|
self.is_ghost = False
|
||||||
|
for i in range(len(self.hand)):
|
||||||
|
self.deck.scrap(self.hand.pop(), True)
|
||||||
|
for i in range(len(self.equipment)):
|
||||||
|
self.deck.scrap(self.equipment.pop(), True)
|
||||||
self.pending_action = PendingAction.WAIT
|
self.pending_action = PendingAction.WAIT
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
self.game.next_turn()
|
self.game.next_turn()
|
||||||
|
Loading…
Reference in New Issue
Block a user