tjc12821

Untitled

Nov 14th, 2018
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1.   static void trigger_ember_gain( warlock_t* p, double amount, gain_t* gain, double chance = 1.0 )
  2.   {
  3.     if ( ! p -> rng().roll( chance ) ) return;
  4.  
  5.     if ( ( p -> sets.has_set_bonus( SET_CASTER, T16, B4 ) || p -> sets.has_set_bonus( WARLOCK_DESTRUCTION, T17, B4 )) && //check whether we fill one up.
  6.          ( ( p -> resources.current[RESOURCE_BURNING_EMBER] < 1.0 && p -> resources.current[RESOURCE_BURNING_EMBER] + amount >= 1.0 ) ||
  7.          ( p -> resources.current[RESOURCE_BURNING_EMBER] < 2.0 && p -> resources.current[RESOURCE_BURNING_EMBER] + amount >= 2.0 ) ||
  8.          ( p -> resources.current[RESOURCE_BURNING_EMBER] < 3.0 && p -> resources.current[RESOURCE_BURNING_EMBER] + amount >= 3.0 ) ||
  9.          ( p -> resources.current[RESOURCE_BURNING_EMBER] < 4.0 && p -> resources.current[RESOURCE_BURNING_EMBER] + amount >= 4.0 ) ) )
  10.     {
  11.       if(p -> sets.has_set_bonus( SET_CASTER, T16, B4 ))
  12.         p -> buffs.tier16_4pc_ember_fillup -> trigger();
  13.  
  14.       if( p -> sets.has_set_bonus( WARLOCK_DESTRUCTION, T17, B4 ) && p -> rppm_chaotic_infusion.trigger())
  15.         p -> buffs.chaotic_infusion ->trigger();
  16.     }
  17.  
  18.     p -> resource_gain( RESOURCE_BURNING_EMBER, amount, gain );
  19.  
  20.     // If getting to 1 full ember was a surprise, the player would have to react to it
  21.     if ( p -> resources.current[RESOURCE_BURNING_EMBER] == 1.0 && ( amount > 0.1 || chance < 1.0 ) )
  22.       p -> ember_react = p -> sim -> current_time() + p -> total_reaction_time();
  23.     else if ( p -> resources.current[RESOURCE_BURNING_EMBER] >= 1.0 )
  24.       p -> ember_react = p -> sim -> current_time();
  25.     else
  26.       p -> ember_react = timespan_t::max();
  27.   }
Advertisement
Add Comment
Please, Sign In to add comment