Skip to content

Commit

Permalink
Use as<> for most double->int conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jundarer committed Jun 26, 2023
1 parent 6a0e086 commit c16ceed
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 37 deletions.
21 changes: 10 additions & 11 deletions engine/class_modules/paladin/sc_paladin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ struct crusading_strike_t : public paladin_melee_attack_t

if ( p->talents.blessed_champion->ok() )
{
aoe = 1 + p->talents.blessed_champion->effectN( 4 ).base_value();
aoe = as<int>( 1 + p->talents.blessed_champion->effectN( 4 ).base_value() );
base_aoe_multiplier *= 1.0 - p->talents.blessed_champion->effectN( 3 ).percent();
}

Expand Down Expand Up @@ -983,7 +983,7 @@ struct crusader_strike_t : public paladin_melee_attack_t

if ( p->talents.blessed_champion->ok() )
{
aoe = 1 + p->talents.blessed_champion->effectN( 4 ).base_value();
aoe = as<int>( 1 + p->talents.blessed_champion->effectN( 4 ).base_value() );
base_aoe_multiplier *= 1.0 - p->talents.blessed_champion->effectN( 3 ).percent();
}

Expand Down Expand Up @@ -1292,7 +1292,7 @@ void judgment_t::impact( action_state_t* s )
int num_stacks = 1;
if ( p()->talents.highlords_judgment->ok() )
{
num_stacks += p()->talents.highlords_judgment->effectN( 1 ).base_value();
num_stacks += as<int>( p()->talents.highlords_judgment->effectN( 1 ).base_value() );
}
td( s->target )->debuff.judgment->trigger( num_stacks );
}
Expand Down Expand Up @@ -1892,9 +1892,10 @@ paladin_td_t::paladin_td_t( player_t* target, paladin_t* paladin ) : actor_targe
debuff.judgment = make_buff( *this, "judgment", paladin->spells.judgment_debuff );
if ( paladin->talents.highlords_judgment->ok() )
{
debuff.judgment = debuff.judgment
->set_max_stack( 1 + paladin->talents.highlords_judgment->effectN( 1 ).base_value() )
->modify_duration( timespan_t::from_millis( paladin->talents.highlords_judgment->effectN( 3 ).base_value() ) );
debuff.judgment =
debuff.judgment->set_max_stack( as<int>( 1 + paladin->talents.highlords_judgment->effectN( 1 ).base_value() ) )
->modify_duration(
timespan_t::from_millis( paladin->talents.highlords_judgment->effectN( 3 ).base_value() ) );
}

debuff.judgment_of_light = make_buff( *this, "judgment_of_light", paladin->find_spell( 196941 ) );
Expand Down Expand Up @@ -2287,10 +2288,8 @@ void paladin_t::create_buffs()

if ( talents.relentless_inquisitor->ok() )
{
buffs.relentless_inquisitor->set_max_stack(
talents.relentless_inquisitor->effectN( 2 ).base_value() +
talents.relentless_inquisitor->effectN( 3 ).base_value()
);
buffs.relentless_inquisitor->set_max_stack( as<int>( talents.relentless_inquisitor->effectN( 2 ).base_value() +
talents.relentless_inquisitor->effectN( 3 ).base_value() ) );
}

