Пример #1
0
def god_attack_village(current_dice, list_players, current_role,
                       players_score):
    """When a total of 7 is draw, God give the smallest die to someone"""

    if int(current_dice[0]) + int(current_dice[1]) == 7:

        if gf.check_role('God', current_role):

            current_god = gf.get_playerFromRole('God', current_role)
            print(current_god + " en son nom de Dieu attaque le village !")
            value_attack = 0

            if current_dice[0] > current_dice[1]:
                value_attack = int(current_dice[1])

            elif int(current_dice[1]) > int(current_dice[0]):
                value_attack = int(current_dice[0])

            village = list_players[:]
            village.remove(current_god)
            print("Tout le village prend " + str(value_attack))
            protection = False

            if gf.check_role('Catin', current_role):
                print("A moins que ...")
                catin.protect(value_attack, current_god, protection,
                              list_players, current_role, players_score)

            if protection == False:

                if gf.check_role('Hero', current_role):
                    print("Mais ...")
                    hero.protect(value_attack, village, current_god,
                                 list_players, current_role, players_score)
Пример #2
0
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)
Пример #3
0
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)
Пример #4
0
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)
Пример #5
0
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)
Пример #6
0
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)
Пример #7
0
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)
Пример #8
0
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)
Пример #9
0
def basic_events(active_player, current_dice, players_score, list_players,
                 current_role):
    """Some few basic rules for non-role score"""

    # A 6 is rolled so the other die is given to someone
    if (int(current_dice[0]) == 6 and int(current_dice[1]) != 6):
        gf.give_to(current_dice[1], list_players, current_role, players_score)

    elif (int(current_dice[1]) == 6 and int(current_dice[0]) != 6):
        gf.give_to(current_dice[0], list_players, current_role, players_score)

    # 42 is rolled so everyone have the special die
    if int(current_dice[0]) == 4 and int(current_dice[1]) == 2:
        print("Tout le monde prend " + str(current_dice[2]) + " !")
        gf.everyone_take(int(current_dice[2]), players_score)

    elif int(current_dice[1]) == 4 and int(current_dice[0]) == 2:
        print("Tout le monde prend " + str(current_dice[2]) + " !")
        gf.everyone_take(int(current_dice[2]), players_score)

    # 51 is rolled so everyone have the special die
    if int(current_dice[0]) == 5 and int(current_dice[1]) == 1:
        print("Tout le monde prend " + str(current_dice[2]) + " !")
        gf.everyone_take(int(current_dice[2]), players_score)

    elif int(current_dice[1]) == 5 and int(current_dice[0]) == 1:
        print("Tout le monde prend " + str(current_dice[2]) + " !")
        gf.everyone_take(int(current_dice[2]), players_score)

    # When a 3 is rolled the prisoner take 1
    if (int(current_dice[0]) == 3 and int(current_dice[1]) != 2 \
    and int(current_dice[1]) != 3) or (int(current_dice[1]) == 3 \
    and int(current_dice[0]) != 2 and int(current_dice[0]) != 3):
        if gf.check_role('Prisoner', current_role):
            current_prisoner = gf.get_playerFromRole('Prisoner', current_role)
            if active_player != current_prisoner:
                print('Un 3 est sorti, le prisonnier ' + current_prisoner +
                      ' prends 1.')
                gf.player_recive(current_prisoner, 1, list_players,
                                 current_role, players_score)

            else:
                print('Félicitation ! ' + active_player +
                      ' Tu sors de prison. Et fête ça en prenant : ' +
                      str(current_dice[2]))
                gf.p_lose_r(active_player, 'Prisoner', current_role,
                            list_players)
                gf.player_recive(current_prisoner, current_dice[2],
                                 list_players, current_role, players_score)

    elif (int(current_dice[0]) == 3 and int(current_dice[1]) == 2) or\
        (int(current_dice[1]) == 3 and int(current_dice[0]) == 2):
        if gf.check_role('Prisoner', current_role):
            current_prisoner = gf.get_playerFromRole('Prisoner', current_role)
            if active_player == current_prisoner:
                print('Félicitation avec le 3, ' + current_prisoner +
                      ' sort de prison. Mais, prends ' + str(current_dice[2]) +
                      " pour fêter qu'il y rerentre !")
                gf.player_recive(current_prisoner, current_dice[2],
                                 list_players, current_role, players_score)

            else:
                print('Un 3 est sorti, le prisonnier ' + current_prisoner +
                      ' prends 1.')
                gf.player_recive(current_prisoner, 1, list_players,
                                 current_role, players_score)

    elif int(current_dice[0]) == 3 and int(current_dice[1]) == 3:
        if gf.check_role('Prisoner', current_role):
            current_prisoner = gf.get_playerFromRole('Prisoner', current_role)
            if active_player != current_prisoner:
                print('Deux 3 ! Le prisonnier ' + current_prisoner +
                      ' prends 2.')
                gf.player_recive(current_prisoner, 2, list_players,
                                 current_role, players_score)
Пример #10
0
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)