Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Usage - scriptname amount_of_runs dust_animated_first
- # Notes - probability of fully animated packs is unknown, so this simulation to ignores it
- import sys
- import random
- vials = [[10, 30], [50, 120], [250, 600], [1000, 2500]] # dis value for normal/animated
- vials_cost = [50, 200, 800, 3500] # craft value
- animated_chance = 0.08 # no info on full animated packs
- expansion_size = [32, 32, 24, 16] # TotG
- #expansion_size = [40, 32, 24, 9] # RoB
- #expansion_size = [46, 31, 23, 9] # DE
- #expansion_size = [126, 99, 69, 24] # Standard
- opened_cards = [[[0, 0] for i in range(expansion_size[0])], [[0, 0] for i in range(expansion_size[1])], [[0, 0] for i in range(expansion_size[2])], [[0, 0] for i in range(expansion_size[3])]]
- dust_gained = 0
- dust_needed = 3 * (vials_cost[0] * expansion_size[0] + vials_cost[1] * expansion_size[1] + vials_cost[2] * expansion_size[2] + vials_cost[3] * expansion_size[3])
- print("Total vial cost of the expansion: " + str(dust_needed))
- dusted = [[0, 0], [0, 0], [0, 0], [0, 0]]
- def add_card(rarity, dust): # dust is order of dusting - 1 for dusting animated cards first, 0 for keeping them
- global opened_cards
- global dusted
- global dust_gained
- global dust_needed
- anim = 1 if random.random() < 0.08 else 0 #animated check
- card = random.randint(0, expansion_size[rarity] - 1)
- count = opened_cards[rarity][card][0] + opened_cards[rarity][card][1]
- if count < 3:
- opened_cards[rarity][card][anim] += 1
- dust_needed -= vials_cost[rarity]
- else:
- if (opened_cards[rarity][card][dust] > 0):
- dust_gained += vials[rarity][dust]
- opened_cards[rarity][card][dust] -= 1
- dusted[rarity][dust] += 1
- opened_cards[rarity][card][anim] += 1
- else:
- dust_gained += vials[rarity][anim]
- dusted[rarity][anim] += 1
- def open_pack(dust = 1): # dust is order of dusting - 1 for dusting animated cards first, 0 for keeping them
- for x in range(8):
- p = random.random()
- if p < 0.675 : # 67.5% bronze
- add_card(0, dust) if x != 7 else add_card(1, dust) # last card is silver+
- continue
- if p < 0.925 : # 25% silver
- add_card(1, dust)
- continue
- if p < 0.985 : # 6% gold
- add_card(2, dust)
- continue
- add_card(3, dust) # 1.5% legendary
- def check_completition(): #
- global dust_needed
- global dust_gained
- if dust_needed < dust_gained:
- return True
- else:
- return False
- def zero_cards_opened(): #reset everything between runs
- global opened_cards
- global dusted
- global dust_gained
- global dust_needed
- opened_cards = [[[0, 0] for i in range(expansion_size[0])], [[0, 0] for i in range(expansion_size[1])], [[0, 0] for i in range(expansion_size[2])], [[0, 0] for i in range(expansion_size[3])]]
- dust_gained = 0
- dust_needed = 3 * (vials_cost[0] * expansion_size[0] + vials_cost[1] * expansion_size[1] + vials_cost[2] * expansion_size[2] + vials_cost[3] * expansion_size[3])
- dusted = [[0, 0], [0, 0], [0, 0], [0, 0]]
- def main():
- global opened_cards
- global dusted
- global dust_gained
- global dust_needed
- argv = sys.argv
- if (len(argv) == 1): # add 1 try if not specified
- argv.append(1)
- if (len(argv) < 3): # dust animateds
- argv.append(1)
- random.seed()
- total_packs_opened = 0
- for x in range(int(argv[1])):
- packs_opened = 0
- zero_cards_opened()
- while(not check_completition()):
- open_pack(int(argv[2]))
- packs_opened += 1
- total_packs_opened += packs_opened
- # print(packs_opened)
- # print('Vials to complete: ' + str(dust_needed))
- # print('Vials gained: ' + str(dust_gained))
- # print('Dusted Bronze cards: ' + str(dusted[0][0]) + ', Animated: ' + str(dusted[0][1]))
- # print('Dusted Silver cards: ' + str(dusted[1][0]) + ', Animated: ' + str(dusted[1][1]))
- # print('Dusted Gold cards: ' + str(dusted[2][0]) + ', Animated: ' + str(dusted[2][1]))
- # print('Dusted Legendary cards: ' + str(dusted[3][0]) + ', Animated: ' + str(dusted[3][1]))
- print("Opened packs on average: " + str(float(total_packs_opened)/int(argv[1])))
- # print(opened_cards)
- # check_completition(0, True)
- if __name__ == '__main__':
- main()
- #Results:
- # TotG: 267 packs
- # RoB: 175 packs
- # DE: 173 packs
- # Standard: 482 packs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement