Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct melee_t: public warrior_attack_t
- {
- bool mh_lost_melee_contact, oh_lost_melee_contact;
- double base_rage_generation, arms_rage_multiplier, fury_rage_multiplier;
- devastate_t* devastator;
- melee_t( const std::string& name, warrior_t* p ):
- warrior_attack_t( name, p, spell_data_t::nil() ),
- mh_lost_melee_contact( true ), oh_lost_melee_contact( true ),
- // patch notes said 10% buff so that would be 4.0 -> 4.4
- // however in game testing suggest that actual value is 4.286
- // with 3.6 speed weapon, we generate 27 rage on hit, not 27.72
- // and crits generate 35 not 36
- base_rage_generation( 1.75 ), arms_rage_multiplier( 4.286 ), fury_rage_multiplier( 0.80 ),
- devastator( nullptr )
- {
- school = SCHOOL_PHYSICAL;
- special = false;
- background = repeating = may_glance = true;
- trigger_gcd = timespan_t::zero();
- if ( p -> dual_wield() )
- {
- base_hit -= 0.19;
- }
- if ( p -> talents.devastator -> ok() )
- {
- devastator = new devastate_t( p, "" );
- add_child( devastator );
- }
- }
- void reset() override
- {
- warrior_attack_t::reset();
- mh_lost_melee_contact = oh_lost_melee_contact = true;
- }
- timespan_t execute_time() const override
- {
- timespan_t t = warrior_attack_t::execute_time();
- if ( weapon -> slot == SLOT_MAIN_HAND && mh_lost_melee_contact )
- {
- return timespan_t::zero(); // If contact is lost, the attack is instant.
- }
- else if ( weapon -> slot == SLOT_OFF_HAND && oh_lost_melee_contact ) // Also used for the first attack.
- {
- return timespan_t::zero();
- }
- else
- {
- return t;
- }
- }
- void schedule_execute( action_state_t* s ) override
- {
- warrior_attack_t::schedule_execute( s );
- if ( weapon -> slot == SLOT_MAIN_HAND )
- {
- mh_lost_melee_contact = false;
- }
- else if ( weapon -> slot == SLOT_OFF_HAND )
- {
- oh_lost_melee_contact = false;
- }
- }
- double composite_hit() const override
- {
- if ( p() -> artifact.focus_in_chaos.rank() && p() -> buff.enrage -> up() )
- {
- return 1.0;
- }
- return warrior_attack_t::composite_hit();
- }
- void execute() override
- {
- if ( p() -> current.distance_to_move > 5 )
- { // Cancel autoattacks, auto_attack_t will restart them when we're back in range.
- if ( weapon -> slot == SLOT_MAIN_HAND )
- {
- p() -> proc.delayed_auto_attack -> occur();
- mh_lost_melee_contact = true;
- player -> main_hand_attack -> cancel();
- }
- else
- {
- p() -> proc.delayed_auto_attack -> occur();
- oh_lost_melee_contact = true;
- player -> off_hand_attack -> cancel();
- }
- }
- else
- {
- warrior_attack_t::execute();
- if ( result_is_hit( execute_state -> result ) )
- {
- if ( p() -> specialization() == WARRIOR_PROTECTION )
- {
- if ( p() -> talents.devastator -> ok() )
- {
- p() -> resource_gain( RESOURCE_RAGE,
- p() -> talents.devastator -> effectN( 1 ).trigger() -> effectN( 3 ).resource( RESOURCE_RAGE ),
- p() -> gain.melee_main_hand );
- devastator -> target = execute_state -> target;
- devastator -> schedule_execute();
- }
- }
- else
- {
- trigger_rage_gain( execute_state );
- }
- }
- }
- }
- void trigger_rage_gain( action_state_t* s )
- {
- double rage_gain = weapon -> swing_time.total_seconds() * base_rage_generation;
- if ( p() -> specialization() == WARRIOR_ARMS )
- {
- rage_gain *= arms_rage_multiplier;
- if ( s -> result == RESULT_CRIT )
- rage_gain *= 1.3;
- }
- else
- {
- rage_gain *= fury_rage_multiplier;
- if ( weapon -> slot == SLOT_OFF_HAND )
- {
- rage_gain *= 0.5;
- }
- rage_gain *= 1.0 + p() -> talents.endless_rage -> effectN( 1 ).percent();
- }
- rage_gain = util::round( rage_gain, 1 );
- if ( p() -> specialization() == WARRIOR_ARMS && s -> result == RESULT_CRIT )
- {
- p() -> resource_gain( RESOURCE_RAGE,
- rage_gain,
- p() -> gain.melee_crit );
- }
- else
- {
- p() -> resource_gain( RESOURCE_RAGE,
- rage_gain,
- weapon -> slot == SLOT_OFF_HAND ? p() -> gain.melee_off_hand : p() -> gain.melee_main_hand );
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement