Skip to content

Commit 0c0fea1

Browse files
committed
[player] Allow for providing comments when assisted combat steps are overridden.
1 parent e45ea03 commit 0c0fea1

File tree

8 files changed

+55
-33
lines changed

8 files changed

+55
-33
lines changed

engine/class_modules/apl/apl_monk.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,19 +929,19 @@ void monk_t::init_blizzard_action_list()
929929
}
930930
}
931931

932-
std::string monk_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
933-
const assisted_combat_step_data_t& step ) const
932+
parsed_assisted_combat_rule_t monk_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
933+
const assisted_combat_step_data_t& step ) const
934934
{
935935
if ( step.spell_id == 152175 && rule.condition_type == TARGET_DISTANCE_LESS )
936936
{
937937
assisted_combat_rule_data_t rule_copy = rule;
938938
rule_copy.condition_value_1 = 10;
939939

940-
return base_t::parse_assisted_combat_rule( rule_copy, step );
940+
return { base_t::parse_assisted_combat_rule( rule_copy, step ), "Extended range check to 10 yards (from 5)." };
941941
}
942942

943943
if ( step.spell_id == 205523 && rule.condition_type == AURA_ON_PLAYER )
944-
return "";
944+
return { "", "Remove talent.blackout_combo check." };
945945

946946
return base_t::parse_assisted_combat_rule( rule, step );
947947
}

engine/class_modules/monk/sc_monk.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,8 +1402,8 @@ struct monk_t : public stagger_t<parse_player_effects_t, monk_t>
14021402
void init_blizzard_action_list() override;
14031403
void validate_actor();
14041404
bool validate_fight_style( fight_style_e style ) const override;
1405-
std::string parse_assisted_combat_rule( const assisted_combat_rule_data_t &rule,
1406-
const assisted_combat_step_data_t &step ) const override;
1405+
parsed_assisted_combat_rule_t parse_assisted_combat_rule( const assisted_combat_rule_data_t &rule,
1406+
const assisted_combat_step_data_t &step ) const override;
14071407

14081408
// Init / Reset
14091409
void create_pets() override;

engine/class_modules/sc_death_knight.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ struct death_knight_t : public parse_player_effects_t
17751775
void init_action_list() override;
17761776
void init_blizzard_action_list() override;
17771777
void parse_assisted_combat_step( const assisted_combat_step_data_t& step, action_priority_list_t* assisted_combat ) override;
1778-
std::string parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule, const assisted_combat_step_data_t& step ) const override;
1778+
parsed_assisted_combat_rule_t parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule, const assisted_combat_step_data_t& step ) const override;
17791779
std::vector<std::string> action_names_from_spell_id( unsigned int spell_id ) const override;
17801780
std::string aura_expr_from_spell_id( unsigned int spell_id, bool on_self ) const override;
17811781
void init_rng() override;
@@ -13901,7 +13901,7 @@ void death_knight_t::init_blizzard_action_list()
1390113901
}
1390213902

