Poweruplover achievement

This commit is contained in:
sudip1401 2014-03-18 01:39:50 +05:30
parent ce12ebe9ce
commit 89d7663112
3 changed files with 17 additions and 5 deletions

View File

@ -29,5 +29,9 @@
title="Skid-row" description="Make 5 skidding in a single race">
<skidding goal="5"/>
</achievement>
<achievement id="6" check-type="all-at-least" reset-after-race="yes"
title="Powerup Love" description="Use 10 or more powerups in a race">
<poweruplover goal="10"/>
</achievement>
</achievements>

View File

@ -47,7 +47,8 @@ public:
ACHIEVE_STRIKE = 2,
ACHIEVE_ARCH_ENEMY = 3,
ACHIEVE_MARATHONER = 4,
ACHIEVE_SKIDDING = 5
ACHIEVE_SKIDDING = 5,
ACHIEVE_POWERUP_LOVER = 6
};
/** Achievement check type:
* ALL_AT_LEAST: All goal values must be reached (or exceeded).

View File

@ -18,6 +18,9 @@
#include "items/powerup.hpp"
#include "achievements/achievement_info.hpp"
#include "config/player_manager.hpp"
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"
#include "config/stk_config.hpp"
@ -170,6 +173,10 @@ void Powerup::adjustSound()
*/
void Powerup::use()
{
// The player gets an achievement point for using a powerup
if (m_type != PowerupManager::POWERUP_NOTHING && m_owner->getController()->isPlayerController())
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_POWERUP_LOVER, "poweruplover");
// Play custom kart sound when collectible is used //TODO: what about the bubble gum?
if (m_type != PowerupManager::POWERUP_NOTHING &&
m_type != PowerupManager::POWERUP_SWATTER &&