Skip to content

Commit

Permalink
[monk] Fix Power of the Thunder King and Emperor's Last Capacitor (#9848
Browse files Browse the repository at this point in the history
)

[monk]
- Delay Last Capacitor expiration so it occurs after all final ticks.
- Implement generic delay callback event.
- Remove PotTK logic from SEF, convert the aoe channel into a sef action.
- Merge SEF action container into a single map.
- Index map based off of `sef_action_e` instead of horrible int
casting.
- Remove actor-based action targeting from base monk pet and into sef
specifically.
- If `source_action->background`, obey current `source_action` target,
disregarding sef actor target/fixation.
- Use `source_action` `composite_dot_duration` and `tick_time` so CJL
has sensible channel times and tick separation, to avoid buffs being
removed too early and channels being absolute nonsense.
- Override CJL AoE `source_action` lookup behaviour.
- Skip automatic `source_action` lookup if already set.
- Update SEF canceling behaviour to be consistent with SCK changes.
- Simplify codepath in several SEF helper functions.
- Set  array entries instead of override function. Remove unnecessary `SEF_MAX` entry.
  • Loading branch information
renanthera authored Jan 12, 2025
1 parent e35a59a commit 5f071c9
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 155 deletions.
28 changes: 16 additions & 12 deletions engine/class_modules/monk/sc_monk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ template <class Base>
template <typename... Args>
monk_action_t<Base>::monk_action_t( Args &&...args )
: parse_action_effects_t<Base>( std::forward<Args>( args )... ),
sef_ability( actions::sef_ability_e::SEF_NONE ),
sef_ability( actions::sef_ability_e::SEF_MIN ),
ww_mastery( false ),
may_combo_strike( false ),
trigger_jadefire_stomp( false ),
Expand Down Expand Up @@ -3352,6 +3352,7 @@ struct crackling_jade_lightning_t : public monk_spell_t
dual = background = true;
ww_mastery = true;
trigger_jadefire_stomp = true;
sef_ability = actions::sef_ability_e::SEF_CRACKLING_JADE_LIGHTNING_AOE;

parse_effects( p->talent.windwalker.power_of_the_thunder_king, effect_mask_t( true ).disable( 1 ) );
parse_effects( p->buff.the_emperors_capacitor );
Expand Down Expand Up @@ -3415,18 +3416,21 @@ struct crackling_jade_lightning_t : public monk_spell_t
{
monk_spell_t::last_tick( dot );

p()->buff.the_emperors_capacitor->expire();

if ( p()->talent.windwalker.power_of_the_thunder_king->ok() )
{
const auto &tl = target_list();
for ( const auto &t : tl )
{
get_td( t )->dot.crackling_jade_lightning_aoe->cancel();
get_td( t )->dot.crackling_jade_lightning_sef->cancel();
get_td( t )->dot.crackling_jade_lightning_sef_aoe->cancel();
}
}
// delay expiration so it occurs after final tick of cjl aoe
make_event<events::delayed_cb_event_t>( *sim, p(), 1_ms, [ & ]() {
p()->buff.the_emperors_capacitor->expire();
const auto &tl = target_list();
for ( const auto &t : tl )
{
get_td( t )->dot.crackling_jade_lightning_aoe->cancel();
get_td( t )->dot.crackling_jade_lightning_sef->cancel();
get_td( t )->dot.crackling_jade_lightning_sef_aoe->cancel();
}
} );
else
p()->buff.the_emperors_capacitor->expire();

// Reset swing timer
if ( player->main_hand_attack )
{
Expand Down
40 changes: 22 additions & 18 deletions engine/class_modules/monk/sc_monk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ namespace actions
{
enum class sef_ability_e
{
SEF_NONE = -1,
// Attacks begin here
SEF_MIN = -1,
SEF_TIGER_PALM,
SEF_BLACKOUT_KICK,
SEF_BLACKOUT_KICK_TOTM,
Expand All @@ -69,19 +68,9 @@ enum class sef_ability_e
SEF_STRIKE_OF_THE_WINDLORD_OH,
SEF_CELESTIAL_CONDUIT,
SEF_RJW_TICK,
SEF_ATTACK_MAX,
// Attacks end here

// Spells begin here
SEF_CHI_WAVE,
SEF_CRACKLING_JADE_LIGHTNING,
SEF_SPELL_MAX,
// Spells end here

// Misc
SEF_SPELL_MIN = SEF_CHI_WAVE,
SEF_ATTACK_MIN = SEF_TIGER_PALM,
SEF_MAX
SEF_CRACKLING_JADE_LIGHTNING_AOE
};

template <class Base>
Expand Down Expand Up @@ -336,11 +325,6 @@ struct aspect_of_harmony_t
};
} // namespace buffs

inline int sef_spell_index( int x )
{
return x - static_cast<int>( actions::sef_ability_e::SEF_SPELL_MIN );
}

struct monk_td_t : public actor_target_data_t
{
public:
Expand Down Expand Up @@ -1506,6 +1490,26 @@ struct delayed_execute_event_t : event_t
action->execute_on_target( target );
}
};

struct delayed_cb_event_t : event_t
{
std::function<void()> cb;

delayed_cb_event_t( monk_t *player, timespan_t delay, std::function<void()> cb )
: event_t( *player->sim, delay ), cb( std::move( cb ) )
{
}

const char *name() const override
{
return "delayed_cb_event_t";
}

void execute() override
{
cb();
}
};
} // namespace events

} // namespace monk
Loading

0 comments on commit 5f071c9

Please sign in to comment.