only allow one attack at a time in Rave
This commit is contained in:
@@ -284,6 +284,23 @@ const StyleDef* GameState::GetCurrentStyleDef()
|
|||||||
|
|
||||||
bool GameState::IsPlayable( const ModeChoice& mc )
|
bool GameState::IsPlayable( const ModeChoice& mc )
|
||||||
{
|
{
|
||||||
|
if( mc.pm == PLAY_MODE_RAVE )
|
||||||
|
{
|
||||||
|
// Can't play Rave without characters for attack definitions.
|
||||||
|
if( m_pCharacters.empty() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Can't play rave unless there is room for two players
|
||||||
|
if( mc.style != STYLE_INVALID &&
|
||||||
|
GAMEMAN->GetStyleDefForStyle(mc.style)->m_StyleType == StyleDef::ONE_PLAYER_TWO_CREDITS )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Can't play rave unless there is room for two players
|
||||||
|
if( m_CurStyle != STYLE_INVALID &&
|
||||||
|
GAMEMAN->GetStyleDefForStyle(m_CurStyle)->m_StyleType == StyleDef::ONE_PLAYER_TWO_CREDITS )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return mc.numSidesJoinedToPlay == GAMESTATE->GetNumSidesJoined();
|
return mc.numSidesJoinedToPlay == GAMESTATE->GetNumSidesJoined();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,17 +516,14 @@ void GameState::LaunchAttack( PlayerNumber target, Attack a )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::RemoveAllActiveAttacks()
|
void GameState::RemoveActiveAttacksForPlayer( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( unsigned s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
||||||
{
|
{
|
||||||
for( unsigned s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
m_ActiveAttacks[pn][s].fSecsRemaining = 0;
|
||||||
{
|
m_ActiveAttacks[pn][s].sModifier = "";
|
||||||
m_ActiveAttacks[p][s].fSecsRemaining = 0;
|
|
||||||
m_ActiveAttacks[p][s].sModifier = "";
|
|
||||||
}
|
|
||||||
RebuildPlayerOptionsFromActiveAttacks( (PlayerNumber)p );
|
|
||||||
}
|
}
|
||||||
|
RebuildPlayerOptionsFromActiveAttacks( (PlayerNumber)pn );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::RemoveAllInventory()
|
void GameState::RemoveAllInventory()
|
||||||
|
|||||||
@@ -175,7 +175,12 @@ public:
|
|||||||
bool m_bActiveAttackEndedThisUpdate[NUM_PLAYERS]; // flag for other objects to watch (play sounds)
|
bool m_bActiveAttackEndedThisUpdate[NUM_PLAYERS]; // flag for other objects to watch (play sounds)
|
||||||
void LaunchAttack( PlayerNumber target, Attack aa );
|
void LaunchAttack( PlayerNumber target, Attack aa );
|
||||||
void RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn );
|
void RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn );
|
||||||
void RemoveAllActiveAttacks(); // called on end of song
|
void RemoveAllActiveAttacks() // called on end of song
|
||||||
|
{
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
RemoveActiveAttacksForPlayer( (PlayerNumber)p );
|
||||||
|
}
|
||||||
|
void RemoveActiveAttacksForPlayer( PlayerNumber pn );
|
||||||
void RemoveAllInventory();
|
void RemoveAllInventory();
|
||||||
int GetSumOfActiveAttackLevels( PlayerNumber pn );
|
int GetSumOfActiveAttackLevels( PlayerNumber pn );
|
||||||
PlayerNumber GetBestPlayer();
|
PlayerNumber GetBestPlayer();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
|
#include "ScreenManager.h"
|
||||||
|
|
||||||
CachedThemeMetricF ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
|
CachedThemeMetricF ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
|
||||||
|
|
||||||
@@ -87,7 +88,13 @@ void ScoreKeeperRave::LaunchAttack( AttackLevel al )
|
|||||||
a.fSecsRemaining = ATTACK_DURATION_SECONDS;
|
a.fSecsRemaining = ATTACK_DURATION_SECONDS;
|
||||||
a.sModifier = sAttackToGive;
|
a.sModifier = sAttackToGive;
|
||||||
|
|
||||||
|
// remove current attack (if any)
|
||||||
|
GAMESTATE->RemoveActiveAttacksForPlayer( pnToAttack );
|
||||||
|
|
||||||
|
// apply new attack
|
||||||
GAMESTATE->LaunchAttack( pnToAttack, a );
|
GAMESTATE->LaunchAttack( pnToAttack, a );
|
||||||
|
|
||||||
|
SCREENMAN->SystemMessage( ssprintf( "attacking %d with %s", pnToAttack, sAttackToGive.c_str() ) );
|
||||||
|
|
||||||
m_soundLaunchAttack.Play();
|
m_soundLaunchAttack.Play();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user