void OnCombatStart(UnitPointer mTarget)
    {
		_unit->SendChatMessage( CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "I am the greatest of my father's sons! Your end has come!");
		RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
		phase = 0;
		ChangeStance();
    }
    void AIUpdate()
	{
		if( spells.size() > 0)
		{
			for( uint8 i = 0; i<spells.size(); i++ )
			{
				if( spells[i]->time < getMSTime() && (spells[i]->phase == phase || spells[i]->phase > PHASES_COUNT))
				{
					if( Rand( spells[i]->chance ) )
					{
						CastScriptSpell( spells[i] );
						spells[i]->time = getMSTime() + spells[i]->timer;
					}
				}
			}
		}
		if( stances_timer < getMSTime() )
		{
			ChangeStance();
		}
    }
示例#3
0
void Protagonist::Die()				
{  
	ChangeStance(DEAD);
	Player::Die();	
} 	   
示例#4
0
void Protagonist::LowerHealth(int h) 
{ 
	Player::LowerHealth(h);
	if( Player::IsDead() )ChangeStance(DEAD); 
}
示例#5
0
void Protagonist::Update( HGE*engine, float ftime )    
{ 
	MainAnimation->Update( ftime );

	if( Player::IsDead() ) return;
	
	if( eCURRENTSTANCE != JUMPING  && eCURRENTSTANCE != DEAD )
	if(engine->Input_GetKeyState(HGEK_ALT) )
	{
		if( ThrowGrenade() )
		{ 
			ChangeStance( THROW_GRENADE);	
		}
	}
	else
	if (engine->Input_GetKeyState(HGEK_SHIFT) )
	{
		ChangeStance( MELEE );
	}
 	else
	if( ( engine->Input_KeyUp(HGEK_DOWN) ) && eCURRENTSTANCE == DUCK /* && eCURRENTSTANCE != THROW_GRENADE */)
	{
			ChangeStance( DUCK );
			MainAnimation->SetMode(HGEANIM_REV);
			Play(); 
	
	}
	else
	if( ( engine->Input_KeyUp(HGEK_UP) )  && eCURRENTSTANCE == LOOKUP && eCURRENTSTANCE != THROW_GRENADE )
	{
		ChangeStance( LOOKUP );
		MainAnimation->SetMode(HGEANIM_REV);
		Play();
	}
	else     ///////////////////////
		if ( !MainAnimation->IsPlaying()  || eCURRENTSTANCE == RUNNING || eCURRENTSTANCE == LOWMOVE || eCURRENTSTANCE == MOVE_BACK )
	    {	
		if ( engine->Input_KeyUp(HGEK_DOWN) /*&& eCURRENTSTANCE != LOOKUP*/ )
		{
			ChangeStance( DUCK );
			MainAnimation->SetMode(HGEANIM_REV);
			Play();
		}
		else
		if (engine->Input_GetKeyState(HGEK_UP) )
		{
			ChangeStance( LOOKUP );	
		}
		else
		if (engine->Input_GetKeyState(HGEK_DOWN) )
		{
				if( engine->Input_GetKeyState(HGEK_RIGHT)  ) // Stealth Move Right
				{
					if( eCURRENTSTANCE == LOWMOVE && !MainAnimation->IsPlaying() ) eCURRENTSTANCE = IDLE;
					ChangeStance( LOWMOVE ); 
					SetFacing( FACERIGHT,false );
					vDirection.x = +1;
				}
				else 
				if( engine->Input_GetKeyState(HGEK_LEFT)  )  // Stealth Move Left
				{
					if( eCURRENTSTANCE == LOWMOVE && !MainAnimation->IsPlaying() ) eCURRENTSTANCE = IDLE;
					ChangeStance( LOWMOVE );
					SetFacing( FACELEFT,true );
					vDirection.x = -1;
				}
				else if(eCURRENTSTANCE == LOWMOVE)   // Stealth Move
				{ 
					ChangeStance( DUCK );  MainAnimation->SetFrame(1);  
				}
 				else
				{ 
					ChangeStance( DUCK ); 
					vDirection.x = ( eFACING == FACERIGHT ) ? 1 : -1;
				}
		}
		else
		if (engine->Input_GetKeyState(HGEK_LEFT) )     // move left
		{
			if ( engine->Input_GetKeyState( HGEK_CTRL ) && eFACING == FACERIGHT )
			{
				if(eCURRENTSTANCE == MOVE_BACK && !MainAnimation->IsPlaying() ) ChangeStance(IDLE);
				ChangeStance(MOVE_BACK);		
				vDirection.x = -1;
			}
			else
			{
				if(eCURRENTSTANCE==RUNNING && !MainAnimation->IsPlaying()) eCURRENTSTANCE = IDLE;
				SetFacing( FACELEFT,true );
				ChangeStance( RUNNING ); 
				vDirection.x = -1;
			}
		}
		else
		if (engine->Input_GetKeyState(HGEK_RIGHT) )  // move right
		{
			if ( engine->Input_GetKeyState( HGEK_CTRL ) && eFACING == FACELEFT )
			{
				if(eCURRENTSTANCE == MOVE_BACK && !MainAnimation->IsPlaying() ) ChangeStance(IDLE);
				ChangeStance(MOVE_BACK);		vDirection.x = 1;
			}
			else
			{
				if(eCURRENTSTANCE==RUNNING && !MainAnimation->IsPlaying()) eCURRENTSTANCE = IDLE;
				SetFacing( FACERIGHT,false );
				ChangeStance( RUNNING );	
				vDirection.x = +1;
			}
		}
		else
		{
			ChangeStance( IDLE );
		}

	}
		/*
		if( eCURRENTSTANCE == MOVE_BACK )
		vDirection.x = ( eFACING == FACERIGHT ) ? -1 :  1;
		else
		vDirection.x = ( eFACING == FACERIGHT ) ?  1 : -1;
		*/
}