Skip to content

Commit

Permalink
✨ Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
tookender committed Oct 18, 2024
1 parent 847df23 commit aa394c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 26 deletions.
6 changes: 3 additions & 3 deletions extensions/dq/calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ async def calc_potential(self, ctx, current_power: int, current_upgrades: int, t
app_commands.Choice(name="Jade Roller", value="Jade Roller"),
app_commands.Choice(name="Solar Beam (2 ticks)", value="Solar Beam (2 ticks)"),
])
async def calc_damage(self, ctx, ability: app_commands.Choice[str], helmet_power: Optional[int], armor_power: Optional[int], weapon_power: Optional[int],
ring1_power: Optional[int], ring2_power: Optional[int], damage_skill_points: Optional[int]):
damage = calculate_damage(ability, helmet_power, armor_power, weapon_power, ring1_power, ring2_power, damage_skill_points)
async def calc_damage(self, ctx, ability: app_commands.Choice[str], helmet_power: int, armor_power: int, weapon_power: int,
ring1_power: int, ring2_power: int, damage_skill_points: int):
damage = calculate_damage(ability, armor_power, helmet_power, weapon_power, ring1_power, ring2_power, damage_skill_points)

ni_low = damage['No Inner']['Low Damage']
ni_avg = damage['No Inner']['Average']
Expand Down
38 changes: 15 additions & 23 deletions utils/calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,7 @@ def calculate_upgrade_cost(current, total):
return cost


def calc_dmg(weapon, armor, helm, ring1, ring2, skill, ability_multiplier):
weapon = weapon or 0
armor = armor or 0
helm = helm or 0
ring1 = ring1 or 0
ring2 = ring2 or 0
skill = skill or 1
return (weapon + armor + helm + ring1 + ring2) * skill * ability_multiplier

def truncate(value):
return int(value)

def calculate_damage(selected_ability, weapon, armor, helm, ring1, ring2, skill):
def calculate_damage(selected_ability, armor, helmet, weapon, ring1, ring2, skill):
abilities = [
{"name": "Spinning Blade Smash / Void Dragon", "multiplier": 148},
{"name": "Kunai Knives (3 ticks)", "multiplier": 150 / 3},
Expand All @@ -57,7 +45,7 @@ def calculate_damage(selected_ability, weapon, armor, helm, ring1, ring2, skill)

ability_multiplier = next((a["multiplier"] for a in abilities if a["name"] == selected_ability), 0)

dmg = calc_dmg(weapon, armor, helm, ring1, ring2, skill, ability_multiplier)
dmg = (weapon + armor + helmet + ring1 + ring2) * skill * ability_multiplier

low = dmg * 0.95
high = dmg * 1.05
Expand All @@ -73,17 +61,17 @@ def calculate_damage(selected_ability, weapon, armor, helm, ring1, ring2, skill)
base_e_inner = dmg * 1.9
high_e_inner = dmg * 1.9 * 1.05

low_damage = truncate(low)
base_damage = truncate(dmg)
high_damage = truncate(high)
low_damage = int(low)
base_damage = int(dmg)
high_damage = int(high)

low_inner_damage = truncate(low_inner)
base_inner_damage = truncate(base_inner)
high_inner_damage = truncate(high_inner)
low_inner_damage = int(low_inner)
base_inner_damage = int(base_inner)
high_inner_damage = int(high_inner)

low_e_inner_damage = truncate(low_e_inner)
base_e_inner_damage = truncate(base_e_inner)
high_e_inner_damage = truncate(high_e_inner)
low_e_inner_damage = int(low_e_inner)
base_e_inner_damage = int(base_e_inner)
high_e_inner_damage = int(high_e_inner)

return {
"No Inner": {
Expand All @@ -100,5 +88,9 @@ def calculate_damage(selected_ability, weapon, armor, helm, ring1, ring2, skill)
"Low Damage": low_e_inner_damage,
"Average": base_e_inner_damage,
"High Damage": high_e_inner_damage
},
f"Other Information": {
"ability_multiplier": ability_multiplier,
"dmg": dmg,
}
}

0 comments on commit aa394c7

Please sign in to comment.