Created
May 10, 2024 18:46
-
-
Save LeonanCarvalho/a298be1a94c99661731c0ea966dd1d37 to your computer and use it in GitHub Desktop.
Lineage2 Compond Enchant probability calc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def simulate_enchant(current_level, target_level, total_attempts, probabilities): | |
success_count = 0 | |
simulations = 100000 # Number of simulations to average out randomness | |
for _ in range(simulations): | |
level = current_level | |
attempts = total_attempts | |
while level < target_level and attempts > 0: | |
if np.random.rand() <= probabilities[level]: | |
level += 1 # Successful enchant | |
else: | |
# If fails, reset to +24 or continue based on current level | |
level = 24 if level >= 26 else level | |
attempts -= 1 | |
if level >= target_level: | |
success_count += 1 | |
return success_count / simulations * 100 # Convert to percentage | |
# Number of attempts and enchant probabilities | |
attempts = 2682 | |
probabilities = { | |
24: 0.35, # +24 to +25 | |
25: 0.25, # +25 to +26 | |
26: 0.20, # +26 to +27 | |
27: 0.15, # +27 to +28 | |
28: 0.10, # +28 to +29 | |
29: 0.30 # +29 to +30 | |
} | |
# Probabilities to reach +28 and +30 starting from +26 | |
prob_to_28 = simulate_enchant(26, 28, attempts, probabilities) | |
prob_to_28 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment