diff --git a/engine/action/parse_effects.cpp b/engine/action/parse_effects.cpp index 15c0caf29c..cd0bd05f43 100644 --- a/engine/action/parse_effects.cpp +++ b/engine/action/parse_effects.cpp @@ -949,6 +949,16 @@ double parse_player_effects_t::composite_parry() const return parry; } +double parse_player_effects_t::composite_block() const +{ + auto block = player_t::composite_block(); + + for ( const auto& i : block_effects ) + block += get_effect_value( i ); + + return block; +} + double parse_player_effects_t::composite_base_armor_multiplier() const { auto bam = player_t::composite_base_armor_multiplier(); @@ -1280,6 +1290,11 @@ std::vector* parse_player_effects_t::get_effect_vector( const s invalidate( CACHE_PARRY ); return &parry_effects; + case A_MOD_BLOCK_PERCENT: + str = "block"; + invalidate( CACHE_BLOCK ); + return &block_effects; + case A_MOD_BASE_RESISTANCE_PCT: if ( eff.misc_value1() & SCHOOL_MASK_PHYSICAL ) { diff --git a/engine/action/parse_effects.hpp b/engine/action/parse_effects.hpp index 9e23306543..242b42b2c0 100644 --- a/engine/action/parse_effects.hpp +++ b/engine/action/parse_effects.hpp @@ -692,6 +692,7 @@ struct parse_player_effects_t : public player_t, public parse_effects_t std::vector spell_hit_effects; std::vector crit_avoidance_effects; std::vector parry_effects; + std::vector block_effects; std::vector base_armor_multiplier_effects; std::vector armor_multiplier_effects; std::vector haste_effects; @@ -733,6 +734,7 @@ struct parse_player_effects_t : public player_t, public parse_effects_t double composite_spell_hit() const override; double composite_crit_avoidance() const override; double composite_parry() const override; + double composite_block() const override; double composite_base_armor_multiplier() const override; double composite_armor_multiplier() const override; double composite_melee_haste() const override; diff --git a/engine/class_modules/apl/warrior.cpp b/engine/class_modules/apl/warrior.cpp index 4367675788..a4554687a0 100644 --- a/engine/class_modules/apl/warrior.cpp +++ b/engine/class_modules/apl/warrior.cpp @@ -43,9 +43,23 @@ void warrior( player_t* p ) default_->add_action( "auto_attack" ); default_->add_action( "battle_shout,if=!buff.battle_shout.up" ); + default_->add_action( "demoralizing_shout,if=!debuff.demoralizing_shout.up" ); + default_->add_action( "intimidating_shout" ); default_->add_action( "bloodrage,if=rage<80" ); + default_->add_action( "victory_rush,if=buff.victorious.up" ); + default_->add_action( "execute,if=target.health.pct<=20" ); default_->add_action( "rend,if=!ticking" ); + default_->add_action( "overpower,if=buff.overpower.up" ); + default_->add_action( "revenge,if=buff.revenge_available.up" ); + default_->add_action( "retaliation" ); + default_->add_action( "mocking_blow" ); + default_->add_action( "disarm" ); + default_->add_action( "shield_block" ); + default_->add_action( "sunder_armor,if=debuff.sunder_armor.stack<5|debuff.sunder_armor.remains<5" ); + default_->add_action( "shield_bash" ); default_->add_action( "thunder_clap,if=spell_targets>=2" ); + default_->add_action( "cleave,if=spell_targets>=2" ); + default_->add_action( "slam,if=rage>=30" ); default_->add_action( "heroic_strike,if=rage>=30" ); } //warrior_apl_end diff --git a/engine/class_modules/sc_warrior.cpp b/engine/class_modules/sc_warrior.cpp index 85e1056e9c..d8e59e7dc6 100644 --- a/engine/class_modules/sc_warrior.cpp +++ b/engine/class_modules/sc_warrior.cpp @@ -7,16 +7,52 @@ #include "action/parse_effects.hpp" #include "class_modules/apl/warrior.hpp" -namespace +namespace warrior { // ========================================================================== // Warrior // ========================================================================== -struct warrior_t : public player_t +constexpr unsigned STANCE_MASK_BATTLE = 0x00010000; +constexpr unsigned STANCE_MASK_DEFENSIVE = 0x00020000; +constexpr unsigned STANCE_MASK_BERSERKER = 0x00040000; + +struct warrior_t; + +struct warrior_td_t : public actor_target_data_t +{ + struct dots_t + { + dot_t* deep_wounds = nullptr; + dot_t* rend = nullptr; + } dots; + + struct debuffs_t + { + buff_t* demoralizing_shout = nullptr; + buff_t* disarm = nullptr; + buff_t* hamstring = nullptr; + buff_t* intimidating_shout = nullptr; + buff_t* sunder_armor = nullptr; + buff_t* thunder_clap = nullptr; + } debuffs; + + warrior_td_t( player_t* target, warrior_t& p ); +}; + +// utility to create target_effect_t compatible functions from warrior_td_t member references +template +static std::function d_fn( T d ) +{ + return [ d ]( actor_target_data_t* t ) { + return std::invoke( d, static_cast( t )->debuffs )->check(); + }; +} + +struct warrior_t final : public parse_player_effects_t { warrior_t( sim_t* sim, util::string_view name, race_e r = RACE_NONE ) : - player_t( sim, WARRIOR, name, r ) {} + parse_player_effects_t( sim, WARRIOR, name, r ) {} resource_e primary_resource() const override { return RESOURCE_RAGE; } @@ -25,6 +61,14 @@ struct warrior_t : public player_t void create_actions() override; void create_buffs() override; void init_spells() override; + void init_special_effects() override; + void activate() override; + void assess_damage( school_e, result_amount_type, action_state_t* ) override; + void parse_action_effects( action_t* ); + + warrior_td_t* get_target_data( player_t* target ) const override; + + unsigned current_stance_mask() const; action_t* create_action( util::string_view name, util::string_view options_str ) override; void init_action_list() override; @@ -39,16 +83,125 @@ struct warrior_t : public player_t { // Arms // Row 1 + player_talent_t improved_heroic_strike; player_talent_t deflection; + player_talent_t improved_rend; + // Row 2 + player_talent_t improved_charge; + player_talent_t improved_tactical_mastery; + player_talent_t improved_overpower; + // Row 3 + player_talent_t anger_management; + player_talent_t deep_wounds; + // Row 4 + player_talent_t spearing_strike; + player_talent_t two_handed_weapon_specialization; + player_talent_t impale; + // Row 5 + player_talent_t bloodthrill; + player_talent_t sweeping_strikes; + player_talent_t weaponmaster; + // Row 6 + player_talent_t improved_slam; + player_talent_t improved_hamstring; + // Row 7 + player_talent_t mortal_strike; + + // Fury + // Row 1 + player_talent_t booming_voice; + player_talent_t cruelty; + // Row 2 + player_talent_t lingering_rage; + player_talent_t unbridled_wrath; + // Row 3 + player_talent_t furious_precision; + player_talent_t piercing_howl; + player_talent_t blood_craze; + // Row 4 + player_talent_t dual_wield_specialization; + player_talent_t raging_blows; + player_talent_t enrage; + player_talent_t improved_execute; + // Row 5 + player_talent_t improved_berserker_rage; + player_talent_t death_wish; + player_talent_t improved_intercept; + // Row 6 + player_talent_t flurry; + player_talent_t gore_drinker; + // Row 7 + player_talent_t bloodthirst; + + // Protection + // Row 1 + player_talent_t improved_bloodrage; + player_talent_t shield_specialization; + player_talent_t iron_will; + // Row 2 + player_talent_t anticipation; + player_talent_t improved_revenge; + player_talent_t improved_thunder_clap; + // Row 3 + player_talent_t last_stand; + player_talent_t master_of_defense; + player_talent_t improved_disarm; + player_talent_t defiance; + // Row 4 + player_talent_t improved_sunder_armor; + player_talent_t vanguard; + player_talent_t improved_shield_bash; + // Row 5 + player_talent_t improved_shield_wall; + player_talent_t concussion_blow; + player_talent_t focused_rage; + // Row 6 + player_talent_t bastion; + // Row 7 + player_talent_t shield_slam; } talent; + struct spells_t + { + const spell_data_t* battle_stance = spell_data_t::nil(); + const spell_data_t* battle_stance_passive = spell_data_t::nil(); + const spell_data_t* berserker_stance = spell_data_t::nil(); + const spell_data_t* berserker_stance_passive = spell_data_t::nil(); + const spell_data_t* defensive_stance = spell_data_t::nil(); + const spell_data_t* defensive_stance_passive = spell_data_t::nil(); + const spell_data_t* demoralizing_shout = spell_data_t::nil(); + const spell_data_t* disarm = spell_data_t::nil(); + const spell_data_t* execute_damage = spell_data_t::nil(); + const spell_data_t* hamstring = spell_data_t::nil(); + const spell_data_t* intimidating_shout = spell_data_t::nil(); + const spell_data_t* intimidating_shout_fear = spell_data_t::nil(); + const spell_data_t* overpower_available = spell_data_t::nil(); + const spell_data_t* retaliation = spell_data_t::nil(); + const spell_data_t* retaliation_attack = spell_data_t::nil(); + const spell_data_t* shield_block = spell_data_t::nil(); + const spell_data_t* sunder_armor = spell_data_t::nil(); + const spell_data_t* thunder_clap = spell_data_t::nil(); + const spell_data_t* victory_rush = spell_data_t::nil(); + const spell_data_t* victorious = spell_data_t::nil(); + } spell; + struct buffs_t { + buff_t* battle_stance = nullptr; + buff_t* berserker_stance = nullptr; + buff_t* defensive_stance = nullptr; + buff_t* battle_shout = nullptr; buff_t* bloodrage = nullptr; + buff_t* cleave_queued = nullptr; buff_t* heroic_strike_queued = nullptr; + buff_t* overpower_available = nullptr; + buff_t* retaliation = nullptr; + buff_t* revenge_available = nullptr; + buff_t* shield_block = nullptr; + buff_t* victorious = nullptr; } buff; struct gains_t @@ -56,19 +209,71 @@ struct warrior_t : public player_t gain_t* melee = nullptr; } gain; + struct actives_t + { + action_t* cleave = nullptr; + action_t* heroic_strike = nullptr; + action_t* retaliation = nullptr; + } active; + struct { spell_ranks_t battle_shout; spell_ranks_t bloodrage; spell_ranks_t charge; + spell_ranks_t cleave; + spell_ranks_t demoralizing_shout; + spell_ranks_t disarm; + spell_ranks_t execute; + spell_ranks_t hamstring; spell_ranks_t heroic_strike; + spell_ranks_t mocking_blow; + spell_ranks_t overpower; spell_ranks_t rend; + spell_ranks_t retaliation; + spell_ranks_t revenge; + spell_ranks_t shield_bash; + spell_ranks_t shield_block; + spell_ranks_t slam; + spell_ranks_t slam_improved; + spell_ranks_t sunder_armor; + spell_ranks_t taunt; spell_ranks_t thunder_clap; } rank; - action_t* heroic_strike = nullptr; +private: + target_specific_t _target_data; }; +warrior_td_t::warrior_td_t( player_t* target, warrior_t& p ) : actor_target_data_t( target, &p ) +{ + dots.deep_wounds = target->get_dot( "deep_wounds", &p ); + dots.rend = target->get_dot( "rend", &p ); + + debuffs.demoralizing_shout = + buff_t::make_buff_fallback( p.spell.demoralizing_shout->ok(), *this, + "demoralizing_shout", p.spell.demoralizing_shout ) + ->set_default_value_from_effect( 1 ); + + if ( p.spell.disarm->ok() ) + debuffs.disarm = make_buff( *this, "disarm", p.spell.disarm ); + + if ( p.spell.hamstring->ok() ) + debuffs.hamstring = make_buff( *this, "hamstring", p.spell.hamstring ) + ->set_default_value_from_effect( 2 ); + + if ( p.spell.intimidating_shout_fear->ok() ) + debuffs.intimidating_shout = make_buff( *this, "intimidating_shout", p.spell.intimidating_shout_fear ); + + if ( p.spell.sunder_armor->ok() ) + debuffs.sunder_armor = + make_buff( *this, "sunder_armor", p.spell.sunder_armor ) + ->set_default_value_from_effect( 1 ); + + if ( p.spell.thunder_clap->ok() ) + debuffs.thunder_clap = make_buff( *this, "thunder_clap", p.spell.thunder_clap ); +} + template struct warrior_action_t : public parse_action_effects_t { @@ -79,7 +284,11 @@ struct warrior_action_t : public parse_action_effects_t using base_t = warrior_action_t; template - warrior_action_t( Args&&... args ) : ab( std::forward( args )... ) {} + warrior_action_t( Args&&... args ) : ab( std::forward( args )... ) + { + if ( ab::data().ok() ) + p()->parse_action_effects( this ); + } warrior_t* p() { return debug_cast( this->player ); } @@ -87,6 +296,32 @@ struct warrior_action_t : public parse_action_effects_t const warrior_t* p() const { return debug_cast( this->player ); } + warrior_td_t* td( player_t* target ) const + { return p()->get_target_data( target ); } + + bool stance_ready() const + { + if ( this->background ) + return true; + + const unsigned mask = this->data().stance_mask(); + if ( !mask ) + return true; + + return ( mask & p()->current_stance_mask() ) != 0; + } + + bool ready() override + { return stance_ready() && ab::ready(); } + + void impact( action_state_t* s ) override + { + ab::impact( s ); + + if ( s->result == RESULT_DODGE ) + p()->buff.overpower_available->trigger(); + } + void consume_resource() override { resource_e cr = this->current_resource(); @@ -165,6 +400,53 @@ struct bloodrage_t : public warrior_spell_t } }; +///////////////////////////////////////////////////////////////////////////////////// +// +// Stances +// +///////////////////////////////////////////////////////////////////////////////////// + +struct warrior_stance_t : public warrior_spell_t +{ + buff_t* stance; + std::array stances; + + warrior_stance_t( warrior_t* player, util::string_view name, const spell_data_t* spell, buff_t* stance, + std::array stances, util::string_view options_str ) : + warrior_spell_t( name, player, spell ), stance( stance ), stances( stances ) + { + parse_options( options_str ); + + harmful = false; + may_miss = false; + target = player; + trigger_gcd = 0_ms; + + cooldown = player->get_cooldown( "stance_swap_cooldown", this ); + cooldown->category = true; + cooldown->duration = std::max( spell->cooldown(), spell->category_cooldown() ); + } + + bool ready() override + { + if ( stance->check() ) + return false; + + return warrior_spell_t::ready(); + } + + void execute() override + { + warrior_spell_t::execute(); + + for ( auto* b : stances ) + if ( b != stance ) + b->expire(); + + stance->trigger(); + } +}; + ///////////////////////////////////////////////////////////////////////////////////// // // Melee @@ -196,9 +478,9 @@ struct warrior_melee_t : public warrior_attack_t // try to trigger a queued heroic strike if ( p()->buff.heroic_strike_queued->check() ) { - if ( p()->resource_available( RESOURCE_RAGE, p()->heroic_strike->cost() ) ) + if ( p()->resource_available( RESOURCE_RAGE, p()->active.heroic_strike->cost() ) ) { - p()->heroic_strike->execute_on_target( target ); + p()->active.heroic_strike->execute_on_target( target ); schedule_execute(); return; } @@ -206,6 +488,19 @@ struct warrior_melee_t : public warrior_attack_t p()->buff.heroic_strike_queued->expire(); } + // try to trigger a queued cleave + if ( p()->buff.cleave_queued->check() ) + { + if ( p()->resource_available( RESOURCE_RAGE, p()->active.cleave->cost() ) ) + { + p()->active.cleave->execute_on_target( target ); + schedule_execute(); + return; + } + // didn't have enough rage, cancel the tracking queue buff + p()->buff.cleave_queued->expire(); + } + warrior_attack_t::execute(); } @@ -272,26 +567,116 @@ struct rend_t : public warrior_attack_t dot_behavior = DOT_CLIP; - // TODO: Verify this at higher levels - attack_power_mod.tick = 0.016; + attack_power_mod.tick = 0.02; } }; -// APL action to queue up heroic strike -// Checks to make sure warrior has enough rage to queue it up -// The actual HS execute in the melee swing will check rage again to make sure that rage -// wasn't consumed mid-swing -// TODO: Is there a better way to handle On Next Swing? -// TODO: look into generalizing this pattern for cleave, hunter (raptor strike), and druid (maul) -struct heroic_strike_queue_t : public action_t +struct hamstring_t : public warrior_attack_t { - heroic_strike_queue_t( warrior_t* p, util::string_view options_str ) - : action_t( ACTION_OTHER, "heroic_strike_queue", p ) + hamstring_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "hamstring", player, player->rank.hamstring.find_rank()->spell() ) { parse_options( options_str ); + } - trigger_gcd = 0_ms; - harmful = false; + void impact( action_state_t* s ) override + { + warrior_attack_t::impact( s ); + + if ( result_is_hit( s->result ) ) + { + // NOTE: Movement speed slow is tracked but not applied to the target. + td( s->target )->debuffs.hamstring->trigger(); + } + } +}; + +struct sunder_armor_t : public warrior_attack_t +{ + sunder_armor_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "sunder_armor", player, player->rank.sunder_armor.find_rank()->spell() ) + { + parse_options( options_str ); + } + + void impact( action_state_t* s ) override + { + warrior_attack_t::impact( s ); + + if ( result_is_hit( s->result ) ) + td( s->target )->debuffs.sunder_armor->trigger(); + } +}; + +struct overpower_t : public warrior_attack_t +{ + overpower_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "overpower", player, player->rank.overpower.find_rank()->spell() ) + { + parse_options( options_str ); + + may_block = may_dodge = may_parry = false; + } + + bool ready() override + { + if ( !data().ok() ) + return false; + + if ( !p()->buff.overpower_available->check() ) + return false; + + return warrior_attack_t::ready(); + } + + void execute() override + { + p()->buff.overpower_available->expire(); + + warrior_attack_t::execute(); + } +}; + +struct revenge_t : public warrior_attack_t +{ + revenge_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "revenge", player, player->rank.revenge.find_rank()->spell() ) + { + parse_options( options_str ); + + // Revenge scales with 22.5% of attack power in Defensive Stance. + attack_power_mod.direct = 0.225; + } + + bool ready() override + { + if ( !data().ok() ) + return false; + + if ( !p()->buff.revenge_available->check() ) + return false; + + return warrior_attack_t::ready(); + } + + void execute() override + { + p()->buff.revenge_available->expire(); + + warrior_attack_t::execute(); + } +}; + +// APL action to queue up cleave +struct cleave_queue_t : public action_t +{ + cleave_queue_t( warrior_t* p, util::string_view options_str ) : + action_t( ACTION_OTHER, "cleave_queue", p ) + { + parse_options( options_str ); + + trigger_gcd = 0_ms; + harmful = false; ignore_false_positive = true; } @@ -300,12 +685,13 @@ struct heroic_strike_queue_t : public action_t bool ready() override { - // already queued - if ( p()->buff.heroic_strike_queued->check() ) + if ( !p()->active.cleave->data().ok() ) return false; - // not enough rage - if ( !p()->resource_available( RESOURCE_RAGE, p()->heroic_strike->cost() ) ) + if ( p()->buff.cleave_queued->check() || p()->buff.heroic_strike_queued->check() ) + return false; + + if ( !p()->resource_available( RESOURCE_RAGE, p()->active.cleave->cost() ) ) return false; return action_t::ready(); @@ -313,14 +699,14 @@ struct heroic_strike_queue_t : public action_t void execute() override { - p()->buff.heroic_strike_queued->trigger(); + p()->buff.cleave_queued->trigger(); } }; -struct heroic_strike_t : public warrior_attack_t +struct cleave_t : public warrior_attack_t { - heroic_strike_t( warrior_t* player, util::string_view options_str ) : - warrior_attack_t( "heroic_strike", player, player->rank.heroic_strike.find_rank()->spell() ) + cleave_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "cleave", player, player->rank.cleave.find_rank()->spell() ) { parse_options( options_str ); @@ -331,108 +717,609 @@ struct heroic_strike_t : public warrior_attack_t { warrior_attack_t::execute(); - p()->buff.heroic_strike_queued->expire(); + p()->buff.cleave_queued->expire(); } }; -struct charge_t : public warrior_attack_t +struct slam_t : public warrior_attack_t { - charge_t( warrior_t* player, util::string_view options_str ) : - warrior_attack_t( "charge", player, player->rank.charge.find_rank()->spell() ) + slam_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "slam", player, + player->talent.improved_slam.ok() + ? player->rank.slam_improved.find_rank()->spell() + : player->rank.slam.find_rank()->spell() ) { parse_options( options_str ); - harmful = false; - may_miss = false; + if ( player->talent.improved_slam.ok() ) + { + // Improved Slam no longer interrupts or delays the melee swing. + interrupt_auto_attack = false; + reset_auto_attack = false; + } + else + { + // Base Slam resets the swing timer. The improved variants are the only + // ranks with the Do Not Reset Combat Timers attribute in the spell data. + reset_auto_attack = true; + } } bool ready() override { - return !player->in_combat && warrior_attack_t::ready(); + if ( !data().ok() ) + return false; + + return warrior_attack_t::ready(); } }; -struct thunder_clap_t : public warrior_attack_t +struct victory_rush_heal_t : public heal_t { - thunder_clap_t( warrior_t* player, util::string_view options_str ) : - warrior_attack_t( "thunder_clap", player, player->rank.thunder_clap.find_rank()->spell() ) + victory_rush_heal_t( warrior_t* player ) : + heal_t( "victory_rush_heal", player, player->spell.victory_rush ) { - parse_options( options_str ); - - aoe = data().max_targets(); - - // TODO: Verify this at higher levels - attack_power_mod.direct = 0.05; - - // TODO: attack speed slow + background = true; + trigger_gcd = 0_ms; + target = player; + may_crit = false; } }; -///////////////////////////////////////////////////////////////////////////////////// -// -// Stats, Actions, Oh my -// -///////////////////////////////////////////////////////////////////////////////////// - -void warrior_t::init_base_stats() +struct victory_rush_t : public warrior_attack_t { - base.attack_power_per_strength = 2.0; + victory_rush_heal_t* heal = nullptr; - player_t::init_base_stats(); + victory_rush_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "victory_rush", player, player->spell.victory_rush ) + { + parse_options( options_str ); + attack_power_mod.direct = data().effectN( 3 ).percent(); - base.parry_per_strength = 0.0; + heal = new victory_rush_heal_t( player ); + add_child( heal ); + } - // TODO - can this base stuff be moved into core? + bool ready() override + { + if ( !data().ok() || !p()->buff.victorious->check() ) + return false; - base.all_crit = 0.0; - base.spell_crit_chance = 0.0; + return warrior_attack_t::ready(); + } - base.dodge_per_agility = base.attack_crit_per_agility; - auto base_dodge = ( dbc->race_base( race ).agility + dbc->attribute_base( type, level() ).agility ) - * base.dodge_per_agility; + void execute() override + { + // Using Victory Rush consumes the Victorious window. + p()->buff.victorious->expire(); - base.attack_crit_chance = get_passive_player_value( 0.0, "attack_crit" ); - base.parry = get_passive_player_value( 0.05, "parry" ); - base.block = get_passive_player_value( 0.05, "block" ); - base.dodge = get_passive_player_value( base_dodge, "dodge" ); + warrior_attack_t::execute(); - base.stats.attack_power = 3.0 * level() - 20.0; -} + // The heal happens even if the attack miss, dodge, or parry. + heal->execute_on_target( p() ); + } +}; -void warrior_t::init_gains() +struct execute_damage_t : public warrior_attack_t { - player_t::init_gains(); - - gain.melee = get_gain( "melee" ); -} + execute_damage_t( warrior_t* player ) : + warrior_attack_t( "execute_damage", player, player->spell.execute_damage ) + { + background = true; + trigger_gcd = 0_ms; + special = true; -void warrior_t::create_actions() -{ - heroic_strike = new heroic_strike_t( this, "" ); + base_dd_min = base_dd_max = 0; + } - player_t::create_actions(); -} + double cost() const override + { return 0; } +}; -void warrior_t::create_buffs() +struct execute_t : public warrior_attack_t { - buff.heroic_strike_queued = make_buff( this, "heroic_strike_queued" ); + execute_damage_t* damage = nullptr; + double base_damage = 0; + double rage_conversion = 0; - buff.battle_shout = make_buff( this, "battle_shout", rank.battle_shout.find_rank()->spell() ); + execute_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "execute", player, player->rank.execute.find_rank()->spell() ) + { + parse_options( options_str ); - buff.bloodrage = make_buff( this, "bloodrage", - rank.bloodrage.find_rank()->buff() ) - ->set_tick_callback( [ this ]( buff_t*, int, timespan_t ) { - resource_gain( RESOURCE_RAGE, 1.0, get_gain( "bloodrage" ) ); } ); + base_damage = data().effectN( 1 ).base_value(); - player_t::create_buffs(); -} + // per-rage conversion in effect 1's chain-multiplier + rage_conversion = data().effectN( 1 ).chain_multiplier() * 10.0; -void warrior_t::init_spells() -{ - player_t::init_spells(); + may_miss = may_dodge = may_parry = may_block = may_crit = false; + base_dd_min = base_dd_max = 0; + attack_power_mod.direct = 0; - rank.battle_shout = { this, + damage = new execute_damage_t( player ); + add_child( damage ); + } + + double cost() const override + { + return std::max( warrior_attack_t::cost(), p()->resources.current[ RESOURCE_RAGE ] ); + } + + // Execute only consumes rage when the damage actually lands. Miss/dodge/parry + // refunds base cost, and extra rage isn't deducted + void consume_resource() override + { + last_resource_cost = 0; + } + + bool ready() override + { + if ( !data().ok() || !target || !target->is_enemy() ) + return false; + + if ( target->resources.pct( RESOURCE_HEALTH ) > 0.20 ) + return false; + + return warrior_attack_t::ready(); + } + + void execute() override + { + double base_cost = warrior_attack_t::cost(); + double current_rage = p()->resources.current[ RESOURCE_RAGE ]; + + double extra_rage = std::max( 0.0, current_rage - base_cost ); + + damage->base_dd_min = damage->base_dd_max = base_damage + extra_rage * rage_conversion; + + warrior_attack_t::execute(); + + damage->execute_on_target( target ); + + if ( damage->execute_state && result_is_hit( damage->execute_state->result ) ) + action_t::consume_resource(); + else + { + last_resource_cost = 0.2 * base_cost; + + p()->resource_loss( RESOURCE_RAGE, last_resource_cost, nullptr, this ); + stats->consume_resource( RESOURCE_RAGE, last_resource_cost ); + + sim->print_log("{} consumes {} {} for {} ({})", + *p(), last_resource_cost, RESOURCE_RAGE, *this, p()->resources.current[ RESOURCE_RAGE ] ); + } + } +}; + +struct retaliation_attack_t : public warrior_attack_t +{ + retaliation_attack_t( warrior_t* player ) : + warrior_attack_t( "retaliation_attack", player, player->spell.retaliation_attack ) + { + background = true; + trigger_gcd = 0_ms; + may_crit = true; + may_dodge = true; + may_parry = true; + special = true; + } +}; + +struct retaliation_t : public warrior_spell_t +{ + retaliation_t( warrior_t* player, util::string_view options_str ) : + warrior_spell_t( "retaliation", player, player->rank.retaliation.find_rank()->spell() ) + { + parse_options( options_str ); + + harmful = false; + may_miss = false; + target = player; + + add_child( p()->active.retaliation ); + } + + bool ready() override + { + if ( !data().ok() ) + return false; + + return warrior_spell_t::ready(); + } + + void execute() override + { + warrior_spell_t::execute(); + + p()->buff.retaliation->trigger(); + } +}; + +// APL action to queue up heroic strike +// Checks to make sure warrior has enough rage to queue it up +// The actual HS execute in the melee swing will check rage again to make sure that rage +// wasn't consumed mid-swing +// TODO: Is there a better way to handle On Next Swing? +// TODO: look into generalizing this pattern for cleave, hunter (raptor strike), and druid (maul) +struct heroic_strike_queue_t : public action_t +{ + heroic_strike_queue_t( warrior_t* p, util::string_view options_str ) + : action_t( ACTION_OTHER, "heroic_strike_queue", p ) + { + parse_options( options_str ); + + trigger_gcd = 0_ms; + harmful = false; + ignore_false_positive = true; + } + + warrior_t* p() const + { return debug_cast( player ); } + + bool ready() override + { + // already queued + if ( p()->buff.heroic_strike_queued->check() || p()->buff.cleave_queued->check() ) + return false; + + // not enough rage + if ( !p()->resource_available( RESOURCE_RAGE, p()->active.heroic_strike->cost() ) ) + return false; + + return action_t::ready(); + } + + void execute() override + { + p()->buff.heroic_strike_queued->trigger(); + } +}; + +struct heroic_strike_t : public warrior_attack_t +{ + heroic_strike_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "heroic_strike", player, player->rank.heroic_strike.find_rank()->spell() ) + { + parse_options( options_str ); + + trigger_gcd = 0_ms; + } + + void execute() override + { + warrior_attack_t::execute(); + + p()->buff.heroic_strike_queued->expire(); + } +}; + +struct charge_t : public warrior_attack_t +{ + charge_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "charge", player, player->rank.charge.find_rank()->spell() ) + { + parse_options( options_str ); + + harmful = false; + may_miss = false; + } + + bool ready() override + { + return !player->in_combat && warrior_attack_t::ready(); + } +}; + +struct taunt_t : public warrior_spell_t +{ + taunt_t( warrior_t* player, util::string_view options_str ) : + warrior_spell_t( "taunt", player, player->rank.taunt.find_rank()->spell() ) + { + parse_options( options_str ); + } + + void execute() override + { + warrior_spell_t::execute(); + + target->taunt( player ); + } +}; + +struct mocking_blow_t : public warrior_attack_t +{ + mocking_blow_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "mocking_blow", player, player->rank.mocking_blow.find_rank()->spell() ) + { + parse_options( options_str ); + + // Mocking Blow has fixed spell damage and no attack-power coefficient. + } + + bool ready() override + { + if ( !data().ok() ) + return false; + + return warrior_attack_t::ready(); + } + + void impact( action_state_t* s ) override + { + warrior_attack_t::impact( s ); + + if ( result_is_hit( s->result ) ) + s->target->taunt( player ); + } +}; + +struct shield_bash_t : public warrior_attack_t +{ + shield_bash_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "shield_bash", player, player->rank.shield_bash.find_rank()->spell() ) + { + parse_options( options_str ); + + is_interrupt = true; + } + + bool ready() override + { + if ( !player->has_shield_equipped() ) + return false; + + return warrior_attack_t::ready(); + } +}; + +struct shield_block_t : public warrior_spell_t +{ + shield_block_t( warrior_t* player, util::string_view options_str ) : + warrior_spell_t( "shield_block", player, player->rank.shield_block.find_rank()->spell() ) + { + parse_options( options_str ); + + harmful = false; + may_miss = false; + target = player; + } + + bool ready() override + { + if ( !data().ok() ) + return false; + + if ( !player->has_shield_equipped() ) + return false; + + return warrior_spell_t::ready(); + } + + void execute() override + { + warrior_spell_t::execute(); + + p()->buff.shield_block->trigger(); + } +}; + +struct disarm_t : public warrior_attack_t +{ + disarm_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "disarm", player, player->rank.disarm.find_rank()->spell() ) + { + parse_options( options_str ); + } + + bool ready() override + { + if ( !data().ok() ) + return false; + + return warrior_attack_t::ready(); + } + + void impact( action_state_t* s ) override + { + warrior_attack_t::impact( s ); + + if ( result_is_hit( s->result ) ) + td( s->target )->debuffs.disarm->trigger(); + } +}; + +struct demoralizing_shout_t : public warrior_spell_t +{ + demoralizing_shout_t( warrior_t* player, util::string_view options_str ) : + warrior_spell_t( "demoralizing_shout", player, player->rank.demoralizing_shout.find_rank()->spell() ) + { + parse_options( options_str ); + + aoe = -1; + } + + bool ready() override + { + if ( !data().ok() ) + return false; + + return warrior_spell_t::ready(); + } + + void impact( action_state_t* s ) override + { + warrior_spell_t::impact( s ); + + if ( result_is_hit( s->result ) ) + td( s->target )->debuffs.demoralizing_shout->trigger(); + } +}; + +struct intimidating_shout_t : public warrior_spell_t +{ + intimidating_shout_t( warrior_t* player, util::string_view options_str ) : + warrior_spell_t( "intimidating_shout", player, player->spell.intimidating_shout ) + { + parse_options( options_str ); + + aoe = data().max_targets(); + } + + bool ready() override + { + if ( !data().ok() ) + return false; + + return warrior_spell_t::ready(); + } + + void impact( action_state_t* s ) override + { + warrior_spell_t::impact( s ); + + if ( result_is_hit( s->result ) ) + td( s->target )->debuffs.intimidating_shout->trigger(); + } +}; + +struct thunder_clap_t : public warrior_attack_t +{ + thunder_clap_t( warrior_t* player, util::string_view options_str ) : + warrior_attack_t( "thunder_clap", player, player->rank.thunder_clap.find_rank()->spell() ) + { + parse_options( options_str ); + + aoe = data().max_targets(); + + // TODO: Verify this at higher levels + attack_power_mod.direct = 0.05; + } + + void impact( action_state_t* s ) override + { + warrior_attack_t::impact( s ); + + if ( result_is_hit( s->result ) ) + { + // NOTE: Currently tracked for uptime only. The attack speed slow is not applied because + // enemy targets do not parse player effects. This only affects target swing timing/DTPS. + td( s->target )->debuffs.thunder_clap->trigger(); + } + } +}; + +///////////////////////////////////////////////////////////////////////////////////// +// +// Stats, Actions, Oh my +// +///////////////////////////////////////////////////////////////////////////////////// + +void warrior_t::init_base_stats() +{ + base.attack_power_per_strength = 2.0; + + parse_player_effects_t::init_base_stats(); + + + base.parry_per_strength = 0.0; + + // TODO - can this base stuff be moved into core? + + base.all_crit = 0.0; + base.spell_crit_chance = 0.0; + + base.dodge_per_agility = base.attack_crit_per_agility; + auto base_dodge = ( dbc->race_base( race ).agility + dbc->attribute_base( type, level() ).agility ) + * base.dodge_per_agility; + + base.attack_crit_chance = get_passive_player_value( 0.0, "attack_crit" ); + base.parry = get_passive_player_value( 0.05, "parry" ); + base.block = get_passive_player_value( 0.05, "block" ); + base.dodge = get_passive_player_value( base_dodge, "dodge" ); + + base.stats.attack_power = 3.0 * level() - 20.0; +} + +void warrior_t::init_gains() +{ + parse_player_effects_t::init_gains(); + + gain.melee = get_gain( "melee" ); +} + +void warrior_t::create_actions() +{ + active.cleave = new cleave_t( this, "" ); + active.heroic_strike = new heroic_strike_t( this, "" ); + active.retaliation = new retaliation_attack_t( this ); + + parse_player_effects_t::create_actions(); +} + +void warrior_t::create_buffs() +{ + buff.cleave_queued = make_buff( this, "cleave_queued" ); + buff.heroic_strike_queued = make_buff( this, "heroic_strike_queued" ); + buff.overpower_available = make_buff( this, "overpower", spell.overpower_available ); + buff.retaliation = make_buff( this, "retaliation", spell.retaliation ); + // Revenge is usable for 5 seconds after a block, dodge, or parry. + buff.revenge_available = make_buff( this, "revenge_available" )->set_duration( 5_s ); + buff.shield_block = make_buff( this, "shield_block", spell.shield_block ); + buff.victorious = make_buff( this, "victorious", spell.victorious ); + + buff.battle_stance = make_buff( this, "battle_stance", spell.battle_stance ); + buff.defensive_stance = make_buff( this, "defensive_stance", spell.defensive_stance ); + buff.berserker_stance = make_buff( this, "berserker_stance", spell.berserker_stance ); + + buff.battle_shout = make_buff( this, "battle_shout", rank.battle_shout.find_rank()->spell() ); + + buff.bloodrage = make_buff( this, "bloodrage", + rank.bloodrage.find_rank()->buff() ) + ->set_tick_callback( [ this ]( buff_t*, int, timespan_t ) { + resource_gain( RESOURCE_RAGE, 1.0, get_gain( "bloodrage" ) ); } ); + + parse_effects( spell.battle_stance_passive, PARSE_PASSIVE, + [ this ] { return buff.battle_stance->check() > 0; } ); + parse_effects( spell.defensive_stance_passive, PARSE_PASSIVE, + [ this ] { return buff.defensive_stance->check() > 0; } ); + parse_effects( spell.berserker_stance_passive, PARSE_PASSIVE, + [ this ] { return buff.berserker_stance->check() > 0; } ); + parse_effects( buff.shield_block, IGNORE_STACKS ); + + register_precombat_begin( buff.battle_stance ); + + parse_player_effects_t::create_buffs(); +} + +unsigned warrior_t::current_stance_mask() const +{ + unsigned mask = 0; + + if ( buff.battle_stance->check() ) + mask |= STANCE_MASK_BATTLE; + if ( buff.defensive_stance->check() ) + mask |= STANCE_MASK_DEFENSIVE; + if ( buff.berserker_stance->check() ) + mask |= STANCE_MASK_BERSERKER; + + return mask; +} + +warrior_td_t* warrior_t::get_target_data( player_t* target ) const +{ + warrior_td_t*& td = _target_data[ target ]; + if ( !td ) + td = new warrior_td_t( target, const_cast( *this ) ); + + return td; +} + +void warrior_t::init_spells() +{ + parse_player_effects_t::init_spells(); + + rank.battle_shout = { this, spell_container_t().set_spell( 5242 ), spell_container_t().set_spell( 6192 ), spell_container_t().set_spell( 6673 ), @@ -474,6 +1361,106 @@ void warrior_t::init_spells() spell_container_t().set_spell( 11578 ), }; + rank.cleave = { this, + spell_container_t().set_spell( 845 ), + spell_container_t().set_spell( 7369 ), + spell_container_t().set_spell( 11608 ), + spell_container_t().set_spell( 11609 ), + spell_container_t().set_spell( 20569 ), + }; + + rank.demoralizing_shout = { this, + spell_container_t().set_spell( 1160 ), + spell_container_t().set_spell( 6190 ), + spell_container_t().set_spell( 11554 ), + spell_container_t().set_spell( 11555 ), + spell_container_t().set_spell( 11556 ), + }; + + rank.disarm = { this, + spell_container_t().set_spell( 676 ), + }; + + rank.execute = { this, + spell_container_t().set_spell( 5308 ), + spell_container_t().set_spell( 20658 ), + spell_container_t().set_spell( 20660 ), + spell_container_t().set_spell( 20661 ), + spell_container_t().set_spell( 20662 ), + }; + + rank.hamstring = { this, + spell_container_t().set_spell( 1715 ), + spell_container_t().set_spell( 7372 ), + spell_container_t().set_spell( 7373 ), + }; + + rank.mocking_blow = { this, + spell_container_t().set_spell( 694 ), + spell_container_t().set_spell( 7400 ), + spell_container_t().set_spell( 7402 ), + spell_container_t().set_spell( 20559 ), + spell_container_t().set_spell( 20560 ), + }; + + rank.overpower = { this, + spell_container_t().set_spell( 7384 ), + spell_container_t().set_spell( 7887 ), + spell_container_t().set_spell( 11584 ), + spell_container_t().set_spell( 11585 ), + }; + + rank.retaliation = { this, + spell_container_t().set_spell( 20230 ), + }; + + rank.revenge = { this, + spell_container_t().set_spell( 6572 ), + spell_container_t().set_spell( 6574 ), + spell_container_t().set_spell( 7379 ), + spell_container_t().set_spell( 11600 ), + spell_container_t().set_spell( 11601 ), + spell_container_t().set_spell( 25288 ), + }; + + rank.shield_bash = { this, + spell_container_t().set_spell( 72 ), + spell_container_t().set_spell( 1671 ), + spell_container_t().set_spell( 1672 ), + }; + + rank.shield_block = { this, + spell_container_t().set_spell( 2565 ), + }; + + rank.slam = { this, + spell_container_t().set_spell( 1240193 ), + spell_container_t().set_spell( 1464 ), + spell_container_t().set_spell( 8820 ), + spell_container_t().set_spell( 11604 ), + spell_container_t().set_spell( 11605 ), + }; + + rank.slam_improved = { this, + spell_container_t().set_spell( 1310196 ), + spell_container_t().set_spell( 1310197 ), + spell_container_t().set_spell( 1310198 ), + spell_container_t().set_spell( 1310199 ), + spell_container_t().set_spell( 1310200 ), + }; + + rank.sunder_armor = { this, + spell_container_t().set_spell( 7386 ), + spell_container_t().set_spell( 7405 ), + spell_container_t().set_spell( 8380 ), + spell_container_t().set_spell( 11596 ), + spell_container_t().set_spell( 11597 ), + }; + + rank.taunt = { this, + spell_container_t().set_spell( 355 ), + }; + rank.thunder_clap = { this, spell_container_t().set_spell( 6343 ), spell_container_t().set_spell( 8198 ), @@ -485,37 +1472,185 @@ void warrior_t::init_spells() parse_all_class_passives(); parse_all_passive_talents(); + + spell.battle_stance = find_spell( 2457 ); + spell.battle_stance_passive = find_spell( 21156 ); + spell.berserker_stance = find_spell( 2458 ); + spell.berserker_stance_passive = find_spell( 7381 ); + spell.defensive_stance = find_spell( 71 ); + spell.defensive_stance_passive = find_spell( 7376 ); + spell.demoralizing_shout = rank.demoralizing_shout.find_rank()->spell(); + spell.disarm = rank.disarm.find_rank()->spell(); + spell.execute_damage = find_spell( 20647 ); + spell.hamstring = rank.hamstring.find_rank()->spell(); + spell.intimidating_shout = find_spell( 5246 ); + spell.intimidating_shout_fear = find_spell( 20511 ); + spell.overpower_available = find_spell( 1282733 ); + spell.retaliation = rank.retaliation.find_rank()->spell(); + spell.retaliation_attack = find_spell( 20240 ); + spell.shield_block = rank.shield_block.find_rank()->spell(); + spell.sunder_armor = rank.sunder_armor.find_rank()->spell(); + spell.thunder_clap = rank.thunder_clap.find_rank()->spell(); + spell.victory_rush = find_spell( 402927 ); + spell.victorious = find_spell( 402975 ); + + // Arms + talent.improved_heroic_strike = find_talent_spell( talent_tree::CLASS, "Improved Heroic Strike" ); + talent.deflection = find_talent_spell( talent_tree::CLASS, "Deflection" ); + talent.improved_rend = find_talent_spell( talent_tree::CLASS, "Improved Rend" ); + talent.improved_charge = find_talent_spell( talent_tree::CLASS, "Improved Charge" ); + talent.improved_tactical_mastery = find_talent_spell( talent_tree::CLASS, "Improved Tactical Mastery" ); + talent.improved_overpower = find_talent_spell( talent_tree::CLASS, "Improved Overpower" ); + talent.anger_management = find_talent_spell( talent_tree::CLASS, "Anger Management" ); + talent.deep_wounds = find_talent_spell( talent_tree::CLASS, "Deep Wounds" ); + talent.spearing_strike = find_talent_spell( talent_tree::CLASS, "Spearing Strike" ); + talent.two_handed_weapon_specialization = find_talent_spell( talent_tree::CLASS, "Two-Handed Weapon Specialization" ); + talent.impale = find_talent_spell( talent_tree::CLASS, "Impale" ); + talent.bloodthrill = find_talent_spell( talent_tree::CLASS, "Bloodthrill" ); + talent.sweeping_strikes = find_talent_spell( talent_tree::CLASS, "Sweeping Strikes" ); + talent.weaponmaster = find_talent_spell( talent_tree::CLASS, "Weaponmaster" ); + talent.improved_slam = find_talent_spell( talent_tree::CLASS, "Improved Slam" ); + talent.improved_hamstring = find_talent_spell( talent_tree::CLASS, "Improved Hamstring" ); + talent.mortal_strike = find_talent_spell( talent_tree::CLASS, "Mortal Strike" ); + + // Fury + talent.booming_voice = find_talent_spell( talent_tree::CLASS, "Booming Voice" ); + talent.cruelty = find_talent_spell( talent_tree::CLASS, "Cruelty" ); + talent.lingering_rage = find_talent_spell( talent_tree::CLASS, "Lingering Rage" ); + talent.unbridled_wrath = find_talent_spell( talent_tree::CLASS, "Unbridled Wrath" ); + talent.furious_precision = find_talent_spell( talent_tree::CLASS, "Furious Precision" ); + talent.piercing_howl = find_talent_spell( talent_tree::CLASS, "Piercing Howl" ); + talent.blood_craze = find_talent_spell( talent_tree::CLASS, "Blood Craze" ); + talent.dual_wield_specialization = find_talent_spell( talent_tree::CLASS, "Dual Wield Specialization" ); + talent.raging_blows = find_talent_spell( talent_tree::CLASS, "Raging Blows" ); + talent.enrage = find_talent_spell( talent_tree::CLASS, "Enrage" ); + talent.improved_execute = find_talent_spell( talent_tree::CLASS, "Improved Execute" ); + talent.improved_berserker_rage = find_talent_spell( talent_tree::CLASS, "Improved Berserker Rage" ); + talent.death_wish = find_talent_spell( talent_tree::CLASS, "Death Wish" ); + talent.improved_intercept = find_talent_spell( talent_tree::CLASS, "Improved Intercept" ); + talent.flurry = find_talent_spell( talent_tree::CLASS, "Flurry" ); + talent.gore_drinker = find_talent_spell( talent_tree::CLASS, "Gore Drinker" ); + talent.bloodthirst = find_talent_spell( talent_tree::CLASS, "Bloodthirst" ); + + // Protection + talent.improved_bloodrage = find_talent_spell( talent_tree::CLASS, "Improved Bloodrage" ); + talent.shield_specialization = find_talent_spell( talent_tree::CLASS, "Shield Specialization" ); + talent.iron_will = find_talent_spell( talent_tree::CLASS, "Iron Will" ); + talent.anticipation = find_talent_spell( talent_tree::CLASS, "Anticipation" ); + talent.improved_revenge = find_talent_spell( talent_tree::CLASS, "Improved Revenge" ); + talent.improved_thunder_clap = find_talent_spell( talent_tree::CLASS, "Improved Thunder Clap" ); + talent.last_stand = find_talent_spell( talent_tree::CLASS, "Last Stand" ); + talent.master_of_defense = find_talent_spell( talent_tree::CLASS, "Master of Defense" ); + talent.improved_disarm = find_talent_spell( talent_tree::CLASS, "Improved Disarm" ); + talent.defiance = find_talent_spell( talent_tree::CLASS, "Defiance" ); + talent.improved_sunder_armor = find_talent_spell( talent_tree::CLASS, "Improved Sunder Armor" ); + talent.vanguard = find_talent_spell( talent_tree::CLASS, "Vanguard" ); + talent.improved_shield_bash = find_talent_spell( talent_tree::CLASS, "Improved Shield Bash" ); + talent.improved_shield_wall = find_talent_spell( talent_tree::CLASS, "Improved Shield Wall" ); + talent.concussion_blow = find_talent_spell( talent_tree::CLASS, "Concussion Blow" ); + talent.focused_rage = find_talent_spell( talent_tree::CLASS, "Focused Rage" ); + talent.bastion = find_talent_spell( talent_tree::CLASS, "Bastion" ); + talent.shield_slam = find_talent_spell( talent_tree::CLASS, "Shield Slam" ); +} + +void warrior_t::init_special_effects() +{ + parse_player_effects_t::init_special_effects(); +} + +void warrior_t::parse_action_effects( action_t* action ) +{ + auto _a = dynamic_cast( action ); + assert( _a ); + + // TODO: parse action-affecting warrior buffs here as they are implemented. } action_t* warrior_t::create_action( util::string_view name, util::string_view options_str ) { if ( name == "auto_attack" ) return new warrior_auto_attack_t( this, options_str ); + if ( name == "battle_stance" ) + return new warrior_stance_t( this, "battle_stance", spell.battle_stance, buff.battle_stance, + { buff.battle_stance, buff.defensive_stance, buff.berserker_stance }, options_str ); + if ( name == "defensive_stance" ) + return new warrior_stance_t( this, "defensive_stance", spell.defensive_stance, buff.defensive_stance, + { buff.battle_stance, buff.defensive_stance, buff.berserker_stance }, options_str ); + if ( name == "berserker_stance" ) + return new warrior_stance_t( this, "berserker_stance", spell.berserker_stance, buff.berserker_stance, + { buff.battle_stance, buff.defensive_stance, buff.berserker_stance }, options_str ); + if ( name == "battle_shout" ) return new battle_shout_t( this, options_str ); + if ( name == "demoralizing_shout" ) return new demoralizing_shout_t( this, options_str ); + if ( name == "intimidating_shout" ) return new intimidating_shout_t( this, options_str ); + if ( name == "disarm" ) return new disarm_t( this, options_str ); if ( name == "bloodrage" ) return new bloodrage_t( this, options_str ); if ( name == "charge" ) return new charge_t( this, options_str ); + if ( name == "taunt" ) return new taunt_t( this, options_str ); + if ( name == "mocking_blow" ) return new mocking_blow_t( this, options_str ); + if ( name == "shield_bash" ) return new shield_bash_t( this, options_str ); + if ( name == "shield_block" ) return new shield_block_t( this, options_str ); if ( name == "rend" ) return new rend_t( this, options_str ); + if ( name == "execute" ) return new execute_t( this, options_str ); + if ( name == "hamstring" ) return new hamstring_t( this, options_str ); + if ( name == "sunder_armor" ) return new sunder_armor_t( this, options_str ); + if ( name == "overpower" ) return new overpower_t( this, options_str ); + if ( name == "revenge" ) return new revenge_t( this, options_str ); + if ( name == "retaliation" ) return new retaliation_t( this, options_str ); + if ( name == "cleave" ) return new cleave_queue_t( this, options_str ); + if ( name == "slam" ) return new slam_t( this, options_str ); + if ( name == "victory_rush" ) return new victory_rush_t( this, options_str ); if ( name == "heroic_strike" ) return new heroic_strike_queue_t( this, options_str ); if ( name == "thunder_clap" ) return new thunder_clap_t( this, options_str ); - return player_t::create_action( name, options_str ); + return parse_player_effects_t::create_action( name, options_str ); } void warrior_t::init_action_list() { if ( !action_list_str.empty() ) { - player_t::init_action_list(); + parse_player_effects_t::init_action_list(); return; } clear_action_priority_lists(); warrior_apl::warrior( this ); use_default_action_list = true; - player_t::init_action_list(); + parse_player_effects_t::init_action_list(); +} + +void warrior_t::activate() +{ + parse_player_effects_t::activate(); + + register_on_kill_callback( [ this ]( player_t* ) { + if ( spell.victory_rush->ok() ) + buff.victorious->trigger(); + } ); +} + +void warrior_t::assess_damage( school_e school, result_amount_type type, action_state_t* s ) +{ + parse_player_effects_t::assess_damage( school, type, s ); + + if ( s->result == RESULT_DODGE || s->result == RESULT_PARRY || + s->block_result == BLOCK_RESULT_BLOCKED ) + buff.revenge_available->trigger(); + + if ( s->block_result == BLOCK_RESULT_BLOCKED && buff.shield_block->check() ) + buff.shield_block->decrement(); + + if ( buff.retaliation->check() && s->action && s->action->player != this && + s->action->type == ACTION_ATTACK && s->action->school == SCHOOL_PHYSICAL && + action_t::result_is_hit( s->result ) ) + { + active.retaliation->execute_on_target( s->action->player ); + buff.retaliation->decrement(); + } } struct warrior_module_t : public module_t @@ -537,10 +1672,10 @@ struct warrior_module_t : public module_t void register_actor_initializers( sim_t* ) const override {} }; -} // UNNAMED NAMESPACE +} // namespace warrior const module_t* module_t::warrior() { - static warrior_module_t m; + static warrior::warrior_module_t m; return &m; } diff --git a/engine/dbc/sc_spell_info.cpp b/engine/dbc/sc_spell_info.cpp index 79610be1b2..57af3f045d 100644 --- a/engine/dbc/sc_spell_info.cpp +++ b/engine/dbc/sc_spell_info.cpp @@ -2118,7 +2118,7 @@ std::ostringstream& spell_info::effect_to_str( const dbc_t& dbc, const spell_dat if ( e->pvp_coeff() != 1.0 ) tokens.emplace_back( fmt::format( "PvP Coefficient: {:.7g}", e->pvp_coeff() ) ); - if ( e->chain_target() != 0 ) + if ( e->chain_target() != 0 || ( e->chain_multiplier() != 0.0 && e->chain_multiplier() != 1.0 ) ) tokens.emplace_back( fmt::format( "Chain Multiplier: {}", e->chain_multiplier() ) ); if ( e->type() == E_ENERGIZE || e->type() == E_ENERGIZE_PCT ||