Skip to content

Commit

Permalink
[Hunter] Unnatural Causes bug, capture all the erroneous extra damage…
Browse files Browse the repository at this point in the history
… mods in spelldata
  • Loading branch information
Jayezi committed Jan 19, 2025
1 parent c83f32f commit af0d2eb
Showing 1 changed file with 48 additions and 25 deletions.
73 changes: 48 additions & 25 deletions engine/class_modules/sc_hunter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,14 @@ struct hunter_td_t: public actor_target_data_t

struct dots_t
{
dot_t* explosive_shot;
dot_t* serpent_sting;
dot_t* a_murder_of_crows;
dot_t* wildfire_bomb;
dot_t* black_arrow;
dot_t* barbed_shot;
dot_t* cull_the_herd;
dot_t* explosive_shot;
dot_t* merciless_blow;
dot_t* merciless_blow;
dot_t* black_arrow;
} dots;

hunter_td_t( player_t* target, hunter_t* p );
Expand Down Expand Up @@ -964,8 +964,8 @@ struct hunter_t final : public player_t
cooldowns.ruthless_marauder = get_cooldown( "ruthless_marauder" );
cooldowns.coordinated_assault = get_cooldown( "coordinated_assault" );

cooldowns.black_arrow = get_cooldown( "black_arrow" );
cooldowns.bleak_powder = get_cooldown( "bleak_powder_icd" );
cooldowns.black_arrow = get_cooldown( "black_arrow" );
cooldowns.bleak_powder = get_cooldown( "bleak_powder_icd" );
cooldowns.banshees_mark = get_cooldown( "banshees_mark" );

cooldowns.lunar_storm = get_cooldown( "lunar_storm" );
Expand Down Expand Up @@ -1093,7 +1093,9 @@ struct hunter_action_t: public Base

struct {
bool cull_the_herd = false;
damage_affected_by unnatural_causes;
damage_affected_by unnatural_causes; // 10% direct from 459527 effect 4, 10% tick from 459527 effect 5
bool unnatural_causes_debuff; // 10-15% dmg taken from caster spells from 459529 effect 1
bool unnatural_causes_debuff_label; // 10-15% dmg taken from caster spells (label) from 459529 effect 2

// bm
bool thrill_of_the_hunt = false;
Expand Down Expand Up @@ -1135,7 +1137,11 @@ struct hunter_action_t: public Base
}

if ( p->talents.unnatural_causes.ok() )
affected_by.unnatural_causes = parse_damage_affecting_aura( this, p->talents.unnatural_causes_debuff );
{
affected_by.unnatural_causes = parse_damage_affecting_aura( this, p->talents.unnatural_causes );
affected_by.unnatural_causes_debuff = check_affected_by( this, p->talents.unnatural_causes_debuff->effectN( 1 ) );
affected_by.unnatural_causes_debuff_label = check_affected_by( this, p->talents.unnatural_causes_debuff->effectN( 2 ) );
}

affected_by.sniper_training = parse_damage_affecting_aura( this, p -> mastery.sniper_training );
affected_by.trueshot_crit_damage_bonus = check_affected_by( this, p -> talents.trueshot -> effectN( 5 ) );
Expand Down Expand Up @@ -1282,15 +1288,7 @@ struct hunter_action_t: public Base
am *= 1 + p()->talents.coordinated_assault->effectN( affected_by.coordinated_assault.direct ).percent();

if ( affected_by.unnatural_causes.direct )
{
double amount = p()->talents.unnatural_causes_debuff->effectN( affected_by.unnatural_causes.direct ).percent();
if ( s->target->health_percentage() < p()->talents.unnatural_causes->effectN( 3 ).base_value() )
{
amount *= 1 + p()->talents.unnatural_causes->effectN( 2 ).percent();
}

am *= 1 + amount;
}
am *= 1 + p()->talents.unnatural_causes->effectN( affected_by.unnatural_causes.direct ).percent();

int affected_by_tip = std::max( affected_by.tip_of_the_spear.direct, affected_by.tip_of_the_spear_explosive.direct );
if ( affected_by_tip && p()->buffs.tip_of_the_spear->check() )
Expand Down Expand Up @@ -1343,13 +1341,7 @@ struct hunter_action_t: public Base
}

if ( affected_by.unnatural_causes.tick )
{
double amount = p()->talents.unnatural_causes_debuff->effectN( affected_by.unnatural_causes.tick ).percent();
if ( s->target->health_percentage() < p()->talents.unnatural_causes->effectN( 3 ).base_value() )
amount *= 1 + p()->talents.unnatural_causes->effectN( 2 ).percent();

am *= 1 + amount;
}
am *= 1 + p()->talents.unnatural_causes->effectN( affected_by.unnatural_causes.tick ).percent();

if ( affected_by.coordinated_assault.tick && p()->buffs.coordinated_assault->check() )
am *= 1 + p()->talents.coordinated_assault->effectN( affected_by.coordinated_assault.tick ).percent();
Expand Down Expand Up @@ -1402,13 +1394,44 @@ struct hunter_action_t: public Base
return cm;
}

double composite_target_da_multiplier( player_t* target ) const override
{
double da = ab::composite_target_da_multiplier( target );

if ( affected_by.unnatural_causes_debuff || affected_by.unnatural_causes_debuff_label )
{
double execute_mod = 0.0;
if ( target->health_percentage() < p()->talents.unnatural_causes->effectN( 3 ).base_value() )
execute_mod = p()->talents.unnatural_causes->effectN( 2 ).percent();

if ( affected_by.unnatural_causes_debuff )
da *= 1 + p()->talents.unnatural_causes_debuff->effectN( 1 ).percent() * ( 1 + execute_mod );

if ( affected_by.unnatural_causes_debuff_label )
da *= 1 + p()->talents.unnatural_causes_debuff->effectN( 2 ).percent() * ( 1 + execute_mod );
}

return da;
}

double composite_target_ta_multiplier( player_t* target ) const override
{
double ta = ab::composite_target_ta_multiplier( target );

if ( affected_by.cull_the_herd && p() -> get_target_data( target ) -> dots.cull_the_herd -> is_ticking() )
{
ta *= 1 + p() -> talents.cull_the_herd -> effectN( 3 ).percent();

if ( affected_by.unnatural_causes_debuff || affected_by.unnatural_causes_debuff_label )
{
double execute_mod = 0.0;
if ( target->health_percentage() < p()->talents.unnatural_causes->effectN( 3 ).base_value() )
execute_mod = p()->talents.unnatural_causes->effectN( 2 ).percent();

if ( affected_by.unnatural_causes_debuff )
ta *= 1 + p()->talents.unnatural_causes_debuff->effectN( 1 ).percent() * ( 1 + execute_mod );

if ( affected_by.unnatural_causes_debuff_label )
ta *= 1 + p()->talents.unnatural_causes_debuff->effectN( 2 ).percent() * ( 1 + execute_mod );
}

return ta;
Expand Down Expand Up @@ -4333,7 +4356,7 @@ struct black_arrow_dot_t : public hunter_ranged_attack_t
}
}
};

struct black_arrow_base_t : public kill_shot_base_t
{
struct bleak_powder_t : public hunter_ranged_attack_t
Expand Down

0 comments on commit af0d2eb

Please sign in to comment.