Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions engine/action/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2739,12 +2739,15 @@ void action_t::init()

if ( does_periodic_damage() )
{
snapshot_flags |= STATE_MUL_TA | STATE_TGT_MUL_TA | STATE_MUL_PERSISTENT | STATE_VERSATILITY;
snapshot_flags |= STATE_MUL_TA | STATE_TGT_MUL_TA | STATE_TGT_MITG_TA | STATE_MUL_PERSISTENT | STATE_VERSATILITY;
}

if ( does_direct_damage() )
{
snapshot_flags |= STATE_MUL_DA | STATE_TGT_MUL_DA | STATE_MUL_PERSISTENT | STATE_VERSATILITY;
snapshot_flags |= STATE_MUL_DA | STATE_TGT_MUL_DA | STATE_TGT_MITG_DA | STATE_MUL_PERSISTENT | STATE_VERSATILITY;

if ( school == SCHOOL_PHYSICAL )
snapshot_flags |= STATE_TGT_ARMOR;
}

if ( player->is_pet() && ( snapshot_flags & ( STATE_MUL_DA | STATE_MUL_TA | STATE_TGT_MUL_DA | STATE_TGT_MUL_TA |
Expand All @@ -2753,9 +2756,6 @@ void action_t::init()
snapshot_flags |= STATE_MUL_PET | STATE_TGT_MUL_PET;
}

if ( school == SCHOOL_PHYSICAL )
snapshot_flags |= STATE_TGT_ARMOR;

if ( data().flags( spell_attribute::SX_DISABLE_PLAYER_MULT ) ||
data().flags( spell_attribute::SX_DISABLE_PLAYER_HEALING_MULT ) )
{
Expand Down Expand Up @@ -4367,14 +4367,15 @@ void action_t::snapshot_internal( action_state_t* state, unsigned flags, result_
if ( flags & STATE_TGT_CRIT )
state->target_crit_chance = composite_target_crit_chance( state->target ) * composite_crit_chance_multiplier();

// Armor MUST BE SNAPSHOT BEFORE any mitigation multipliers
if ( flags & STATE_TGT_ARMOR )
state->target_armor = composite_target_armor( state->target );

if ( flags & STATE_TGT_MITG_DA )
state->target_mitigation_da_multiplier = composite_target_mitigation( state->target, get_school() );
state->target_mitigation_da_multiplier = composite_target_mitigation( state, true );

if ( flags & STATE_TGT_MITG_TA )
state->target_mitigation_ta_multiplier = composite_target_mitigation( state->target, get_school() );

if ( flags & STATE_TGT_ARMOR )
state->target_armor = composite_target_armor( state->target );
state->target_mitigation_ta_multiplier = composite_target_mitigation( state, false );
}

// action_t::composite_dot_duration =========================================
Expand Down Expand Up @@ -5012,14 +5013,15 @@ double action_t::composite_rolling_ta_multiplier( const action_state_t* s ) cons

/// Persistent modifiers that are snapshot at the start of the spell cast

double action_t::composite_persistent_multiplier(const action_state_t*) const
double action_t::composite_persistent_multiplier( const action_state_t* ) const
{
return player->composite_persistent_multiplier(get_school());
return player->composite_persistent_multiplier( get_school() );
}

double action_t::composite_target_mitigation(player_t* t, school_e s) const
double action_t::composite_target_mitigation( const action_state_t* s, bool direct ) const
{
return t->composite_mitigation_multiplier(s);
return s->target->composite_mitigation_multiplier( s, get_school(), direct ) *
s->target->composite_mitigation_from_player_multiplier( s->action->player, s, get_school(), direct );
}

double action_t::composite_player_critical_multiplier( const action_state_t* s ) const
Expand Down
4 changes: 2 additions & 2 deletions engine/action/action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,9 +976,9 @@ struct action_t : private noncopyable
virtual double composite_aoe_multiplier( const action_state_t* ) const
{ return 1.0; }

virtual double composite_target_mitigation( player_t* t, school_e s ) const;
virtual double composite_target_mitigation( const action_state_t*, bool direct ) const;

virtual double composite_player_critical_multiplier( const action_state_t* s ) const;
virtual double composite_player_critical_multiplier( const action_state_t* ) const;

/// Action proc type, needed for dynamic aoe stuff and such.
virtual proc_types proc_type() const
Expand Down
6 changes: 1 addition & 5 deletions engine/action/action_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ void action_state_t::initialize()
result = RESULT_NONE;
result_type = result_amount_type::NONE;
block_result = BLOCK_RESULT_UNBLOCKED;
result_raw = result_total = result_mitigated = result_absorbed =
result_amount = blocked_amount = self_absorb_amount = 0;
result_raw = result_total = result_mitigated = result_absorbed = result_amount = self_absorb_amount = 0;
}
/*
void action_state_t::copy_state( const action_state_t* o )
Expand Down Expand Up @@ -91,7 +90,6 @@ void action_state_t::copy_state( const action_state_t* o )
result_absorbed = o->result_absorbed;
result_crit_bonus = o->result_crit_bonus;
result_amount = o->result_amount;
blocked_amount = o->blocked_amount;
self_absorb_amount = o->self_absorb_amount;
haste = o->haste;
crit_chance = o->crit_chance;
Expand Down Expand Up @@ -133,7 +131,6 @@ action_state_t::action_state_t( action_t* a, player_t* t )
result_absorbed( 0 ),
result_crit_bonus( 0 ),
result_amount( 0 ),
blocked_amount( 0 ),
self_absorb_amount( 0 ),
haste( 1.0 ),
crit_chance( 0 ),
Expand Down Expand Up @@ -210,7 +207,6 @@ std::ostringstream& action_state_t::debug_str( std::ostringstream& s )
s << " absorbed_amount=" << result_absorbed;
s << " crit_bonus=" << result_crit_bonus;
s << " actual_amount=" << result_amount;
s << " only_blocked_damage=" << blocked_amount;
s << " self_absorbed_damage=" << self_absorb_amount;
s << " ap=" << attack_power;
s << " sp=" << spell_power;
Expand Down
3 changes: 1 addition & 2 deletions engine/action/action_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ struct action_state_t : private noncopyable
block_result_e block_result;
double result_raw; // Base result value, without crit/glance etc.
double result_total; // Total unmitigated result, including crit bonus, glance penalty, etc.
double result_mitigated; // Result after mitigation / resist. *NOTENOTENOTE* Only filled after action_t::impact() call
double result_mitigated; // Result after mitigation / resist.
double result_absorbed; // Result after absorption. *NOTENOTENOTE* Only filled after action_t::impact() call
double result_crit_bonus; // Crit bonus multiplier used in the final calculation
double result_amount; // Final (actual) result
double blocked_amount; // The amount of damage reduced via block or critical block
double self_absorb_amount; // The amount of damage reduced via personal absorbs such as shield_barrier.
// Snapshotted stats during execution
double haste;
Expand Down
8 changes: 8 additions & 0 deletions engine/action/heal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ void heal_t::init()
{
base_t::init();

snapshot_flags &= ~( STATE_TGT_MITG_DA | STATE_TGT_MITG_TA );
update_flags &= ~( STATE_TGT_MITG_DA | STATE_TGT_MITG_TA );

record_healing = player->record_healing();
}

Expand All @@ -96,6 +99,11 @@ double heal_t::composite_ta_multiplier( const action_state_t* s ) const
return m;
}

double heal_t::composite_target_multiplier( player_t* t ) const
{
return t->composite_player_healing_received_multiplier();
}

double heal_t::composite_player_critical_multiplier( const action_state_t* ) const
{
return player->composite_player_critical_healing_multiplier();
Expand Down
1 change: 1 addition & 0 deletions engine/action/heal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct heal_t : public spell_base_t
int num_targets() const override;
double composite_da_multiplier( const action_state_t* s ) const override;
double composite_ta_multiplier( const action_state_t* s ) const override;
double composite_target_multiplier( player_t* ) const override;
double composite_player_critical_multiplier( const action_state_t* /* s */ ) const override;
double composite_versatility( const action_state_t* state ) const override;
double total_crit_bonus( const action_state_t* ) const override;
Expand Down
77 changes: 45 additions & 32 deletions engine/action/parse_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ std::string ratings_invalidate( const player_effect_t& data )

std::string school( uint32_t opt )
{
return opt == 0x7f ? "All" : util::school_type_string( dbc::get_school_type( opt ) );
return opt == 0x7f ? "all" : util::school_type_string( dbc::get_school_type( opt ) );
}

std::string pet_type( uint32_t opt )
Expand Down Expand Up @@ -664,7 +664,7 @@ bool parse_effects_t::parse_effect( pack_t<U>& pack, size_t i, bool force )
return false;
}