buffs.final_verdict = make_buff( this, "final_verdict", find_spell( 337228 ) );
Expand Down Expand Up @@ -3105,7 +3104,7 @@ double paladin_t::resource_gain( resource_e resource_type, double amount, gain_t
if ( !( source->name_str == "arcane_torrent" || source->name_str == "divine_toll" ) )
{
holy_power_generators_used++;
int hpGensNeeded = talents.of_dusk_and_dawn->effectN( 1 ).base_value();
int hpGensNeeded = as<int>( talents.of_dusk_and_dawn->effectN( 1 ).base_value() );
if ( holy_power_generators_used >= hpGensNeeded )
{
holy_power_generators_used -= hpGensNeeded;
Expand Down
8 changes: 4 additions & 4 deletions engine/class_modules/paladin/sc_paladin_retribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,12 @@ struct judgment_ret_t : public judgment_t

if ( p->talents.boundless_judgment->ok() )
{
holy_power_generation += p->talents.boundless_judgment->effectN( 1 ).base_value();
holy_power_generation += as<int>( p->talents.boundless_judgment->effectN( 1 ).base_value() );
}

if ( p->talents.blessed_champion->ok() )
{
aoe = 1 + p->talents.blessed_champion->effectN( 4 ).base_value();
aoe = as<int>( 1 + p->talents.blessed_champion->effectN( 4 ).base_value() );
base_aoe_multiplier *= 1.0 - p->talents.blessed_champion->effectN( 3 ).percent();
}

Expand Down Expand Up @@ -694,7 +694,7 @@ struct judgment_ret_t : public judgment_t

if ( p->talents.boundless_judgment->ok() )
{
holy_power_generation += p->talents.boundless_judgment->effectN( 1 ).base_value();
holy_power_generation += as<int>( p->talents.boundless_judgment->effectN( 1 ).base_value() );
}

// we don't do the blessed champion stuff here; DT judgments do not seem to cleave
Expand Down Expand Up @@ -1054,7 +1054,7 @@ struct base_templar_strike_t : public paladin_melee_attack_t

if ( p->talents.blessed_champion->ok() )
{
aoe = 1 + p->talents.blessed_champion->effectN( 4 ).base_value();
aoe = as<int>( 1 + p->talents.blessed_champion->effectN( 4 ).base_value() );
base_aoe_multiplier *= 1.0 - p->talents.blessed_champion->effectN( 3 ).percent();
}

Expand Down
2 changes: 1 addition & 1 deletion engine/class_modules/priest/sc_priest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ struct holy_nova_t final : public priest_spell_t
{
parse_options( options_str );
aoe = -1;
full_amount_targets = priest().talents.holy_nova->effectN( 3 ).base_value();
full_amount_targets = as<int>( priest().talents.holy_nova->effectN( 3 ).base_value() );
reduced_aoe_targets = priest().talents.holy_nova->effectN( 3 ).base_value();
}

Expand Down
2 changes: 1 addition & 1 deletion engine/class_modules/priest/sc_priest_discipline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ void priest_t::create_buffs_discipline()

buffs.harsh_discipline = make_buff( this, "harsh_discipline", talents.discipline.harsh_discipline )
->set_max_stack( talents.discipline.harsh_discipline.enabled()
? talents.discipline.harsh_discipline->effectN( 1 ).base_value()
? as<int>(talents.discipline.harsh_discipline->effectN( 1 ).base_value())
: 999 )
->set_stack_change_callback( [ this ]( buff_t*, int, int ) {
if ( buffs.harsh_discipline->at_max_stacks() )
Expand Down
2 changes: 1 addition & 1 deletion engine/class_modules/priest/sc_priest_holy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ struct burning_vehemence_t final : public priest_spell_t
may_crit = false;
may_miss = false;
aoe = -1;
full_amount_targets = priest().talents.holy.burning_vehemence_damage->effectN( 2 ).percent();
full_amount_targets = as<int>( priest().talents.holy.burning_vehemence_damage->effectN( 2 ).base_value() );
reduced_aoe_targets = priest().talents.holy.burning_vehemence_damage->effectN( 2 ).base_value();
base_multiplier = priest().talents.holy.burning_vehemence->effectN( 3 ).percent();
}
Expand Down
4 changes: 2 additions & 2 deletions engine/class_modules/sc_demon_hunter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5341,14 +5341,14 @@ struct soul_carver_t : public demon_hunter_attack_t
if ( !result_is_hit( s->result ) )
return;

p()->spawn_soul_fragment( soul_fragment::LESSER, data().effectN( 3 ).base_value() );
p()->spawn_soul_fragment( soul_fragment::LESSER, as<unsigned int>( data().effectN( 3 ).base_value() ) );
}

void tick( dot_t* d ) override
{
demon_hunter_attack_t::tick( d );

p()->spawn_soul_fragment( soul_fragment::LESSER, data().effectN( 4 ).base_value() );
p()->spawn_soul_fragment( soul_fragment::LESSER, as<unsigned int>( data().effectN( 4 ).base_value() ) );
}
};

Expand Down
30 changes: 15 additions & 15 deletions engine/class_modules/sc_shaman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ struct maelstrom_weapon_buff_t : public buff_t
maelstrom_weapon_buff_t( shaman_t* p ) :
buff_t( p, "maelstrom_weapon", p->find_spell( 344179 ) ), shaman( p )
{
set_max_stack( data().max_stacks() + p->talent.raging_maelstrom->effectN( 1 ).base_value() );
set_max_stack( data().max_stacks() + as<int>( p->talent.raging_maelstrom->effectN( 1 ).base_value() ) );
}

void increment( int stacks, double value, timespan_t duration ) override
Expand Down Expand Up @@ -1096,7 +1096,7 @@ struct cl_crash_lightning_buff_t : public buff_t
int max_stack = data().max_stacks();
if (p->talent.crashing_storms->ok())
{
max_stack += p->talent.crashing_storms.spell()->effectN( 3 ).base_value();
max_stack += as<int>( p->talent.crashing_storms.spell()->effectN( 3 ).base_value() );
}

set_max_stack( max_stack );
Expand Down Expand Up @@ -3931,7 +3931,7 @@ struct stormstrike_base_t : public shaman_attack_t
{
make_event( sim, 0_s, [ this ]() {
p()->generate_maelstrom_weapon( execute_state,
p()->talent.elemental_assault->effectN( 2 ).base_value() );
as<int>( p()->talent.elemental_assault->effectN( 2 ).base_value() ) );
} );
}

Expand Down Expand Up @@ -4544,7 +4544,7 @@ struct chain_lightning_overload_t : public chained_overload_base_t

if ( p()->buff.surge_of_power->up() )
{
t += p()->talent.surge_of_power->effectN( 4 ).base_value();
t += as<int>( p()->talent.surge_of_power->effectN( 4 ).base_value() );
}

return t;
Expand Down Expand Up @@ -4580,7 +4580,7 @@ struct lava_beam_overload_t : public chained_overload_base_t

if ( p()->buff.surge_of_power->up() )
{
t += p()->talent.surge_of_power->effectN( 4 ).base_value();
t += as<int>( p()->talent.surge_of_power->effectN( 4 ).base_value() );
}

return t;
Expand Down Expand Up @@ -4774,7 +4774,7 @@ struct chain_lightning_t : public chained_base_t

if ( p()->buff.surge_of_power->up() )
{
t += p()->talent.surge_of_power->effectN( 4 ).base_value();
t += as<int>( p()->talent.surge_of_power->effectN( 4 ).base_value() );
}

return t;
Expand Down Expand Up @@ -4924,7 +4924,7 @@ struct lava_beam_t : public chained_base_t

if ( p()->buff.surge_of_power->up() )
{
t += p()->talent.surge_of_power->effectN( 4 ).base_value();
t += as<int>( p()->talent.surge_of_power->effectN( 4 ).base_value() );
}

return t;
Expand Down Expand Up @@ -5991,7 +5991,7 @@ struct elemental_blast_t : public shaman_spell_t
{
if ( player->talent.elemental_blast.ok() && player->talent.lava_burst.ok() )
{
cooldown->charges += player->find_spell( 394152 )->effectN( 2 ).base_value();
cooldown->charges += as<int>( player->find_spell( 394152 )->effectN( 2 ).base_value() );
}
}
}
Expand Down Expand Up @@ -6979,7 +6979,7 @@ struct frost_shock_t : public shaman_spell_t
// It looks like Frost Shock does not have the expected 1 baseline n_targets.
// Spell data suggests Electrified Shocks adds 3 targets.
// But the baseline target needs to be added, too.
t += 1 + p()->talent.electrified_shocks->effectN( 1 ).base_value();
t += 1 + as<int>( p()->talent.electrified_shocks->effectN( 1 ).base_value() );
}

