Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import numpy as np
- import seaborn as sns
- import os
- import matplotlib
- import matplotlib.pyplot as plt
- plt.rc("font", family = "Malgun Gothic")
- sns.set(font="Malgun Gothic",
- rc={"axes.unicode_minus":False}, style='white')
- %matplotlib inline
- evol_db = {
- 't2_limitbreak_1': [('evol_multiplier', lambda x: x + 0.1)],
- 't2_limitbreak_2': [('evol_multiplier', lambda x: x + 0.2)],
- 't2_limitbreak_3': [('evol_multiplier', lambda x: x + 0.3)],
- 't2_keen_sense_1': [('evol_multiplier', lambda x: x + 0.05), ('crit_rate', lambda x: x + 0.04)],
- 't2_keen_sense_2': [('evol_multiplier', lambda x: x + 0.1), ('crit_rate', lambda x: x + 0.08)],
- 't3_full_force_smite_1': [('evol_multiplier', lambda x: x + 0.02), ('crit_rate', lambda x: x + 0.12)],
- 't3_full_force_smite_2': [('evol_multiplier', lambda x: x + 0.04), ('crit_rate', lambda x: x + 0.24)],
- 't3_strike_2': [('crit_rate', lambda x: x + 0.2), ('crit_damage', lambda x: x + 0.32)],
- 't3_strike_2_nonba': [('crit_rate', lambda x: x + 0.2)],
- 't3_juggernaut_2': [('evol_multiplier', lambda x: x + 0.24)],
- 't3_juggernaut_1': [('evol_multiplier', lambda x: x + 0.12)],
- 't3_domination_1': [('evol_multiplier', lambda x: x + 0.08), ('cdr', lambda x: x + 0.05)],
- 't3_domination_2': [('evol_multiplier', lambda x: x + 0.16), ('cdr', lambda x: x + 0.1)],
- 't4_mana_forge': [('evol_multiplier', lambda x: x + 0.225)],
- 't4_standup_fight': [('evol_multiplier', lambda x: x + 0.21)],
- 't4_blunt_spike': [('evol_multiplier', lambda x: x + 0.15)],
- }
- engravings_db = {
- 'stabilized': [('damage_multiplier', lambda x: x*1.17)],
- 'kbw': [('damage_multiplier', lambda x: x*0.98), ('crit_damage', lambda x: x + 0.52)],
- 'grudge': [('damage_multiplier', lambda x: x*1.21)],
- 'cd': [('damage_multiplier', lambda x: x*1.17)],
- 'manaregen': [('damage_multiplier', lambda x: x*1.16)],
- 'adrenaline': [('crit_rate', lambda x: x + 0.2), ('atk_multiplier', lambda x: x + 0.054)],
- 'pd': [('crit_rate', lambda x: x + 0.2), ('crit_damage', lambda x: x - 0.06)],
- 'raid_captain': [('damage_multiplier', lambda x: x*(1+0.4*0.48))],
- 'mass_increase': [('damage_multiplier', lambda x: x*1.19)],
- 'master_elixir': [('crit_rate', lambda x: x + 0.07), ('additional_damage_multiplier', lambda x: x + 0.085)],
- 'crit_elixir': [('crit_damage_mutiplier', lambda x: x*1.12)],
- 'critdam_elixir': [('crit_damage', lambda x: x + 0.07)],
- 'adddam_elixir': [('additional_damage_multiplier', lambda x: x + 0.031)],
- 'ambush_master': [('damage_multiplier', lambda x: x*1.226)],
- 'ambush_master_nonba': [('damage_multiplier', lambda x: x*1.076)],
- }
- enlightment_db = {
- 'ew_ba': [('damage_multiplier', lambda x: x*1.16 * 1.06), ('crit_damage', lambda x: x + 0.08), ('crit_rate', lambda x: x + 0.24)],
- 'ew_nba': [('damage_multiplier', lambda x: x*1.16), ('crit_damage', lambda x: x + 0.08), ('crit_rate', lambda x: x + 0.24)],
- 'ew_synergy': [('crit_rate', lambda x: x + 0.1)],
- 'at_core_enchant': [('crit_rate', lambda x: x + 0.09)]
- }
- class APassive():
- def __init__(self, name):
- self.name = name
- self.atk_multiplier = 1.0
- self.damage_multiplier = 1.0
- self.crit_rate = 0.02 # support bracelet
- self.crit_damage = 2.0
- self.crit_damage_mutiplier = 1.0
- self.crit_total_multiplier = 1.0
- self.additional_damage_multiplier = 1.3 # weapon quality
- self.evol_multiplier = 1.0 + 0.14 # support
- self.spec_multiplier = 1.0
- self.cdr = 0.24 # level 10 cdr gem
- self.cdr_reduction_coefficient = 1.0
- def set_stat(self, crit_stat: int, spec_stat: int, swift_stat: int, spec_stat_coefficient: float):
- crit_stat_coefficient = 0.000357
- swift_cdr_coefficient = 1/(46.57*100)
- self.crit_stat = crit_stat + 60
- self.spec_stat = spec_stat + 60
- self.swift_stat = swift_stat + 60
- self.spec_multiplier = spec_stat_coefficient*(self.spec_stat) + 1.0
- self.crit_rate = self.crit_rate + (self.crit_stat)*crit_stat_coefficient
- self.cdr = self.cdr + (self.swift_stat)*swift_cdr_coefficient
- def back_attack(self, ba=bool):
- if ba:
- self.crit_rate += 0.1
- self.damage_multiplier *= 1.05
- def set_engravings(self, engravings: list, engravings_db: dict):
- self.engravings = engravings
- for engraving in engravings:
- for target_stat, effect_func in engravings_db[engraving]:
- attribute = getattr(self, target_stat)
- setattr(self, target_stat, effect_func(attribute))
- def set_enlightment(self, enlightments: list, enlightment_db: dict):
- self.enlightment = enlightments
- for enlightment in enlightments:
- for target_stat, effect_func in enlightment_db[enlightment]:
- attribute = getattr(self, target_stat)
- setattr(self, target_stat, effect_func(attribute))
- def set_evol(self, evol_nodes: list, evol_db: dict):
- self.evol_nodes = evol_nodes
- for evol_node in evol_nodes:
- for target_stat, effect_func in evol_db[evol_node]:
- attribute = getattr(self, target_stat)
- setattr(self, target_stat, effect_func(attribute))
- def blunt_spike(self):
- if self.crit_rate >= 0.8:
- blunt_spike_evol_bonus = min(1.4*(self.crit_rate - 0.8), 0.55)
- self.evol_multiplier += blunt_spike_evol_bonus
- self.crit_rate = min(self.crit_rate, 0.8)
- def expected_dps(self):
- self.crit_total_multiplier = (self.crit_rate)*self.crit_damage*self.crit_damage_mutiplier + (1-self.crit_rate)
- self.total_damage = self.atk_multiplier * self.damage_multiplier * self.crit_total_multiplier * self.additional_damage_multiplier * self.evol_multiplier * self.spec_multiplier
- self.total_dps = self.total_damage/(1-self.cdr*self.cdr_reduction_coefficient)
- def build_output_calc(self, target_attr_list):
- result = {}
- for attr in target_attr_list:
- result[attr] = getattr(self, attr)
- return result
- target_attr_list = ['crit_stat', 'spec_stat', 'swift_stat', 'engravings', 'enlightment', 'evol_nodes',
- 'evol_multiplier', 'damage_multiplier', 'crit_rate', 'crit_damage',
- 'crit_damage_mutiplier', 'additional_damage_multiplier', 'atk_multiplier',
- 'cdr', 'cdr_reduction_coefficient', 'total_damage', 'total_dps']
- spec_stat_coefficient = 0
- input_data = {
- '뭉툭한가시_저받달인': {
- 'crit_base': 1500 + 100 + 160, 'spec_base': 0, 'swift_base': 500 + 100,
- 'spec_stat_coefficient': spec_stat_coefficient,
- 'engravings': ['grudge', 'raid_captain', 'mass_increase', 'cd', 'kbw', 'master_elixir', 'critdam_elixir'],
- 'enlightment': ['at_core_enchant'],
- 'evol_nodes': ['t2_limitbreak_3', 't3_full_force_smite_2', 't4_blunt_spike']},
- '뭉툭한가시_저받회심': {
- 'crit_base': 1500 + 100 + 160, 'spec_base': 0, 'swift_base': 500 + 100,
- 'spec_stat_coefficient': spec_stat_coefficient,
- 'engravings': ['grudge', 'raid_captain', 'mass_increase', 'cd', 'kbw', 'crit_elixir', 'adddam_elixir'],
- 'enlightment': ['at_core_enchant'],
- 'evol_nodes': ['t2_limitbreak_1', 't2_keen_sense_2', 't3_full_force_smite_2', 't4_blunt_spike']},
- '입식타격_아드회심': {
- 'crit_base': 1500 + 100 + 160, 'spec_base': 0, 'swift_base': 500 + 100,
- 'spec_stat_coefficient': spec_stat_coefficient,
- 'engravings': ['grudge', 'raid_captain', 'mass_increase', 'cd', 'kbw', 'crit_elixir', 'critdam_elixir'],
- 'enlightment': ['at_core_enchant'],
- 'evol_nodes': ['t2_limitbreak_3', 't3_full_force_smite_1', 't3_domination_1', 't4_standup_fight']},
- '파괴전차입식_저받': {
- 'crit_base': 1500 + 100 + 160, 'spec_base': 0, 'swift_base': 500 + 100,
- 'spec_stat_coefficient': spec_stat_coefficient,
- 'engravings': ['grudge', 'raid_captain', 'mass_increase', 'cd', 'kbw', 'crit_elixir', 'critdam_elixir'],
- 'enlightment': ['at_core_enchant'],
- 'evol_nodes': ['t2_limitbreak_3', 't3_full_force_smite_1', 't3_juggernaut_1', 't4_standup_fight']},
- '파괴전차뭉가_아드': {
- 'crit_base': 1500 + 100 + 160, 'spec_base': 0, 'swift_base': 500 + 100,
- 'spec_stat_coefficient': spec_stat_coefficient,
- 'engravings': ['grudge', 'raid_captain', 'mass_increase', 'adrenaline', 'kbw', 'crit_elixir', 'critdam_elixir'],
- 'enlightment': ['at_core_enchant'],
- 'evol_nodes': ['t2_limitbreak_1', 't2_keen_sense_2', 't3_juggernaut_2', 't4_blunt_spike']}
- }
- output_data = {}
- target_attr_list = ['crit_stat', 'spec_stat', 'swift_stat', 'engravings', 'enlightment', 'evol_nodes',
- 'evol_multiplier', 'damage_multiplier', 'crit_rate', 'crit_damage',
- 'crit_damage_mutiplier', 'additional_damage_multiplier', 'atk_multiplier',
- 'cdr', 'cdr_reduction_coefficient', 'total_damage', 'total_dps']
- for key in input_data.keys():
- build = input_data[key]
- model = APassive(key)
- model.set_stat(crit_stat=build['crit_base'], spec_stat=build['spec_base'],
- swift_stat=build['swift_base'], spec_stat_coefficient=build['spec_stat_coefficient'])
- model.back_attack(ba=True)
- model.set_engravings(engravings=build['engravings'], engravings_db=engravings_db)
- model.set_enlightment(enlightments=build['enlightment'], enlightment_db=enlightment_db)
- model.set_evol(evol_nodes=build['evol_nodes'], evol_db=evol_db)
- if 't4_blunt_spike' in build['evol_nodes']:
- model.blunt_spike()
- model.expected_dps()
- output_data[key] = model.build_output_calc(target_attr_list)
- output_data[key]['build'] = key
- output_df = pd.DataFrame(output_data).transpose()
- output_df['damage_percentage'] = (output_df.total_damage / output_df.total_damage.min()).map(lambda x: round(x, 3))
- output_df['dps_percentage'] = (output_df.total_dps / output_df.total_dps.min()).map(lambda x: round(x, 3))
- output_df_kr = output_df.copy()
- output_df_kr.columns = ['치', '특', '신', '각인', '깨달음', '진화', '진화형피해계수',
- '피해량증가계수', '치명타적중률', '치피', '치피뎀(회심)', '추가피해계수',
- '공격력계수', '쿨감', '쿨감감소율(미사용)', '사이클데미지계수', 'DPS계수', '빌드명',
- '사이클데미지퍼센트환산', 'DPS퍼센트환산']
- output_df_kr.to_excel('result.xlsx')
- output_viz = output_df[['damage_percentage', 'dps_percentage', 'build']]
- output_viz.columns = ['데미지 배율', 'DPS 배율', '빌드']
- fig, ax = plt.subplots(figsize=(8, 8))
- ax=sns.barplot(
- data=pd.melt(output_viz, id_vars='빌드', value_vars=['데미지 배율', 'DPS 배율']),
- x='variable', y='value', hue='빌드')
- ax.set_title('빌드별 데미지/DPS 비교')
- ax.set_ylabel('데미지 증가량 계수')
- ax.set_xlabel('변수')
- ax.legend(title='빌드')
- plt.tight_layout()
- for i in ax.containers:
- ax.bar_label(i,)
- fig.savefig('passive_test/build_compare_at.png')
- output_df_kr[['빌드명', '치', '특', '신', '진화형피해계수',
- '피해량증가계수', '치명타적중률', '치피', '치피뎀(회심)', '추가피해계수',
- '공격력계수', '쿨감', '사이클데미지계수', 'DPS계수',
- '사이클데미지퍼센트환산', 'DPS퍼센트환산']].reset_index(drop=True).to_excel('result.xlsx')
Advertisement
Add Comment
Please, Sign In to add comment