Skip to content

Commit

Permalink
[monk] Mucking out SEF pet.
Browse files Browse the repository at this point in the history
  • Loading branch information
renanthera committed Sep 4, 2024
1 parent 7dccbf8 commit f4f3428
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 37 deletions.
15 changes: 13 additions & 2 deletions engine/class_modules/monk/sc_monk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<blackout_kick_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" )
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions engine/class_modules/monk/sc_monk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,7 @@ struct monk_t : public stagger_t<parse_player_effects_t, monk_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;
Expand Down
60 changes: 25 additions & 35 deletions engine/class_modules/monk/sc_monk_pets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,52 +362,42 @@ struct storm_earth_and_fire_pet_t : public monk_pet_t
template <typename BASE>
struct sef_action_base_t : public pet_action_base_t<BASE, storm_earth_and_fire_pet_t>
{
using super_t = pet_action_base_t<BASE, storm_earth_and_fire_pet_t>;
using base_t = sef_action_base_t<BASE>;
using base_t = pet_action_base_t<BASE, storm_earth_and_fire_pet_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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f4f3428

Please sign in to comment.