From 9030291340cff5f1786267034cb2040d2088aa8e Mon Sep 17 00:00:00 2001 From: Guillaume P Date: Sat, 15 Mar 2014 10:47:36 +0100 Subject: [PATCH] Now IA don't fire a cake if the kart is driving too slow. Also correct some comments. --- src/karts/controller/skidding_ai.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/karts/controller/skidding_ai.cpp b/src/karts/controller/skidding_ai.cpp index 5db0c83c3..9eeb44211 100644 --- a/src/karts/controller/skidding_ai.cpp +++ b/src/karts/controller/skidding_ai.cpp @@ -1242,11 +1242,12 @@ void SkiddingAI::handleItems(const float dt) case PowerupManager::POWERUP_CAKE: { // Do not destroy your own shield - if(m_kart->getShieldTime() > min_bubble_time) // if the kart has a shield, do not break it by using a swatter. + if(m_kart->getShieldTime() > min_bubble_time) // if the kart has a shield, do not break it by using a cake. break; // Leave some time between shots if(m_time_since_last_shot<3.0f) break; - //TODO: do not fire if the kart is driving too slow + // Do not fire if the kart is driving too slow + if (m_kart->getSpeed() < 0.5 * m_kart->getCurrentMaxSpeed()) break; // Since cakes can be fired all around, just use a sane distance // with a bit of extra for backwards, as enemy will go towards cake @@ -1265,7 +1266,7 @@ void SkiddingAI::handleItems(const float dt) case PowerupManager::POWERUP_BOWLING: { // Do not destroy your own shield - if(m_kart->getShieldTime() > min_bubble_time) // if the kart has a shield, do not break it by using a swatter. + if(m_kart->getShieldTime() > min_bubble_time) // if the kart has a shield, do not break it by using a bowling ball. break; // Leave more time between bowling balls, since they are // slower, so it should take longer to hit something which @@ -1295,7 +1296,7 @@ void SkiddingAI::handleItems(const float dt) case PowerupManager::POWERUP_PLUNGER: { // Do not destroy your own shield - if(m_kart->getShieldTime() > min_bubble_time) // if the kart has a shield, do not break it by using a swatter. + if(m_kart->getShieldTime() > min_bubble_time) // if the kart has a shield, do not break it by using a plunger. break; // Leave more time after a plunger, since it will take some