Skip to content

[Warlock] Class adjustments for more faithful behavior of Mug's Moxie Jug trinket procs #10298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: thewarwithin
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions engine/class_modules/warlock/sc_warlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,21 @@ void warlock_td_t::target_demise()
{
warlock.sim->print_log( "Player {} demised. Warlock {} gains a shard from Unstable Affliction.", target->name(), warlock.name() );

warlock.resource_gain( RESOURCE_SOUL_SHARD, warlock.talents.unstable_affliction_2->effectN( 1 ).base_value(), warlock.gains.unstable_affliction_refund );
warlock.energize_action->execute_resource_gain( RESOURCE_SOUL_SHARD, warlock.talents.unstable_affliction_2->effectN( 1 ).base_value(), warlock.gains.unstable_affliction_refund );
}

if ( dots_jackpot_ua->is_ticking() )
{
warlock.sim->print_log( "Player {} demised. Warlock {} gains a shard from Unstable Affliction.", target->name(), warlock.name() );

warlock.resource_gain( RESOURCE_SOUL_SHARD, warlock.talents.unstable_affliction_2->effectN( 1 ).base_value(), warlock.gains.unstable_affliction_refund );
warlock.energize_action->execute_resource_gain( RESOURCE_SOUL_SHARD, warlock.talents.unstable_affliction_2->effectN( 1 ).base_value(), warlock.gains.unstable_affliction_refund );
}

if ( dots_drain_soul->is_ticking() )
{
warlock.sim->print_log( "Player {} demised. Warlock {} gains a shard from Drain Soul.", target->name(), warlock.name() );

warlock.resource_gain( RESOURCE_SOUL_SHARD, 1.0, warlock.gains.drain_soul );
warlock.energize_action->execute_resource_gain( RESOURCE_SOUL_SHARD, 1.0, warlock.gains.drain_soul );
}

if ( debuffs_haunt->check() )
Expand All @@ -175,7 +175,7 @@ void warlock_td_t::target_demise()

warlock.sim->print_log( "Player {} demised. Warlock {} gains 1 shard from Shadowburn.", target->name(), warlock.name() );

warlock.resource_gain( RESOURCE_SOUL_SHARD, debuffs_shadowburn->check_value(), warlock.gains.shadowburn_refund );
warlock.energize_action->execute_resource_gain( RESOURCE_SOUL_SHARD, debuffs_shadowburn->check_value(), warlock.gains.shadowburn_refund );
}

if ( warlock.hero.demonic_soul.ok() && warlock.hero.shared_fate.ok() )
Expand All @@ -192,7 +192,7 @@ void warlock_td_t::target_demise()

warlock.sim->print_log( "Player {} demised. Warlock {} triggers Shared Fate on {}.", target->name(), warlock.name(), t->name() );

tdata->debuffs_shared_fate->trigger();
warlock.buff_apply_action->trigger_buff( tdata->debuffs_shared_fate );

break;
}
Expand Down Expand Up @@ -994,7 +994,7 @@ double warlock_t::resource_gain( resource_e resource_type, double amount, gain_t

if ( rng().roll( chance ) )
{
buffs.succulent_soul->trigger();
buff_apply_action->trigger_buff( buffs.succulent_soul );
procs.succulent_soul->occur();
}
}
Expand All @@ -1005,9 +1005,9 @@ double warlock_t::resource_gain( resource_e resource_type, double amount, gain_t

void warlock_t::feast_of_souls_gain()
{
player_t::resource_gain( RESOURCE_SOUL_SHARD, 1.0, gains.feast_of_souls );
player_t::resource_gain( RESOURCE_SOUL_SHARD, hero.feast_of_souls_energize->effectN( 1 ).base_value() / 10.0, gains.feast_of_souls );

buffs.succulent_soul->trigger();
buff_apply_action->trigger_buff( buffs.succulent_soul );
procs.succulent_soul->occur();
procs.feast_of_souls->occur();
}
Expand Down
150 changes: 150 additions & 0 deletions engine/class_modules/warlock/sc_warlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ struct warlock_t : public player_t
// Affliction
const spell_data_t* agony;
const spell_data_t* agony_2; // Rank 2 still a separate spell (learned automatically). Grants increased max stacks
const spell_data_t* agony_energize; // Agony soul shard generation proc
const spell_data_t* xavian_teachings; // Passive granted only to Affliction. Instant cast data in this spell, points to base Corruption spell (172) for the direct damage
const spell_data_t* malefic_rapture; // This contains an old sp_coeff value, but it is most likely no longer in use
const spell_data_t* malefic_rapture_dmg;
Expand All @@ -130,6 +131,7 @@ struct warlock_t : public player_t
const spell_data_t* hog_impact; // Secondary spell responsible for impact damage
const spell_data_t* wild_imp; // Data for pet summoning
const spell_data_t* fel_firebolt_2; // Still a separate spell (learned automatically). Reduces pet's energy cost
const spell_data_t* infernal_command_buff; // This still applies but with 0 value
const spell_data_t* master_demonologist; // Demonology Mastery - Increased demon damage
const spell_data_t* demonology_warlock; // Spec aura

Expand Down Expand Up @@ -191,6 +193,7 @@ struct warlock_t : public player_t
player_talent_t sargerei_technique;
player_talent_t demonic_tactics;
player_talent_t soul_conduit;
const spell_data_t* soul_conduit_energize; // Soul Shard refund spell effect
player_talent_t soulburn;
const spell_data_t* soulburn_buff; // This buff is applied after using Soulburn and prevents another usage unless cleared

Expand Down Expand Up @@ -291,9 +294,11 @@ struct warlock_t : public player_t
player_talent_t carnivorous_stalkers; // Chance for Dreadstalkers to perform additional Dreadbites

player_talent_t inner_demons;
const spell_data_t* inner_demons_wild_imp; // Data for pet summoning (spawned from Inner Demons talent)
player_talent_t soul_strike;
const spell_data_t* soul_strike_pet;
const spell_data_t* soul_strike_dmg;
const spell_data_t* soul_strike_energize;
player_talent_t bilescourge_bombers;
const spell_data_t* bilescourge_bombers_aoe; // Ground AoE data
player_talent_t demonic_strength;
Expand Down Expand Up @@ -552,6 +557,7 @@ struct warlock_t : public player_t
const spell_data_t* shared_fate_debuff;
const spell_data_t* shared_fate_dmg;
player_talent_t feast_of_souls;
const spell_data_t* feast_of_souls_energize;

player_talent_t wicked_reaping;
const spell_data_t* wicked_reaping_dmg;
Expand All @@ -578,6 +584,147 @@ struct warlock_t : public player_t
action_t* jackpot_cdf;
} proc_actions;

