void CUser::Attack(int sid, int tid) { CNpc* pNpc = m_pMain->m_arNpc.GetData(tid-NPC_BAND); if(pNpc == NULL) return; if(pNpc->m_NpcState == NPC_DEAD) return; if(pNpc->m_iHP == 0) return; /* if(pNpc->m_tNpcType == NPCTYPE_GUARD) // 경비병이면 타겟을 해당 유저로 { pNpc->m_Target.id = m_iUserId + USER_BAND; pNpc->m_Target.x = m_curx; pNpc->m_Target.y = m_cury; pNpc->m_Target.failCount = 0; pNpc->Attack(m_pIocport); // return; } */ int nDefence = 0, nFinalDamage = 0; // NPC 방어값 nDefence = pNpc->GetDefense(); // 명중이면 //Damage 처리 ----------------------------------------------------------------// nFinalDamage = GetDamage(tid); if( m_pMain->m_byTestMode ) nFinalDamage = 3000; // sungyong test // Calculate Target HP -------------------------------------------------------// short sOldNpcHP = pNpc->m_iHP; if(pNpc->SetDamage(0, nFinalDamage, m_strUserID, m_iUserId + USER_BAND, m_pIocport) == FALSE) { // Npc가 죽은 경우,, pNpc->SendExpToUserList(); // 경험치 분배!! pNpc->SendDead(m_pIocport); SendAttackSuccess(tid, ATTACK_TARGET_DEAD, nFinalDamage, pNpc->m_iHP); // CheckMaxValue(m_dwXP, 1); // 몹이 죽을때만 1 증가! // SendXP(); } else { // 공격 결과 전송 SendAttackSuccess(tid, ATTACK_SUCCESS, nFinalDamage, pNpc->m_iHP); } // m_dwLastAttackTime = GetTickCount(); }
void CUser::Attack(int sid, int tid) { CNpc* pNpc = g_pMain->m_arNpc.GetData(tid-NPC_BAND); if(pNpc == nullptr) return; if(pNpc->m_NpcState == NPC_DEAD) return; if(pNpc->m_iHP == 0) return; /* if(pNpc->m_proto->m_tNpcType == NPCTYPE_GUARD) // 경비병이면 타겟을 해당 유저로 { pNpc->m_Target.id = m_iUserId + USER_BAND; pNpc->m_Target.x = m_curx; pNpc->m_Target.y = m_cury; pNpc->m_Target.failCount = 0; pNpc->Attack(); // return; } */ int nDefence = 0, nFinalDamage = 0; // NPC 방어값 nDefence = pNpc->GetDefense(); // 명중이면 //Damage 처리 ----------------------------------------------------------------// nFinalDamage = GetDamage(tid); // Calculate Target HP -------------------------------------------------------// short sOldNpcHP = pNpc->m_iHP; if(pNpc->SetDamage(0, nFinalDamage, m_strUserID, m_iUserId + USER_BAND) == false) { // Npc가 죽은 경우,, pNpc->SendExpToUserList(); // 경험치 분배!! pNpc->SendDead(); SendAttackSuccess(tid, ATTACK_TARGET_DEAD, nFinalDamage, pNpc->m_iHP); } else { // 공격 결과 전송 SendAttackSuccess(tid, ATTACK_SUCCESS, nFinalDamage, pNpc->m_iHP); } }
void CUser::Dead(int tid, int nDamage) { if (m_bLive == USER_DEAD) return; m_sHP = 0; m_bLive = USER_DEAD; InitNpcAttack(); MAP* pMap = GetMap(); if (pMap == nullptr || m_sRegionX < 0 || m_sRegionZ < 0 || m_sRegionX > pMap->GetXRegionMax() || m_sRegionZ > pMap->GetZRegionMax()) return; pMap->RegionUserRemove(m_sRegionX, m_sRegionZ, m_iUserId); TRACE("*** User Dead = %d, %s ***\n", m_iUserId, m_strUserID); if (tid > 0) SendAttackSuccess(m_iUserId+USER_BAND, ATTACK_TARGET_DEAD, nDamage, m_sHP, 1, 2, tid /*sid*/); }