def banner_pity(rarity):
    if rarity == 5:
        # 50-50 chance of getting either a character or a weapon
        if random.randint(1, 2) == 1:
            # Character won
            a = random.choice(lst.star5_standard_characters)
            # Adding to Inventory
            inv.add_5star_char_inv(a)
        else:
            # Weapon won
            a = random.choice(lst.star5_standar_weapons)
            # Adding to Inventory
            inv.add_5star_weapon_inv(a)
        add_gacha(5, a)
        add_pity(four=True, five=True)
        pp.five_star_pity_standard = 0

    elif rarity == 4:
        # 50-50 chance of getting either a character or a weapon
        if random.randint(1, 2) == 1:
            # Character won
            a = random.choice(lst.star4_standard_characters)
            # Adding to Inventory
            inv.add_4star_char_inv(a)
        else:
            # Weapon won
            a = random.choice(lst.star4_standar_weapons)
            # Adding to Inventory
            inv.add_4star_weapon_inv(a)
        add_gacha(4, a)
        add_pity(four=True, five=True)
        pp.four_star_pity_standard = 0
Beispiel #2
0
def weapon_banner(limit):
    """
    Banner contains all 5* standard weapons
    Banner contains all standard 4* characters and 4* weapons
    Promotional 5* weapons with higher drop rate are 'Thundering Pulse' and 'Skyward Blade'
    Promotional 4* weapons are 'Favonius Warbow, 'Sacrificial Fragments', 'Dragon's Bane', 'Rainslasher',
    Sacrificial Sword

    5 Star Hard Pity is configured at 80, having higher probability of getting a 5 star after 64 (soft pity)
    4 Star Hard Pity is configured at 9

    Percentages:
    93.3% Chance to get a 3 Star
    5.1% Chance to get a 4 Star
    0.7% Chance to get a 5 Star
    """
    global gacha
    global gacha_show

    # Empty gatcha pulls
    gacha = []
    gacha_show = []

    # Weighted list for pull percentages (0.7% - 5.1% - 93.3%)
    # https://stackoverflow.com/questions/14992521/python-weighted-random
    og_pull_percentage = ['3'] * 933 + ['4'] * 51 + ['5'] * 7
    pull_percentage = og_pull_percentage.copy()

    for _ in range(1, limit + 1):
        # Pity System
        # 80 - Is 5 Star pity (n-1) = 79
        if pp.five_star_weapon_pity >= 79:
            # Returning to the original weight percentages
            pull_percentage = og_pull_percentage.copy()
            get_banner_pity(5)
        # 9 - is 4 star pity (n-1) = 8
        elif pp.four_star_weapon_pity >= 8:
            get_banner_pity(4)
        else:
            # Pulls
            if pp.five_star_weapon_pity > 64:
                # Adding more prob to get a 5 star
                pull_percentage.extend(['5'] * 320)
            magic = random.choice(pull_percentage)
            # 3 Star
            if magic == '3':
                a = random.choice(lst.star3_weapons)
                add_gacha_weapon(3,
                                 item=a)  # -------------------------------- #
                inv.add_3star_weapon_inv(a)
                add_pity(four=True, five=True)
            # 4 Star
            elif magic == '4':
                # If Promo Weapon was won = 75% Chance of winning another one
                if not pp.flag_4star_weapon:
                    # 75% chance of getting either a promotional character, or a standard character/weapon
                    if random.randint(1, 4) != 1:
                        # Random Promotional 4* Weapon Won
                        b = random.choice(lstbn.yoi_weapon_banner_4)
                        # Adding to Inventory
                        inv.add_4star_weapon_inv(b)
                    else:
                        pp.flag_4star_weapon = True
                        # 50-50 chance of getting either a character or a weapon (standard)
                        if random.randint(1, 2) == 1:
                            # Character won
                            b = random.choice(
                                lst.all_4star_standard_except_akl)
                            # Adding to Inventory
                            inv.add_4star_char_inv(b)
                        else:
                            # Weapon won
                            b = random.choice(lst.star4_standar_weapons)
                            # Adding to Inventory
                            inv.add_4star_weapon_inv(b)
                    add_gacha_weapon(4, b)
                    add_pity(four=True, five=True)
                    pp.four_star_weapon_pity = 0
                else:
                    # Guaranteed 4 Star Promotional Weapon
                    b = random.choice(lstbn.yoi_weapon_banner_4)
                    # Adding to Inventory
                    inv.add_4star_weapon_inv(b)
                    pp.flag_4star_weapon = False
                    add_gacha_weapon(4, b)
                    add_pity(four=True, five=True)
                    pp.four_star_weapon_pity = 0
            # 5 Star
            else:
                # If Promo Weapon was won = 75% Chance of winning another one
                if not pp.flag_5star_weapon:
                    # 75% chance of getting a promotional weapon. 25% chance of getting a standard weapon
                    if random.randint(1, 4) == 1:
                        # Non promotional weapon won
                        a = random.choice(lst.star5_standar_weapons)
                    else:
                        # 50-50% chance of getting either promotional weapon A or B
                        a = random.choice(lstbn.yoi_weapon_banner_5)
                        pp.flag_5star_weapon = True
                    # Adding to Inventory
                    inv.add_5star_weapon_inv(a)
                    add_gacha_weapon(5, item=a)
                    add_pity(four=True, five=True)
                else:
                    # Guaranteed one of the two 5* Promotional Weapons
                    a = random.choice(lstbn.yoi_weapon_banner_5)
                    # Adding to Inventory
                    inv.add_5star_weapon_inv(a)
                    pp.flag_5star_weapon = False
                    add_gacha_weapon(5, item=a)
                    add_pity(four=True, five=True)
                # Returning to the original weight percentages
                pull_percentage = og_pull_percentage.copy()
                pp.five_star_weapon_pity = 0

    # Init Star Animation
    # Checking if there is a 5*,4* or 3* in the pulls. If there are, the animation changes.
    check4 = any(item in gacha for item in lst.all_4star)
    check5 = any(item in gacha for item in lst.all_5star)
    if check5:
        # 5 Star animation
        wishes.animation(5, f'{wishes.banner_}')
    elif check4:
        # 4 Star animation
        wishes.animation(4, f'{wishes.banner_}')
    else:
        # 3 Star animation
        wishes.animation(3, f'{wishes.banner_}')
