From f4f3428eedce00601dae1add15c8f397be8fc418 Mon Sep 17 00:00:00 2001 From: Kate Martin <51387586+renanthera@users.noreply.github.com> Date: Tue, 3 Sep 2024 23:13:18 -0600 Subject: [PATCH] [monk] Mucking out SEF pet. --- engine/class_modules/monk/sc_monk.cpp | 15 +++++- engine/class_modules/monk/sc_monk.hpp | 1 + engine/class_modules/monk/sc_monk_pets.cpp | 60 +++++++++------------- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/engine/class_modules/monk/sc_monk.cpp b/engine/class_modules/monk/sc_monk.cpp index 7be8af5b710..fc1b2ddecf0 100644 --- a/engine/class_modules/monk/sc_monk.cpp +++ b/engine/class_modules/monk/sc_monk.cpp @@ -4450,7 +4450,7 @@ struct celestial_conduit_t : public monk_spell_t struct celestial_conduit_dmg_t : public monk_spell_t { celestial_conduit_dmg_t( monk_t *p ) - : monk_spell_t( p, "celestial_conduit_dmg", p->talent.conduit_of_the_celestials.celestial_conduit_dmg ) + : monk_spell_t( p, "celestial_conduit_damage", p->talent.conduit_of_the_celestials.celestial_conduit_dmg ) { background = true; aoe = -1; @@ -6652,8 +6652,10 @@ action_t *monk_t::create_action( util::string_view name, util::string_view optio return new crackling_jade_lightning_t( this, options_str ); if ( name == "tiger_palm" ) return new tiger_palm_t( this, options_str ); - if ( name == "blackout_kick" ) + if ( name == "blackout_kick" && user_options.sef_beta ) return new sef_action_t( this, "blackout_kick", options_str ); + if ( name == "blackout_kick" ) + return new blackout_kick_t( this, "blackout_kick", options_str ); if ( name == "expel_harm" ) return new expel_harm_t( this, options_str ); if ( name == "leg_sweep" ) @@ -9007,6 +9009,15 @@ void monk_t::copy_from( player_t *source ) user_options = source_p->user_options; } +// monk_t::copy_from ========================================================= +action_t *monk_t::find_action( int id ) +{ + for ( const action_t *action : action_list ) + if ( id == action->id ) + return action; + return nullptr; +} + // monk_t::primary_resource ================================================= resource_e monk_t::primary_resource() const diff --git a/engine/class_modules/monk/sc_monk.hpp b/engine/class_modules/monk/sc_monk.hpp index 0077feba392..cb714ff00a5 100644 --- a/engine/class_modules/monk/sc_monk.hpp +++ b/engine/class_modules/monk/sc_monk.hpp @@ -1394,6 +1394,7 @@ struct monk_t : public stagger_t void reset() override; void create_options() override; void copy_from( player_t * ) override; + action_t *find_action( int id ); resource_e primary_resource() const override; role_e primary_role() const override; stat_e convert_hybrid_stat( stat_e s ) const override; diff --git a/engine/class_modules/monk/sc_monk_pets.cpp b/engine/class_modules/monk/sc_monk_pets.cpp index 459c7071f18..f609d806bba 100644 --- a/engine/class_modules/monk/sc_monk_pets.cpp +++ b/engine/class_modules/monk/sc_monk_pets.cpp @@ -362,52 +362,42 @@ struct storm_earth_and_fire_pet_t : public monk_pet_t template struct sef_action_base_t : public pet_action_base_t { - using super_t = pet_action_base_t; - using base_t = sef_action_base_t; + using base_t = pet_action_base_t; const action_t *source_action; - sef_action_base_t( util::string_view n, storm_earth_and_fire_pet_t *p, - const spell_data_t *data = spell_data_t::nil() ) - : super_t( n, p, data ), source_action( nullptr ) + sef_action_base_t( std::string_view name, storm_earth_and_fire_pet_t *p, + const spell_data_t *spell_data = spell_data_t::nil() ) + : base_t( name, p, spell_data ), source_action( nullptr ) { - // Make SEF attacks always background, so they do not consume resources - // or do anything associated with "foreground actions". - this->background = this->may_crit = true; - this->callbacks = false; + base_t::background = true; + base_t::cooldown->duration = timespan_t::zero(); - // Cooldowns are handled automatically by the mirror abilities, the SEF specific ones need none. - this->cooldown->duration = timespan_t::zero(); + // TODO: Is this correct? + base_t::callbacks = false; + } - // No costs are needed either - this->base_costs[ RESOURCE_ENERGY ] = 0; - this->base_costs[ RESOURCE_CHI ] = 0; + double base_cost() override + { + return 0.0; } void init() override { - super_t::init(); + base_t::init(); - // Find source_action from the owner by matching the action name and - // spell id with eachother. This basically means that by default, any - // spell-data driven ability with 1:1 mapping of name/spell id will - // always be chosen as the source action. In some cases this needs to be - // overridden (see sef_zen_sphere_t for example). - for ( const action_t *a : this->o()->action_list ) - { - if ( ( this->id > 0 && this->id == a->id ) || util::str_compare_ci( this->name_str, a->name_str ) ) - { - source_action = a; - break; - } - } + // Look up source action based on id, falling back to name if not found. + if ( action_t *action = find_action( base_t::id ) ) + source_action = action; + else + source_action = find_action( base_t::name_str ); - if ( source_action ) - { - this->update_flags = source_action->update_flags; - auto pet_multiplier_snapshot = this->snapshot_flags & STATE_MUL_PET; - this->snapshot_flags = source_action->snapshot_flags | pet_multiplier_snapshot; - } + if ( !source_action ) + return; + + base_t::update_flags = source_action->update_flags; + // isn't base_t::snapshot_flags == source_action->snapshot_flags or 0? + base_t::snapshot_flags = source_action->snapshot_flags | ( base_t::snapshot_flags & STATE_MUL_PET ); } void snapshot_internal( action_state_t *state, unsigned flags, result_amount_type rt ) override @@ -719,7 +709,7 @@ struct storm_earth_and_fire_pet_t : public monk_pet_t sef_glory_of_the_dawn_t *glory_of_the_dawn; sef_rising_sun_kick_dmg_t( storm_earth_and_fire_pet_t *player ) - : sef_melee_attack_t( "rising_sun_kick_dmg", player, + : sef_melee_attack_t( "rising_sun_kick_damage", player, player->o()->talent.monk.rising_sun_kick->effectN( 1 ).trigger() ) { background = true;