From 3d69a8d5f69eb3e6492ae2cdb2e9ef413113c711 Mon Sep 17 00:00:00 2001 From: Kate Martin <51387586+renanthera@users.noreply.github.com> Date: Sun, 8 Jun 2025 03:44:48 -0600 Subject: [PATCH 1/5] [player] Create `bool player_t::validate_actor()` to validate whether or not actor initialization should continue. --- engine/player/player.cpp | 7 +++++++ engine/player/player.hpp | 2 ++ engine/sim/sim.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/engine/player/player.cpp b/engine/player/player.cpp index 1d64dd39681..a25720cc979 100644 --- a/engine/player/player.cpp +++ b/engine/player/player.cpp @@ -3826,6 +3826,13 @@ void player_t::init_background_actions() void player_t::create_actions() { + // if actor is not valid, set `quiet` and skip the rest of action creation + if ( !validate_actor() ) + { + quiet = true; + return; + } + if( is_player() && !is_enemy() && !is_pet() ) consumable::create_consumeable_actions( this ); diff --git a/engine/player/player.hpp b/engine/player/player.hpp index aece8de5ff4..aa425ef0d9c 100644 --- a/engine/player/player.hpp +++ b/engine/player/player.hpp @@ -1114,6 +1114,8 @@ struct player_t : public actor_t virtual void validate_sim_options() {} virtual bool validate_fight_style( fight_style_e ) const { return true; } + virtual bool validate_actor() + { return true; } virtual void init_meta_gem(); virtual void init_resources( bool force = false ); virtual std::vector get_item_actions(); diff --git a/engine/sim/sim.cpp b/engine/sim/sim.cpp index f5df6d92e31..9c7c858b18e 100644 --- a/engine/sim/sim.cpp +++ b/engine/sim/sim.cpp @@ -2975,7 +2975,7 @@ void sim_t::analyze() std::fflush( stdout ); } - + assert( iterations > 0 ); // Run core analyze for all actor collected data before proceeding to full analysis. This is to prevent errors from From fc8c880bda79cbc2267fbfa977ed9257bce20582 Mon Sep 17 00:00:00 2001 From: Kate Martin <51387586+renanthera@users.noreply.github.com> Date: Sun, 8 Jun 2025 04:12:16 -0600 Subject: [PATCH 2/5] [monk] Remove calling for actor validation and modify signature. --- engine/class_modules/apl/apl_monk.cpp | 22 ++++++++-------------- engine/class_modules/monk/sc_monk.hpp | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/engine/class_modules/apl/apl_monk.cpp b/engine/class_modules/apl/apl_monk.cpp index 51087191fce..d45033dd590 100644 --- a/engine/class_modules/apl/apl_monk.cpp +++ b/engine/class_modules/apl/apl_monk.cpp @@ -850,30 +850,27 @@ void default_apl( monk_t* player ) // Shared Defaults namespace monk { -void monk_t::validate_actor() +bool monk_t::validate_actor() { if ( specialization() == MONK_MISTWEAVER && !sim->allow_experimental_specializations ) { if ( !quiet ) sim->error( "Mistweaver Monk for {} is not currently supported.", *this ); - quiet = true; - return; + return false; } if ( main_hand_weapon.type == WEAPON_NONE ) { if ( !quiet ) sim->error( "{} has no weapon equipped at the Main-Hand slot.", *this ); - quiet = true; - return; + return false; } if ( main_hand_weapon.group() == WEAPON_2H && off_hand_weapon.group() == WEAPON_1H ) { if ( !quiet ) sim->error( "{} both a 1-hand and 2-hand weapon equipped at once.", *this ); - quiet = true; - return; + return false; } switch ( specialization() ) @@ -881,18 +878,17 @@ void monk_t::validate_actor() case MONK_BREWMASTER: case MONK_MISTWEAVER: case MONK_WINDWALKER: - return; + return true; default: sim->error( "No specialization was selected for {}.", *this ); - quiet = true; - return; + return false; } + + return false; } void monk_t::init_blizzard_action_list() { - validate_actor(); - action_priority_list_t* default_ = get_action_priority_list( "default" ); switch ( specialization() ) @@ -1026,8 +1022,6 @@ std::string monk_t::default_temporary_enchant() const void monk_t::init_action_list() { - validate_actor(); - if ( action_list_str.empty() ) { clear_action_priority_lists(); diff --git a/engine/class_modules/monk/sc_monk.hpp b/engine/class_modules/monk/sc_monk.hpp index bba84d40e9a..091dbf1953a 100644 --- a/engine/class_modules/monk/sc_monk.hpp +++ b/engine/class_modules/monk/sc_monk.hpp @@ -1400,7 +1400,7 @@ struct monk_t : public stagger_t std::string default_temporary_enchant() const override; void init_action_list() override; void init_blizzard_action_list() override; - void validate_actor(); + bool validate_actor() override; bool validate_fight_style( fight_style_e style ) const override; parsed_assisted_combat_rule_t parse_assisted_combat_rule( const assisted_combat_rule_data_t &rule, const assisted_combat_step_data_t &step ) const override; From 70ac1225eee7b2b4b810051eae1bdee325d419e1 Mon Sep 17 00:00:00 2001 From: Kate Martin <51387586+renanthera@users.noreply.github.com> Date: Sun, 8 Jun 2025 04:25:32 -0600 Subject: [PATCH 3/5] [shaman] Move actor validation out of `init_action_list()`. --- engine/class_modules/sc_shaman.cpp | 46 ++++++++++++++++++------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/engine/class_modules/sc_shaman.cpp b/engine/class_modules/sc_shaman.cpp index e90e8b1d61f..6a48c1ca2de 100644 --- a/engine/class_modules/sc_shaman.cpp +++ b/engine/class_modules/sc_shaman.cpp @@ -1897,6 +1897,7 @@ struct shaman_t : public parse_player_effects_t void init_items() override; void init_special_effects() override; void init_finished() override; + bool validate_actor() override; std::string create_profile( save_e ) override; void create_special_effects() override; action_t* create_proc_action( util::string_view /* name */, const special_effect_t& /* effect */ ) override; @@ -14370,6 +14371,31 @@ void shaman_t::init_finished() apply_player_effects(); } +bool shaman_t::validate_actor() +{ + if ( !( primary_role() == ROLE_ATTACK && specialization() == SHAMAN_ENHANCEMENT ) && + !( primary_role() == ROLE_SPELL && specialization() == SHAMAN_ELEMENTAL ) && + !( primary_role() == ROLE_SPELL && specialization() == SHAMAN_RESTORATION ) ) + { + if ( !quiet ) + sim->errorf( "Player %s's role (%s) or spec(%s) isn't supported yet.", name(), + util::role_type_string( primary_role() ), util::specialization_string( specialization() ) ); + return false; + } + + // Restoration isn't supported atm + if ( !sim->allow_experimental_specializations && specialization() == SHAMAN_RESTORATION && + primary_role() == ROLE_HEAL ) + { + if ( !quiet ) + sim->errorf( "Restoration Shaman healing for player %s is not currently supported.", name() ); + + return false; + } + + return true; +} + // shaman_t::apply_affecting_auras ========================================== void shaman_t::apply_affecting_auras( action_t& action ) @@ -15073,25 +15099,7 @@ void shaman_t::init_action_list_restoration_dps() void shaman_t::init_action_list() { - if ( !( primary_role() == ROLE_ATTACK && specialization() == SHAMAN_ENHANCEMENT ) && - !( primary_role() == ROLE_SPELL && specialization() == SHAMAN_ELEMENTAL ) && - !( primary_role() == ROLE_SPELL && specialization() == SHAMAN_RESTORATION ) ) - { - if ( !quiet ) - sim->errorf( "Player %s's role (%s) or spec(%s) isn't supported yet.", name(), - util::role_type_string( primary_role() ), util::specialization_string( specialization() ) ); - quiet = true; - return; - } - - // Restoration isn't supported atm - if ( !sim->allow_experimental_specializations && specialization() == SHAMAN_RESTORATION && - primary_role() == ROLE_HEAL ) - { - if ( !quiet ) - sim->errorf( "Restoration Shaman healing for player %s is not currently supported.", name() ); - - quiet = true; + if ( quiet ) return; } From 07747bbe9f0c5df065494e4b1afc8925fd41642a Mon Sep 17 00:00:00 2001 From: Kate Martin <51387586+renanthera@users.noreply.github.com> Date: Sun, 8 Jun 2025 04:44:44 -0600 Subject: [PATCH 4/5] [shaman] Remove rogue curly brace. --- engine/class_modules/sc_shaman.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/class_modules/sc_shaman.cpp b/engine/class_modules/sc_shaman.cpp index 6a48c1ca2de..29ea4fb7d71 100644 --- a/engine/class_modules/sc_shaman.cpp +++ b/engine/class_modules/sc_shaman.cpp @@ -15101,7 +15101,6 @@ void shaman_t::init_action_list() { if ( quiet ) return; - } // After error checks, initialize secondary actions for various things windfury_mh = new windfury_attack_t( "windfury_attack", this, find_spell( 25504 ), &( main_hand_weapon ) ); From 77f1b05cde0a773d23d94e21d848e680dab419e1 Mon Sep 17 00:00:00 2001 From: Kate Martin <51387586+renanthera@users.noreply.github.com> Date: Sun, 8 Jun 2025 05:37:01 -0600 Subject: [PATCH 5/5] [sim] Remove a whitespace-only change. --- engine/sim/sim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/sim/sim.cpp b/engine/sim/sim.cpp index 9c7c858b18e..f5df6d92e31 100644 --- a/engine/sim/sim.cpp +++ b/engine/sim/sim.cpp @@ -2975,7 +2975,7 @@ void sim_t::analyze() std::fflush( stdout ); } - + assert( iterations > 0 ); // Run core analyze for all actor collected data before proceeding to full analysis. This is to prevent errors from