Last active
December 30, 2024 12:02
-
-
Save minisbett/c4e7026180cda874687582e5f2d255f4 to your computer and use it in GitHub Desktop.
An optimizer for Pillar, Howa, Facon Technique and Master of all Trades
This file contains hidden or 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 argparse | |
| def calculate_damage(dex, str, int, do_print, no_howa, no_falcon, no_moat): | |
| if do_print: print("Attributes") | |
| if do_print: print("--------------------") | |
| if do_print: print(f"Total: {dex + int + str}") | |
| if do_print: print(f"Dex: {dex} Int: {int} Str: {str}") | |
| if do_print: print() | |
| # | |
| # Attack Damage | |
| # | |
| # Howa attack damage (10 lightning damage per 10 intelligence) | |
| if do_print: print("Damage") | |
| if do_print: print("--------------------") | |
| if no_howa: | |
| attack_damage = 1 | |
| if do_print: print(f"Base Damage: 1") | |
| else: | |
| attack_damage = int // 10 * 10 | |
| if do_print: print(f"Base Damage (Howa): {attack_damage}") | |
| # Pillar attack damage multiplier (+10% per 5 strength) | |
| attack_damage_multiplier_pillar = (str // 5) * 0.1 | |
| if do_print: print(f"Damage Multiplier (Pillar): {round(attack_damage_multiplier_pillar * 100, 1)}%") | |
| # Master of All Trades attack damage multiplier (+2% per 5 of lowest attribute) | |
| lowest_stat = min(dex, str, int) | |
| attack_damage_multiplier_moat = 0 if no_moat else (lowest_stat // 5) * 0.02 | |
| if not no_moat: | |
| if do_print: print(f"Damage Multiplier (MoAT): {round(attack_damage_multiplier_moat * 100, 1)}%") | |
| # | |
| # Attack Speed Bonus | |
| # | |
| if do_print: print() | |
| if do_print: print("Attack Speed") | |
| if do_print: print("--------------------") | |
| # Pillar attack speed bonus (+2% per 5 dexterity) | |
| attack_speed_bonus_pillar = (dex // 5) * 0.02 # +2% per 5 dexterity | |
| if do_print: print(f"Attack Speed Bonus (Pillar): {attack_speed_bonus_pillar * 100}%") | |
| # Falcon Technique attack speed bonus (+1% per 15 dexterity) | |
| attack_speed_bonus_falcon = 0 if no_falcon else (dex // 15) * 0.01 # +1% per 15 dexterity | |
| if do_print and not no_falcon: print(f"Attack Speed Bonus (Falcon): {attack_speed_bonus_falcon * 100}%") | |
| # Howa attack speed bonus (+3% per 25 dexterity) | |
| attack_speed_bonus_howa = 0 if no_howa else (dex // 25) * 0.03 # +3% per 25 dexterity | |
| if do_print and not no_howa: print(f"Attack Speed Bonus (Howa): {attack_speed_bonus_howa * 100}%") | |
| # | |
| # Total Damage | |
| # | |
| if do_print: print() | |
| if do_print: print("Resulting Damage") | |
| if do_print: print("--------------------") | |
| # Total attack damage multiplier | |
| attack_damage_multiplier = attack_damage_multiplier_pillar + attack_damage_multiplier_moat | |
| if do_print: print(f"Damage Multiplier: {round(attack_damage_multiplier * 100, 1)}%") | |
| # Total attack speed bonus | |
| attack_speed_bonus = attack_speed_bonus_pillar + attack_speed_bonus_falcon + attack_speed_bonus_howa | |
| if do_print: print(f"Attack Speed Bonus: {attack_speed_bonus * 100}%") | |
| # Final damage formula | |
| if do_print: print(f"Damage per Use: {round(attack_damage * attack_damage_multiplier, 1)}") | |
| dps = (1 + attack_speed_bonus) * attack_damage * attack_damage_multiplier | |
| if do_print: print(f"Damage per Second: {round(dps, 1)}") | |
| return dps | |
| def optimize_stats(total_points, dex_override, str_override, int_override, no_howa, no_falcon, no_moat, polymathy): | |
| max_damage = 0 | |
| best_split = (0, 0, 0) | |
| poly_mult = 1.1 if polymathy else 1 | |
| total_points = int(round(total_points / poly_mult)) | |
| # Iterate through all possible splits of total points | |
| for dex in range(0, total_points + 1): | |
| if dex_override is not None: | |
| dex = int(round(dex_override / poly_mult)) | |
| for str in range(0, total_points - dex + 1): | |
| if str_override is not None: | |
| str = int(round(str_override / poly_mult)) | |
| int_ = total_points - dex - str | |
| if int_override is not None: | |
| int_ = int(round(int_override / poly_mult)) | |
| if dex + str + int_ > total_points: # Ensure the int override doesn't exceed the total | |
| continue | |
| damage = calculate_damage(dex, str, int_, False, no_howa, no_falcon, no_moat) | |
| if damage > max_damage: | |
| max_damage = damage | |
| best_split = (round(dex * poly_mult), round(str * poly_mult), round(int_ * poly_mult)) | |
| calculate_damage(*best_split, True, no_howa, no_falcon, no_moat) | |
| if __name__ == "__main__": | |
| parser = argparse.ArgumentParser(description="Optimize stats for max damage.") | |
| parser.add_argument("-T", type=int, required=True, help="Total points to distribute.") | |
| parser.add_argument("--dex", type=int, help="Override Dexterity value.") | |
| parser.add_argument("--str", type=int, help="Override Strength value.") | |
| parser.add_argument("--int", type=int, help="Override Intelligence value.") | |
| parser.add_argument("--no-howa", action="store_true", help="Disable Howa bonuses.") | |
| parser.add_argument("--no-falcon", action="store_true", help="Disable Falcon bonuses.") | |
| parser.add_argument("--no-moat", action="store_true", help="Disable Master of All Trades bonuses.") | |
| parser.add_argument("--polymathy", action="store_true", help="Enable Polymathy (+10% to all attributes).") | |
| args = parser.parse_args() | |
| optimize_stats( | |
| total_points=args.T, | |
| dex_override=args.dex, | |
| str_override=args.str, | |
| int_override=args.int, | |
| no_howa=args.no_howa, | |
| no_falcon=args.no_falcon, | |
| no_moat=args.no_moat, | |
| polymathy=args.polymathy | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment