achievement_unstoppable
This commit is contained in:
parent
a3eee305ca
commit
8616ce546a
@ -40,5 +40,9 @@
|
||||
title="Powerup Love" description="Use 10 or more powerups in a race">
|
||||
<poweruplover goal="10"/>
|
||||
</achievement>
|
||||
<achievement id="8" check-type="all-at-least" reset-after-race="no"
|
||||
title="Unstoppable" description="Win 5 single races in a row">
|
||||
<wins goal="5"/>
|
||||
</achievement>
|
||||
</achievements>
|
||||
|
||||
|
@ -49,7 +49,8 @@ public:
|
||||
ACHIEVE_MARATHONER = 4,
|
||||
ACHIEVE_SKIDDING = 5,
|
||||
ACHIEVE_GOLD_DRIVER = 6,
|
||||
ACHIEVE_POWERUP_LOVER = 7
|
||||
ACHIEVE_POWERUP_LOVER = 7,
|
||||
ACHIEVE_UNSTOPPABLE = 8
|
||||
};
|
||||
/** Achievement check type:
|
||||
* ALL_AT_LEAST: All goal values must be reached (or exceeded).
|
||||
|
@ -485,7 +485,32 @@ void World::terminateRace()
|
||||
}
|
||||
} // for i < kart_amount
|
||||
} // if (achiev)
|
||||
|
||||
|
||||
Achievement *win = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_UNSTOPPABLE);
|
||||
//if achivement has been unlocked
|
||||
if (win->getValue("wins") < 5 )
|
||||
{
|
||||
for(unsigned int i = 0; i < kart_amount; i++)
|
||||
{
|
||||
// Retrieve the current player
|
||||
StateManager::ActivePlayer* p = m_karts[i]->getController()->getPlayer();
|
||||
if (p && p->getConstProfile() == PlayerManager::get()->getCurrentPlayer())
|
||||
{
|
||||
// Check if the player has won
|
||||
if (m_karts[i]->getPosition() == 1 )
|
||||
{
|
||||
// Increase number of consecutive wins
|
||||
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_UNSTOPPABLE,
|
||||
"wins", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Set number of consecutive wins to 0
|
||||
win->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PlayerManager::get()->getCurrentPlayer()->raceFinished();
|
||||
|
||||
if (m_race_gui) m_race_gui->clearAllMessages();
|
||||
|
Loading…
x
Reference in New Issue
Block a user