add black flower

This commit is contained in:
Alberto Xamin 2023-01-28 19:05:17 +00:00
parent 89f5de47c7
commit fc603dcba3
3 changed files with 20 additions and 2 deletions

View File

@ -1,13 +1,23 @@
from typing import List
from bang.characters import Character
import bang.cards as cs
class BlackFlower(Character):
def __init__(self):
super().__init__("Black Flower", max_lives=4)
# Una volta nel tuo turno, puoi usare una carta di fiori per sparare un BANG! extra.
self.icon = '🥀'
def special(self, player, data): #fiori = suit.Clubs
if player.special_use_count > 0 and not any((c.suit == cs.Suit.CLUBS for c in player.hand)):
return False
if super().special(player, data):
from bang.players import PendingAction
player.special_use_count += 1
player.available_cards = [c for c in player.hand if c.suit == cs.Suit.CLUBS]
player.pending_action = PendingAction.CHOOSE
player.choose_text = 'blackflower_special'
player.notify_self()
class ColoradoBill(Character):
def __init__(self):
super().__init__("Colorado Bill", max_lives=4)
@ -63,7 +73,7 @@ class TucoFranziskaner(Character):
def all_characters() -> List[Character]:
cards = [
# BlackFlower(),
BlackFlower(),
ColoradoBill(),
DerSpotBurstRinger(),
# EvelynShebang(),

View File

@ -871,6 +871,13 @@ class Player:
G.sio.emit('chat_message', room=player.game.name, data=f'_play_card_against|{self.name}|Sventagliata|{player.name}')
self.pending_action = PendingAction.PLAY
self.notify_self()
elif 'blackflower_special' in self.choose_text:
if card_index <= len(self.available_cards):
self.hand.remove(self.available_cards[card_index])
self.game.deck.scrap(self.available_cards[card_index], player=self)
self.hand.append(cs.Bang(cs.Suit.CLUBS,42))
self.pending_action = PendingAction.PLAY
self.notify_self()
elif 'choose_tornado' in self.choose_text:
if card_index <= len(self.available_cards):
self.game.deck.scrap(self.hand.pop(card_index), player=self)

View File

@ -35,6 +35,7 @@
<button :class="{'btn': true, 'cant-play':(pending_action != 2)}" :disabled="pending_action != 2" v-if="!(eventCard && eventCard.name == 'Sbornia') && is_my_turn && character.name === 'Josh McCloud' && gold_nuggets >=2" @click="()=>{$socket.emit('special', {})}">{{$t('special_ability')}}</button>
<button :class="{'btn': true, 'cant-play':(pending_action != 2)}" :disabled="pending_action != 2" v-if="!(eventCard && eventCard.name == 'Sbornia') && is_my_turn && character.name === 'Raddie Snake' && special_use_count < 2 && gold_nuggets >=1" @click="()=>{$socket.emit('special', {})}">{{$t('special_ability')}}</button>
<button :class="{'btn': true, 'cant-play':(pending_action != 2)}" :disabled="pending_action != 2" v-if="!(eventCard && eventCard.name == 'Sbornia') && is_my_turn && character.name === 'Der Spot Burst Ringer' && special_use_count < 1" @click="()=>{$socket.emit('special', {})}">{{$t('special_ability')}}</button>
<button :class="{'btn': true, 'cant-play':(pending_action != 2)}" :disabled="pending_action != 2" v-if="!(eventCard && eventCard.name == 'Sbornia') && is_my_turn && character.name === 'Black Flower' && special_use_count < 1" @click="()=>{$socket.emit('special', {})}">{{$t('special_ability')}}</button>
</div>
<div v-if="lives > 0 || is_ghost" style="position:relative">
<span id="hand_text">{{$t('hand')}}</span>