// Action that applies a buff
// Useful for allowing trinket and spells procs to occur when a buff/debuff is applied
struct buff_apply_action_t : public spell_t
{
private:
bool is_trigger_call;
bool result;
buff_t* buff;
int stacks;
double value;
double chance;
timespan_t duration;
public:
buff_apply_action_t( util::string_view n, warlock_t* p )
: spell_t( n, p )
{
may_crit = may_miss = false;
background = dual = quiet = true;
harmful = true;
weapon_multiplier = 0.0;
}

bool trigger_buff( propagate_const<buff_t*> tbuff, timespan_t tduration )
{
return trigger_buff( tbuff, -1, tduration );
}

bool trigger_buff( propagate_const<buff_t*> tbuff, int tstacks, timespan_t tduration )
{
return trigger_buff( tbuff, tstacks, buff_t::DEFAULT_VALUE(), -1, tduration );
}

bool trigger_buff( propagate_const<buff_t*> tbuff, action_t* taction, int tstacks = -1, double tvalue = buff_t::DEFAULT_VALUE(), double tchance = -1.0, timespan_t tduration = timespan_t::min() )
{
if ( tbuff->can_trigger( taction ) )
return trigger_buff( tbuff, tstacks, tvalue, tchance, tduration );

return false;
}

// Triggers a buff doing a dummy action to allow procs
bool trigger_buff( propagate_const<buff_t*> tbuff, int tstacks = -1, double tvalue = buff_t::DEFAULT_VALUE(), double tchance = -1.0, timespan_t tduration = timespan_t::min() )
{
// Set func mode
is_trigger_call = true;
// Set buff and buff->trigger call args
buff = tbuff;
stacks = tstacks;
value = tvalue;
chance = tchance;
duration = tduration;
// Execute action that triggers the buff
execute();
// Return the result of the buff trigger call
return result;
}

// Execute a buff doing a dummy action to allow procs
void execute_buff( propagate_const<buff_t*> tbuff, int tstacks = -1, double tvalue = buff_t::DEFAULT_VALUE(), timespan_t tduration = timespan_t::min() ) {
// Set func mode
is_trigger_call = false;
// Set buff and buff->execute call args
buff = tbuff;
stacks = tstacks;
value = tvalue;
duration = tduration;
// Execute action that execute the buff
execute();
}

void execute() override
{
if ( is_trigger_call )
{
result = buff->trigger( stacks, value, chance, duration );
if ( result )
spell_t::execute(); // only on sucesfull buff triggers
}
else
{
buff->execute( stacks, value, duration );
spell_t::execute();
}
}
} *buff_apply_action;

// Action for energize (resource gain) effects
// Useful for allowing energizing effects to proc trinkets and spells
struct energize_action_t : public spell_t
{
private:
double result;
resource_e resource_type;
double amount;
gain_t* source;
action_t* action;
public:
energize_action_t( util::string_view n, warlock_t* p )
: spell_t( n, p )
{
may_crit = may_miss = false;
background = dual = quiet = true;
harmful = true;
weapon_multiplier = 0.0;
}

// Execute a resource_gain doing a dummy action to allow procs
double execute_resource_gain( resource_e tresource_type, double tamount, gain_t* tsource = nullptr, action_t* taction = nullptr )
{
// Set resource_gain call args
resource_type = tresource_type;
amount = tamount;
source = tsource;
action = taction;
// Execute action that does the resource_gain call
execute();
// Return the result of the resource_gain call
return result;
}

void execute() override
{
result = static_cast<warlock_t*>( player )->resource_gain( resource_type, amount, source, action );

spell_t::execute();
}
} *energize_action;

struct pet_summon_actions_t
{
// Diabolist
propagate_const<action_t*> overlord;
propagate_const<action_t*> mother_of_chaos;
propagate_const<action_t*> pit_lord;

// Demonology
propagate_const<action_t*> wild_imp;
propagate_const<action_t*> inner_demons_wild_imp;
propagate_const<action_t*> greater_dreadstalker;
} pet_summon_actions;

struct tier_sets_t
{
// Affliction
Expand Down Expand Up @@ -860,6 +1007,9 @@ struct warlock_t : public player_t
void create_diabolist_proc_actions();
void create_hellcaller_proc_actions();
void create_soul_harvester_proc_actions();
void create_demonology_pet_summon_actions();
void create_diabolist_pet_summon_actions();
void create_helper_actions();
action_t* create_action( util::string_view name, util::string_view options ) override;
pet_t* create_pet( util::string_view name, util::string_view type = {} ) override;
void create_pets() override;
Expand Down
Loading