1) Fixes bug 1812403 (you could get rid of a bomb by

using another banana, now the bomb will explode if you
   hit a banana).
2) All other 'bananas' now get more severe as well if you 
   hit a banana while having an anvil/parachute attached
   (anvil: time is extended, parachute: you get an anvil
   with the same time as the parachute attached).



git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1276 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2007-10-18 13:22:20 +00:00
parent 6967d7f7b0
commit 3eeac7bec0

View File

@ -64,17 +64,44 @@ void Attachment::set(attachmentType _type, float time, Kart *current_kart)
// -----------------------------------------------------------------------------
void Attachment::hitGreenHerring()
{
switch (rand()%3)
int random_attachment;
float leftover_time = 0.0f;
switch(getType()) // If there already is an attachment, make it worse :)
{
case 0: set( ATTACH_PARACHUTE, stk_config->m_parachute_time ) ;
case ATTACH_BOMB: projectile_manager->newExplosion(m_kart->getCoord());
// Best solution would probably be to trigger the
// explosion, and then to attach a new, random
// attachment. Unfortunately, handleExplosion() is not
// really severe enough, and forceRescue() attaches
// tinytux, so that the new attachment is immediately lost.
//m_kart->handleExplosion(m_kart->getCoord()->xyz, true);
m_kart->forceRescue();
clear();
random_attachment = rand()%3;
break;
case ATTACH_ANVIL :// if the kart already has an anvil, attach a new anvil,
// and increase the overall time
random_attachment = 2;
leftover_time = m_time_left;
break;
case ATTACH_PARACHUTE:
random_attachment = 2; // anvil
leftover_time = m_time_left;
break;
default: random_attachment = rand()%3;
} // switch
switch (random_attachment)
{
case 0: set( ATTACH_PARACHUTE, stk_config->m_parachute_time+leftover_time);
// if ( m_kart == m_kart[0] )
// sound -> playSfx ( SOUND_SHOOMF ) ;
break ;
case 1: set( ATTACH_BOMB, stk_config->m_bomb_time ) ;
case 1: set( ATTACH_BOMB, stk_config->m_bomb_time+leftover_time);
// if ( m_kart == m_kart[0] )
// sound -> playSfx ( SOUND_SHOOMF ) ;
break ;
case 2: set( ATTACH_ANVIL, stk_config->m_anvil_time ) ;
case 2: set( ATTACH_ANVIL, stk_config->m_anvil_time+leftover_time);
// if ( m_kart == m_kart[0] )
// sound -> playSfx ( SOUND_SHOOMF ) ;
// Reduce speed once (see description above), all other changes are