Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import seaborn as sns
- import matplotlib.pyplot as plt
- np.random.seed(1234)
- # [02/07 18:30] Whisper from [Owner] Blah: gold can roll from 1375 to 2000, even % chance for every integer. A total
- # boost up to 200% is added to that roll consisting of the % sums of resistances, mob debuff and elemental distribution
- # [02/07 18:31] Whisper from [Owner] Blah: Resistances can roll from 5% to 40%, mob debuff from 5% to -15%, elemental
- # can roll from 5% to 30% (for elemental it is the distance away from 30% that is the boost)
- # [02/07 18:31] Whisper from [Owner] Blah: so ultimately 40% * 3 + 5% + 25% * 3 which should total to 200%
- # Theoretical max: 2000 * (1 + 0.4 + 0.4 + 0.4 + 0.05 + 0.25 + 0.25 + 0.25) = 6000
- # Theoretical min: 1375 * (1 + 0.05 + 0.05 + 0.05 - 0.15 + 0.0 + 0.0 + 0.0) = 1375
- num_simulations = 1_000_000
- sim = []
- for i in range(num_simulations):
- base_gold = np.random.randint(1375, 2000 + 1)
- water_res = np.random.randint(5, 41) / 100.0
- fire_res = np.random.randint(5, 41) / 100.0
- thunder_res = np.random.randint(5, 41) / 100.0
- mob_debuff = np.random.randint(-15, 6) / 100.0
- water_dis = 0.3 - np.random.randint(5, 31) / 100.0
- fire_dis = 0.3 - np.random.randint(5, 31) / 100.0
- thunder_dis = 0.3 - np.random.randint(5, 31) / 100.0
- roll_gold = base_gold * (1 + water_res + fire_res + thunder_res + mob_debuff + water_dis + fire_dis + thunder_dis)
- sim.append(roll_gold)
- mu = np.mean(sim)
- std = np.std(sim)
- print(f'min: {np.min(sim)}')
- print(f'max: {np.max(sim)}')
- fake_data = np.random.normal(loc=mu, scale=std, size=num_simulations)
- fig, ax = plt.subplots(figsize=(9, 7), dpi=80)
- sns.histplot(sim, color=colors[0], kde=True, edgecolor=None, alpha=0.4, ax=ax, bins=50)
- plt.xlim(1375, 6000)
- plt.title('Catacomb base gold probability analysis', fontsize=14)
- plt.xlabel('Base gold', fontsize=12)
- plt.ylabel('Count', fontsize=12)
- plt.subplots_adjust(bottom=0.3)
- plt.gcf().text(0.66, 0.89, f'Theoretical min: {1375}', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.86, f'Theoretical max: {6000}', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.81, f'P(gold) > {np.percentile(sim, 50):.2f} = 50%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.78, f'P(gold) > {np.percentile(sim, 80):.2f} = 20%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.75, f'P(gold) > {np.percentile(sim, 90):.2f} = 10%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.72, f'P(gold) > {np.percentile(sim, 95):.2f} = 5%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.69, f'P(gold) > {np.percentile(sim, 97.5):.2f} = 2.5%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.66, f'P(gold) > {np.percentile(sim, 99):.2f} = 1%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.63, f'P(gold) > {np.percentile(sim, 99.9):.2f} = 0.1%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.60, f'P(gold) > {np.percentile(sim, 99.99):.2f} = 0.01%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.57, f'P(gold) > {np.percentile(sim, 99.999):.2f} = 0.001%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.52, f'P(gold) > 4000 = {(1-(np.array(sim) < 4000).astype(int).mean())*100:.3f}%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.49, f'P(gold) > 4250 = {(1-(np.array(sim) < 4250).astype(int).mean())*100:.3f}%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.46, f'P(gold) > 4500 = {(1-(np.array(sim) < 4500).astype(int).mean())*100:.3f}%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.43, f'P(gold) > 4750 = {(1-(np.array(sim) < 4750).astype(int).mean())*100:.3f}%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.40, f'P(gold) > 5000 = {(1-(np.array(sim) < 5000).astype(int).mean())*100:.3f}%', fontsize=12, family='monospace')
- plt.gcf().text(0.66, 0.37, f'P(gold) > 5250 = {(1-(np.array(sim) < 5250).astype(int).mean())*100:.3f}%', fontsize=12, family='monospace')
- plt.gcf().text(0.84, 0.02, 'Player data: anfneub', fontsize=8)
- plt.tight_layout()
- plt.savefig('cata_gold.png')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement