il dottore

This commit is contained in:
Alberto Xamin 2020-12-23 15:14:21 +01:00
parent 8f18bee200
commit 60b5c7699e
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
4 changed files with 23 additions and 4 deletions

View File

@ -37,6 +37,12 @@ class IlReverendo(CardEvent):
self.desc = "Non si possono giocare birre" self.desc = "Non si possono giocare birre"
self.desc_eng = "" self.desc_eng = ""
class IlDottore(CardEvent):
def __init__(self):
super().__init__("Il Dottore", "👨‍⚕️")
self.desc = "Il giocatore con meno vite recupera 1 vita"
self.desc_eng = ""
class MezzogiornoDiFuoco(CardEvent): class MezzogiornoDiFuoco(CardEvent):
def __init__(self): def __init__(self):
super().__init__("Mezzogiorno di Fuoco", "🔥") super().__init__("Mezzogiorno di Fuoco", "🔥")
@ -50,7 +56,7 @@ def get_all_events():
# CittaFantasma(), # CittaFantasma(),
# CorsaAllOro(), # CorsaAllOro(),
# IDalton(), # IDalton(),
# IlDottore(), IlDottore(),
IlReverendo(), IlReverendo(),
IlTreno(), IlTreno(),
Sbornia(), Sbornia(),

View File

@ -2,12 +2,14 @@
from typing import List, Set, Dict, Tuple, Optional from typing import List, Set, Dict, Tuple, Optional
import random import random
import socketio import socketio
import eventlet
import bang.players as pl import bang.players as pl
import bang.characters as characters import bang.characters as characters
from bang.deck import Deck from bang.deck import Deck
import bang.roles as roles import bang.roles as roles
import bang.expansions.fistful_of_cards.card_events as ce import bang.expansions.fistful_of_cards.card_events as ce
import eventlet import bang.expansions.high_noon.card_events as ceh
class Game: class Game:
def __init__(self, name, sio:socketio): def __init__(self, name, sio:socketio):
@ -277,6 +279,15 @@ class Game:
else: else:
self.responders_did_respond_resume_turn(did_lose=True) self.responders_did_respond_resume_turn(did_lose=True)
return return
elif self.check_event(ceh.IlDottore):
most_hurt = [p.lives for p in self.players if p.lives > 0 and p.max_lives > p.lives]
if len(most_hurt) > 0:
hurt_players = [p for p in self.players if p.lives == min(most_hurt)]
for p in hurt_players:
p.lives += 1
self.sio.emit('chat_message', room=self.name, data=f'_doctor_heal|{p.name}')
p.notify_self()
if self.check_event(ce.PerUnPugnoDiCarte) and len(self.players[self.turn].hand) > 0: if self.check_event(ce.PerUnPugnoDiCarte) and len(self.players[self.turn].hand) > 0:
self.player_bangs = len(self.players[self.turn].hand) self.player_bangs = len(self.players[self.turn].hand)
if self.players[self.turn].get_banged(self.deck.event_cards[0]): if self.players[self.turn].get_banged(self.deck.event_cards[0]):

View File

@ -90,7 +90,8 @@
"guess": "{0} guesses {1}.", "guess": "{0} guesses {1}.",
"guess_right": "{0} was right.", "guess_right": "{0} was right.",
"guess_wrong": "{0} was wrong.", "guess_wrong": "{0} was wrong.",
"fratelli_sangue": "{0} gave one of his lives to {1}." "fratelli_sangue": "{0} gave one of his lives to {1}.",
"doctor_heal": "{0} was healed by the doctor."
}, },
"foc": { "foc": {
"leggedelwest": "He must play this card on this turn if possible." "leggedelwest": "He must play this card on this turn if possible."

View File

@ -90,7 +90,8 @@
"guess": "{0} pensa sia {1}.", "guess": "{0} pensa sia {1}.",
"guess_right": "{0} ha indovinato.", "guess_right": "{0} ha indovinato.",
"guess_wrong": "{0} ha sbagliato.", "guess_wrong": "{0} ha sbagliato.",
"fratelli_sangue": "{0} ha donato una delle sue vite a {1}." "fratelli_sangue": "{0} ha donato una delle sue vite a {1}.",
"doctor_heal": "{0} è stato curato dal dottore."
}, },
"foc": { "foc": {
"leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile" "leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"