Open EvoLandEco opened 2 years ago
Stun rocket belongs to the projectile class
Shooting cooldown does not work on stun rocket at the moment.
Similar to #513 #518, we may add tests like this:
#define FIX_ISSUE_517
#ifdef FIX_ISSUE_517
// Player enters cool down status after shooting stun rocket
{
game g;
g.do_action(0, action_type::shoot_stun_rocket);
g.tick();
assert(g.get_player(0).is_cooling_down());
g.do_action(0, action_type::shoot_stun_rocket);
assert(!g.get_player(0).is_shooting_stun_rocket());
}
// Player can shoot stun rocket again after the cool down interval, player cannot shoot stun rocket during the interval
{
game g;
g.do_action(0, action_type::shoot_stun_rocket);
for (auto i = 0; i < projectile::m_fire_rate - 1; ++i)
{
g.tick();
assert(g.get_player(0).is_cooling_down());
g.do_action(0, action_type::shoot_stun_rocket);
assert(!g.get_player(0).is_shooting_stun_rocket());
}
g.tick();
assert(!g.get_player(0).is_cooling_down());
g.do_action(0, action_type::shoot_stun_rocket);
assert(g.get_player(0).is_shooting_stun_rocket());
}
// Player 0 enters cool down status will not affect other players
{
game g;
g.do_action(0, action_type::shoot_stun_rocket);
g.tick();
assert(g.get_player(0).is_cooling_down());
assert(!g.get_player(1).is_cooling_down());
assert(!g.get_player(2).is_cooling_down());
}
#endif
There should also be a cool down time for the stun rocket