Beispiel #3
0
def get_banner_pity(rarity):
    if rarity == 5:
        if not pp.flag_5star_weapon:
            # 75% chance of getting a promotional weapon. 25% chance of getting a standard weapon
            if random.randint(1, 4) == 1:
                # Non promotional weapon won
                a = random.choice(lst.star5_standar_weapons)
                # Adding to Inventory
                inv.add_5star_weapon_inv(a)
            else:
                # 50-50% chance of getting either promotional weapon A or B
                a = random.choice(lstbn.yoi_weapon_banner_5)
                # Adding to Inventory
                inv.add_5star_weapon_inv(a)
                pp.flag_5star_weapon = True
            add_gacha_weapon(5, item=a)
            add_pity(four=True, five=True)
        else:
            # Guaranteed one of the two 5* Promotional Weapons
            a = random.choice(lstbn.yoi_weapon_banner_5)
            # Adding to Inventory
            inv.add_5star_weapon_inv(a)
            pp.flag_5star_weapon = False
            add_gacha_weapon(5, item=a)
            add_pity(four=True, five=True)
        pp.five_star_weapon_pity = 0

    elif rarity == 4:
        # If Promo Character was won = 50-50% Chance of winning another one
        if not pp.flag_4star_weapon:
            # 75% chance of getting either a promotional character, or a standard character/weapon
            if random.randint(1, 4) != 1:
                # Random Promotional 4* Weapon Won
                b = random.choice(lstbn.yoi_weapon_banner_4)
                # Adding to Inventory
                inv.add_4star_weapon_inv(b)
            else:
                pp.flag_4star_weapon = True
                # 50-50 chance of getting either a character or a weapon (standard)
                if random.randint(1, 2) == 1:
                    # Character won
                    b = random.choice(lst.all_4star_standard_except_akl)
                    # Adding to Inventory
                    inv.add_4star_char_inv(b)
                else:
                    # Weapon won
                    b = random.choice(lst.star4_standar_weapons)
                    # Adding to Inventory
                    inv.add_4star_weapon_inv(b)
            add_gacha_weapon(4, b)
            add_pity(four=True, five=True)
            pp.four_star_weapon_pity = 0
        else:
            # Guaranteed 4 Star Promotional Weapon
            b = random.choice(lstbn.yoi_weapon_banner_4)
            # Adding to Inventory
            inv.add_4star_weapon_inv(b)
            pp.flag_4star_weapon = False
            add_gacha_weapon(4, b)
            add_pity(four=True, five=True)
            pp.four_star_weapon_pity = 0
