diff --git a/CMakeLists.txt b/CMakeLists.txt index e11fa8ed0ff..ef89a8f7cd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,6 @@ SET(SIMC_ENGINE_SOURCE "engine/sc_player.cpp" "engine/sc_plot.cpp" "engine/sc_raid_event.cpp" - "engine/sc_rating.cpp" "engine/sc_reforge_plot.cpp" "engine/sc_rng.cpp" "engine/sc_scaling.cpp" diff --git a/engine/Makefile b/engine/Makefile index 4e04c9808f1..8d7b4c8b94f 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -129,7 +129,6 @@ SRC = \ sc_player.cpp \ sc_plot.cpp \ sc_raid_event.cpp \ - sc_rating.cpp \ sc_reforge_plot.cpp \ sc_rng.cpp \ sc_scaling.cpp \ diff --git a/engine/class_modules/sc_hunter.cpp b/engine/class_modules/sc_hunter.cpp index bc5808ef743..19ebc69bb8d 100644 --- a/engine/class_modules/sc_hunter.cpp +++ b/engine/class_modules/sc_hunter.cpp @@ -645,13 +645,13 @@ struct hunter_main_pet_t : public hunter_pet_t { base_t::init_base_stats(); - base.stats.attribute[ ATTR_STRENGTH ] = rating_t::interpolate( level, 0, 162, 331, 476 ); - base.stats.attribute[ ATTR_AGILITY ] = rating_t::interpolate( level, 0, 54, 113, 438 ); - base.stats.attribute[ ATTR_STAMINA ] = rating_t::interpolate( level, 0, 307, 361 ); // stamina is different for every pet type + base.stats.attribute[ ATTR_STRENGTH ] = util::interpolate( level, 0, 162, 331, 476 ); + base.stats.attribute[ ATTR_AGILITY ] = util::interpolate( level, 0, 54, 113, 438 ); + base.stats.attribute[ ATTR_STAMINA ] = util::interpolate( level, 0, 307, 361 ); // stamina is different for every pet type base.stats.attribute[ ATTR_INTELLECT ] = 100; // FIXME: is 61 at lvl 75. Use /script print(UnitStats("pet",x)); 1=str,2=agi,3=stam,4=int,5=spi base.stats.attribute[ ATTR_SPIRIT ] = 100; // FIXME: is 101 at lvl 75. Values are equal for a cat and a gorilla. - resources.base[ RESOURCE_HEALTH ] = rating_t::interpolate( level, 0, 4253, 6373 ); + resources.base[ RESOURCE_HEALTH ] = util::interpolate( level, 0, 4253, 6373 ); resources.base[ RESOURCE_FOCUS ] = 100 + o() -> specs.kindred_spirits -> effectN( 1 ).resource( RESOURCE_FOCUS ); base_gcd = timespan_t::from_seconds( 1.20 ); diff --git a/engine/sc_player.cpp b/engine/sc_player.cpp index 7cfd4b0ecb9..d6cf14b99db 100644 --- a/engine/sc_player.cpp +++ b/engine/sc_player.cpp @@ -1172,7 +1172,11 @@ void player_t::init_base_stats() } #endif - base.rating.init( sim, dbc, level, type ); + if ( ! is_enemy() ) + base.rating.init( dbc, level ); + + if ( sim -> debug ) + sim -> output( "%s: Base Ratings initialized: %s", name(), base.rating.to_string().c_str() ); scale_challenge_mode( *this, base.rating ); // needs initialzied base.rating diff --git a/engine/sc_rating.cpp b/engine/sc_rating.cpp deleted file mode 100644 index 5615ed2fd2f..00000000000 --- a/engine/sc_rating.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// ========================================================================== -// Dedmonwakeen's Raid DPS/TPS Simulator. -// Send questions to natehieter@gmail.com -// ========================================================================== - -#include "simulationcraft.hpp" - -// ========================================================================== -// Rating -// ========================================================================== - -// rating_t::init =========================================================== - -void rating_t::init( sim_t* sim, dbc_t& dbc, int level, player_e type ) -{ - if ( sim -> debug ) sim -> output( "rating_t::init: level=%d type=%s", - level, util::player_type_string( type ) ); - - if ( player_t::_is_enemy( type ) ) - { - double max = +1.0E+50; - spell_haste = max; - spell_hit = max; - spell_crit = max; - attack_haste = max; - attack_hit = max; - attack_crit = max; - ranged_haste = max; - ranged_hit = max; - ranged_crit = max; - expertise = max; - dodge = max; - parry = max; - block = max; - mastery = max; - pvp_power = max; - } - else - { - spell_haste = dbc.combat_rating( RATING_SPELL_HASTE, level ); - spell_hit = dbc.combat_rating( RATING_SPELL_HIT, level ); - spell_crit = dbc.combat_rating( RATING_SPELL_CRIT, level ); - attack_haste = dbc.combat_rating( RATING_MELEE_HASTE, level ); - attack_hit = dbc.combat_rating( RATING_MELEE_HIT, level ); - attack_crit = dbc.combat_rating( RATING_MELEE_CRIT, level ); - ranged_haste = dbc.combat_rating( RATING_RANGED_HASTE, level ); - ranged_hit = dbc.combat_rating( RATING_RANGED_HIT, level ); - ranged_crit = dbc.combat_rating( RATING_RANGED_CRIT, level ); - expertise = dbc.combat_rating( RATING_EXPERTISE, level ); - dodge = dbc.combat_rating( RATING_DODGE, level ); - parry = dbc.combat_rating( RATING_PARRY, level ); - block = dbc.combat_rating( RATING_BLOCK, level ); - mastery = dbc.combat_rating( RATING_MASTERY, level ) / 100; - pvp_power = dbc.combat_rating( RATING_PVP_POWER, level ); - } -} - -// rating_t::interpolate ==================================================== - -double rating_t::interpolate( int level, - double val_60, - double val_70, - double val_80, - double val_85 ) -{ - if ( val_85 < 0 ) val_85 = val_80; // TODO - if ( level <= 60 ) - { - return val_60; - } - else if ( level == 70 ) - { - return val_70; - } - else if ( level == 80 ) - { - return val_80; - } - else if ( level >= 85 ) - { - return val_85; - } - else if ( level < 70 ) - { - // Assume linear progression for now. - double adjust = ( level - 60 ) / 10.0; - return val_60 + adjust * ( val_70 - val_60 ); - } - else if ( level < 80 ) - { - // Assume linear progression for now. - double adjust = ( level - 70 ) / 10.0; - return val_70 + adjust * ( val_80 - val_70 ); - } - else // ( level < 85 ) - { - // Assume linear progression for now. - double adjust = ( level - 80 ) / 5.0; - return val_80 + adjust * ( val_85 - val_80 ); - } - assert( 0 ); - return 0; -} diff --git a/engine/sc_util.cpp b/engine/sc_util.cpp index db75ad926bc..f8678104d98 100644 --- a/engine/sc_util.cpp +++ b/engine/sc_util.cpp @@ -204,44 +204,51 @@ bool util::str_in_str_ci( const std::string& l, return std::search( l.begin(), l.end(), r.begin(), r.end(), pred_ci ) != l.end(); } -// ability_rank ===================================================== +// rating_t::interpolate ==================================================== -double util::ability_rank( int player_level, - double ability_value, - int ability_level, ... ) +double util::interpolate( int level, + double val_60, + double val_70, + double val_80, + double val_85 ) { - va_list vap; - va_start( vap, ability_level ); - - while ( player_level < ability_level ) + if ( val_85 < 0 ) val_85 = val_80; // TODO + if ( level <= 60 ) { - ability_value = va_arg( vap, double ); - ability_level = va_arg( vap, int ); + return val_60; } - - va_end( vap ); - - return ability_value; -} - -// ability_rank ===================================================== - -int util::ability_rank( int player_level, - int ability_value, - int ability_level, ... ) -{ - va_list vap; - va_start( vap, ability_level ); - - while ( player_level < ability_level ) + else if ( level == 70 ) { - ability_value = va_arg( vap, int ); - ability_level = va_arg( vap, int ); + return val_70; } - - va_end( vap ); - - return ability_value; + else if ( level == 80 ) + { + return val_80; + } + else if ( level >= 85 ) + { + return val_85; + } + else if ( level < 70 ) + { + // Assume linear progression for now. + double adjust = ( level - 60 ) / 10.0; + return val_60 + adjust * ( val_70 - val_60 ); + } + else if ( level < 80 ) + { + // Assume linear progression for now. + double adjust = ( level - 70 ) / 10.0; + return val_70 + adjust * ( val_80 - val_70 ); + } + else // ( level < 85 ) + { + // Assume linear progression for now. + double adjust = ( level - 80 ) / 5.0; + return val_80 + adjust * ( val_85 - val_80 ); + } + assert( 0 ); + return 0; } // dot_behavior_type_string ========================================= diff --git a/engine/simulationcraft.hpp b/engine/simulationcraft.hpp index de56c2cc022..57c8a1e0e76 100644 --- a/engine/simulationcraft.hpp +++ b/engine/simulationcraft.hpp @@ -1180,8 +1180,9 @@ namespace util double wall_time(); double cpu_time(); -double ability_rank( int player_level, double ability_value, int ability_level, ... ); -int ability_rank( int player_level, int ability_value, int ability_level, ... ); +template +T ability_rank( int player_level, T ability_value, int ability_level, ... ); +double interpolate( int level, double val_60, double val_70, double val_80, double val_85 = -1 ); const char* attribute_type_string ( attribute_e type ); const char* dmg_type_string ( dmg_e type ); @@ -2854,6 +2855,7 @@ inline cache_e cache_from_rating( rating_e r ) case RATING_BLOCK: return CACHE_BLOCK; case RATING_MASTERY: return CACHE_MASTERY; case RATING_PVP_POWER: return CACHE_NONE; + case RATING_PVP_RESILIENCE: return CACHE_NONE; default: break; } assert( false ); return CACHE_NONE; @@ -2867,7 +2869,7 @@ struct rating_t double expertise; double dodge, parry, block; double mastery; - double pvp_power; + double pvp_resilience, pvp_power; double& get( rating_e r ) { @@ -2888,12 +2890,43 @@ struct rating_t case RATING_BLOCK: return block; case RATING_MASTERY: return mastery; case RATING_PVP_POWER: return pvp_power; + case RATING_PVP_RESILIENCE: return pvp_resilience; default: break; } assert( false ); return mastery; } - void init( sim_t*, dbc_t& pData, int level, player_e type ); - static double interpolate( int level, double val_60, double val_70, double val_80, double val_85 = -1 ); + + rating_t() + { + // Initialize all ratings to a very high number + double max = +1.0E+50; + for( rating_e i = static_cast( 0 ); i < RATING_MAX; ++i ) + { + get( i ) = max; + } + } + + void init( dbc_t& dbc, int level ) + { + // Read ratings from DBC + for( rating_e i = static_cast( 0 ); i < RATING_MAX; ++i ) + { + get( i ) = dbc.combat_rating( i, level ); + if ( i == RATING_MASTERY ) + get( i ) /= 100.0; + } + } + + std::string to_string() + { + std::ostringstream s; + for( rating_e i = static_cast( 0 ); i < RATING_MAX; ++i ) + { + if ( i > 0 ) s << " "; + s << util::cache_type_string( cache_from_rating( i ) ) << "=" << get( i ); // hacky + } + return s.str(); + } }; // Weapon =================================================================== @@ -5901,6 +5934,26 @@ T util::str_to_num ( const std::string& text ) return ss >> result ? result : T(); } +// ability_rank ===================================================== +template +T util::ability_rank( int player_level, + T ability_value, + int ability_level, ... ) +{ + va_list vap; + va_start( vap, ability_level ); + + while ( player_level < ability_level ) + { + ability_value = va_arg( vap, T ); + ability_level = va_arg( vap, int ); + } + + va_end( vap ); + + return ability_value; +} + // NEW ITEM STUFF REMOVED IN r #endif // SIMULATIONCRAFT_H diff --git a/simc.vcproj b/simc.vcproj index 3a37be48c39..edf86920a63 100644 --- a/simc.vcproj +++ b/simc.vcproj @@ -393,10 +393,6 @@ RelativePath=".\engine\sc_raid_event.cpp" > - - diff --git a/simc.vcxproj b/simc.vcxproj index c51318d9010..3593609fa42 100644 --- a/simc.vcxproj +++ b/simc.vcxproj @@ -217,7 +217,6 @@ - diff --git a/simc.vcxproj.filters b/simc.vcxproj.filters index 3f5e515ee26..5658dccfa41 100644 --- a/simc.vcxproj.filters +++ b/simc.vcxproj.filters @@ -28,7 +28,6 @@ - diff --git a/simc11.vcxproj b/simc11.vcxproj index 022090504d3..de1c3796139 100644 --- a/simc11.vcxproj +++ b/simc11.vcxproj @@ -257,7 +257,6 @@ - diff --git a/simc11.vcxproj.filters b/simc11.vcxproj.filters index 5d530473e24..409392ef303 100644 --- a/simc11.vcxproj.filters +++ b/simc11.vcxproj.filters @@ -20,7 +20,6 @@ - diff --git a/simcqt.pro b/simcqt.pro index 476992b52a0..dc83ee3b4d9 100644 --- a/simcqt.pro +++ b/simcqt.pro @@ -88,7 +88,6 @@ SOURCES += engine/sc_pet.cpp SOURCES += engine/sc_player.cpp SOURCES += engine/sc_plot.cpp SOURCES += engine/sc_raid_event.cpp -SOURCES += engine/sc_rating.cpp SOURCES += engine/sc_reforge_plot.cpp SOURCES += engine/sc_rng.cpp SOURCES += engine/sc_scaling.cpp diff --git a/simcqt.vcproj b/simcqt.vcproj index 3200d2fa2b5..3d51205cfb8 100644 --- a/simcqt.vcproj +++ b/simcqt.vcproj @@ -495,10 +495,6 @@ RelativePath="engine\sc_raid_event.cpp" > - - diff --git a/simcqt.vcxproj b/simcqt.vcxproj index 63ec393030a..8777a3e6229 100644 --- a/simcqt.vcxproj +++ b/simcqt.vcxproj @@ -199,7 +199,6 @@ - diff --git a/simcqt.vcxproj.filters b/simcqt.vcxproj.filters index b394a3c6103..c2118ee634d 100644 --- a/simcqt.vcxproj.filters +++ b/simcqt.vcxproj.filters @@ -127,9 +127,6 @@ Source Files - - Source Files - Source Files