add mira, fix sventagliata

This commit is contained in:
Alberto Xamin 2023-01-30 13:50:53 +00:00
parent cd1d1a0e2d
commit 9ab96088b9
4 changed files with 12 additions and 9 deletions

View File

@ -42,6 +42,7 @@ class Card(ABC):
self.can_be_used_now = True # to check wether the green card can be used now
self.usable_next_turn = False # it will be True for Green Cards
self.need_with = False # it will be true for cards that require a card to be discarded with
self.need_with_only = '' # names of the cards allowed to be discarded with
self.must_be_used = False # used by LeggeDelWest
def __str__(self):

View File

@ -126,6 +126,8 @@ class Sventagliata(Bang): # : conta come un normale BANG! del turno. Il BANG! se
def play_card(self, player, against, _with=None):
if against is not None:
if player.has_played_bang:
return False
t = player.game.get_player_named(against)
player.available_cards = [dict(p, **{'original_target':against}) for p in player.game.get_visible_players(t) if p['name'] != player.name and p['name'] != t.name and p['dist']]
if len(player.available_cards) > 0:
@ -156,15 +158,15 @@ class Mira(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Mira', number)
self.icon = '👌🏻'
self.need_with_only = 'Bang'
self.alt_text = "💥🃏💔💔"
self.need_target = True
self.need_with = True
def play_card(self, player, against, _with=None):
if against is not None:
#TODO
# super().play_card(player, against=against)
# player.game.attack(player, against, card_name=self.name)
if against is not None and _with is not None:
super().play_card(player, against=against)
player.game.attack(player, against, card_name=self.name)
return True
return False
@ -226,7 +228,7 @@ def get_starting_deck() -> List[Card]:
# Salvo(Suit.HEARTS, 5),
Bandidos(Suit.DIAMONDS,'Q'), # gli altri giocatori scelgono se scartare 2 carte o perdere 1 punto vita
Fuga(Suit.HEARTS, 3), # evita l'effetto di carte marroni (tipo panico cat balou) di cui sei bersaglio
# Mira(Suit.CLUBS, 6),
Mira(Suit.CLUBS, 6),
Poker(Suit.HEARTS, 'J'), # tutti gli altri scartano 1 carta a scelta, se non ci sono assi allora pesca 2
RitornoDiFiamma(Suit.CLUBS, 'Q'), # un mancato che fa bang
Tornado(Suit.CLUBS, "A"),

View File

@ -1181,9 +1181,9 @@ class Player:
for i in range(len(self.equipment)):
if self.equipment[i].can_be_used_now:
print('usable', self.equipment[i])
if not self.game.is_competitive and not any((isinstance(c, cs.Barile) for c in self.equipment)) and not self.character.check(self.game, chars.Jourdonnais)\
if (not self.game.is_competitive and not any((isinstance(c, cs.Barile) for c in self.equipment)) and not self.character.check(self.game, chars.Jourdonnais)\
and not any(((isinstance(c, cs.Mancato) and c.can_be_used_now) or (self.character.check(self.game, chars.CalamityJanet) and isinstance(c, cs.Bang)) or self.character.check(self.game, chd.ElenaFuente) for c in self.hand))\
and not any((c.can_be_used_now and isinstance(c, cs.Mancato) for c in self.equipment)) and not self.can_escape(card_name):
and not any((c.can_be_used_now and isinstance(c, cs.Mancato) for c in self.equipment)) and not self.can_escape(card_name)) or card_name=='Mira':
print('Cant defend')
if not no_dmg:
self.take_damage_response()

View File

@ -62,7 +62,7 @@
<Chooser v-if="!show_role && is_my_turn && pending_action < 2" :text="$t('play_your_turn')" :key="is_my_turn" class="turn-notify" />
<Chooser v-if="!show_role && availableCharacters.length > 0" :text="$t('choose_character')" :cards="availableCharacters" :select="setCharacter" :timer="45"/>
<Chooser v-if="hasToPickResponse" :playAudio="true" :text="`${$t('pick_a_card')} ${attacker?($t('to_defend_from')+' '+attacker):''}`" :key="hasToPickResponse" class="turn-notify" />
<Chooser v-if="!card_against && card_with" :text="`${$t('choose_scarp_card_to')} ${card_with.name.toUpperCase()}`" :cards="handComputed.filter(x => x !== card_with)" :select="selectWith" :cancel="()=>{card_with = null}"/>
<Chooser v-if="!card_against && card_with" :text="`${$t('choose_scarp_card_to')} ${card_with.name.toUpperCase()}`" :cards="handComputed.filter(x => x !== card_with && (x.name.indexOf(card_with.need_with_only) > -1))" :select="selectWith" :cancel="()=>{card_with = null}"/>
<Chooser v-if="showScrapScreen" :text="`${$t('discard')} ${hand.length}/${maxHandLength()}`" :cards="hand" :select="scrap" :cancel="cancelEndingTurn"/>
<Chooser v-if="sidWantsScrapForHealth && scrapHand.length < 2" :text="`${$t('discard')} ${2 - scrapHand.length} ${$t('to_regain_1_hp')}`"
:cards="notScrappedHand" :select="sidScrap" :cancel="() => {sidWantsScrapForHealth = false;scrapHand=[]}"/>
@ -327,7 +327,7 @@ export default {
let cantBePlayed = false
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)
if ((x.name == 'Bang!' || (calamity_special && x.name=='Mancato!')) && (cant_play_bang || (this.eventCard && this.eventCard.name == "Sermone"))) cantBePlayed = true;
if ((x.name == 'Bang!' || x.name == 'Sventagliata' || (calamity_special && x.name=='Mancato!')) && (cant_play_bang || (this.eventCard && this.eventCard.name == "Sermone"))) 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.need_with && this.hand.length === 1) cantBePlayed = true;