Skip to content

Commit

Permalink
[Druid] Implement Memory of Lucid Dreams for Feral and Balance
Browse files Browse the repository at this point in the history
  • Loading branch information
Jundarer committed Jun 21, 2019
1 parent d780f53 commit 2cf371d
Showing 1 changed file with 65 additions and 2 deletions.
67 changes: 65 additions & 2 deletions engine/class_modules/sc_druid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ struct druid_t : public player_t
bool catweave_bear;
bool t21_2pc;
bool t21_4pc;
double lucid_dreams_proc_chance_balance;
double lucid_dreams_proc_chance_feral;

struct active_actions_t
{
Expand Down Expand Up @@ -302,6 +304,7 @@ struct druid_t : public player_t

//other
spells::solar_empowerment_t* solar_empowerment;
const spell_data_t* lucid_dreams;

// Druid Events
std::vector<event_t*> persistent_buff_delay;
Expand Down Expand Up @@ -345,6 +348,11 @@ struct druid_t : public player_t

} azerite;

struct
{
azerite_essence_t memory_of_lucid_dreams; // Memory of lucid dreams minor
} azerite_essences;

// Buffs
struct buffs_t
{
Expand Down Expand Up @@ -459,6 +467,7 @@ struct druid_t : public player_t
// Multiple Specs / Forms
gain_t* clearcasting; // Feral & Restoration
gain_t* soul_of_the_forest; // Feral & Guardian
gain_t* lucid_dreams;

// Balance
gain_t* natures_balance; //talent
Expand Down Expand Up @@ -725,6 +734,8 @@ struct druid_t : public player_t
druid_t( sim_t* sim, const std::string& name, race_e r = RACE_NIGHT_ELF ) :
player_t( sim, DRUID, name, r ),
form( NO_FORM ),
lucid_dreams_proc_chance_balance( 0.15 ),
lucid_dreams_proc_chance_feral( 0.15 ),
starshards( 0.0 ),
previous_streaking_stars(SS_NONE),
predator_rppm_rate( 0.0 ),
Expand Down Expand Up @@ -1547,6 +1558,43 @@ struct druid_action_t : public Base
return ab::ready();
}

void trigger_lucid_dreams()
{
if ( !p()->lucid_dreams )
return;

if ( ab::last_resource_cost <= 0.0 )
return;

double multiplier = p()->lucid_dreams->effectN( 1 ).percent();
double proc_chance = ( p()->specialization() == DRUID_BALANCE )
? p()->lucid_dreams_proc_chance_balance
: ( p()->specialization() == DRUID_FERAL ) ? p()->lucid_dreams_proc_chance_feral : 0.0;

if ( ab::rng().roll( proc_chance ) )
{
switch ( p()->specialization() )
{
case DRUID_BALANCE:
p()->resource_gain( RESOURCE_ASTRAL_POWER, multiplier * ab::last_resource_cost, p()->gain.lucid_dreams );
break;
case DRUID_FERAL:
p()->resource_gain( RESOURCE_ENERGY, multiplier * ab::last_resource_cost, p()->gain.lucid_dreams );
break;
default:
break;
}

p()->player_t::buffs.lucid_dreams->trigger();
}
}

virtual void consume_resource() override
{
ab::consume_resource();
trigger_lucid_dreams();
}

void trigger_gushing_wound( player_t* t, double dmg )
{
if ( ! ( ab::special && ab::harmful && dmg > 0 ) )
Expand Down Expand Up @@ -2116,6 +2164,11 @@ struct druid_spell_t : public druid_spell_base_t<spell_t>
{
if (warrior_of_elune && p()->buff.warrior_of_elune->check())
e *= 1.0 + p()->talent.warrior_of_elune->effectN(2).percent();

if ( p()->buffs.memory_of_lucid_dreams->up() )
{
e *= 1.0 + p()->buffs.memory_of_lucid_dreams->data().effectN( 1 ).percent();
}
}

return e;
Expand All @@ -2124,7 +2177,6 @@ struct druid_spell_t : public druid_spell_base_t<spell_t>
virtual void consume_resource() override
{
ab::consume_resource();

trigger_impeccable_fel_essence();
}

Expand Down Expand Up @@ -7425,6 +7477,11 @@ void druid_t::init_spells()
azerite.twisted_claws = find_azerite_spell("Twisted Claws");
azerite.burst_of_savagery = find_azerite_spell("Burst of Savagery");

//Azerite essences
auto essence = find_azerite_essence( "Memory of Lucid Dreams" );
if ( essence.enabled() )
lucid_dreams = essence.spell( 1u, essence_type::MINOR );

// Affinities =============================================================

spec.feline_swiftness = specialization() == DRUID_FERAL || talent.feral_affinity -> ok() ?
Expand Down Expand Up @@ -7589,6 +7646,9 @@ void druid_t::create_buffs()

buff.arcanic_pulsar = make_buff(this, "arcanic_pulsar", azerite.arcanic_pulsar.spell()->effectN(1).trigger()->effectN(1).trigger());

if ( specialization() == DRUID_FERAL )
player_t::buffs.memory_of_lucid_dreams->set_affects_regen( true );

// Talent buffs
buff.tiger_dash = new tiger_dash_buff_t(*this);

Expand Down Expand Up @@ -8514,6 +8574,7 @@ void druid_t::init_gains()
// Multiple Specs / Forms
gain.clearcasting = get_gain( "clearcasting" ); // Feral & Restoration
gain.soul_of_the_forest = get_gain( "soul_of_the_forest" ); // Feral & Guardian
gain.lucid_dreams = get_gain( " Lucid Dreams " );

// Balance
gain.natures_balance = get_gain("natures_balance");
Expand Down Expand Up @@ -8707,6 +8768,9 @@ double druid_t::resource_regen_per_second( resource_e r ) const
{
if (buff.savage_roar->check() && buff.savage_roar->data().effectN(3).subtype() == A_MOD_POWER_REGEN_PERCENT)
reg *= 1.0 + buff.savage_roar->data().effectN(3).percent();

if ( player_t::buffs.memory_of_lucid_dreams->check() )
reg *= 1.0 + player_t::buffs.memory_of_lucid_dreams->data().effectN( 1 ).percent();
}

return reg;
Expand Down Expand Up @@ -9066,7 +9130,6 @@ double druid_t::composite_spell_power_multiplier() const
return player_t::composite_spell_power_multiplier();
}


// druid_t::composite_attribute =============================================

double druid_t::composite_attribute( attribute_e attr ) const
Expand Down

0 comments on commit 2cf371d

Please sign in to comment.