#include "StdAfx.h" #include "DnFreezingExplosionBlow.h" #include "DnMonsterActor.h" #include "EtActionSignal.h" #ifdef _GAMESERVER #include "DnGameRoom.h" #include "DnGameDataManager.h" #include "DnUserSession.h" #endif #ifdef _DEBUG #define new new(_NORMAL_BLOCK,__FILE__,__LINE__) #endif #define FREEZING_EXPLOSION_ACTION_NAME "Hit_Freezing" #ifdef PRE_FIX_70011 #define FREEZING_EXPLOSION_HIT_ACTION_NAME "Hit_Pushed" #endif // PRE_FIX_70011 CDnFreezingExplosionBlow::CDnFreezingExplosionBlow( DnActorHandle hActor, const char* szValue ) : CDnBlow( hActor ), m_pActionElement( NULL ), m_fFrame( 0.0f ) #ifdef _GAMESERVER ,m_iOriAttackMMin( 0 ), m_iOriAttackMMax( 0 ), m_bFreezingHitAction( false ) #endif { m_StateBlow.emBlowIndex = STATE_BLOW::BLOW_117; AddCallBackType(SB_ONTARGETHIT); SetValue( szValue ); m_fValue = (float)atof(szValue); m_pActionElement = m_hActor->GetElement( FREEZING_EXPLOSION_ACTION_NAME ); _ASSERT( m_pActionElement && "È­»ó Æø¹ß ¾×¼Ç Á¤º¸¸¦ ãÀ» ¼ö ¾øÀ½." ); m_ActionDurationTime = 0; if (m_pActionElement) { m_ActionDurationTime = m_pActionElement->dwLength; m_vlpSignalList = m_pActionElement->pVecSignalList; } } CDnFreezingExplosionBlow::~CDnFreezingExplosionBlow(void) { } bool CDnFreezingExplosionBlow::CanBegin( void ) { // °áºù »óÅÂÈ¿°ú°¡ °É·ÁÀÖ´Â »óŰ¡ ¾Æ´Ï¶ó¸é ½ÃÀÛµÉ ¼ö ¾ø´Ù. bool bCanBegin = m_hActor->IsAppliedThisStateBlow( STATE_BLOW::BLOW_041 ) || m_hActor->IsAppliedThisStateBlow( STATE_BLOW::BLOW_144 ); // µ¿»ó »óÅÂÈ¿°úµµ Á¦°Å. (#27838); if( false == bCanBegin ) OutputDebug( "CDnFreezingExplosionBlow::CanBegin - °áºù »óÅÂÈ¿°ú°¡ °É·ÁÀÖÁö ¾ÊÀ¸¹Ç·Î °áºù Æø¹ß »óÅÂÈ¿°ú ¹ßµ¿ ½ÇÆÐ.\n" ); // Æø¹ß ¾×¼Ç ¾øÀ» ¶© ¹ßµ¿½ÃŰÁö ¾Ê´Â´Ù. if( NULL == m_pActionElement ) { bCanBegin = false; OutputDebug( "CDnFreezingExplosionBlow::CanBegin - °áºù Æø¹ß ¾×¼ÇÀÌ ¾øÀ¸¹Ç·Î È­»ó Æø¹ß »óÅÂÈ¿°ú ¹ßµ¿ ½ÇÆÐ.\n" ); } return bCanBegin; } void CDnFreezingExplosionBlow::OnBegin( LOCAL_TIME LocalTime, float fDelta ) { // °áºù »óÅÂÈ¿°ú ÇØÁ¦ #ifdef _GAMESERVER // #28747 °áºù, µ¿»ó »óÅÂÈ¿°ú µÑ Áß¿¡ Çϳª¸¸ Á¦°ÅÇÑ´Ù. if( m_hActor->IsAppliedThisStateBlow( STATE_BLOW::BLOW_041 ) ) m_hActor->CmdRemoveStateEffect( STATE_BLOW::BLOW_041 ); if( m_hActor->IsAppliedThisStateBlow( STATE_BLOW::BLOW_144 ) ) m_hActor->CmdRemoveStateEffect( STATE_BLOW::BLOW_144 ); // µ¿»ó »óÅÂÈ¿°úµµ Á¦°Å. (#27838) _ApplyOtherSE( m_hActor ); // »óÅÂÈ¿°ú °É¸° ÁÖü¿¡°Ô ´À·ÁÁü »óÅÂÈ¿°ú Ãß°¡. #endif #ifdef PRE_FIX_70011 if( m_hActor->GetHitParam()->bSuccessNormalDamage == true && m_hActor->GetHitParam()->szActionName.empty() == true ) m_hActor->CmdAction( FREEZING_EXPLOSION_HIT_ACTION_NAME ); #endif // PRE_FIX_70011 // ÀÌ »óÅÂÈ¿°ú°¡ ³¢¾îÀÖ´Â ½ºÅ³ÀÇ ½ÃÀüÀÚÀÇ ¸¶¹ý °ø°Ý·ÂÀ¸·Î »óÅÂÈ¿°ú°¡ Àû¿ëµÈ ¾×ÅÍÀÇ ¸¶¹ý°ø°Ý·ÂÀ» Áö¼Ó½Ã°£ µ¿¾È ´ëü½ÃÅ´. #ifdef _GAMESERVER _ASSERT( m_ParentSkillInfo.hSkillUser ); if( !m_ParentSkillInfo.hSkillUser ) { g_Log.Log( LogType::_ERROR, L"CDnFreezingExplosionBlow::OnBegin - °áºù Æø¹ß »óÅÂÈ¿°ú ¾×ÅͰ¡ À¯È¿ÇÏÁö ¾Ê¾Æ¼­ ¹ßµ¿ ½ÇÆÐ..\n" ); SetState( STATE_BLOW::STATE_END ); return; } m_iOriAttackMMin = m_hActor->GetAttackMMin(); m_iOriAttackMMax = m_hActor->GetAttackMMax(); m_hActor->SetAttackMMin( m_ParentSkillInfo.hSkillUser->GetAttackMMin() ); m_hActor->SetAttackMMax( m_ParentSkillInfo.hSkillUser->GetAttackMMax() ); // ¸ó½ºÅͶó¸é Ŭ¶ó¿¡¼­ µ¥¹ÌÁö Ç¥½Ã¸¦ À§ÇØ ¼ÂÆÃ. if( m_hActor && CDnActorState::Reserved6 < m_hActor->GetActorType() ) static_cast(m_hActor.GetPointer())->SlaveOf( m_ParentSkillInfo.hSkillUser->GetUniqueID() ); #endif // Áö¼Ó½Ã°£Àº Æø¹ß ¾×¼ÇÀÇ Áö¼Ó½Ã°£À¸·Î ó¸®ÇÑ´Ù. float fFPS = 60.0f; //m_StateBlow.fDurationTime = (float)m_pActionElement->dwLength / fFPS; m_StateBlow.fDurationTime = m_ActionDurationTime != 0 ? (float)m_ActionDurationTime / fFPS : 0.0f; // ¹Ù·Î Á¾·á°¡ µÉ ¼ö ÀÖÀ¸¹Ç·Î Á¤»ó »óÅÂÀ϶§¸¸ Ãß°¡ if (STATE_BLOW::STATE_BEGIN == GetBlowState()) m_hActor->AddStateBlowSignal(this->GetMySmartPtr()); OutputDebug( "CDnFreezingExplosionBlow::OnBegin\n" ); } void CDnFreezingExplosionBlow::Process( LOCAL_TIME LocalTime, float fDelta ) { CDnBlow::Process( LocalTime, fDelta ); } void CDnFreezingExplosionBlow::OnEnd( LOCAL_TIME LocalTime, float fDelta ) { #ifdef _GAMESERVER m_hActor->SetAttackMMin( m_iOriAttackMMin ); m_hActor->SetAttackMMax( m_iOriAttackMMax ); // ¸ó½ºÅͶó¸é Ŭ¶ó¿¡¼­ µ¥¹ÌÁö Ç¥½Ã¸¦ À§ÇØ ¼ÂÆÃÇÑ °Í ¿ø»ó º¹±¸. //if( CDnActorState::Reserved6 < m_hActor->GetActorType() ) if( m_hActor && m_hActor->IsMonsterActor() ) { DWORD dwInvalidMasterActorID = UINT_MAX; static_cast(m_hActor.GetPointer())->SlaveOf( dwInvalidMasterActorID ); } #endif m_hActor->RemoveStateBlowSignal(this->GetMySmartPtr()); OutputDebug( "CDnFreezingExplosionBlow::OnEnd\n" ); } void CDnFreezingExplosionBlow::OnTargetHit( DnActorHandle hTargetActor ) { #ifdef _GAMESERVER if( m_bFreezingHitAction ) _ApplyOtherSE( hTargetActor ); #endif } #ifdef _GAMESERVER void CDnFreezingExplosionBlow::_ApplyOtherSE( DnActorHandle hActor ) { // ÀÏ´Ü ½ÃÇèÀûÀÎ ºÎºÐÀ¸·Î, Äڵ忡 ¹Ú¾Æ³õ´Â´Ù. (#7842) //- ÇÁ·¹ÀÓ Áõ°¡ = 0.5 //- ÀÌ¼Ó °¨¼Ò = -0.5 //- »óÅÂÀÌ»ó È¿°ú(µ¿»ó) -> ÀÌÆåÆ®¸¦ ¸»ÇÏ´Â °ÍÀÓ. // ³×½ºÆ®ÀÇ º¸½º¶ó¸é ºÎ°¡ »óÅÂÈ¿°úµéÀÌ Ãß°¡µÇÁö ¾Ê´Â´Ù. CDNGameRoom* pGameRoom = static_cast(m_hActor->GetRoom()); bool bNestMap = false; if( false == pGameRoom->bIsPvPRoom() ) { UINT uiSessionID = 0; pGameRoom->GetLeaderSessionID( uiSessionID ); CDNUserSession *pUserSession = pGameRoom ? pGameRoom->GetUserSession(uiSessionID) : NULL; if( pUserSession ) { const TMapInfo* pMapData = g_pDataManager->GetMapInfo( pUserSession->GetMapIndex() ); if( pMapData ) #if defined(PRE_ADD_DRAGON_FELLOWSHIP) bNestMap = CDnBlow::CheckEffectIgnoreMapType(pMapData->MapType, pMapData->MapSubType); #else // #if defined(PRE_ADD_DRAGON_FELLOWSHIP) bNestMap = (GlobalEnum::MAP_DUNGEON == pMapData->MapType) && (GlobalEnum::MAPSUB_NEST == pMapData->MapSubType); #endif // #if defined(PRE_ADD_DRAGON_FELLOWSHIP) } } bool bBossMonster = false; if( hActor->IsMonsterActor() ) { CDnMonsterActor* pMonsterActor = static_cast(m_hActor.GetPointer()); if( (CDnMonsterState::Boss == pMonsterActor->GetGrade() || CDnMonsterState::BossHP4 == pMonsterActor->GetGrade() || CDnMonsterState::NestBoss == pMonsterActor->GetGrade() || CDnMonsterState::NestBoss8 == pMonsterActor->GetGrade()) ) { bBossMonster = true; } } //#51048 235¹ø »óÅÂÈ¿°ú°¡ Àû¿ë µÇ¾î ÀÖ´Â °æ¿ì Çൿ°¨¼Ò È¿°ú°¡ Àû¿ëµÇÁö ¾Êµµ·ÏÇÑ´Ù. if( m_hActor->IsAppliedThisStateBlow(STATE_BLOW::BLOW_235) ) { bNestMap = true; bBossMonster = true; } if( false == bNestMap || false == bBossMonster ) { // µ¿ÀÏÇÑ ½ºÅ³ÀÇ ÀÌ »óÅÂÈ¿°ú·Î µé¾î°¡ ÀÖ´Â ÇÁ·¹ÀÓ, À̵¿¼Óµµ °¨¼Ò »óÅÂÈ¿°ú°¡ ÀÖ´Ù¸é Ãß°¡ÇÏÁö ¾Ê´Â´Ù. bool bCanAdd = true; if( hActor->IsAppliedThisStateBlow(STATE_BLOW::BLOW_025) && hActor->IsAppliedThisStateBlow(STATE_BLOW::BLOW_076) ) { DNVector(DnBlowHandle) vlBlows; hActor->GetAllAppliedStateBlowBySkillID( m_ParentSkillInfo.iSkillID, vlBlows ); bCanAdd = vlBlows.empty(); //for( int i = 0; i < (int)vlBlows.size(); ++i ) //{ // DnBlowHandle hBlow = vlBlows.at( i ); //} } if( bCanAdd ) { CDnSkill::SkillInfo SkillInfo = m_ParentSkillInfo; char szBuff[128] = {0, }; _snprintf_s(szBuff, _countof(szBuff), _TRUNCATE, "%d", 22 ); SkillInfo.szEffectOutputIDToClient = szBuff; //SkillInfo.hSkillUser = m_hActor;/*GetMySmartPtr();*/ hActor->CmdAddStateEffect( &SkillInfo, STATE_BLOW::BLOW_025, 7000, "-0.5" ); hActor->CmdAddStateEffect( &SkillInfo, STATE_BLOW::BLOW_076, 7000, "-0.5" ); } } } #endif //#ifdef _GAMESERVER // //#endif void CDnFreezingExplosionBlow::SignalProcess( LOCAL_TIME LocalTime, float fDelta ) { // ½ÇÁ¦ ¾×¼ÇÀ» ½ÇÇàÇÏÁö ¾Ê°í ½Ã±×³Îµé¸¸ ½ÇÇà½Ã۵µ·Ï ÇÑ´Ù. float fFPS = 60.0f; float fPrevFrame = m_fFrame; m_fFrame += (fDelta * fFPS); //if(m_pActionElement->dwLength < (DWORD)m_fFrame ) if (m_ActionDurationTime < (DWORD)m_fFrame) { m_fFrame = 1.0f; fPrevFrame = -0.1f; // ¾×¼ÇÀ» ´Ù ½ÇÇàÇß´Ù¸é ´õ ÀÌ»ó ½Ã±×³Î 󸮸¦ ÇÏÁö ¾Ê°í »óÅÂÈ¿°ú°¡ ³¡³­´Ù. // ¾×¼Ç ±æÀÌ ¸¸Å­ Áö¼Ó½Ã°£À» ¼³Á¤ÇßÀ¸¹Ç·Î °ð »óÅÂÈ¿°ú Á¾·áµÊ. return; } if( 0.0f == fPrevFrame ) fPrevFrame = -(m_fFrame * 0.1f); CEtActionSignal *pSignal = NULL; #if defined(PRE_FIX_55378) m_hActor->SetChargerAction(FREEZING_EXPLOSION_ACTION_NAME); #endif // PRE_FIX_55378 #if defined(PRE_FIX_62309) #if defined(_GAMESERVER) //#62309 //½Ã±×³Î ÇÁ·Î¼¼¼­ µ¹¸é¼­ OnSignal·Î Hit½Ã ¼Ó¼ºÀÌ ¼³Á¤µÇÁö ¾ÊÀ» ¼ö ÀÖ´Ù. //½Ã±×³Î ÇÁ·Î¼¼¼­ È£ÃâÀü¿¡ °­Á¦¼Ó¼ºÀ» ¼³Á¤ ÇØ ³õ°í, Hit½Ã±×³Î 󸮽ÿ¡ ¼³Á¤µÈ ¼Ó¼º°ªÀ¸·Î //°­Á¦¼³Á¤ Çϵµ·Ï ÇÑ´Ù.. m_hActor->PushForceHitElement(m_ParentSkillInfo.eSkillElement); #endif // _GAMESERVER #endif // PRE_FIX_62309 //for( DWORD i=0; i < m_pActionElement->pVecSignalList.size(); i++ ) for( DWORD i=0; i < m_vlpSignalList.size(); i++ ) { //pSignal = m_pActionElement->pVecSignalList[i]; pSignal = m_vlpSignalList[i]; if( pSignal->CheckSignal( fPrevFrame, m_fFrame ) == true ) { #ifdef _GAMESERVER if( STE_Hit == pSignal->GetSignalIndex() ) m_bFreezingHitAction = true; #endif LOCAL_TIME StartTime = LocalTime - (LOCAL_TIME)( 1000.f / fFPS * ( m_fFrame - pSignal->GetStartFrame() ) ); LOCAL_TIME EndTime = LocalTime + (LOCAL_TIME)( 1000.f / fFPS * ( pSignal->GetEndFrame() - m_fFrame ) ); m_hActor->OnSignal( (SignalTypeEnum)pSignal->GetSignalIndex(), pSignal->GetData(), LocalTime, StartTime, EndTime, pSignal->GetSignalListArrayIndex() ); #ifdef _GAMESERVER if( m_bFreezingHitAction ) m_bFreezingHitAction = false; #endif } } #if defined(PRE_FIX_62309) #if defined(_GAMESERVER) m_hActor->PopForceHitElement(); #endif // _GAMESERVER #endif // PRE_FIX_62309 #if defined(PRE_FIX_55378) m_hActor->SetChargerAction(NULL); #endif // PRE_FIX_55378 } #if defined(PRE_ADD_PREFIX_SYSTE_RENEW) void CDnFreezingExplosionBlow::AddStateEffectValue(const char* szOrigValue, const char* szAddValue, std::string& szNewValue) { char szBuff[128] = {0, }; //ÇÊ¿äÇÑ °ª º¯¼ö float fValue[2]; ////////////////////////////////////////////////////////////////////////// //ù¹øÂ° °ª fValue[0] = (float)atof( szOrigValue ); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //µÎ¹øÂ° fValue[1] = (float)atof( szAddValue ); ////////////////////////////////////////////////////////////////////////// //µÎ °ªÀ» ´õÇÑ´Ù. float fResultValue = fValue[0] + fValue[1]; sprintf_s(szBuff, "%f", fResultValue); szNewValue = szBuff; } void CDnFreezingExplosionBlow::RemoveStateEffectValue(const char* szOrigValue, const char* szAddValue, std::string& szNewValue) { char szBuff[128] = {0, }; //ÇÊ¿äÇÑ °ª º¯¼ö float fValue[2]; ////////////////////////////////////////////////////////////////////////// //ù¹øÂ° °ª fValue[0] = (float)atof( szOrigValue ); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //µÎ¹øÂ° fValue[1] = (float)atof( szAddValue ); ////////////////////////////////////////////////////////////////////////// //°ª °è»ê float fResultValue = fValue[0] - fValue[1]; sprintf_s(szBuff, "%f", fResultValue); szNewValue = szBuff; } #endif // PRE_ADD_PREFIX_SYSTE_RENEW