return t;
Expand Down Expand Up @@ -8132,7 +8132,7 @@ struct primordial_wave_t : public shaman_spell_t
if ( p()->talent.primal_maelstrom.ok() )
{
p()->generate_maelstrom_weapon( execute_state,
p()->talent.primal_maelstrom->effectN( 1 ).base_value() );
as<int>( p()->talent.primal_maelstrom->effectN( 1 ).base_value() ) );
}

if ( p()->talent.primordial_surge.ok() )
Expand Down Expand Up @@ -9912,7 +9912,7 @@ void shaman_t::trigger_splintered_elements( action_t* secondary )

auto value = talent.splintered_elements->effectN( 1 ).percent();

buff.splintered_elements->trigger( count_duplicates, value );
buff.splintered_elements->trigger( as<int>( count_duplicates ), value );
}

void shaman_t::trigger_flash_of_lightning()
Expand Down Expand Up @@ -9982,7 +9982,7 @@ void shaman_t::trigger_swirling_maelstrom( const action_state_t* state )
return;
}

generate_maelstrom_weapon( state, talent.swirling_maelstrom->effectN( 1 ).base_value() );
generate_maelstrom_weapon( state, as<int>( talent.swirling_maelstrom->effectN( 1 ).base_value() ) );
}

void shaman_t::trigger_static_accumulation_refund( const action_state_t* state, int mw_stacks )
Expand Down Expand Up @@ -10147,7 +10147,7 @@ void shaman_t::create_buffs()
->set_refresh_behavior( buff_refresh_behavior::DURATION )
->set_tick_callback( [ this ]( buff_t* b, int, timespan_t ) {
generate_maelstrom_weapon( action.feral_spirits,
b->data().effectN( 1 ).base_value() );
as<int>( b->data().effectN( 1 ).base_value() ) );
} );