def standard_banner(limit):
    """
    Banner contains all standard 5 star characters and weapons, not including promotional ones
    Contains all standard 4 star characters and weapons, not including promotional ones
    Contains all 3 Star Weapons

    5 Star Hard Pity is configured at 90 , having higher probability of getting a 5 star after 74 (soft pity)
    4 Star Hard Pity is configured at 10
    There is a 50-50 chance to get either a 5 Star Character or Weapon
    There is a 50-50 chance to get either a 4 Star Character or Weapon

    Percentages:
    94.3% Chance to get a 3 Star
    5.1% Chance to get a 4 Star
    0.6% Chance to get a 5 Star
    """
    global gacha
    global gacha_show

    # Empty gatcha pulls
    gacha = []
    gacha_show = []

    # Weighted list for pull percentages (0.6% - 5.1% - 94.3%)
    # https://stackoverflow.com/questions/14992521/python-weighted-random
    og_pull_percentage = ['3'] * 943 + ['4'] * 51 + ['5'] * 6
    pull_percentage = og_pull_percentage.copy()

    for _ in range(1, limit + 1):
        # Pity System
        # 90 - Is 5 Star pity (n-1) = 89
        if pp.five_star_pity_standard >= 89:
            # Returning to the original weight percentages
            pull_percentage = og_pull_percentage.copy()
            banner_pity(5)
        # 10 - is 4 star pity (n-1) = 9
        elif pp.four_star_pity_standard >= 9:
            banner_pity(4)
        else:
            # Pulls
            if pp.five_star_pity_standard > 74:
                # Adding more prob to get a 5 star
                pull_percentage.extend(['5'] * 250)
            magic = random.choice(pull_percentage)
            # 3 Star
            if magic == '3':
                a = random.choice(lst.star3_weapons)
                add_gacha(3, a)
                inv.add_3star_weapon_inv(a)
                add_pity(four=True, five=True)
            # 4 Star
            elif magic == '4':
                # 50-50 chance of getting either a character or a weapon
                if random.randint(1, 2) == 1:
                    # Character won
                    a = random.choice(lst.star4_standard_characters)
                    # Adding to Inventory
                    inv.add_4star_char_inv(a)
                else:
                    # Weapon won
                    a = random.choice(lst.star4_standar_weapons)
                    # Adding to Inventory
                    inv.add_4star_weapon_inv(a)
                add_gacha(4, a)
                add_pity(four=True, five=True)
                pp.four_star_pity_standard = 0
            # 5 Star
            else:
                # 50-50 chance of getting either a character or a weapon
                if random.randint(1, 2) == 1:
                    # Character won
                    a = random.choice(lst.star5_standard_characters)
                    # Adding to Inventory
                    inv.add_5star_char_inv(a)
                else:
                    # Weapon won
                    a = random.choice(lst.star5_standar_weapons)
                    # Adding to Inventory
                    inv.add_5star_weapon_inv(a)
                add_gacha(5, a)
                add_pity(four=True, five=True)
                # Returning to the original weight percentages
                pull_percentage = og_pull_percentage.copy()
                pp.five_star_pity_standard = 0

    # Init Star Animation
    # Checking if there is a 5*,4* or 3* in the pulls. If there are, the animation changes.
    check4 = any(item in gacha for item in lst.all_4star)
    check5 = any(item in gacha for item in lst.all_5star)
    if check5:
        # 5 Star animation
        wishes.animation(5, f'{wishes.banner_}')
    elif check4:
        # 4 Star animation
        wishes.animation(4, f'{wishes.banner_}')
    else:
        # 3 Star animation
        wishes.animation(3, f'{wishes.banner_}')
