Skip to content

Instantly share code, notes, and snippets.

@cgdangelo
Created October 27, 2017 13:56
Show Gist options
  • Save cgdangelo/f5fa2031f587358c96450e683537e2e4 to your computer and use it in GitHub Desktop.
Save cgdangelo/f5fa2031f587358c96450e683537e2e4 to your computer and use it in GitHub Desktop.
nuck forrinir
diff --git a/engine/class_modules/sc_mage.cpp b/engine/class_modules/sc_mage.cpp
index 4c2f247..a4f3e1a 100755
--- a/engine/class_modules/sc_mage.cpp
+++ b/engine/class_modules/sc_mage.cpp
@@ -213,6 +213,7 @@ public:
// State switches for rotation selection
state_switch_t burn_phase;
+ state_switch_t oom_waiting;
// Ground AoE tracking
std::map<std::string, timespan_t> ground_aoe_expiration;
@@ -224,6 +225,10 @@ public:
int blessing_of_wisdom_count;
bool allow_shimmer_lance;
+ extended_sample_data_t* burn_duration_history;
+ extended_sample_data_t* burn_initial_mana;
+ extended_sample_data_t* oom_waiting_time;
+
// Cached actions
struct actions_t
{
@@ -618,6 +623,8 @@ public:
virtual void combat_end() override;
virtual std::string create_profile( save_e ) override;
virtual void copy_from( player_t* ) override;
+ virtual void merge( player_t& ) override;
+ virtual void analyze( sim_t& ) override;
target_specific_t<mage_td_t> target_data;
@@ -6042,6 +6049,7 @@ struct start_burn_phase_t : public action_t
return;
}
+ p -> burn_initial_mana -> add( p -> resources.current[ RESOURCE_MANA ] / p -> resources.max[ RESOURCE_MANA ] * 100);
p -> uptimes.burn_phase -> update( true, sim -> current_time() );
p -> uptimes.conserve_phase -> update( false, sim -> current_time() );
}
@@ -6075,6 +6083,8 @@ struct stop_burn_phase_t : public action_t
{
mage_t* p = debug_cast<mage_t*>( player );
+ p -> burn_duration_history -> add( p -> burn_phase.duration( sim -> current_time() ).total_seconds() );
+
bool success = p -> burn_phase.disable( sim -> current_time() );
if ( !success )
{
@@ -6087,6 +6097,12 @@ struct stop_burn_phase_t : public action_t
p -> uptimes.burn_phase -> update( false, sim -> current_time() );
p -> uptimes.conserve_phase -> update( true, sim -> current_time() );
+
+ if ( p -> oom_waiting.on() )
+ {
+ p -> oom_waiting_time -> add( p -> oom_waiting.duration( sim -> current_time() ).total_seconds() );
+ p -> oom_waiting.disable( sim -> current_time() );
+ }
}
bool ready() override
@@ -6102,6 +6118,38 @@ struct stop_burn_phase_t : public action_t
}
};
+struct record_oom_waiting_t : public action_t
+{
+ record_oom_waiting_t( mage_t* p, const std::string& options_str ) :
+ action_t( ACTION_USE, "record_oom_waiting", p )
+ {
+ parse_options( options_str );
+ trigger_gcd = timespan_t::zero();
+ harmful = false;
+ ignore_false_positive = true;
+ action_skill = 1;
+ }
+
+ virtual void execute() override
+ {
+ mage_t* p = debug_cast<mage_t*>( player );
+
+ p -> oom_waiting.enable( sim -> current_time() );
+ }
+
+ bool ready() override
+ {
+ mage_t* p = debug_cast<mage_t*>( player );
+
+ if ( !p -> burn_phase.on() || p -> oom_waiting.on() )
+ {
+ return false;
+ }
+
+ return action_t::ready();
+ }
+};
+
// Unstable Magic =============================================================
@@ -6576,6 +6624,9 @@ mage_t::mage_t( sim_t* sim, const std::string& name, race_e r ) :
firestarter_time( timespan_t::zero() ),
allow_shimmer_lance( false ),
blessing_of_wisdom_count( 0 ),
+ burn_duration_history( nullptr ),
+ burn_initial_mana( nullptr ),
+ oom_waiting_time( nullptr ),
action( actions_t() ),
benefits( benefits_t() ),
buffs( buffs_t() ),
@@ -6637,6 +6688,9 @@ mage_t::~mage_t()
delete benefits.arcane_missiles;
delete benefits.fingers_of_frost;
delete benefits.ray_of_frost;
+ delete burn_duration_history;
+ delete burn_initial_mana;
+ delete oom_waiting_time;
}
/// Touch of the Magi explosion trigger
@@ -6703,6 +6757,7 @@ action_t* mage_t::create_action( const std::string& name,
if ( name == "start_burn_phase" ) return new start_burn_phase_t( this, options_str );
if ( name == "stop_burn_phase" ) return new stop_burn_phase_t( this, options_str );
+ if ( name == "record_oom_waiting" ) return new record_oom_waiting_t( this, options_str );
// Fire
if ( name == "blast_wave" ) return new blast_wave_t( this, options_str );
@@ -6882,6 +6937,31 @@ void mage_t::copy_from( player_t* source )
allow_shimmer_lance = p -> allow_shimmer_lance;
}
+void mage_t::merge( player_t& other )
+{
+ player_t::merge( other );
+
+ mage_t& mage = dynamic_cast< mage_t& >( other );
+
+ if ( specialization() == MAGE_ARCANE )
+ {
+ burn_duration_history -> merge ( *mage.burn_duration_history );
+ burn_initial_mana -> merge( *mage.burn_initial_mana );
+ oom_waiting_time -> merge( *mage.oom_waiting_time );
+ }
+}
+
+void mage_t::analyze( sim_t& s )
+{
+ player_t::analyze( s );
+
+ if ( specialization() == MAGE_ARCANE ) {
+ burn_duration_history -> analyze();
+ burn_initial_mana -> analyze();
+ oom_waiting_time -> analyze();
+ }
+}
+
// mage_t::create_pets ========================================================
void mage_t::create_pets()
@@ -7367,6 +7447,10 @@ void mage_t::init_uptimes()
{
uptimes.burn_phase = get_uptime( "Burn Phase" );
uptimes.conserve_phase = get_uptime( "Conserve Phase" );
+
+ burn_duration_history = new extended_sample_data_t( name_str + "_Burn_Duration_History", false );
+ burn_initial_mana = new extended_sample_data_t( name_str + "_Burn_Initial_Mana", false );
+ oom_waiting_time = new extended_sample_data_t( name_str + "_OOM_Waiting_Time", false );
}
}
@@ -8305,6 +8389,12 @@ void mage_t::combat_end()
{
uptimes.burn_phase -> update( false, sim -> current_time() );
uptimes.conserve_phase -> update( false, sim -> current_time() );
+
+ if ( oom_waiting.on() )
+ {
+ oom_waiting_time -> add( oom_waiting.duration( sim -> current_time() ).total_seconds() );
+ oom_waiting.disable( sim -> current_time() );
+ }
}
}
@@ -8664,20 +8754,85 @@ public:
}
- virtual void html_customsection( report::sc_html_stream& /* os*/ ) override
+ virtual void html_customsection( report::sc_html_stream& os ) override
{
- (void) p;
- /*// Custom Class Section
- os << "\t\t\t\t<div class=\"player-section custom_section\">\n"
- << "\t\t\t\t\t<h3 class=\"toggle open\">Custom Section</h3>\n"
- << "\t\t\t\t\t<div class=\"toggle-content\">\n";
-
- os << p.name();
-
- os << "\t\t\t\t\t\t</div>\n" << "\t\t\t\t\t</div>\n";*/
+ if ( p.specialization() == MAGE_ARCANE )
+ {
+ this -> html_customsection_burn_phases( os );
+ }
}
private:
mage_t& p;
+
+ void html_customsection_burn_phases( report::sc_html_stream& os )
+ {
+ os << "<div class=\"player-section custom_section\">"
+ << "<h3 class=\"toggle open\">Burn Phases</h3>"
+ << "<div class=\"toggle-content\">";
+
+ os << "<table class=\"sc\">"
+ << "<thead>"
+ << "<tr>"
+ << "<th>Burn Phase Duration</th>"
+ << "</tr>"
+ << "<tbody>";
+
+ os.format("<tr><td class=\"left\">Count</td><td>%d</td></tr>", p.burn_duration_history -> count() );
+ os.format("<tr><td class=\"left\">Minimum</td><td>%.3f</td></tr>", p.burn_duration_history -> min() );
+ os.format("<tr><td class=\"left\">5<sup>th</sup> percentile</td><td>%.3f</td></tr>", p.burn_duration_history -> percentile( 0.05 ) );
+ os.format("<tr><td class=\"left\">Mean</td><td>%.3f</td></tr>", p.burn_duration_history -> mean() );
+ os.format("<tr><td class=\"left\">95<sup>th</sup> percentile</td><td>%.3f</td></tr>", p.burn_duration_history -> percentile( 0.95 ) );
+ os.format("<tr><td class=\"left\">Max</td><td>%.3f</td></tr>", p.burn_duration_history -> max() );
+ os.format("<tr><td class=\"left\">Variance</td><td>%.3f</td></tr>", p.burn_duration_history -> variance );
+ os.format("<tr><td class=\"left\">Mean Variance</td><td>%.3f</td></tr>", p.burn_duration_history -> mean_variance );
+ os.format("<tr><td class=\"left\">Mean Std. Dev</td><td>%.3f</td></tr>", p.burn_duration_history -> mean_std_dev );
+
+ os << "</tbody>"
+ << "</table>";
+
+ os << "<table class=\"sc\">"
+ << "<thead>"
+ << "<tr>"
+ << "<th>Mana at Burn Start</th>"
+ << "</tr>"
+ << "<tbody>";
+
+ os.format("<tr><td class=\"left\">Count</td><td>%d</td></tr>", p.burn_initial_mana -> count() );
+ os.format("<tr><td class=\"left\">Minimum</td><td>%.3f</td></tr>", p.burn_initial_mana -> min() );
+ os.format("<tr><td class=\"left\">5<sup>th</sup> percentile</td><td>%.3f</td></tr>", p.burn_initial_mana -> percentile( 0.05 ) );
+ os.format("<tr><td class=\"left\">Mean</td><td>%.3f</td></tr>", p.burn_initial_mana -> mean() );
+ os.format("<tr><td class=\"left\">95<sup>th</sup> percentile</td><td>%.3f</td></tr>", p.burn_initial_mana -> percentile( 0.95 ) );
+ os.format("<tr><td class=\"left\">Max</td><td>%.3f</td></tr>", p.burn_initial_mana -> max() );
+ os.format("<tr><td class=\"left\">Variance</td><td>%.3f</td></tr>", p.burn_initial_mana -> variance );
+ os.format("<tr><td class=\"left\">Mean Variance</td><td>%.3f</td></tr>", p.burn_initial_mana -> mean_variance );
+ os.format("<tr><td class=\"left\">Mean Std. Dev</td><td>%.3f</td></tr>", p.burn_initial_mana -> mean_std_dev );
+
+ os << "</tbody>"
+ << "</table>";
+
+ os << "<table class=\"sc\">"
+ << "<thead>"
+ << "<tr>"
+ << "<th>OOM Waiting Time</th>"
+ << "</tr>"
+ << "<tbody>";
+
+ os.format("<tr><td class=\"left\">Count</td><td>%d</td></tr>", p.oom_waiting_time -> count() );
+ os.format("<tr><td class=\"left\">Minimum</td><td>%.3f</td></tr>", p.oom_waiting_time -> min() );
+ os.format("<tr><td class=\"left\">5<sup>th</sup> percentile</td><td>%.3f</td></tr>", p.oom_waiting_time -> percentile( 0.05 ) );
+ os.format("<tr><td class=\"left\">Mean</td><td>%.3f</td></tr>", p.oom_waiting_time -> mean() );
+ os.format("<tr><td class=\"left\">95<sup>th</sup> percentile</td><td>%.3f</td></tr>", p.oom_waiting_time -> percentile( 0.95 ) );
+ os.format("<tr><td class=\"left\">Max</td><td>%.3f</td></tr>", p.oom_waiting_time -> max() );
+ os.format("<tr><td class=\"left\">Variance</td><td>%.3f</td></tr>", p.oom_waiting_time -> variance );
+ os.format("<tr><td class=\"left\">Mean Variance</td><td>%.3f</td></tr>", p.oom_waiting_time -> mean_variance );
+ os.format("<tr><td class=\"left\">Mean Std. Dev</td><td>%.3f</td></tr>", p.oom_waiting_time -> mean_std_dev );
+
+ os << "</tbody>"
+ << "</table>";
+
+ os << "</div>"
+ << "</div>";
+ }
};
// Custom Gear ==============================================================
using namespace unique_gear;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment