fix blackflower
This commit is contained in:
parent
2418f7cc53
commit
3262580592
@ -9,12 +9,12 @@ class BlackFlower(Character):
|
||||
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)):
|
||||
if player.special_use_count > 0 or 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.special_use_count += 1
|
||||
player.pending_action = PendingAction.CHOOSE
|
||||
player.choose_text = 'blackflower_special'
|
||||
player.notify_self()
|
||||
|
@ -50,3 +50,22 @@ def test_ColoradoBill():
|
||||
assert p1.lives == 3
|
||||
p.play_card(0, p1.name)
|
||||
assert p1.pending_action == PendingAction.RESPOND
|
||||
|
||||
# test BlackFlower
|
||||
def test_BlackFlower():
|
||||
g = Game('test')
|
||||
ps = [Player(f'p{i}', f'p{i}') for i in range(2)]
|
||||
for p in ps:
|
||||
g.add_player(p)
|
||||
g.start_game()
|
||||
for p in ps:
|
||||
p.available_characters = [BlackFlower()]
|
||||
p.set_character(p.available_characters[0].name)
|
||||
p = g.players[g.turn]
|
||||
p.draw('')
|
||||
p.hand = [cs.Volcanic(cs.Suit.DIAMONDS,0)]
|
||||
p.special('')
|
||||
assert p.pending_action == PendingAction.PLAY
|
||||
p.hand = [cs.Volcanic(cs.Suit.CLUBS,0)]
|
||||
p.special('')
|
||||
assert p.pending_action == PendingAction.CHOOSE
|
||||
|
Loading…
Reference in New Issue
Block a user