add terenkill and youlgrinner
This commit is contained in:
parent
e4f9cfc886
commit
d3a056cc6a
@ -84,8 +84,8 @@ def all_characters() -> List[Character]:
|
||||
# GreygoryDeckard(),
|
||||
JohnPain(),
|
||||
# LeeVanKliff(),
|
||||
# TerenKill(),
|
||||
# YoulGrinner(),
|
||||
TerenKill(),
|
||||
YoulGrinner(),
|
||||
]
|
||||
for c in cards:
|
||||
c.expansion_icon = '🎪'
|
||||
|
@ -265,6 +265,12 @@ class Player:
|
||||
if isinstance(self.gold_rush_equipment[i], grc.Zaino):
|
||||
self.gold_rush_equipment[i].play_card(self, None)
|
||||
return # play card will notify the player
|
||||
if self.character.check(self.game, chw.TerenKill):
|
||||
picked: cs.Card = self.game.deck.pick_and_scrap()
|
||||
G.sio.emit('chat_message', room=self.game.name, data=f'_flipped|{self.name}|{picked.name}|{picked.num_suit()}')
|
||||
if not picked.check_suit(self.game, [cs.Suit.SPADES]):
|
||||
self.lives = 1
|
||||
self.game.deck.draw(True, player=self)
|
||||
if self.character.check(self.game, chars.SidKetchum) and len(self.hand) > 1 and self.lives == 0:
|
||||
if self.game.players[self.game.turn] != self:
|
||||
self.game.players[self.game.turn].pending_action = PendingAction.WAIT
|
||||
@ -573,6 +579,12 @@ class Player:
|
||||
self.notify_self()
|
||||
else:
|
||||
self.pending_action = PendingAction.PLAY
|
||||
if self.character.check(self.game, chw.YoulGrinner):
|
||||
hsize = len(self.hand)
|
||||
for p in self.game.get_alive_players():
|
||||
if p != self and len(p.hand) > hsize:
|
||||
G.sio.emit('card_drawn', room=self.game.name, data={'player': self.name, 'pile': p.name})
|
||||
self.hand.append(p.hand.pop(randint(0, len(p.hand)-1)))
|
||||
num = 2 if not self.character.check(self.game, chd.BillNoface) else self.max_lives-self.lives+1
|
||||
if self.character.check(self.game, chd.PixiePete): num += 1
|
||||
if self.character.check(self.game, tvosch.TucoFranziskaner) and not any((True for c in self.equipment if not c.usable_next_turn)): num += 2
|
||||
|
@ -7,7 +7,7 @@ from globals import G
|
||||
G.sio = DummySocket()
|
||||
|
||||
|
||||
def started_game(expansions, players=4):
|
||||
def started_game(expansions, players=4, character=Character('test_char', 4)):
|
||||
g = Game('test')
|
||||
g.expansions = expansions
|
||||
ps = [Player(f'p{i}', f'p{i}') for i in range(players)]
|
||||
@ -15,7 +15,7 @@ def started_game(expansions, players=4):
|
||||
g.add_player(p)
|
||||
g.start_game()
|
||||
for p in ps:
|
||||
p.available_characters = [Character('test_char', 4)]
|
||||
p.available_characters = [character]
|
||||
p.set_character(p.available_characters[0].name)
|
||||
return g
|
||||
|
||||
|
34
backend/tests/wild_west_show_characters_test.py
Normal file
34
backend/tests/wild_west_show_characters_test.py
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
from tests import started_game, set_events, current_player, next_player, current_player_with_cards
|
||||
|
||||
from bang.expansions.wild_west_show.characters import *
|
||||
from bang.cards import Card, Suit
|
||||
import bang.roles as roles
|
||||
from bang.players import PendingAction
|
||||
|
||||
|
||||
# test TerenKill
|
||||
def test_TerenKill():
|
||||
g = started_game(['wild_west_show'], 4, TerenKill())
|
||||
p = current_player_with_cards(g, [])
|
||||
p.lives = 0
|
||||
g.deck.cards = [Card(Suit.HEARTS, 'card', 0), Card(Suit.HEARTS, 'card', 0)]
|
||||
p.notify_self()
|
||||
assert p.lives == 1
|
||||
assert len(p.hand) == 1
|
||||
p.lives = 0
|
||||
g.deck.cards = [Card(Suit.SPADES, 'card', 0), Card(Suit.HEARTS, 'card', 0)]
|
||||
p.notify_self()
|
||||
assert p.lives == 0
|
||||
|
||||
|
||||
# test YoulGrinner
|
||||
def test_YoulGrinner():
|
||||
g = started_game(['wild_west_show'], 4, YoulGrinner())
|
||||
p = current_player(g)
|
||||
p.hand = []
|
||||
p.draw('')
|
||||
assert len(p.hand) == 5
|
||||
for pl in g.players:
|
||||
if pl != p:
|
||||
assert len(pl.hand) == 3
|
@ -58,7 +58,7 @@ def test_LadyRosaDelTexas():
|
||||
p = current_player_with_cards(g, [Card(0,'card',0)]*4)
|
||||
t = g.turn
|
||||
p.draw('event')
|
||||
assert g.turn == t+1
|
||||
assert g.turn == (t+1)%len(g.players)
|
||||
|
||||
# test MissSusanna
|
||||
def test_miss_suzanna():
|
||||
|
Loading…
Reference in New Issue
Block a user