1390313903
// death_knight_t::parse_assisted_combat_rule ===============================
13904-
std::string death_knight_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
13904+
parsed_assisted_combat_rule_t death_knight_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
1390513905
const assisted_combat_step_data_t& step ) const
1390613906
{
1390713907
// Blizz uses 5 in their apl, making the condition <5, however, this should be <6 to align with
@@ -13910,7 +13910,7 @@ std::string death_knight_t::parse_assisted_combat_rule( const assisted_combat_ru
1391013910
{
1391113911
assisted_combat_rule_data_t rule_copy = rule;
1391213912
rule_copy.condition_value_1 = 6;
13913-
return player_t::parse_assisted_combat_rule( rule_copy, step );
13913+
return { player_t::parse_assisted_combat_rule( rule_copy, step ), "TODO: Fill comment." };
1391413914
}
1391513915
return player_t::parse_assisted_combat_rule( rule, step );
1391613916
}
@@ -13940,12 +13940,14 @@ void death_knight_t::parse_assisted_combat_step( const assisted_combat_step_data
1394013940
action_priority_list_t* assisted_combat )
1394113941
{
1394213942
std::string options = "";
13943-
std::string rule_str;
13943+
std::string comment = "";
1394413944
for ( const auto& rule : assisted_combat_rule_data_t::data( step.id, is_ptr() ) )
1394513945
{
13946-
std::string rule_str = parse_assisted_combat_rule( rule, step );
13947-
if ( !rule_str.empty() )
13948-
options += options.empty() ? rule_str : "&" + rule_str;
13946+
parsed_assisted_combat_rule_t rule_str = parse_assisted_combat_rule( rule, step );
13947+
if ( !rule_str.expr.empty() )
13948+
options += options.empty() ? rule_str.expr : "&" + rule_str.expr;
13949+
if ( !rule_str.comment.empty() )
13950+
comment += comment.empty() ? rule_str.comment : ", " + rule_str.comment;
1394913951
}
1395013952

1395113953
// This is kinda ugly, maybe find a better way to do this?
@@ -13954,7 +13956,7 @@ void death_knight_t::parse_assisted_combat_step( const assisted_combat_step_data
1395413956
std::string name = blizzard_apl_action_replace( options );
1395513957
if ( name != "" )
1395613958
{
13957-
assisted_combat->add_action( name + ",if=" + options );
13959+
assisted_combat->add_action( name + ",if=" + options, comment );
1395813960
return;
1395913961
}
1396013962
}
@@ -13964,9 +13966,9 @@ void death_knight_t::parse_assisted_combat_step( const assisted_combat_step_data
1396413966
if ( !name.empty() )
1396513967
{
1396613968
if ( options.empty() )
13967-
assisted_combat->add_action( name );
13969+
assisted_combat->add_action( name, comment );
1396813970
else
13969-
assisted_combat->add_action( name + ",if=" + options );
13971+
assisted_combat->add_action( name + ",if=" + options, comment );
1397013972
}
1397113973
}
1397213974
}

engine/class_modules/sc_hunter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ struct hunter_t final : public player_t
10711071
void init_assessors() override;
10721072
void init_action_list() override;
10731073
void init_blizzard_action_list() override;
1074-
std::string parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule, const assisted_combat_step_data_t& step ) const override;
1074+
parsed_assisted_combat_rule_t parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule, const assisted_combat_step_data_t& step ) const override;
10751075
std::vector<std::string> action_names_from_spell_id( unsigned int spell_id ) const override;
10761076
void init_special_effects() override;
10771077
void init_finished() override;
@@ -9092,7 +9092,7 @@ void hunter_t::init_blizzard_action_list()
90929092
}
90939093
}
90949094

9095-
std::string hunter_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
9095+
parsed_assisted_combat_rule_t hunter_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
90969096
const assisted_combat_step_data_t& step ) const
90979097
{
90989098
return player_t::parse_assisted_combat_rule( rule, step );

engine/class_modules/sc_mage.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ struct mage_t final : public player_t
948948
void create_options() override;
949949
void init_action_list() override;
950950
void init_blizzard_action_list() override;
951-
std::string parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
951+
parsed_assisted_combat_rule_t parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
952952
const assisted_combat_step_data_t& step ) const override;
953953
std::string default_potion() const override { return mage_apl::potion( this ); }
954954
std::string default_flask() const override { return mage_apl::flask( this ); }
@@ -8903,17 +8903,17 @@ void mage_t::init_blizzard_action_list()
89038903
}
89048904
}
89058905

8906-
std::string mage_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
8906+
parsed_assisted_combat_rule_t mage_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
89078907
const assisted_combat_step_data_t& step ) const
89088908
{
89098909
if ( rule.condition_type == TARGET_AURA_APPLICATION_GREATER && rule.condition_value_1 == 384452 )
89108910
{
89118911
assert( rule.condition_value_3 == 0 );
89128912
if ( bugs )
89138913
// Right now, this will never trigger because it checks for Arcane Harmony stacks on the target.
8914-
return "0";
8914+
return { "0", "TODO: Fill comment." };
89158915

8916-
return fmt::format( "buff.arcane_harmony.stack>={}", rule.condition_value_2 );
8916+
return { fmt::format( "buff.arcane_harmony.stack>={}", rule.condition_value_2 ), "TODO: Fill comment." };
89178917
}
89188918

89198919
return player_t::parse_assisted_combat_rule( rule, step );

engine/class_modules/sc_warrior.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ struct warrior_t : public parse_player_effects_t
995995
void init_action_list() override;
996996
void init_blizzard_action_list() override;
997997
void parse_assisted_combat_step( const assisted_combat_step_data_t& step, action_priority_list_t* assisted_combat ) override;
998-
std::string parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule, const assisted_combat_step_data_t& step ) const override;
998+
parsed_assisted_combat_rule_t parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule, const assisted_combat_step_data_t& step ) const override;
999999
std::vector<std::string> action_names_from_spell_id( unsigned int spell_id ) const override;
10001000

