add Lee Van Kliff

This commit is contained in:
Alberto Xamin 2023-04-02 22:36:26 +01:00
parent 744bc44950
commit a936f44099
No known key found for this signature in database
GPG Key ID: 5ABFCD8A22EA6F5D
3 changed files with 66 additions and 15 deletions

View File

@ -1,80 +1,126 @@
from typing import List
import bang.cards as cs
from bang.characters import Character
class BigSpencer(Character):
"""
Inizia con 5 carte. Non può giocare Mancato!
"""
def __init__(self):
super().__init__("Big Spencer", max_lives=9)
self.icon = '🫘'
self.icon = "🫘"
class FlintWestwood(Character):
"""
Nel suo turno può scambiare una carta dalla mano con 2 carte a caso dalla mano di un altro giocatore.
> NOTE: La carta dalla tua mano è a scelta, non a caso. Se il giocatore bersaglio ha una sola carta, ne ricevi solo una.
"""
def __init__(self):
super().__init__("Flint Westwood", max_lives=4)
self.icon = '🔫'
self.icon = "🔫"
def special(self, player, data):
if not player.is_my_turn or not any((len(p.hand) > 0 for p in player.game.get_alive_players())) or not super().special(player, data):
if (
not player.is_my_turn
or not any((len(p.hand) > 0 for p in player.game.get_alive_players()))
or not super().special(player, data)
):
return False
from bang.players import PendingAction
import bang.players as pls
player.available_cards = player.hand.copy()
player.choose_text = 'choose_flint_special'
player.pending_action = PendingAction.CHOOSE
player.choose_text = "choose_flint_special"
player.pending_action = pls.PendingAction.CHOOSE
player.special_use_count += 1
player.notify_self()
class GaryLooter(Character):
"""
Pesca tutte le carte in eccesso scartate dagli altri giocatori a fine turno.
"""
def __init__(self):
super().__init__("Gary Looter", max_lives=5)
self.icon = '🥲'
self.icon = "🥲"
class GreygoryDeckard(Character):
"""
All'inizio del suo turno può pescare 2 personaggi a caso. Ha tutte le abilità dei personaggi pescati.
"""
def __init__(self):
super().__init__("Greygory Deckard", max_lives=4)
self.icon = '👨‍🦳'
self.icon = "👨‍🦳"
class JohnPain(Character):
"""
Se ha meno di 6 carte in mano, quando un giocatore "estrae!" John aggiunge alla mano la carta appena estratta.
"""
def __init__(self):
super().__init__("John Pain", max_lives=4)
self.icon = '🤕'
self.icon = "🤕"
class LeeVanKliff(Character):
"""
Nel suo turno, può scartare un BANG! per ripetere l'effetto di una carta a bordo marrone che ha appena giocato.
"""
def __init__(self):
super().__init__("Lee Van Kliff", max_lives=4)
self.icon = '👨‍🦲'
self.icon = "👨‍🦲"
def special(self, player, data):
if player.last_played_card is None:
return False
if (
player.last_played_card.is_equipment
or player.last_played_card.usable_next_turn
or player.last_played_card.number == 42
or not any(isinstance(c, cs.Bang) for c in player.hand)
or not super().special(player, data)
):
return False
bang_index = next(
(i for i, card in enumerate(player.hand) if isinstance(card, cs.Bang)), -1
)
bang_card = player.hand.pop(bang_index)
print(f"{bang_card=}")
player.game.deck.scrap(bang_card, player=player)
player.last_played_card.must_be_used = True
player.last_played_card.number = 42
player.hand.append(player.last_played_card)
print(f"{player.hand=}")
player.notify_self()
class TerenKill(Character):
"""
Ogni volta che sarebbe eliminato "estrai!": se non è Picche, Teren resta a 1 punto vita e pesca 1 carta.
"""
def __init__(self):
super().__init__("Teren Kill", max_lives=3)
self.icon = '👨‍🦰'
self.icon = "👨‍🦰"
class YoulGrinner(Character):
"""
Prima di pescare, i giocatori con più carte in mano di lui devono dargli una carta a scelta.
"""
def __init__(self):
super().__init__("Youl Grinner", max_lives=4)
self.icon = '🤡'
self.icon = "🤡"
def all_characters() -> List[Character]:
cards = [
@ -83,11 +129,11 @@ def all_characters() -> List[Character]:
# GaryLooter(),
# GreygoryDeckard(),
JohnPain(),
# LeeVanKliff(),
LeeVanKliff(),
TerenKill(),
YoulGrinner(),
]
for c in cards:
c.expansion_icon = '🎪'
c.expansion = 'wild_west_show'
c.expansion_icon = "🎪"
c.expansion = "wild_west_show"
return cards

View File

@ -104,6 +104,7 @@ class Player:
self.discord_id = None
self.played_cards = 0
self.avatar = ""
self.last_played_card: cs.Card = None
if self.is_bot:
self.avatar = robot_pictures[randrange(len(robot_pictures))]
if self.discord_token:
@ -118,6 +119,7 @@ class Player:
self.character: chars.Character = None
self.real_character: chars.Character = None
self.is_using_checchino = False
self.last_played_card = None
self.lives = 0
self.max_lives = 0
self.is_my_turn = False
@ -728,6 +730,7 @@ class Player:
self.played_cards = 0
self.can_play_ranch = True
self.is_playing_ranch = False
self.last_played_card = None
self.can_play_vendetta = can_play_vendetta
if not again:
G.sio.emit("chat_message", room=self.game.name, data=f"_turn|{self.name}")
@ -1306,6 +1309,7 @@ class Player:
):
if did_play_card:
self.game.deck.scrap(card, True)
self.last_played_card = card
else:
self.hand.insert(hand_index, card)
if withCard:

View File

@ -37,6 +37,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 === '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>
<button :class="{'btn': true, 'cant-play':(pending_action != 2)}" :disabled="pending_action != 2" v-if="!(eventCard && eventCard.name == 'Sbornia') && is_my_turn && character.name === 'Flint Westwood' && 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 === 'Lee Van Kliff' && 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>