Beispiel #5
0
def banner(limit):
    """
    Banner contains all standard 5 star characters, including promotional character 'Tortellini'
    Contains all standard 4 star characters and weapons
    Characters 'Yanfei','Ningguang' and 'Chongyun' have higher drop rate than the other ones
    Contains all 3 Star Weapons

    5 Star Hard Pity is configured at 90, having higher probability of getting a 5 star after 74 (soft pity)
    4 Star Hard Pity is configured at 10
    There is a 50-50 chance to get either a 5 Star Character or Weapon
    There is a 50-50 chance to get either a 4 Star Character or Weapon

    Percentages:
    94.3% Chance to get a 3 Star
    5.1% Chance to get a 4 Star
    0.6% Chance to get a 5 Star
    """
    global gacha
    global gacha_show

    # Empty gatcha pulls
    gacha = []
    gacha_show = []

    # Weighted list for pull percentages (0.6% - 5.1% - 94.3%)
    # https://stackoverflow.com/questions/14992521/python-weighted-random
    og_pull_percentage = ['3'] * 943 + ['4'] * 51 + ['5'] * 6
    pull_percentage = og_pull_percentage.copy()

    for _ in range(1, limit + 1):
        # Pity System
        # 90 - Is 5 Star pity (n-1) = 89
        if pp.five_star_promo_pity >= 89:
            # Returning to the original weight percentages
            pull_percentage = og_pull_percentage.copy()
            get_banner_pity(5)
        # 10 - is 4 star pity (n-1) = 9
        elif pp.four_star_promo_pity >= 9:
            get_banner_pity(4)
        else:
            # Pulls
            if pp.five_star_promo_pity > 74:
                # Adding more prob to get a 5 star
                pull_percentage.extend(['5'] * 250)
            magic = random.choice(pull_percentage)
            # 3 Star
            if magic == '3':
                a = random.choice(lst.star3_weapons)
                add_gacha(3, item=a)
                inv.add_3star_weapon_inv(a)
                add_pity(four=True, five=True)
            # 4 Star
            elif magic == '4':
                # If Promo Character was won = 50-50% Chance of winning another one
                if not pp.flag_4star:
                    # 50-50% chance of getting either a promotional character, or a standard character/weapon
                    if random.randint(1, 2) == 1:
                        # Promotional Character won
                        b = random.choice(lstbn.childe_re2_banner_4)
                        # Adding to Inventory
                        inv.add_4star_char_inv(b)
                    else:
                        pp.flag_4star = True
                        # 50-50 chance of getting either a character or a weapon
                        if random.randint(1, 2) == 1:
                            # Character won
                            b = random.choice(
                                lst.all_4star_standard_except_akl)
                            # Adding to Inventory
                            inv.add_4star_char_inv(b)
                        else:
                            # Weapon won
                            b = random.choice(lst.star4_standar_weapons)
                            # Adding to Inventory
                            inv.add_4star_weapon_inv(b)
                    add_gacha(4, b)
                    add_pity(four=True, five=True)
                    pp.four_star_promo_pity = 0
                else:
                    # Guaranteed 4 Star Promotional
                    b = random.choice(lstbn.childe_re2_banner_4)
                    # Adding to Inventory
                    inv.add_4star_char_inv(b)
                    pp.flag_4star = False
                    add_gacha(4, b)
                    add_pity(four=True, five=True)
                    pp.four_star_promo_pity = 0
            # 5 Star
            else:
                # If Promo Character was won = 50-50% Chance of winning another one
                if not pp.flag_5star:
                    # 50-50 chance of getting either a promotional character, or a standard character/weapon
                    if random.randint(1, 2) == 1:
                        # Promotional Character won
                        a = random.choice(lstbn.childe_re2_banner_5)
                        # Adding to Inventory
                        inv.add_5star_char_inv(a)
                    else:
                        # Standard Character Won
                        a = random.choice(lst.star5_standard_characters)
                        # Adding to Inventory
                        inv.add_5star_char_inv(a)
                        pp.flag_5star = True
                    add_gacha(5, item=a)
                    add_pity(four=True, five=True)
                else:
                    # Guaranteed 5 Star Promotional
                    a = random.choice(lstbn.childe_re2_banner_5)
                    # Adding to Inventory
                    inv.add_5star_char_inv(a)
                    pp.flag_5star = False
                    add_gacha(5, item=a)
                    add_pity(four=True, five=True)
                # Returning to the original weight percentages
                pull_percentage = og_pull_percentage.copy()
                pp.five_star_promo_pity = 0

    # Init Star Animation
    # Checking if there is a 5*,4* or 3* in the pulls. If there are, the animation changes.
    check4 = any(item in gacha for item in lst.all_4star)
    check5 = any(item in gacha for item in lst.all_5star)
    if check5:
        # 5 Star animation
        wishes.animation(5, f'{wishes.banner_}')
    elif check4:
        # 4 Star animation
        wishes.animation(4, f'{wishes.banner_}')
    else:
        # 3 Star animation
        wishes.animation(3, f'{wishes.banner_}')