buff.forceful_winds = make_buff<buff_t>( this, "forceful_winds", find_spell( 262652 ) )
Expand Down Expand Up @@ -10212,12 +10212,12 @@ void shaman_t::create_buffs()
->set_default_value_from_effect_type( A_ADD_PCT_MODIFIER, P_GENERIC )
->set_max_stack(
talent.overflowing_maelstrom.ok()
? talent.overflowing_maelstrom->effectN( 1 ).base_value()
? as<int>( talent.overflowing_maelstrom->effectN( 1 ).base_value() )
: find_spell( 334196 )->max_stacks() );
buff.static_accumulation = make_buff( this, "static_accumulation", find_spell( 384437 ) )
->set_default_value( talent.static_accumulation->effectN( 1 ).base_value() )
->set_tick_callback( [ this ]( buff_t* b, int, timespan_t ) {
generate_maelstrom_weapon( action.ascendance, b->value() );
generate_maelstrom_weapon( action.ascendance, as<int>( b->value() ) );
} );
buff.doom_winds = make_buff( this, "doom_winds", talent.doom_winds );
buff.ice_strike = make_buff( this, "ice_strike", talent.ice_strike->effectN( 3 ).trigger() )
Expand Down
4 changes: 2 additions & 2 deletions engine/class_modules/sc_warrior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3172,7 +3172,7 @@ struct onslaught_t : public warrior_attack_t
if ( p()->talents.fury.tenderize->ok() )
{
p()->enrage();
p()->buff.slaughtering_strikes_rb->trigger( p()->talents.fury.tenderize->effectN( 2 ).base_value() );
p()->buff.slaughtering_strikes_rb->trigger( as<int>( p()->talents.fury.tenderize->effectN( 2 ).base_value() ) );
}

if ( p()->talents.fury.unbridled_ferocity.ok() && rng().roll( unbridled_chance ) )
Expand Down Expand Up @@ -5917,7 +5917,7 @@ struct titanic_throw_t : public warrior_attack_t
{
parse_options( options_str );
may_dodge = may_parry = may_block = false;
aoe = p->talents.warrior.titanic_throw->effectN( 2 ).base_value();
aoe = as<int>( p->talents.warrior.titanic_throw->effectN( 2 ).base_value() );
}

double action_multiplier() const override
Expand Down

0 comments on commit c16ceed

Please sign in to comment.