Пример #1
0
 def run(game, source_player, target_player):
     if target_player == source_player:
         raise GameInvalidOperation("Cannot steal from yourself. Choose a different action")
     if target_player.dead():
         raise GameInvalidOperation("{} is dead. Choose a different action".format(target_player))
     if same_team(source_player, target_player):
         raise GameInvalidOperation("{} is on your team. Choose a different action".format(target_player))
     if target_player.cash() < 1:
         raise GameInvalidOperation("{} has no cash. Choose a different action".format(target_player))
     cash_to_steal = max(target_player.cash(), 2)
     game.broadcast_message("{} steals {} coins from {}".format(source_player, cash_to_steal, target_player))
     game.add_message_to_queue(target_player.name, "Please challenge, counter, or accept with .accept")
     responses = [Challenge, Counter, Accept]
     game.event_queue.add(Steal, responses, source_player, target=target_player)
Пример #2
0
 def run(game, source_player, target_player):
     if target_player == source_player:
         raise GameInvalidOperation("Cannot examine from yourself. Choose a different action")
     if target_player.dead():
         raise GameInvalidOperation("{} is dead. Choose a different action".format(target_player))
     if same_team(source_player, target_player):
         raise GameInvalidOperation("{} is on your team. Choose a different action".format(target_player))
     game.broadcast_message("{} examines one of {}'s cards".format(source_player, target_player))
     if len(target_player.available_influence) > 1:
         game.add_message_to_queue(target_player.name, "Please challenge, counter, or select which card to "
                                                       "provide with .select 1 or .select 2")
         responses = [Challenge, Counter, Select]
     else:
         game.add_message_to_queue(target_player.name, "Please challenge, counter, or accept with .accept")
         responses = [Challenge, Counter, Accept]
     game.event_queue.add(Examine, responses, source_player, target=target_player)
Пример #3
0
 def run(game, source_player, target_player, guess=None):
     if target_player == source_player:
         raise GameInvalidOperation("Cannot coup from yourself. Choose a different action")
     if target_player.dead():
         raise GameInvalidOperation("{} is dead. Choose a different action".format(target_player))
     if same_team(source_player, target_player):
         raise GameInvalidOperation("{} is on your team. Choose a different action".format(target_player))
     source_player.modify_coins(-7)
     game.broadcast_message("{} coups {}".format(source_player, target_player))
     game.add_message_to_queue(target_player.name, "Please challenge, counter, or accept with .accept")
     if len(target_player.available_influence) > 1:
         game.add_message_to_queue(target_player.name, "Please select which card to lose "
                                                       "with .select 1 or .select 2")
         responses = [Select]
     else:
         game.add_message_to_queue(target_player.name, "Please challenge, counter, or accept with .accept")
         responses = []
     game.event_queue.add(Coup, responses, source_player, target=target_player)