ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Programacion Skill

skillpunk19 de Julio de 2013

1.585 Palabras (7 Páginas)344 Visitas

Página 1 de 7

void CMagicProcess::ExecuteType3(int magicid, int sid, int tid, int data1, int data2, int data3) // Applied when a magical attack, healing, and mana restoration is done.

{

int damage = 0, duration_damage = 0, send_index = 0, result = 1; // Variable initialization. result == 1 : success, 0 : fail

char send_buff[128]; memset( send_buff, NULL, 128);

char strLogData[128]; memset( strLogData, NULL, 128);

BOOL bFlag = FALSE;

CNpc* pMon = NULL;

/*if(!UserRegionCheck(sid,tid,magicid,10,data1,data3))

return;

*/

int casted_member[MAX_USER], party_index = 0 ;

for (int h = 0 ; h < MAX_USER ; h++) {

casted_member[h] = -1;

}

// //TRACE(execute type 3 - 1\n");

_MAGIC_TABLE* pMagic = NULL;

pMagic = m_pMain->m_MagictableArray.GetData( magicid ); // Get main magic table.

if( !pMagic ) return;

_MAGIC_TYPE3* pType = NULL;

pType = m_pMain->m_Magictype3Array.GetData(magicid); // Get magic skill table type 3.

if( !pType ) return;

if (sid >= NPC_BAND) {

bFlag = TRUE;

pMon = m_pMain->m_arNpcArray.GetData(sid);

if( !pMon || pMon->m_NpcState == NPC_DEAD ) return;

/* if(pTUser->m_sDuration[91] + pTUser->m_fStartTime[91] > TimeGet() )

if(magicid == 300139)

return;

*/ }

// //TRACE(execute type 3 - 2\n");

if (tid == -1) { // If the target was the source's party....

for (int i = 0 ; i < MAX_USER ; i++) { // Maximum number of users in the server....

CUser* pTUser = NULL ; // Pointer initialization!

pTUser = (CUser*)m_pMain->m_Iocport.m_SockArray[i]; // Get target info.

// if( !pTUser || pTUser->m_bResHpType == USER_DEAD || pTUser->m_bResHpType == USER_BLINKING) continue ;

if( !pTUser || pTUser->m_bResHpType == USER_DEAD || pTUser->m_bAbnormalType == ABNORMAL_BLINKING) continue ;

// if (UserRegionCheck(sid, i, magicid, pType->bRadius)) {

if (UserRegionCheck(sid, i, magicid, pType->bRadius, data1, data3)) {

casted_member[party_index] = i ;

party_index++ ;

// //TRACE(%d casted \n",i);

}

}

// //TRACE(execute type 3 - 3\n");

if (party_index == 0) { // If none of the members are in the region, return.

/*

SetByte( send_buff, WIZ_MAGIC_PROCESS, send_index );

SetByte( send_buff, MAGIC_FAIL, send_index );

SetDWORD( send_buff, magicid, send_index );

SetShort( send_buff, sid, send_index );

SetShort( send_buff, tid, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

SetShort( send_buff, 0, send_index );

if (!bFlag) {

m_pMain->Send_Region( send_buff, send_index, m_pSrcUser->m_pUserData->m_bZone, m_pSrcUser->m_RegionX, m_pSrcUser->m_RegionZ, NULL, false );

}

else {

m_pMain->Send_Region( send_buff, send_index, pMon->m_sCurZone, pMon->m_sRegion_X, pMon->m_sRegion_Z, NULL, false );

}

return;*/

}

}

else

{ // If the target was another single player.

CUser* pTUser = NULL ; // Pointer initialization!

if (tid < 0 || tid >= MAX_USER) return;

pTUser = (CUser*)m_pMain->m_Iocport.m_SockArray[tid]; // Get target info.

if( !pTUser ) return; // Check if target exists and not already dead.

casted_member[0] = tid ;

party_index = 1 ;

}

for ( int j = 0 ; j < party_index ; j++) { // THIS IS WHERE THE FUN STARTS!!!

CUser* pTUser = NULL ; // Pointer initialization!

if (casted_member[j] < 0 || casted_member[j] >= MAX_USER) continue;

pTUser = (CUser*)m_pMain->m_Iocport.m_SockArray[casted_member[j]]; // Get target info.

if (pTUser->m_sDuration[91]+pTUser->m_fStartTime[91] > TimeGet()) continue;

if (!pTUser|| pTUser->m_bResHpType == USER_DEAD) continue;

if( !pTUser || pTUser->m_bResHpType == USER_DEAD) { // Check if target exists and not already dead.

result = 0 ;

goto packet_send ;

}

// if (pType->sFirstDamage < 0) { // If you are casting an attack spell.

if ((pType->sFirstDamage < 0) && (pType->bDirectType == 1) && (magicid < 400000)) { // If you are casting an attack spell.

damage = GetMagicDamage(sid, casted_member[j], pType->sFirstDamage, pType->bAttribute) ; // Get Magical damage point.

TRACE("Magic id : %d",magicid);

if(damage > 0)

{

if(damage < 500)

{

damage = damage + 538;

}

damage = 0-damage;

}

}

else damage = pType->sFirstDamage ;

// ´«½Î¿òÀüÀïÁ¸¿¡¼­ ´«½Î¿òÁßÀ̶ó¸é °ø°ÝÀº ´«À» ´øÁö´Â °Í¸¸ °¡´ÉÇϵµ·Ï,,,

if( m_pSrcUser ) {

if( m_pSrcUser->m_pUserData->m_bZone == ZONE_SNOW_BATTLE && m_pMain->m_byBattleOpen == SNOW_BATTLE ) {

damage = -10;

}

}

if (pType->bDirectType == 18)

{

TRACE("Anger basildi \n\n\n\n");

m_pSrcUser->m_sAnger=0;

m_pSrcUser->RFullAnger();

duration_damage = ((m_pSrcUser->m_pUserData->m_bLevel * 50)/10)+30 ;

if(m_pSrcUser->m_pUserData->m_bLevel > 65 ){

duration_damage = duration_damage*2;

}

duration_damage = 0 - duration_damage;

TRACE("Damage %d \n",duration_damage);

pTUser->m_fHPStartTime[19] = pTUser->m_fHPLastTime[19] = TimeGet(); // The durational magic routine.

pTUser->m_bHPDuration[19] = pType->sDuration;

pTUser->m_bHPInterval[19] = 1;

pTUser->m_bHPAmount[19] = duration_damage; // ( pTUser->m_bHPDuration[k] / pTUser->m_bHPInterval[k] ) ;

pTUser->m_sSourceID[19] = sid;

pTUser->InitType3();

pTUser->m_bType3Flag = TRUE;

// For continuous damages...

/*for (int k = 0 ; k < MAX_TYPE3_REPEAT ; k++) { // For continuous damages...

if(tid >= 0 && tid < MAX_USER){

if (pTUser->m_bHPInterval[k] == 0) {

//TRACE(infected \n");

pTUser->m_fHPStartTime[k] = pTUser->m_fHPLastTime[k] = TimeGet(); // The durational magic routine.

pTUser->m_bHPDuration[k] = pType->sDuration;

pTUser->m_bHPInterval[k] = 1;

pTUser->m_bHPAmount[k] = duration_damage / ( pTUser->m_bHPDuration[k] / pTUser->m_bHPInterval[k] ) ;

pTUser->m_sSourceID[k] = sid;

break;

} }

}/*

if(tid >= 0 && tid < MAX_USER){

pTUser->m_fHPStartTime[18] = pTUser->m_fHPLastTime[18] = TimeGet(); // The durational magic routine.

pTUser->m_bHPDuration[18] = 5;

pTUser->m_bHPInterval[18] = 1;

pTUser->m_bHPAmount[18] = duration_damage ;

pTUser->m_sSourceID[18] = sid;

} */

}

if (pType->sDuration == 0) { // Non-Durational Spells.

// //TRACE(execute type 3 - 61 tid %d sid %d result = %d \n",casted_member[j],sid,result);

if (pType->bDirectType == 9)

{ if (!bFlag)

{

int hp = pTUser->m_pUserData->m_sHp;

pTUser->HpChange(-((hp/100)*pType->sFirstDamage), 0, false, sid);

m_pSrcUser->SendTargetHP( 0, casted_member[j], -((hp/100)*pType->sFirstDamage) ) ;

}

else

{

int hp = pMon->m_iHP;

// Monster için % yazilacak

//pTUser->HpChange(-((hp/100)*pType->sFirstDamage), 0, false, sid);

}

}

if (pType->bDirectType == 1) // Health Point related !

{

// //TRACE(execute type 3 - 62 tid %d sid %d\n",casted_member[j],sid);

if(pTUser->m_fStartTime[25] + pTUser->m_sDuration[25] > TimeGet())

{

damage -= (damage / 100)*13;

m_pSrcUser->HpChange(-((damage / 100)*13), 0,false,tid);

/*if(m_pSrcUser->m_fStartTime[32] < 1)

{

m_pSrcUser->m_sDuration[32]=40;

m_pSrcUser->m_fStartTime[32]=TimeGet();

}*/

}

if(magicid

...

Descargar como (para miembros actualizados) txt (17 Kb)
Leer 6 páginas más »
Disponible sólo en Clubensayos.com