add manette card event
Co-authored-by: Alberto Xamin <alberto@xamin.it>
This commit is contained in:
parent
3bb7db8e33
commit
b779cb21d0
@ -71,13 +71,13 @@ class Manette(CardEvent):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("Manette", "🔗")
|
super().__init__("Manette", "🔗")
|
||||||
#self.desc = "Dopo aver pescato in fase 1, il giocatore di turno dichiara un seme: potrà usare solamente carte di quel seme nel suo turno"
|
#self.desc = "Dopo aver pescato in fase 1, il giocatore di turno dichiara un seme: potrà usare solamente carte di quel seme nel suo turno"
|
||||||
#self.desc_eng = ""
|
#self.desc_eng = "After drawing in phase 1, the player declares a suit. He will be able to use only cards of that suit for that turn"
|
||||||
|
|
||||||
class NuovaIdentita(CardEvent):
|
class NuovaIdentita(CardEvent):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("Nuova Identita", "🕶")
|
super().__init__("Nuova Identita", "🕶")
|
||||||
#self.desc = "All'inizio del proprio turno, ogni giocatore potrà decidere se sostituire il suo personaggio attuale con quello era stato proposto ad inizio partita, se lo fa riparte con 2 punti vita"
|
#self.desc = "All'inizio del proprio turno, ogni giocatore potrà decidere se sostituire il suo personaggio attuale con quello era stato proposto ad inizio partita, se lo fa riparte con 2 punti vita"
|
||||||
#self.desc_eng = ""
|
#self.desc_eng = "At the beginning of their turn, each player can choose to change its character with the other shown at the game start. If he does so he restarts from 2 HP."
|
||||||
|
|
||||||
class CittaFantasma(CardEvent):
|
class CittaFantasma(CardEvent):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -110,7 +110,7 @@ def get_all_events():
|
|||||||
Sermone(),
|
Sermone(),
|
||||||
Sete(),
|
Sete(),
|
||||||
Sparatoria(),
|
Sparatoria(),
|
||||||
# Manette(),
|
Manette(),
|
||||||
NuovaIdentita(),
|
NuovaIdentita(),
|
||||||
]
|
]
|
||||||
random.shuffle(cards)
|
random.shuffle(cards)
|
||||||
|
@ -57,6 +57,7 @@ class Player:
|
|||||||
self.target_p: str = None
|
self.target_p: str = None
|
||||||
self.is_drawing = False
|
self.is_drawing = False
|
||||||
self.special_use_count = 0
|
self.special_use_count = 0
|
||||||
|
self.committed_suit_manette = None
|
||||||
self.not_chosen_character = None
|
self.not_chosen_character = None
|
||||||
try:
|
try:
|
||||||
del self.win_status
|
del self.win_status
|
||||||
@ -218,10 +219,11 @@ class Player:
|
|||||||
elif self.pending_action == PendingAction.DRAW:
|
elif self.pending_action == PendingAction.DRAW:
|
||||||
self.draw('')
|
self.draw('')
|
||||||
elif self.pending_action == PendingAction.PLAY:
|
elif self.pending_action == PendingAction.PLAY:
|
||||||
equippables = [c for c in self.hand if (c.is_equipment or c.usable_next_turn) and not isinstance(c, cs.Prigione) and not any([type(c) == type(x) for x in self.equipment])]
|
non_blocked_cards = [card for card in self.hand if (self.game.check_event(ceh.Manette) and card.suit == self.committed_suit_manette)]
|
||||||
misc = [c for c in self.hand if (isinstance(c, cs.WellsFargo) or isinstance(c, cs.Indiani) or isinstance(c, cs.Gatling) or isinstance(c, cs.Diligenza) or isinstance(c, cs.Emporio) or (isinstance(c, cs.Birra) and self.lives < self.max_lives and not self.game.check_event(ceh.IlReverendo)) or (c.need_with and len(self.hand) > 1 and not c.need_target and not (isinstance(c, csd.Whisky) and self.lives == self.max_lives)))
|
equippables = [c for c in non_blocked_cards if (c.is_equipment or c.usable_next_turn) and not isinstance(c, cs.Prigione) and not any([type(c) == type(x) for x in self.equipment])]
|
||||||
|
misc = [c for c in non_blocked_cards if (isinstance(c, cs.WellsFargo) or isinstance(c, cs.Indiani) or isinstance(c, cs.Gatling) or isinstance(c, cs.Diligenza) or isinstance(c, cs.Emporio) or (isinstance(c, cs.Birra) and self.lives < self.max_lives and not self.game.check_event(ceh.IlReverendo)) or (c.need_with and len(self.hand) > 1 and not c.need_target and not (isinstance(c, csd.Whisky) and self.lives == self.max_lives)))
|
||||||
and not (not c.can_be_used_now and self.game.check_event(ce.IlGiudice))]
|
and not (not c.can_be_used_now and self.game.check_event(ce.IlGiudice))]
|
||||||
need_target = [c for c in self.hand if c.need_target and c.can_be_used_now and not (c.need_with and len(self.hand) < 2) and not (
|
need_target = [c for c in non_blocked_cards if c.need_target and c.can_be_used_now and not (c.need_with and len(self.hand) < 2) and not (
|
||||||
(self.game.check_event(ceh.Sermone) or self.has_played_bang and not (any([isinstance(c, cs.Volcanic) for c in self.equipment]) and type(c) == type(cs.Bang)
|
(self.game.check_event(ceh.Sermone) or self.has_played_bang and not (any([isinstance(c, cs.Volcanic) for c in self.equipment]) and type(c) == type(cs.Bang)
|
||||||
) and not self.game.check_event(ce.Lazo))) and not ( isinstance(c, cs.Prigione) and self.game.check_event(ce.IlGiudice))]
|
) and not self.game.check_event(ce.Lazo))) and not ( isinstance(c, cs.Prigione) and self.game.check_event(ce.IlGiudice))]
|
||||||
green_cards = [c for c in self.equipment if not self.game.check_event(ce.Lazo) and not isinstance(c, cs.Mancato) and c.usable_next_turn and c.can_be_used_now]
|
green_cards = [c for c in self.equipment if not self.game.check_event(ce.Lazo) and not isinstance(c, cs.Mancato) and c.usable_next_turn and c.can_be_used_now]
|
||||||
@ -432,8 +434,20 @@ class Player:
|
|||||||
return self.notify_self()
|
return self.notify_self()
|
||||||
if self.game.check_event(ceh.IlTreno) or (self.is_ghost and self.game.check_event(ceh.CittaFantasma)):
|
if self.game.check_event(ceh.IlTreno) or (self.is_ghost and self.game.check_event(ceh.CittaFantasma)):
|
||||||
self.hand.append(self.game.deck.draw())
|
self.hand.append(self.game.deck.draw())
|
||||||
|
self.manette()
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
|
|
||||||
|
def manette(self):
|
||||||
|
if self.game.check_event(ceh.Manette):
|
||||||
|
self.choose_text = 'choose_manette'
|
||||||
|
self.available_cards = [{
|
||||||
|
'name': '',
|
||||||
|
'icon': '♦♣♥♠'[s],
|
||||||
|
'alt_text': '',
|
||||||
|
'noDesc': True
|
||||||
|
} for s in [0,1,2,3]]
|
||||||
|
self.pending_action = PendingAction.CHOOSE
|
||||||
|
|
||||||
def pick(self):
|
def pick(self):
|
||||||
if self.pending_action != PendingAction.PICK:
|
if self.pending_action != PendingAction.PICK:
|
||||||
return
|
return
|
||||||
@ -519,7 +533,7 @@ class Player:
|
|||||||
withCard = self.hand.pop(_with) if hand_index > _with else self.hand.pop(_with - 1)
|
withCard = self.hand.pop(_with) if hand_index > _with else self.hand.pop(_with - 1)
|
||||||
print(self.name, 'is playing ', card, ' against:', against, ' with:', _with)
|
print(self.name, 'is playing ', card, ' against:', against, ' with:', _with)
|
||||||
did_play_card = False
|
did_play_card = False
|
||||||
event_blocks_card = (self.game.check_event(ce.IlGiudice) and (card.is_equipment or (card.usable_next_turn and not card.can_be_used_now))) or (self.game.check_event(ce.Lazo) and card.usable_next_turn and card.can_be_used_now)
|
event_blocks_card = (self.game.check_event(ce.IlGiudice) and (card.is_equipment or (card.usable_next_turn and not card.can_be_used_now))) or (self.game.check_event(ce.Lazo) and card.usable_next_turn and card.can_be_used_now) or (self.game.check_event(ceh.Manette) and card.suit != self.committed_suit_manette and not (card.usable_next_turn and card.can_be_used_now))
|
||||||
if not(against != None and isinstance(self.game.get_player_named(against).character, chd.ApacheKid) and card.check_suit(self.game, [cs.Suit.DIAMONDS])) and not event_blocks_card:
|
if not(against != None and isinstance(self.game.get_player_named(against).character, chd.ApacheKid) and card.check_suit(self.game, [cs.Suit.DIAMONDS])) and not event_blocks_card:
|
||||||
if against == self.name and not isinstance(card, csd.Tequila):
|
if against == self.name and not isinstance(card, csd.Tequila):
|
||||||
did_play_card = False
|
did_play_card = False
|
||||||
@ -581,6 +595,11 @@ class Player:
|
|||||||
self.lives = 2
|
self.lives = 2
|
||||||
self.sio.emit('chat_message', room=self.game.name, data=f'_choose_character|{self.name}|{self.character.name}')
|
self.sio.emit('chat_message', room=self.game.name, data=f'_choose_character|{self.name}|{self.character.name}')
|
||||||
self.play_turn(again = True)
|
self.play_turn(again = True)
|
||||||
|
elif self.game.check_event(ceh.Manette) and self.choose_text == 'choose_manette':
|
||||||
|
self.committed_suit_manette = cs.Suit(card_index)
|
||||||
|
self.sio.emit('chat_message', room=self.game.name, data=f'_choose_manette|{self.name}|{"♦♣♥♠"[card_index]}')
|
||||||
|
self.pending_action = PendingAction.PLAY
|
||||||
|
self.notify_self()
|
||||||
elif self.is_giving_life and self.game.check_event(ce.FratelliDiSangue):
|
elif self.is_giving_life and self.game.check_event(ce.FratelliDiSangue):
|
||||||
try:
|
try:
|
||||||
player = self.game.get_player_named(self.available_cards[card_index]['name'])
|
player = self.game.get_player_named(self.available_cards[card_index]['name'])
|
||||||
@ -666,6 +685,7 @@ class Player:
|
|||||||
self.game.deck.put_on_top(self.available_cards.pop())
|
self.game.deck.put_on_top(self.available_cards.pop())
|
||||||
self.is_drawing = False
|
self.is_drawing = False
|
||||||
self.pending_action = PendingAction.PLAY
|
self.pending_action = PendingAction.PLAY
|
||||||
|
self.manette()
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
elif self.is_drawing and self.character.check(self.game, chd.PatBrennan):
|
elif self.is_drawing and self.character.check(self.game, chd.PatBrennan):
|
||||||
self.is_drawing = False
|
self.is_drawing = False
|
||||||
@ -675,6 +695,7 @@ class Player:
|
|||||||
self.available_cards = []
|
self.available_cards = []
|
||||||
self.game.get_player_named(self.pat_target).notify_self()
|
self.game.get_player_named(self.pat_target).notify_self()
|
||||||
self.pending_action = PendingAction.PLAY
|
self.pending_action = PendingAction.PLAY
|
||||||
|
self.manette()
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
else: # emporio
|
else: # emporio
|
||||||
self.game.respond_emporio(self, card_index)
|
self.game.respond_emporio(self, card_index)
|
||||||
@ -995,6 +1016,7 @@ class Player:
|
|||||||
self.game.deck.scrap(self.hand.pop(), True)
|
self.game.deck.scrap(self.hand.pop(), True)
|
||||||
for i in range(len(self.equipment)):
|
for i in range(len(self.equipment)):
|
||||||
self.game.deck.scrap(self.equipment.pop(), True)
|
self.game.deck.scrap(self.equipment.pop(), True)
|
||||||
|
self.committed_suit_manette = None
|
||||||
self.pending_action = PendingAction.WAIT
|
self.pending_action = PendingAction.WAIT
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
self.game.next_turn()
|
self.game.next_turn()
|
||||||
|
@ -117,6 +117,7 @@ export default {
|
|||||||
emporioCards: {},
|
emporioCards: {},
|
||||||
spectator: false,
|
spectator: false,
|
||||||
noStar: false,
|
noStar: false,
|
||||||
|
committed_suit_manette: null,
|
||||||
}),
|
}),
|
||||||
sockets: {
|
sockets: {
|
||||||
role(role) {
|
role(role) {
|
||||||
@ -144,6 +145,7 @@ export default {
|
|||||||
this.special_use_count = self.special_use_count
|
this.special_use_count = self.special_use_count
|
||||||
this.choose_text = self.choose_text
|
this.choose_text = self.choose_text
|
||||||
this.is_my_turn = self.is_my_turn
|
this.is_my_turn = self.is_my_turn
|
||||||
|
this.committed_suit_manette = self.committed_suit_manette
|
||||||
if (this.is_my_turn) document.title = this.$t('your_turn')+' | PewPew!'
|
if (this.is_my_turn) document.title = this.$t('your_turn')+' | PewPew!'
|
||||||
else if (this.pending_action == 3) document.title = this.$t('your_response')+' | PewPew!'
|
else if (this.pending_action == 3) document.title = this.$t('your_response')+' | PewPew!'
|
||||||
else if (this.pending_action == 5) document.title = this.$t('your_choose')+' | PewPew!'
|
else if (this.pending_action == 5) document.title = this.$t('your_choose')+' | PewPew!'
|
||||||
@ -257,7 +259,7 @@ export default {
|
|||||||
return cc
|
return cc
|
||||||
},
|
},
|
||||||
handComputed() {
|
handComputed() {
|
||||||
return this.hand.map(x=> {
|
return this.hand.map(x => {
|
||||||
let cantBePlayed = false
|
let cantBePlayed = false
|
||||||
let calamity_special = (x.name === 'Mancato!' && this.character.name === 'Calamity Janet')
|
let calamity_special = (x.name === 'Mancato!' && this.character.name === 'Calamity Janet')
|
||||||
let cant_play_bang = (this.has_played_bang && this.equipment.filter(x => x.name == 'Volcanic').length == 0)
|
let cant_play_bang = (this.has_played_bang && this.equipment.filter(x => x.name == 'Volcanic').length == 0)
|
||||||
@ -265,6 +267,7 @@ export default {
|
|||||||
else if (this.eventCard && this.eventCard.name == "Il Giudice" && (x.is_equipment || !x.can_be_used_now)) cantBePlayed = true;
|
else if (this.eventCard && this.eventCard.name == "Il Giudice" && (x.is_equipment || !x.can_be_used_now)) cantBePlayed = true;
|
||||||
else if (this.eventCard && this.eventCard.name == "Il Reverendo" && (x.name == "Birra")) cantBePlayed = true;
|
else if (this.eventCard && this.eventCard.name == "Il Reverendo" && (x.name == "Birra")) cantBePlayed = true;
|
||||||
else if (this.need_with && this.hand.length === 1) cantBePlayed = true;
|
else if (this.need_with && this.hand.length === 1) cantBePlayed = true;
|
||||||
|
else if (this.committed_suit_manette !== null && this.committed_suit_manette !== x.suit) cantBePlayed = true;
|
||||||
return {
|
return {
|
||||||
...x,
|
...x,
|
||||||
cantBePlayed: cantBePlayed
|
cantBePlayed: cantBePlayed
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
"choose_response": "Choose your response ",
|
"choose_response": "Choose your response ",
|
||||||
"choose_response_to": "to ",
|
"choose_response_to": "to ",
|
||||||
"choose_response_needed": "NEEDED ",
|
"choose_response_needed": "NEEDED ",
|
||||||
|
"choose_manette": "Choose a suit, you will be able to play only cards with that suit on this turn.",
|
||||||
"hand": "HAND",
|
"hand": "HAND",
|
||||||
"card_against": "Who will you play your card against?",
|
"card_against": "Who will you play your card against?",
|
||||||
"choose_card_to_get": "Choose a card",
|
"choose_card_to_get": "Choose a card",
|
||||||
@ -104,7 +105,8 @@
|
|||||||
"lobby_reset": "Going back to lobby in {0} seconds...",
|
"lobby_reset": "Going back to lobby in {0} seconds...",
|
||||||
"prison_free": "{0} got out of prison",
|
"prison_free": "{0} got out of prison",
|
||||||
"prison_turn": "{0} stayed in prison this turn",
|
"prison_turn": "{0} stayed in prison this turn",
|
||||||
"flip_event": "🎴 EVENT: {0} 🎴"
|
"flip_event": "🎴 EVENT: {0} 🎴",
|
||||||
|
"choose_manette": "{0} committed to play only cards of suit {1} in this turn."
|
||||||
},
|
},
|
||||||
"foc": {
|
"foc": {
|
||||||
"leggedelwest": "He must play this card on this turn if possible."
|
"leggedelwest": "He must play this card on this turn if possible."
|
||||||
@ -538,11 +540,11 @@
|
|||||||
},
|
},
|
||||||
"Nuova Identita": {
|
"Nuova Identita": {
|
||||||
"name": "New Identity",
|
"name": "New Identity",
|
||||||
"desc": ""
|
"desc": "At the beginning of their turn, each player can choose to change its character with the other shown at the game start. If he does so he restarts from 2 HP"
|
||||||
},
|
},
|
||||||
"Manette": {
|
"Manette": {
|
||||||
"name": "Handcuffs",
|
"name": "Handcuffs",
|
||||||
"desc": ""
|
"desc": "After drawing in phase 1, the player declares a suit. He will be able to use only cards of that suit for that turn"
|
||||||
},
|
},
|
||||||
"Mezzogiorno di Fuoco":{
|
"Mezzogiorno di Fuoco":{
|
||||||
"name": "High Noon",
|
"name": "High Noon",
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
"choose_response": "Scegli come rispondere ",
|
"choose_response": "Scegli come rispondere ",
|
||||||
"choose_response_to": "a ",
|
"choose_response_to": "a ",
|
||||||
"choose_response_needed": "NE OCCORRONO ",
|
"choose_response_needed": "NE OCCORRONO ",
|
||||||
|
"choose_manette": "Scegli un seme, potrai giocare solo carte di quel seme questo turno.",
|
||||||
"hand": "MANO",
|
"hand": "MANO",
|
||||||
"card_against": "Contro chi vuoi giocare la carta",
|
"card_against": "Contro chi vuoi giocare la carta",
|
||||||
"choose_card_to_get": "Scegli che carta pescare",
|
"choose_card_to_get": "Scegli che carta pescare",
|
||||||
@ -104,7 +105,8 @@
|
|||||||
"lobby_reset": "Si ritorna alla stanza in {0} secondi...",
|
"lobby_reset": "Si ritorna alla stanza in {0} secondi...",
|
||||||
"prison_free": "{0} è uscito di prigione",
|
"prison_free": "{0} è uscito di prigione",
|
||||||
"prison_turn": "{0} rimane in prigione questo turno",
|
"prison_turn": "{0} rimane in prigione questo turno",
|
||||||
"flip_event": "🎴 EVENTO: {0} 🎴"
|
"flip_event": "🎴 EVENTO: {0} 🎴",
|
||||||
|
"choose_manette": "{0} si è impegnato ad usare solo carte di seme {1} in questo turno."
|
||||||
},
|
},
|
||||||
"foc": {
|
"foc": {
|
||||||
"leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"
|
"leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"
|
||||||
|
Loading…
Reference in New Issue
Block a user