10011001
action_t* create_action( util::string_view name, util::string_view options ) override;
@@ -10168,7 +10168,7 @@ void warrior_t::init_blizzard_action_list()
1016810168
}
1016910169

1017010170
// warrior_t::parse_assisted_combat_rule ===============================
10171-
std::string warrior_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
10171+
parsed_assisted_combat_rule_t warrior_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
1017210172
const assisted_combat_step_data_t& step ) const
1017310173
{
1017410174
// Blizz uses 5 in their apl, making the condition <5, however, this should be <6 to align with
@@ -10177,7 +10177,7 @@ std::string warrior_t::parse_assisted_combat_rule( const assisted_combat_rule_da
1017710177
{
1017810178
assisted_combat_rule_data_t rule_copy = rule;
1017910179
rule_copy.condition_value_1 = 6;
10180-
return player_t::parse_assisted_combat_rule( rule_copy, step );
10180+
return { player_t::parse_assisted_combat_rule( rule_copy, step ), "TODO: Fill comment." };
1018110181
}
1018210182
return player_t::parse_assisted_combat_rule( rule, step );
1018310183
}

engine/player/player.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3458,26 +3458,28 @@ std::string player_t::aura_expr_from_spell_id( unsigned int spell_id, bool on_se
34583458
void player_t::parse_assisted_combat_step( const assisted_combat_step_data_t& step, action_priority_list_t* assisted_combat )
34593459
{
34603460
std::string options = "";
3461-
std::string rule_str;
3461+
std::string comment = "";
34623462
for ( const auto& rule : assisted_combat_rule_data_t::data( step.id, is_ptr() ) )
34633463
{
3464-
std::string rule_str = parse_assisted_combat_rule( rule, step );
3465-
if ( !rule_str.empty() )
3466-
options += options.empty() ? rule_str : "&" + rule_str;
3464+
parsed_assisted_combat_rule_t rule_str = parse_assisted_combat_rule( rule, step );
3465+
if ( !rule_str.expr.empty() )
3466+
options += options.empty() ? rule_str.expr : "&" + rule_str.expr;
3467+
if ( !rule_str.comment.empty() )
3468+
comment += comment.empty() ? rule_str.comment : ", " + rule_str.comment;
34673469
}
34683470
for ( const auto& name : action_names_from_spell_id( step.spell_id ) )
34693471
{
34703472
if ( !name.empty() )
34713473
{
34723474
if ( options.empty() )
3473-
assisted_combat->add_action( name );
3475+
assisted_combat->add_action( name, comment );
34743476
else
3475-
assisted_combat->add_action( name + ",if=" + options );
3477+
assisted_combat->add_action( name + ",if=" + options, comment );
34763478
}
34773479
}
34783480
}
34793481

3480-
std::string player_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
3482+
parsed_assisted_combat_rule_t player_t::parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
34813483
const assisted_combat_step_data_t& step ) const
34823484
{
34833485
auto tokenize_spell = [ & ] ( unsigned int spell_id )

engine/player/player.hpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,23 @@ struct player_report_extension_t
110110
virtual void html_customsection(report::sc_html_stream&) = 0;
111111
};
112112

113+
struct parsed_assisted_combat_rule_t
114+
{
115+
std::string expr;
116+
std::string comment;
117+
118+
parsed_assisted_combat_rule_t( std::string expr )
119+
: expr( expr ), comment( {} ) {}
120+
121+
parsed_assisted_combat_rule_t( const char* expr )
122+
: expr( expr ), comment( {} ) {}
123+
124+
parsed_assisted_combat_rule_t( std::string expr, std::string comment )
125+
: expr( expr ), comment( comment ) {}
126+
127+
operator std::string() { return expr; }
128+
};
129+
113130
struct player_t : public actor_t
114131
{
115132
static const int default_level = MAX_LEVEL;
@@ -1124,7 +1141,8 @@ struct player_t : public actor_t
11241141
virtual std::vector<std::string> action_names_from_spell_id( unsigned int spell_id ) const;
11251142
virtual std::string aura_expr_from_spell_id( unsigned int spell_id, bool on_self = true ) const;
11261143
virtual void parse_assisted_combat_step( const assisted_combat_step_data_t& step, action_priority_list_t* assisted_combat );
1127-
virtual std::string parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
1144+
1145+
virtual parsed_assisted_combat_rule_t parse_assisted_combat_rule( const assisted_combat_rule_data_t& rule,
11281146
const assisted_combat_step_data_t& step ) const;
11291147
virtual void init_gains();
11301148
virtual void init_procs();

0 commit comments

Comments
 (0)