Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Execute ==================================================================
- struct execute_sweep_t: public warrior_attack_t
- {
- double original;
- bool free;
- execute_sweep_t( warrior_t* p, double original_cost, bool was_it_free ):
- warrior_attack_t( "execute", p, p -> spec.execute ), original( original_cost ), free( was_it_free )
- {
- weapon = &( p -> main_hand_weapon );
- base_crit += p -> artifact.deathblow.percent();
- base_crit += p -> artifact.deathdealer.percent();
- energize_amount = 0;
- }
- double action_multiplier() const override
- {
- double am = warrior_attack_t::action_multiplier();
- if ( p() -> mastery.colossal_might -> ok() )
- {
- am *= 4.0 * ( std::min( 40.0, ( free ? 40.0 : original ) ) / 40 );
- }
- am *= 1.0 + p() -> buff.shattered_defenses -> stack_value();
- return am;
- }
- double composite_crit_chance() const override
- {
- double cc = warrior_attack_t::composite_crit_chance();
- if ( p() -> buff.shattered_defenses -> check() )
- {
- cc += p() -> buff.shattered_defenses -> data().effectN( 2 ).percent();
- }
- return cc;
- }
- double cost() const override
- {
- return 0;
- }
- void execute() override
- {
- warrior_attack_t::execute();
- p() -> execute_sweeping_strike = nullptr;
- }
- void impact( action_state_t* s ) override
- {
- warrior_attack_t::impact( s );
- if ( s -> result == RESULT_CRIT )
- {
- arms_t19_4p( *s );
- }
- }
- };
- struct sweeping_execute_t: public event_t
- {
- timespan_t duration;
- execute_sweep_t* execute_sweep;
- player_t* original_target;
- warrior_t* warrior;
- sweeping_execute_t( warrior_t*p, double cost, bool free, player_t* target ):
- event_t( *p -> sim ), execute_sweep( nullptr ), original_target( target ), warrior( p )
- {
- duration = next_execute();
- add_event( duration );
- execute_sweep = new execute_sweep_t( p, cost, free );
- }
- timespan_t next_execute() const
- {
- return timespan_t::from_millis( 500 );
- }
- void execute() override
- {
- player_t* new_target = nullptr;
- // Gotta find a target for this bastard to hit. Also if the target dies in the 0.5 seconds between the original execute and this, we don't want to continue.
- for ( size_t i = 0; execute_sweep -> target_cache.list.size() <= i; ++i )
- {
- if ( execute_sweep -> target_cache.list[i] == original_target )
- continue;
- new_target = execute_sweep -> target_cache.list[i];
- }
- if ( new_target )
- {
- execute_sweep -> target = new_target;
- execute_sweep -> execute();
- }
- else
- {
- warrior -> execute_sweeping_strike = nullptr;
- }
- }
- };
- struct execute_off_hand_t: public warrior_attack_t
- {
- execute_off_hand_t( warrior_t* p, const char* name, const spell_data_t* s ):
- warrior_attack_t( name, p, s )
- {
- dual = true;
- may_miss = may_dodge = may_parry = may_block = false;
- weapon = &( p -> off_hand_weapon );
- if ( p -> main_hand_weapon.group() == WEAPON_1H &&
- p -> off_hand_weapon.group() == WEAPON_1H )
- {
- weapon_multiplier *= 1.0 + p -> spec.singleminded_fury -> effectN( 3 ).percent();
- }
- base_crit += p -> artifact.deathdealer.percent();
- }
- double action_multiplier() const override
- {
- double am = warrior_attack_t::action_multiplier();
- am *= 1.0 + p() -> buff.juggernaut -> stack_value();
- return am;
- }
- void impact( action_state_t* s ) override
- {
- warrior_attack_t::impact( s );
- if ( s -> result == RESULT_CRIT )
- {
- p() -> buff.massacre -> trigger();
- if ( p() -> execute_enrage )
- {
- p() -> enrage();
- }
- }
- }
- };
- struct execute_t: public warrior_attack_t
- {
- execute_off_hand_t* oh_attack;
- double max_rage;
- execute_t( warrior_t* p, const std::string& options_str ):
- warrior_attack_t( "execute", p, p -> spec.execute ), oh_attack( nullptr ),
- max_rage( 0 )
- {
- parse_options( options_str );
- weapon = &( p -> main_hand_weapon );
- if ( p -> specialization() == WARRIOR_FURY )
- {
- oh_attack = new execute_off_hand_t( p, "execute_offhand", p -> find_spell( 163558 ) );
- add_child( oh_attack );
- if ( p -> main_hand_weapon.group() == WEAPON_1H &&
- p -> off_hand_weapon.group() == WEAPON_1H )
- {
- weapon_multiplier *= 1.0 + p -> spec.singleminded_fury -> effectN( 3 ).percent();
- }
- }
- base_crit += p -> artifact.deathblow.percent();
- base_crit += p -> artifact.deathdealer.percent();
- energize_amount = 0;
- max_rage = p -> talents.dauntless -> ok() ? 32 : 40;
- }
- double action_multiplier() const override
- {
- double am = warrior_attack_t::action_multiplier();
- if ( p() -> mastery.colossal_might -> ok() )
- {
- bool free = ( p() -> buff.ayalas_stone_heart -> up() || p() -> buff.battle_cry_deadly_calm -> up() );
- am *= 4.0 * ( std::min( max_rage, ( free ? max_rage : p() -> resources.current[RESOURCE_RAGE] ) ) / max_rage );
- }
- else if ( p() -> has_shield_equipped() )
- { am *= 1.0 + p() -> spec.protection -> effectN( 2 ).percent(); }
- am *= 1.0 + p() -> buff.shattered_defenses -> stack_value();
- am *= 1.0 + p() -> buff.juggernaut -> stack_value();
- return am;
- }
- double composite_crit_chance() const override
- {
- double cc = warrior_attack_t::composite_crit_chance();
- if ( p() -> buff.shattered_defenses -> check() )
- {
- cc += p() -> buff.shattered_defenses -> data().effectN( 2 ).percent();
- }
- return cc;
- }
- double tactician_cost() const override
- {
- double c = 0;
- c = std::min( max_rage, std::max( p() -> resources.current[RESOURCE_RAGE], c ) );
- if ( p() -> talents.dauntless -> ok() )
- {
- c /= 1.0 + p() -> talents.dauntless -> effectN( 1 ).percent();
- }
- if ( sim -> log )
- {
- sim -> out_debug.printf( "Rage used to calculate tactician chance from ability %s: %4.4f, actual rage used: %4.4f",
- name(),
- c,
- cost() );
- }
- return c;
- }
- double cost() const override
- {
- double c = warrior_attack_t::cost();
- if ( p() -> buff.ayalas_stone_heart -> check() )
- {
- return c *= 1.0 + p() -> buff.ayalas_stone_heart -> data().effectN( 2 ).percent();
- }
- if ( p() -> buff.battle_cry_deadly_calm -> check() )
- {
- return c *= 1.0 + p() -> talents.deadly_calm -> effectN( 1 ).percent();
- }
- if ( p() -> mastery.colossal_might -> ok() ) // Arms
- {
- c = std::min( max_rage, std::max( p() -> resources.current[RESOURCE_RAGE], c ) );
- c *= 1.0 + p() -> buff.precise_strikes -> check_value();
- }
- else if ( p() -> buff.sense_death -> check() ) // Fury
- {
- c *= 1.0 + p() -> buff.sense_death -> data().effectN( 1 ).percent();
- }
- return c;
- }
- void execute() override
- {
- warrior_attack_t::execute();
- if ( p() -> cooldown.rage_of_the_valarjar_icd -> up() && p() -> buff.berserking_driver -> trigger() )
- {
- p() -> cooldown.rage_of_the_valarjar_icd -> start();
- }
- p() -> buff.sense_death -> expire();
- p() -> buff.sense_death -> trigger();
- if ( p() -> specialization() == WARRIOR_FURY && result_is_hit( execute_state -> result ) &&
- p() -> off_hand_weapon.type != WEAPON_NONE ) // If MH fails to land, or if there is no OH weapon for Fury, oh attack does not execute.
- oh_attack -> execute();
- p() -> buff.shattered_defenses -> expire();
- p() -> buff.precise_strikes -> expire();
- p() -> buff.juggernaut -> trigger( 1 );
- if ( p() -> talents.sweeping_strikes -> ok() && target_cache.list.size() > 1 )
- {
- p() -> execute_sweeping_strike = new ( *sim ) sweeping_execute_t( p(),
- resource_consumed,
- p() -> buff.ayalas_stone_heart -> up(),
- execute_state -> target );
- }
- p() -> buff.ayalas_stone_heart -> expire();
- }
- void impact( action_state_t* s ) override
- {
- warrior_attack_t::impact( s );
- if ( s -> result == RESULT_CRIT )
- {
- p() -> buff.massacre -> trigger();
- arms_t19_4p( *s );
- if ( p() -> execute_enrage && p() -> specialization() == WARRIOR_FURY )
- {
- p() -> enrage();
- }
- }
- }
- bool ready() override
- {
- if ( p() -> main_hand_weapon.type == WEAPON_NONE )
- {
- return false;
- }
- if ( p() -> buff.ayalas_stone_heart -> check() )
- {
- return warrior_attack_t::ready();
- }
- // Call warrior_attack_t::ready() first for proper targeting support.
- if ( warrior_attack_t::ready() && target -> health_percentage() <= 20 )
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement