fratelli di sangue

This commit is contained in:
Alberto Xamin 2020-12-20 14:51:23 +01:00
parent 622d8d7330
commit 2e73b96499
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
4 changed files with 27 additions and 5 deletions

View File

@ -24,7 +24,7 @@ class DeadMan(CardEvent):
self.desc_eng = "The first player that died return back to life with 2 hp and 2 cards"
class FratelliDiSangue(CardEvent):
def __init__(self):#TODO
def __init__(self):
super().__init__("Fratelli Di Sangue", "💉")
self.desc = "All'inizio del proprio turno i giocatori possono perdere 1 vita per darla a un altro giocatore"
self.desc_eng = "At the begin of their turn, payers can lose 1 hp to give it to another player"
@ -100,7 +100,7 @@ def get_all_events():
Agguato(),
# Cecchino(),
DeadMan(),
# FratelliDiSangue(),
FratelliDiSangue(),
IlGiudice(),
Lazo(),
LeggeDelWest(),

View File

@ -48,6 +48,7 @@ class Player:
self.attacker: Player = None
self.target_p: str = None
self.is_drawing = False
self.is_giving_life = False
self.mancato_needed = 0
self.molly_discarded_cards = 0
self.is_bot = bot
@ -304,9 +305,19 @@ class Player:
self.is_waiting_for_action = True
self.has_played_bang = False
self.special_use_count = 0
if not self.game.check_event(ce.Lazo) and any([isinstance(c, cs.Dinamite) or isinstance(c, cs.Prigione) for c in self.equipment]):
if self.game.check_event(ce.FratelliDiSangue) and self.lives > 1 and not self.is_giving_life and len([p for p in self.game.players if p != self and p.lives < p.max_lives]):
self.available_cards = [{
'name': p.name,
'icon': isinstance(p.role, r.Sheriff),
} for p in self.game.players if p != self and p.lives < p.max_lives]
self.available_cards.append({'icon': ''})
self.pending_action = PendingAction.CHOOSE
self.is_giving_life = True
elif not self.game.check_event(ce.Lazo) and any([isinstance(c, cs.Dinamite) or isinstance(c, cs.Prigione) for c in self.equipment]):
self.is_giving_life = False
self.pending_action = PendingAction.PICK
else:
self.is_giving_life = False
if isinstance(self.real_character, chd.VeraCuster):
self.set_available_character([p.character for p in self.game.players if p != self])
else:
@ -494,6 +505,15 @@ class Player:
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()
elif self.is_giving_life and self.game.check_event(ce.FratelliDiSangue):
try:
player = self.game.get_player_named(self.available_cards[card_index]['name'])
player.lives += 1
self.lives -= 1
player.notify_self()
self.sio.emit('chat_message', room=self.game.name, data=f'_fratelli_sangue|{self.name}|{player.name}')
except: pass
self.play_turn()
elif self.is_drawing and self.game.check_event(ce.Peyote):
self.is_drawing = False
card = self.game.deck.draw()

View File

@ -83,7 +83,8 @@
"allroles": "In the game there are: {0}.",
"guess": "{0} guesses {1}.",
"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}."
},
"foc": {
"leggedelwest": "He must play this card on this turn if possible."

View File

@ -83,7 +83,8 @@
"allroles": "Nella partita ci sono: {0}.",
"guess": "{0} pensa sia {1}.",
"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}."
},
"foc": {
"leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"