Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct voidform_t final : public priest_buff_t<buff_t>
- {
- struct insanity_loss_event_t final : public player_event_t
- {
- voidform_t* vf;
- insanity_loss_event_t( voidform_t* s )
- : player_event_t( *s->player ), vf( s )
- {
- add_event( timespan_t::from_seconds( 0.05 ) ); // See note below.
- }
- const char* name() const override
- {
- return "voidform_insanity_loss";
- }
- void execute() override
- {
- // Updated 2016-06-08 by Twintop:
- // ---
- // http://us.battle.net/wow/en/forum/topic/20743504316?page=2#31
- // http://us.battle.net/wow/en/forum/topic/20743504316?page=4#71
- // ---
- // Drain starts at 9 over 1 second and increases by 1 over 2 seconds per
- // stack of Voidform. I.E.: 9 over t=0->1, 9.5 over t=1->2, etc.
- // Drain happens continuously, like energy in reverse.
- // We make ticks happen every 0.05sec to get as close to contiunuous as
- // possible without killing simulation lengths.
- // CHECK ME: Triggering Voidform in-game and not using any abilities
- // results in 10 stacks, rarely 11 stacks if you have high latency.
- // Sim seems to mostly get 9 stacks, rarely 10 stacks.
- // ---
- // 2016/06/05 update by Twintop:
- // The drain amount for Insanity is tracked separately from the Voidform
- // stacks. "Insanity Drain Stacks" always begins at 1 (Legendary Shoulders
- // can let you start with more stacks of Voidform). Using Dispersion or
- // Void Torrent cause these "Insanity Drain Stacks" to pause while being
- // channeled.
- auto priest = debug_cast<priest_t*>( player() );
- // LOGIC/SANITY CHECK:
- // Stack 1 = 9 insanity = ( -4500 / -500 ) + ( (1 - 1) / 2 ) = 9 + (0 /
- // 2) = 9
- // Stack 2 = 9.5 insanity = ( -4500) / -500 ) + ( (2 - 1) / 2 ) = 9 +
- // (1/2) = 9.5
- double insanity_loss =
- ( ( priest->buffs.voidform->data().effectN( 2 ).base_value() /
- -500 ) +
- ( ( priest->buffs.insanity_drain_stacks->check() - 1 ) / 2 ) ) *
- 0.05;
- if ( insanity_loss > priest->resources.current[ RESOURCE_INSANITY ] )
- {
- insanity_loss = priest->resources.current[ RESOURCE_INSANITY ];
- }
- priest->resource_loss( RESOURCE_INSANITY, insanity_loss,
- priest->gains.insanity_drain );
- if ( priest->buffs.dispersion->check() )
- {
- priest->resource_gain( RESOURCE_INSANITY, insanity_loss,
- priest->gains.insanity_dispersion );
- }
- if ( priest->buffs.void_torrent->check() )
- {
- priest->resource_gain( RESOURCE_INSANITY, insanity_loss,
- priest->gains.insanity_void_torrent );
- }
- // If you don't have enough insanity for the drain, you drop out
- // with however much insanity you had left. HOWEVER, there is a
- // bug presently where this extra insanity doesn't count towards
- // your next Voidform. We're going to just remove this extra
- // insanity and drop down to 0 until this bug is fixed, one way
- // or another. -- 2014/04/17 Twintop
- if ( priest->resources.current[ RESOURCE_INSANITY ] == 0 )
- {
- if ( sim().debug )
- {
- sim().out_debug << "Insanity-loss event cancels voidform because "
- "priest is out of insanity.";
- }
- vf->insanity_loss = nullptr; // avoid double-canceling
- priest->buffs.voidform->expire();
- priest->buffs.sphere_of_insanity->expire();
- return;
- }
- vf->insanity_loss = new ( sim() ) insanity_loss_event_t( vf );
- }
- };
- insanity_loss_event_t* insanity_loss;
- voidform_t( priest_t& p )
- : base_t( p, buff_creator_t( &p, "voidform" )
- .spell( p.find_spell( 194249 ) )
- .add_invalidate( CACHE_PLAYER_DAMAGE_MULTIPLIER )
- .add_invalidate( CACHE_HASTE )
- .add_invalidate( CACHE_PLAYER_HEAL_MULTIPLIER ) ),
- insanity_loss( nullptr )
- {
- }
- bool trigger( int stacks, double value, double chance,
- timespan_t duration ) override
- {
- bool r = base_t::trigger( stacks, value, chance, duration );
- assert( insanity_loss == nullptr );
- insanity_loss = new ( *sim ) insanity_loss_event_t( this );
- priest.buffs.insanity_drain_stacks->trigger();
- priest.buffs.the_twins_painful_touch->trigger();
- return r;
- }
- void expire_override( int expiration_stacks,
- timespan_t remaining_duration ) override
- {
- if ( priest.buffs.lingering_insanity->check() )
- priest.buffs.lingering_insanity->expire();
- priest.buffs.insanity_drain_stacks->expire();
- priest.buffs.lingering_insanity->trigger( expiration_stacks );
- priest.buffs.the_twins_painful_touch->expire();
- if ( priest.buffs.surrender_to_madness->check() )
- {
- if ( sim->log )
- {
- sim->out_log.printf(
- "%s %s: Surrender to Madness kills you. You die. Horribly.",
- priest.name(), name() );
- }
- priest.demise();
- priest.arise();
- priest.buffs.surrender_to_madness_death->trigger();
- }
- event_t::cancel( insanity_loss );
- base_t::expire_override( expiration_stacks, remaining_duration );
- }
- void reset() override
- {
- base_t::reset();
- event_t::cancel( insanity_loss );
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment