Skip to content

Commit 46fccae

Browse files
committed
[Balance] refactor buff.eclipse expression alias
1 parent 7d56fea commit 46fccae

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

engine/class_modules/sc_druid.cpp

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13263,23 +13263,17 @@ std::unique_ptr<expr_t> druid_t::create_expression( std::string_view name )
1326313263
if ( util::str_compare_ci( name, "astral_power" ) )
1326413264
return make_ref_expr( name, resources.current[ RESOURCE_ASTRAL_POWER ] );
1326513265

13266-
auto _buff = [ this ] { return buff.eclipse_lunar->check() ? buff.eclipse_lunar : buff.eclipse_solar; };
13267-
13268-
if ( splits.size() == 3 && util::str_compare_ci( splits[ 0 ], "buff" ) &&
13266+
if ( splits.size() >= 2 && util::str_compare_ci( splits[ 0 ], "buff" ) &&
1326913267
util::str_compare_ci( splits[ 1 ], "eclipse" ) )
1327013268
{
13271-
if ( util::str_compare_ci( splits[ 2 ], "duration" ) )
13272-
return make_fn_expr( "eclipse_duration", [ _buff ] { return _buff()->buff_duration(); } );
13273-
else if ( util::str_compare_ci( splits[ 2 ], "elapsed" ) )
13274-
return make_fn_expr( "eclipse_elapsed", [ _buff, this ] { return _buff()->elapsed( sim->current_time() ); } );
13275-
else if ( util::str_compare_ci( splits[ 2 ], "remains" ) )
13276-
return make_fn_expr( "eclipse_remains", [ _buff ] { return _buff()->remains(); } );
13277-
else if ( util::str_compare_ci( splits[ 2 ], "up" ) )
13278-
return make_fn_expr( "eclipse_up", [ _buff ] { return _buff()->check() > 0; } );
13279-
else if ( util::str_compare_ci( splits[ 2 ], "down" ) )
13280-
return make_fn_expr( "eclipse_down", [ _buff ] { return _buff()->check() <= 0; } );
13281-
else if ( util::str_compare_ci( splits[ 2 ], "value" ) )
13282-
return make_fn_expr( "eclipse_value", [ _buff ] { return _buff()->check_value(); } );
13269+
splits[ 1 ] = "eclipse_solar";
13270+
auto solar = druid_t::create_expression( util::string_join( splits, "." ) );
13271+
splits[ 1 ] = "eclipse_lunar";
13272+
auto lunar = druid_t::create_expression( util::string_join( splits, "." ) );
13273+
13274+
return make_fn_expr( name, [ solar = std::move( solar ), lunar = std::move( lunar ), this ] {
13275+
return buff.eclipse_lunar->check() ? lunar->evaluate() : solar->evaluate();
13276+
} );
1328313277
}
1328413278

1328513279
if ( splits.size() >= 2 && util::str_compare_ci( splits[ 0 ], "cooldown" ) &&
@@ -13294,9 +13288,9 @@ std::unique_ptr<expr_t> druid_t::create_expression( std::string_view name )
1329413288
if ( splits.size() == 2 && util::str_compare_ci( splits[ 0 ], "eclipse" ) )
1329513289
{
1329613290
if ( util::str_compare_ci( splits[ 1 ], "solar" ) )
13297-
return make_fn_expr( "eclipse_solar", [ this ] { return !buff.lunar_eclipse_override->check(); } );
13291+
return make_fn_expr( name, [ this ] { return !buff.lunar_eclipse_override->check(); } );
1329813292
else if ( util::str_compare_ci( splits[ 1 ], "lunar" ) )
13299-
return make_fn_expr( "eclipse_lunar", [ this ] { return buff.lunar_eclipse_override->check(); } );
13293+
return make_fn_expr( name, [ this ] { return buff.lunar_eclipse_override->check(); } );
1330013294
}
1330113295

1330213296
// New Moon stage related expressions

0 commit comments

Comments
 (0)