Skip to content

Commit

Permalink
Add corruption/corruption resistance stats to core
Browse files Browse the repository at this point in the history
Depending on what Blizzard decides to do with the stat, we may need more
functionality implemented (for example options to adjust things, scale
factor calcs etc), however for now we only need to be able to represent
the composite value somehow.
  • Loading branch information
navv1234 committed Nov 3, 2019
1 parent c7d17fa commit 3904ce5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
6 changes: 3 additions & 3 deletions engine/dbc/data_enums.hh
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,9 @@ enum item_mod_type {
ITEM_MOD_CRIT_MELEE_RATING = 19,
ITEM_MOD_CRIT_RANGED_RATING = 20,
ITEM_MOD_CRIT_SPELL_RATING = 21,
ITEM_MOD_HIT_TAKEN_MELEE_RATING = 22,
ITEM_MOD_HIT_TAKEN_RANGED_RATING = 23,
ITEM_MOD_HIT_TAKEN_SPELL_RATING = 24,
ITEM_MOD_CORRUPTION = 22,
ITEM_MOD_CORRUPTION_RESISTANCE = 23, // TODO: Guess
ITEM_MOD_UNSUSED = 24,
ITEM_MOD_CRIT_TAKEN_MELEE_RATING = 25,
ITEM_MOD_CRIT_TAKEN_RANGED_RATING = 26,
ITEM_MOD_CRIT_TAKEN_SPELL_RATING = 27,
Expand Down
2 changes: 2 additions & 0 deletions engine/sc_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,8 @@ enum stat_e
STAT_LEECH_RATING,
STAT_SPEED_RATING,
STAT_AVOIDANCE_RATING,
STAT_CORRUPTION,
STAT_CORRUPTION_RESISTANCE,
STAT_ARMOR,
STAT_BONUS_ARMOR,
STAT_RESILIENCE_RATING,
Expand Down
17 changes: 14 additions & 3 deletions engine/sc_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,9 @@ const char* util::stat_type_string( stat_e stat )
case STAT_SPEED_RATING: return "speed_rating";
case STAT_AVOIDANCE_RATING: return "avoidance_rating";

case STAT_CORRUPTION: return "corruption";
case STAT_CORRUPTION_RESISTANCE: return "corruption_resistance";

case STAT_ALL: return "all";

default: return "unknown";
Expand Down Expand Up @@ -1415,6 +1418,9 @@ const char* util::stat_type_abbrev( stat_e stat )
case STAT_SPEED_RATING: return "RunSpeed";
case STAT_AVOIDANCE_RATING: return "Avoidance";

case STAT_CORRUPTION: return "Cor";
case STAT_CORRUPTION_RESISTANCE: return "Rcor";

case STAT_ALL: return "All";

default: return "unknown";
Expand Down Expand Up @@ -1962,6 +1968,8 @@ stat_e util::translate_item_mod( int item_mod )
case ITEM_MOD_LEECH_RATING: return STAT_LEECH_RATING;
case ITEM_MOD_SPEED_RATING: return STAT_SPEED_RATING;
case ITEM_MOD_AVOIDANCE_RATING: return STAT_AVOIDANCE_RATING;
case ITEM_MOD_CORRUPTION: return STAT_CORRUPTION;
case ITEM_MOD_CORRUPTION_RESISTANCE: return STAT_CORRUPTION_RESISTANCE;
default: return STAT_NONE;
}
}
Expand Down Expand Up @@ -1995,6 +2003,8 @@ int util::translate_stat( stat_e stat )
case STAT_LEECH_RATING: return ITEM_MOD_LEECH_RATING;
case STAT_SPEED_RATING: return ITEM_MOD_SPEED_RATING;
case STAT_AVOIDANCE_RATING: return ITEM_MOD_AVOIDANCE_RATING;
case STAT_CORRUPTION: return ITEM_MOD_CORRUPTION;
case STAT_CORRUPTION_RESISTANCE: return ITEM_MOD_CORRUPTION_RESISTANCE;
default: return ITEM_MOD_NONE;
}
}
Expand Down Expand Up @@ -2082,6 +2092,10 @@ rating_e util::stat_to_rating( stat_e s )
return RATING_PARRY;
case STAT_BLOCK_RATING:
return RATING_BLOCK;
case STAT_CORRUPTION:
return RATING_CORRUPTION;
case STAT_CORRUPTION_RESISTANCE:
return RATING_CORRUPTION_RESISTANCE;
default:
return RATING_MAX;
}
Expand Down Expand Up @@ -2756,9 +2770,6 @@ bool util::is_combat_rating( item_mod_type t )
case ITEM_MOD_CRIT_MELEE_RATING:
case ITEM_MOD_CRIT_RANGED_RATING:
case ITEM_MOD_CRIT_SPELL_RATING:
case ITEM_MOD_HIT_TAKEN_MELEE_RATING:
case ITEM_MOD_HIT_TAKEN_RANGED_RATING:
case ITEM_MOD_HIT_TAKEN_SPELL_RATING:
case ITEM_MOD_CRIT_TAKEN_MELEE_RATING:
case ITEM_MOD_CRIT_TAKEN_RANGED_RATING:
case ITEM_MOD_CRIT_TAKEN_SPELL_RATING:
Expand Down
13 changes: 11 additions & 2 deletions engine/sim/sc_gear_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ void gear_stats_t::add_stat( stat_e stat,
case STAT_RESILIENCE_RATING: resilience_rating += value; break;
case STAT_PVP_POWER: pvp_power += value; break;

case STAT_CORRUPTION: corruption += value; break;
case STAT_CORRUPTION_RESISTANCE: corruption_resistance += value; break;

case STAT_ALL:
for ( attribute_e i = ATTRIBUTE_NONE; i < ATTRIBUTE_STAT_ALL_MAX; i++ )
{ attribute[ i ] += value; }
Expand Down Expand Up @@ -145,8 +148,11 @@ void gear_stats_t::set_stat( stat_e stat,

case STAT_MASTERY_RATING: mastery_rating = value; break;

case STAT_RESILIENCE_RATING: resilience_rating += value; break;
case STAT_PVP_POWER: pvp_power += value; break;
case STAT_RESILIENCE_RATING: resilience_rating = value; break;
case STAT_PVP_POWER: pvp_power = value; break;

case STAT_CORRUPTION: corruption = value; break;
case STAT_CORRUPTION_RESISTANCE: corruption_resistance = value; break;

case STAT_ALL:
for ( attribute_e i = ATTRIBUTE_NONE; i < ATTRIBUTE_STAT_ALL_MAX; i++ )
Expand Down Expand Up @@ -221,6 +227,9 @@ double gear_stats_t::get_stat( stat_e stat ) const
case STAT_RESILIENCE_RATING: return resilience_rating;
case STAT_PVP_POWER: return pvp_power;

case STAT_CORRUPTION: return corruption;
case STAT_CORRUPTION_RESISTANCE: return corruption_resistance;

case STAT_ALL: return default_value;

default: assert( 0 ); break;
Expand Down
8 changes: 7 additions & 1 deletion engine/simulationcraft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ struct gear_stats_t
double leech_rating;
double speed_rating;
double avoidance_rating;
double corruption;
double corruption_resistance;

gear_stats_t() :
default_value( 0.0 ), attribute(), resource(),
Expand All @@ -407,7 +409,7 @@ struct gear_stats_t
weapon_offhand_dps( 0.0 ), weapon_offhand_speed( 0.0 ), armor( 0.0 ), bonus_armor( 0.0 ), dodge_rating( 0.0 ),
parry_rating( 0.0 ), block_rating( 0.0 ), mastery_rating( 0.0 ), resilience_rating( 0.0 ), pvp_power( 0.0 ),
versatility_rating( 0.0 ), leech_rating( 0.0 ), speed_rating( 0.0 ),
avoidance_rating( 0.0 )
avoidance_rating( 0.0 ), corruption( 0.0 ), corruption_resistance( 0.0 )
{ }

void initialize( double initializer )
Expand Down Expand Up @@ -441,6 +443,8 @@ struct gear_stats_t
leech_rating = initializer;
speed_rating = initializer;
avoidance_rating = initializer;
corruption = initializer;
corruption_resistance = initializer;
}

friend gear_stats_t operator+( const gear_stats_t& left, const gear_stats_t& right )
Expand Down Expand Up @@ -476,6 +480,8 @@ struct gear_stats_t
leech_rating += right.leech_rating;
speed_rating += right.speed_rating;
avoidance_rating += right.avoidance_rating;
corruption += right.corruption;
corruption_resistance += right.corruption_resistance;
range::transform ( attribute, right.attribute, attribute.begin(), std::plus<double>() );
range::transform ( resource, right.resource, resource.begin(), std::plus<double>() );
return *this;
Expand Down

0 comments on commit 3904ce5

Please sign in to comment.