Beispiel #6
0
def get_banner_pity(rarity):
    if rarity == 5:
        if not pp.flag_5star:
            # 50-50 chance of getting either a promotional character, or a standard character
            if random.randint(1, 2) == 1:
                # Promotional Character won
                a = random.choice(lstbn.childe_re2_banner_5)
                # Adding to Inventory
                inv.add_5star_char_inv(a)
            else:
                # Standard Character Won
                a = random.choice(lst.star5_standard_characters)
                # Adding to Inventory
                inv.add_5star_char_inv(a)
                pp.flag_5star = True
            add_gacha(5, item=a)
            add_pity(four=True, five=True)
        else:
            # Guaranteed 5 Star Promotional
            a = random.choice(lstbn.childe_re2_banner_5)
            # Adding to Inventory
            inv.add_5star_char_inv(a)
            pp.flag_5star = False
            add_gacha(5, item=a)
            add_pity(four=True, five=True)
        pp.five_star_promo_pity = 0

    elif rarity == 4:
        # If Promo Character was won = 50-50% Chance of winning another one
        if not pp.flag_4star:
            # 50-50 chance of getting either a promotional character, or a standard character/weapon
            if random.randint(1, 2) == 1:
                # Promotional Character won
                b = random.choice(lstbn.childe_re2_banner_4)
                # Adding to Inventory
                inv.add_4star_char_inv(b)
            else:
                pp.flag_4star = True
                # 50-50 chance of getting either a character or a weapon
                if random.randint(1, 2) == 1:
                    # Character won
                    b = random.choice(lst.all_4star_standard_except_akl)
                    # Adding to Inventory
                    inv.add_4star_char_inv(b)
                else:
                    # Weapon won
                    b = random.choice(lst.star4_standar_weapons)
                    # Adding to Inventory
                    inv.add_4star_weapon_inv(b)
            add_gacha(4, b)
            add_pity(four=True, five=True)
            pp.four_star_promo_pity = 0
        else:
            # Guaranteed 4 Star Promotional
            b = random.choice(lstbn.childe_re2_banner_4)
            # Adding to Inventory
            inv.add_4star_char_inv(b)
            pp.flag_4star = False
            add_gacha(4, b)
            add_pity(four=True, five=True)
            pp.four_star_promo_pity = 0