if ( pack.data.value != 0.0 )
if ( pack.data.type & VALUE_OVERRIDE )
{
val = pack.data.value;
val_mul = 1.0;
Expand Down Expand Up @@ -750,7 +750,7 @@ bool parse_effects_t::parse_effect( pack_t<U>& pack, size_t i, bool force )
tmp.simple = false;
}

if ( tmp.simple && !tmp.buff )
if ( tmp.simple && !tmp.buff && !( tmp.type & PARSE_PASSIVE ) )
{
throw_passive_error( pack.spell );
return false;
Expand Down Expand Up @@ -1132,16 +1132,28 @@ double parse_player_effects_t::composite_player_target_pet_damage_multiplier( pl
return tm;
}

void parse_player_effects_t::target_mitigation( school_e school, result_amount_type, action_state_t* state )
double parse_player_effects_t::composite_mitigation_multiplier( const action_state_t* s, school_e school, bool direct ) const
{
for ( const auto& i : damage_taken_multiplier_effects )
auto m = player_t::composite_mitigation_multiplier( s, school, direct );

for ( const auto& i : mitigation_multiplier_effects )
if ( i.opt_enum & dbc::get_school_mask( school ) )
state->result_amount *= 1.0 + get_effect_value( i );
m *= 1.0 + get_effect_value( i );

auto td = get_target_data( state->target );
for ( const auto& i : target_damage_done_multiplier_effects )
return m;
}

double parse_player_effects_t::composite_mitigation_from_player_multiplier( player_t* source, const action_state_t* s,
school_e school, bool direct ) const
{
auto m = player_t::composite_mitigation_from_player_multiplier( source, s, school, direct );
auto td = get_target_data( source );

for ( const auto& i : mitigation_from_target_multiplier_effects )
if ( i.opt_enum & dbc::get_school_mask( school ) )
state->result_amount *= 1.0 + get_effect_value( i, td );
m *= 1.0 + get_effect_value( i, td );

return m;
}

void parse_player_effects_t::invalidate_cache( cache_e c )
Expand Down Expand Up @@ -1322,7 +1334,7 @@ std::vector<player_effect_t>* parse_player_effects_t::get_effect_vector( const s
tmp.opt_enum = eff.misc_value1();
str = opt_strings::school( tmp.opt_enum );
str += " damage taken";
return &damage_taken_multiplier_effects;
return &mitigation_multiplier_effects;

case A_MOD_ABSORB_DONE_PERCENT:
str = "absorb multiplier";
Expand Down Expand Up @@ -1379,15 +1391,15 @@ void parse_player_effects_t::debug_message( const player_effect_t& data, std::st
void parse_player_effects_t::throw_passive_error( const spell_data_t* s )
{
if ( s->flags( SX_PASSIVE ) )
sim->error( TRIVIAL,
"Parse Effects: Spell `{}` ignored. Passive effects are applied automatically. Please remove this from "
"parse_effects().",
s->name_cstr() );
{
sim->error(
"Parse Effects: {} is a passive spell and applied automatically. Please remove this from parse_effects().", *s );
}
else
sim->error( TRIVIAL,
"Parse Effects: Spell `{}` was ignored due to being detected as a passive effect. If this is "
"incorrect, please report it.",
s->name_cstr() );
{
sim->error(
"Parse Effects: {} was determined to be a passive spell and ignored. Please report if incorrect.", *s );
}
}

bool parse_player_effects_t::is_valid_target_aura( const spelleffect_data_t& eff ) const
Expand Down Expand Up @@ -1424,7 +1436,8 @@ std::vector<target_effect_t>* parse_player_effects_t::get_effect_vector( const s
case A_MOD_DAMAGE_TO_CASTER:
tmp.opt_enum = eff.misc_value1();
str = opt_strings::school( tmp.opt_enum );
return &target_damage_done_multiplier_effects;
str += " damage taken from target";
return &mitigation_from_target_multiplier_effects;

default:
return nullptr;
Expand All @@ -1436,7 +1449,7 @@ std::vector<target_effect_t>* parse_player_effects_t::get_effect_vector( const s
void parse_player_effects_t::debug_message( const target_effect_t&, std::string_view type_str, std::string_view val_str,
const spelleffect_data_t& eff )
{
sim->print_debug( "target-effects: Target {} damage taken modified by {} from {}", type_str, val_str, eff );
sim->print_debug( "target-effects: {} {} modified by {} from {}", *this, type_str, val_str, eff );
}

void parse_player_effects_t::print_custom_parsed_effects( report::sc_html_stream& os ) const
Expand Down Expand Up @@ -1468,8 +1481,9 @@ void parse_player_effects_t::print_custom_parsed_effects( report::sc_html_stream
print_parsed_type( os, crit_chance_effects, "Crit Chance" );
print_parsed_type( os, crit_bonus_effects, "Crit Damage Bonus" );
print_parsed_type( os, dodge_effects, "Dodge" );
print_parsed_type( os, damage_taken_multiplier_effects, "Damage Taken Multiplier", &opt_strings::school );
print_parsed_type( os, target_damage_done_multiplier_effects, "Target Damage Done Multiplier", &opt_strings::school );
print_parsed_type( os, mitigation_multiplier_effects, "Damage Taken Multiplier", &opt_strings::school );
print_parsed_type( os, mitigation_from_target_multiplier_effects, "Damage Taken From Target Multiplier",
&opt_strings::school );
print_parsed_type( os, expertise_effects, "Expertise" );
print_parsed_type( os, haste_effects, "All Haste" );
print_parsed_type( os, melee_haste_effects, "Melee Haste" );
Expand Down Expand Up @@ -1516,8 +1530,8 @@ size_t parse_player_effects_t::total_effects_count() const
mastery_effects.size() +
parry_rating_from_crit_effects.size() +
dodge_effects.size() +
damage_taken_multiplier_effects.size() +
target_damage_done_multiplier_effects.size() +
mitigation_multiplier_effects.size() +
mitigation_from_target_multiplier_effects.size() +
absorb_multiplier_effects.size() +
healing_received_effects.size() +
absorb_received_mult_effects.size() +
Expand Down Expand Up @@ -1761,16 +1775,15 @@ void parse_action_base_t::debug_message( const player_effect_t& data, std::strin
void parse_action_base_t::throw_passive_error( const spell_data_t* s )
{
if ( s->flags( SX_PASSIVE ) )
{
_action->sim->error(
TRIVIAL,
"Parse Effects: Spell `{}` ignored. Passive effects are applied automatically. Please remove this from "
"parse_effects().",
s->name_cstr() );
"Parse Effects: {} is a passive spell and applied automatically. Please remove this from parse_effects().", *s );
}
else
_action->sim->error( TRIVIAL,
"Parse Effects: Spell `{}` was ignored due to being detected as a passive effect. If this is "
"incorrect, please report it.",
s->name_cstr() );
{
_action->sim->error(
"Parse Effects: {} was determined to be a passive spell and ignored. Please report if incorrect.", *s );
}
}

bool parse_action_base_t::is_valid_target_aura( const spelleffect_data_t& eff ) const
Expand Down
22 changes: 12 additions & 10 deletions engine/action/parse_effects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ enum parse_flag_e : uint16_t
CONSUME_BUFF = 0x0010,
ROUND_VALUE = 0x0020, // uses std::round (round to nearest integer, round half away from zero)
IGNORE_WHITELIST = 0x0040,
PARSE_PASSIVE = 0x0080, // force parsing of passive effects
// internal flags that should not be used in parse_effects()
VALUE_OVERRIDE = 0x0100,
AFFECTED_OVERRIDE = 0x0200,
MANUAL_ENTRY = 0x0400,
VALUE_FUNCTION = 0x0800
VALUE_OVERRIDE = 0x1000,
AFFECTED_OVERRIDE = 0x2000,
MANUAL_ENTRY = 0x4000,
VALUE_FUNCTION = 0x8000
};

enum parse_callback_e
Expand Down Expand Up @@ -346,7 +347,7 @@ struct parse_base_t
return;
}

if ( mod == ROUND_VALUE )
if ( mod == ROUND_VALUE || mod == PARSE_PASSIVE )
{
pack.data.type |= mod;
return;
Expand Down Expand Up @@ -715,8 +716,8 @@ struct parse_player_effects_t : public player_t, public parse_effects_t
std::vector<player_effect_t> mastery_effects;
std::vector<player_effect_t> parry_rating_from_crit_effects;
std::vector<player_effect_t> dodge_effects;
std::vector<player_effect_t> damage_taken_multiplier_effects;
std::vector<target_effect_t> target_damage_done_multiplier_effects;
std::vector<player_effect_t> mitigation_multiplier_effects;
std::vector<target_effect_t> mitigation_from_target_multiplier_effects;
std::vector<player_effect_t> absorb_multiplier_effects;
std::vector<player_effect_t> absorb_received_mult_effects;
std::vector<player_effect_t> healing_received_effects;
Expand Down Expand Up @@ -753,13 +754,14 @@ struct parse_player_effects_t : public player_t, public parse_effects_t
double composite_mastery() const override;
double composite_parry_rating() const override;
double composite_dodge() const override;
double composite_player_absorb_multiplier( const action_state_t* s ) const override;
double composite_player_absorb_multiplier( const action_state_t* ) const override;
double composite_player_healing_received_multiplier() const override;
double composite_player_absorb_received_multiplier() const override;
double composite_player_target_multiplier( player_t*, school_e ) const override;
double composite_player_target_pet_damage_multiplier( player_t*, bool ) const override;

void target_mitigation( school_e, result_amount_type, action_state_t* ) override;
double composite_mitigation_multiplier( const action_state_t*, school_e, bool direct ) const override;
double composite_mitigation_from_player_multiplier( player_t*, const action_state_t*, school_e,
bool direct ) const override;

void invalidate_cache( cache_e c ) override;

Expand Down
Loading