Skip to content

Commit 5acd61b

Browse files
committed
[DK] Move pet available logic into base_death_knight_pet_t
1 parent 085a5e8 commit 5acd61b

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

engine/class_modules/sc_death_knight.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,6 +2743,33 @@ struct death_knight_pet_t : public pet_t
27432743
return nullptr;
27442744
}
27452745

2746+
timespan_t available() const override
2747+
{
2748+
if ( is_moving() )
2749+
return time_to_move();
2750+
2751+
if ( buffs.stunned->check() )
2752+
return buffs.stunned->remains();
2753+
2754+
if ( in_gcd() )
2755+
return sim->current_time() - gcd_ready;
2756+
2757+
if ( primary_resource() == RESOURCE_ENERGY )
2758+
{
2759+
double energy = resources.current[ RESOURCE_ENERGY ];
2760+
2761+
if ( energy >= resource_thresholds.front() )
2762+
return pet_t::available();
2763+
2764+
timespan_t time_to_next = timespan_t::from_seconds( ( resource_thresholds.front() - energy ) /
2765+
resource_regen_per_second( RESOURCE_ENERGY ) );
2766+
2767+
return std::max( time_to_next, pet_t::available() );
2768+
}
2769+
2770+
return pet_t::available();
2771+
}
2772+
27462773
void arise() override
27472774
{
27482775
pet_t::arise();
@@ -3168,33 +3195,6 @@ struct base_ghoul_pet_t : public death_knight_pet_t
31683195
{
31693196
return RESOURCE_ENERGY;
31703197
}
3171-
3172-
timespan_t available() const override
3173-
{
3174-
if ( is_moving() )
3175-
return time_to_move();
3176-
3177-
if ( buffs.stunned->check() )
3178-
return buffs.stunned->remains();
3179-
3180-
if ( in_gcd() )
3181-
return sim->current_time() - gcd_ready;
3182-
3183-
if ( primary_resource() == RESOURCE_ENERGY )
3184-
{
3185-
double energy = resources.current[ RESOURCE_ENERGY ];
3186-
3187-
if ( energy >= resource_thresholds.front() )
3188-
return death_knight_pet_t::available();
3189-
3190-
timespan_t time_to_next = timespan_t::from_seconds( ( resource_thresholds.front() - energy ) /
3191-
resource_regen_per_second( RESOURCE_ENERGY ) );
3192-
3193-
return std::max( time_to_next, death_knight_pet_t::available() );
3194-
}
3195-
3196-
return death_knight_pet_t::available();
3197-
}
31983198
};
31993199

32003200
// ===============================================================================

0 commit comments

Comments
 (0)