def ecuyer(active_player, current_dice, players_score, list_players, current_role): """If a Hero is in the game, you will follow him in his travel """ if int(current_dice[0]) == 3 and int(current_dice[1]) == 1\ or int(current_dice[0]) == 1 and int(current_dice[1]) == 3: if gf.check_role('Hero', current_role): current_hero = gf.get_playerFromRole('Hero', current_role) current_god = gf.get_playerFromRole('God', current_role) if active_player != current_hero and active_player != current_god: if gf.check_role('Ecuyer', current_role): current_ecuyer = gf.get_playerFromRole( 'Ecuyer', current_role) if active_player != current_ecuyer: gf.switch_role(current_ecuyer, active_player, 'Ecuyer', current_role, list_players) print(active_player + " remplace " + current_ecuyer + " auprès de " + current_hero) else: print(active_player + " est déjà l'Ecuyer de " + current_hero) else: gf.p_win_r(active_player, 'Ecuyer', current_role)
def prisonnier(active_player, current_dice, players_score, list_players, current_role): """A villager enter the prison by rolling a 32""" if int(current_dice[0]) == 3 and int(current_dice[1]) == 2 or \ int(current_dice[0]) == 2 and int(current_dice[1]) == 3: if gf.check_role('Prisoner', current_role): current_prisonner = gf.get_playerFromRole('Prisoner', current_role) if active_player != current_prisonner: print(current_prisonner + " est déjà en prison !!!") else: print(active_player + ", tu es le prisonnier du village.") gf.p_win_r(active_player, 'Prisoner', current_role) print("Prends " + str(current_dice[2]) + " pour fêter ton entrée en prison !") gf.player_recive(active_player, current_dice[2], list_players, current_role, players_score)
def oracle(active_player, current_dice, players_score, list_players, current_role): """Try to predict Hero's roll before his trial""" role = 'Oracle' if int(current_dice[0]) == 2 and int(current_dice[1]) == 1 or \ int(current_dice[0]) == 1 and int(current_dice[1]) == 2: if gf.check_role(role, current_role): old_oracle = gf.get_playerFromRole(role, current_role) if old_oracle != active_player: print(old_oracle + " n'est plus l'Oracle. ") gf.switch_role(old_oracle, active_player, role, current_role, list_players) if gf.player_role(active_player, 'Oracle', current_role): print(active_player + ", tu es déjà l'Oracle.") else: gf.p_win_r(active_player, role, current_role)
def dragon(active_player, current_dice, players_score, list_players, current_role): """When the dragon take, he can spread the total/2 in chain in left and right""" if int(current_dice[0]) == 5 and int(current_dice[1]) == 6 or \ int(current_dice[0]) == 6 and int(current_dice[1]) == 5: if gf.check_role('Dragon', current_role): current_dragon = gf.get_playerFromRole('Dragon', current_role) if gf.player_role(active_player, 'Dragon', current_role): print(active_player + ", tu es déjà le Dragon.") elif active_player != current_dragon: print(active_player + " prend le rôle de " + current_dragon + " en devenant le nouveau Dragon.") gf.switch_role(current_dragon, active_player, 'Dragon', current_role, list_players) else: gf.p_win_r(active_player, 'Dragon', current_role)
def princesse(active_player, current_dice, players_score, list_players, current_role): """If she take something, she can give the half to the Hero""" if int(current_dice[0]) == 5 and int(current_dice[1]) == 4 or \ int(current_dice[0]) == 4 and int(current_dice[1]) == 5: if gf.check_role('Princesse', current_role): current_princesse = gf.get_playerFromRole('Princesse', current_role) if gf.player_role(active_player, 'Princesse', current_role): print(active_player + ", tu es déjà la Princesse.") elif active_player != current_princesse: print(active_player + " prend le rôle de " + current_princesse + " en devenant le nouvel Princesse du village.") gf.switch_role(current_princesse, active_player, 'Princesse', current_role, list_players) else: print(active_player + ' , tu deviens la Princesse.') gf.p_win_r(active_player, 'Princesse', current_role)
def aubergiste(active_player, current_dice, players_score, list_players, current_role): """When someone take something, he can apply +1 ou +1""" if int(current_dice[0]) == 5 and int(current_dice[1]) == 3 or \ int(current_dice[0]) == 3 and int(current_dice[1]) == 5: if gf.check_role('Aubergiste', current_role): current_aubergiste = gf.get_playerFromRole('Aubergiste', current_role) if gf.player_role(active_player, 'Aubergiste', current_role): print(active_player + ", tu es déjà l'Aubergiste'.") elif active_player != current_aubergiste: print(active_player + " prend le rôle de " + current_aubergiste + " en devenant le nouvel Aubergiste du village.") gf.switch_role(current_aubergiste, active_player, 'Aubergiste', current_role, list_players) else: gf.p_win_r(active_player, 'Aubergiste', current_role)
def catin(active_player, current_dice, players_score, list_players, current_role): """A villager enter the prison by rolling a 32""" if int(current_dice[0]) == 4 and int(current_dice[1]) == 1 or \ int(current_dice[0]) == 1 and int(current_dice[1]) == 4: current_catin = gf.get_playerFromRole('Catin', current_role) if gf.check_role('God', current_role) and \ gf.player_role(active_player, 'God', current_role): print("Tu es le Dieu, tu ne peux être la Catin.") elif gf.check_role('Catin', current_role) : if gf.player_role(active_player, 'Catin', current_role): print(active_player + ', tu es déjà la Catin.') elif active_player != current_catin: print(active_player + " prend le rôle de " + current_catin + " en devenant la nouvelle Catin du village.") gf.switch_role(current_catin, active_player, 'Catin', current_role, list_players) else: print(active_player + " devient la Catin du village.") gf.p_win_r(active_player, 'Catin', current_role)
def god(active_player, current_dice, players_score, list_players, current_role): """Ascension : Become God by rolling double 4/5/6 then give the value""" list_roles = ['Hero', 'Catin', 'Ecuyer'] # Roles that God can't be role = 'God' if int(current_dice[0]) == 4 and int(current_dice[1]) == 4 or \ int(current_dice[0]) == 5 and int(current_dice[1]) == 5: gf.give_to(current_dice[0], list_players, current_role, players_score) current_god = gf.get_playerFromRole(role, current_role) if gf.check_role(role, current_role) and current_god != active_player: print("Bataille de Dieux ! ") duel_result = gf.duel(active_player, current_god, list_players, current_role, players_score, turn=2) winner = duel_result['winner'] loser = duel_result['loser'] if winner == current_god: print(loser + ' you lost !') else: new_god = duel_result['winner'] lost_god = duel_result['loser'] gf.switch_role(lost_god, new_god, role, current_role, list_players) gf.lose_roles(new_god, list_roles, current_role, list_players) print('Accueillez le nouveau Dieu : ' + new_god) if gf.player_role(active_player, 'God', current_role): print(active_player + ", tu es déjà Dieu.") else: print("Tu es le Dieu.") gf.p_win_r(active_player, role, current_role) gf.lose_roles(active_player, list_roles, current_role, list_players) elif int(current_dice[0]) == 6 and int(current_dice[1]) == 6: print(active_player + ', tu es le Dieu incontesté !') if gf.check_role(role, current_role): current_god = gf.get_playerFromRole(role, current_role) if current_god != active_player: lost_god = gf.get_playerFromRole(role, current_role) print(lost_god + " n'est plus Dieu ...") gf.switch_role(lost_god, active_player, role, current_role, list_players) gf.lose_roles(active_player, list_roles, current_role, list_players) gf.give_to(current_dice[0], list_players, current_role, players_score) if gf.player_role(active_player, 'God', current_role): print(active_player + ", tu es déjà Dieu.") else: gf.p_win_r(active_player, role, current_role)