Add a new achievement : Mosquito Hunter

This commit is contained in:
Mathieu Laprise 2015-01-06 14:47:13 -05:00
parent 949c16cfb0
commit 24944a810c
3 changed files with 17 additions and 3 deletions

View File

@ -51,5 +51,8 @@
<achievement id="10" secret="yes" check-type="all-at-least" reset-type="race"
name="It's secret" description="Really ... a secret.">
</achievement>
<achievement id="11" check-type="all-at-least" reset-type="race"
name="Mosquito Hunter" description="Take your opponents for mosquitos! With the swatter, squash at least 5 of them in a race.">
<swatter goal="5"/>
</achievement>
</achievements>

View File

@ -51,7 +51,8 @@ public:
ACHIEVE_GOLD_DRIVER = 6,
ACHIEVE_POWERUP_LOVER = 7,
ACHIEVE_UNSTOPPABLE = 8,
ACHIEVE_BANANA = 9
ACHIEVE_BANANA = 9,
ACHIEVE_MOSQUITO = 11
};
/** Achievement check type:

View File

@ -25,10 +25,11 @@
// TODO: move some constants to KartProperties, use all constants from KartProperties
#include "items/swatter.hpp"
#include "achievements/achievement_info.hpp"
#include "audio/music_manager.hpp"
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"
#include "config/player_manager.hpp"
#include "graphics/explosion.hpp"
#include "graphics/irr_driver.hpp"
#include "io/file_manager.hpp"
@ -296,6 +297,15 @@ void Swatter::squashThingsAround()
kart->setSquash(kp->getSquashDuration() * kart->getPlayerDifficulty()->getSquashDuration(),
kp->getSquashSlowdown() * kart->getPlayerDifficulty()->getSquashSlowdown());
//Handle achievement if the swatter is used by the current player
const StateManager::ActivePlayer *const ap = m_kart->getController()
->getPlayer();
if (ap && ap->getConstProfile() == PlayerManager::getCurrentPlayer())
{
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_MOSQUITO,
"swatter", 1);
}
if (kart->getAttachment()->getType()==Attachment::ATTACH_BOMB)
{ // make bomb explode
kart->getAttachment()->update(10000);