SKILL_RESULT_CODE CastOnCasterArea(KCharacter pDisplayCaster, KCharacter pLogicCaster) { SKILL_RESULT_CODE nResult = SKILL_RESULT_CODE.srcFailed; int nRetCode = 0; KTarget pTarget = new KTarget(); KSKILL_BULLET pBullet = new KSKILL_BULLET(); float fX = 0f; float fZ = 0f; nRetCode = pTarget.SetTarget(pDisplayCaster); if (nRetCode == 0) { goto Exit0; } nRetCode = SetupBullet(pBullet, pLogicCaster, ref pTarget); if (nRetCode == 0) { goto Exit0; } if (pBullet.nEndFrame > FirstFightMgr.Instance().m_nGameLoop) { pLogicCaster.AddBullet(pBullet); } else { pDisplayCaster.GetAbsoluteCoordinate(ref fX, ref fZ); nRetCode = (int)ApplyOnArea(pBullet, fX, fZ); } nResult = SKILL_RESULT_CODE.srcSuccess; Exit0: return(nResult); }
SKILL_RESULT_CODE CastOnCasterSingle(KCharacter pDisplayCaster, KCharacter pLogicCaster) { SKILL_RESULT_CODE nResult = SKILL_RESULT_CODE.srcFailed; int nRetCode = 0; KSKILL_BULLET pBullet = new KSKILL_BULLET(); KTarget pTarget = new KTarget(); nRetCode = pTarget.SetTarget(pDisplayCaster); if (nRetCode == 0) { goto Exit0; } nRetCode = SetupBullet(pBullet, pLogicCaster, ref pTarget); if (nRetCode == 0) { goto Exit0; } if (pBullet.nEndFrame > FirstFightMgr.Instance().m_nGameLoop) { pLogicCaster.AddBullet(pBullet); } else { ApplyOnSingle(pBullet); } nResult = SKILL_RESULT_CODE.srcSuccess; Exit0: return(nResult); }
SKILL_RESULT_CODE CastOnSector(KCharacter pDisplayCaster, KCharacter pLogicCaster) { SKILL_RESULT_CODE nResult = SKILL_RESULT_CODE.srcFailed; int nRetCode = 0; KSKILL_BULLET pBullet = new KSKILL_BULLET(); KTarget pTarget = new KTarget(); nRetCode = pTarget.SetTarget(pDisplayCaster); if (nRetCode == 0) { return(SKILL_RESULT_CODE.srcFailed); } nRetCode = SetupBullet(pBullet, pLogicCaster, ref pTarget); if (nRetCode == 0) { goto Exit0; } nRetCode = (int)ApplyOnSector(pBullet); if (nRetCode != (int)SKILL_RESULT_CODE.srcSuccess) { return((SKILL_RESULT_CODE)nRetCode); } nResult = SKILL_RESULT_CODE.srcSuccess; Exit0: return(nResult); }
void ProcessBullet(KSKILL_BULLET pBullet) { KCharacter pCaster = null; KSkill pSkill = null; pCaster = pBullet.pSkillSrc; if (pCaster == null) { goto Exit0; } pSkill = pBullet.pSkillPointer; if (pSkill == null) { goto Exit0; } if ((pCaster.m_dwID == pBullet.dwSkillSrcID) == false) { goto Exit0; } switch (pSkill.m_pBaseInfo.nCastMode) { case KSKILL_CAST_MODE.scmTargetSingle: pSkill.ApplyOnSingle(pBullet); break; default: goto Exit0; break; } Exit0: return; }
public void CheckBullet() { KSKILL_BULLET pBullet = null; if (m_pBulletListHead == null) { goto Exit0; } if (m_pBulletListHead.nEndFrame > FirstFightMgr.Instance().m_nGameLoop) { goto Exit0; } pBullet = m_pBulletListHead; m_pBulletListHead = m_pBulletListHead.pNext; ProcessBullet(pBullet); pBullet = null; Exit0: return; }
public void AddBullet(KSKILL_BULLET pBullet) { KSKILL_BULLET pPreNode = null; KSKILL_BULLET pNode = null; pNode = m_pBulletListHead; while (pNode != null) { if (pNode.nEndFrame > pBullet.nEndFrame) { break; } pPreNode = pNode; pNode = pNode.pNext; } if (pPreNode != null) { pBullet.pNext = pPreNode.pNext; pPreNode.pNext = pBullet; } else { pBullet.pNext = m_pBulletListHead; m_pBulletListHead = pBullet; } }
SKILL_RESULT_CODE ApplyOnArea(KSKILL_BULLET pBullet, float fX, float fZ) { SKILL_RESULT_CODE nResult = SKILL_RESULT_CODE.srcFailed; KCharacter pCaster = null; KSkill pSkill = null; KScene pScene = null; pSkill = pBullet.pSkillPointer; if (pSkill == null) { goto Exit0; } pCaster = pBullet.pSkillSrc; if (pCaster == null) { goto Exit0; } pScene = pCaster.m_pScene; if (pScene == null) { goto Exit0; } KSkillAreaTravFunc AreaTravFunc = new KSkillAreaTravFunc(); AreaTravFunc.pBullet = pBullet; AreaTravFunc.nLeftCount = 3; if (m_pBaseInfo.nCastMode == KSKILL_CAST_MODE.scmTargetArea) { KCharacter pObject = null; pBullet.pTarget.GetTarget(ref pObject); if (pObject == null) { goto Exit0; } AreaTravFunc.bTargetArea = true; AreaTravFunc.nTargetType = (int)pBullet.pTarget.GetTargetType(); AreaTravFunc.dwTargetID = pObject.m_dwID; AreaTravFunc.nLeftCount -= 1; } else { AreaTravFunc.bTargetArea = false; AreaTravFunc.nTargetType = (int)TARGET_TYPE.ttInvalid; AreaTravFunc.dwTargetID = 0; } pScene.TraverseRangePlayer <KSkillAreaTravFunc>(ref AreaTravFunc); pScene.TraverseRangeNpc <KSkillAreaTravFunc>(ref AreaTravFunc); nResult = SKILL_RESULT_CODE.srcSuccess; Exit0: return(nResult); }
public int ApplyBullet(KSKILL_BULLET pBullet) { int nResult = 0; ConcludeResult(pBullet.dwBulletID, false); nResult = 1; Exit0: return(nResult); }
SKILL_RESULT_CODE ApplyOnSector(KSKILL_BULLET pBullet) { SKILL_RESULT_CODE nResult = SKILL_RESULT_CODE.srcFailed; int nRetCode = 0; nResult = SKILL_RESULT_CODE.srcSuccess; Exit0: return(nResult); }
//以目标为中心的圆形区域 SKILL_RESULT_CODE CastOnTargetArea(KCharacter pDisplayCaster, KCharacter pLogicCaster, ref KTarget rTarget) { SKILL_RESULT_CODE nResult = SKILL_RESULT_CODE.srcFailed; int nRetCode = 0; KSKILL_BULLET pBullet = new KSKILL_BULLET(); float fTargetX = 0f; float fTargetZ = 0f; nRetCode = SetupBullet(pBullet, pLogicCaster, ref rTarget); if (nRetCode == 0) { goto Exit0; } if (pBullet.nEndFrame > FirstFightMgr.Instance().m_nGameLoop) { pLogicCaster.AddBullet(pBullet); } else { nRetCode = rTarget.GetTarget(ref fTargetX, ref fTargetZ); if (nRetCode == 0) { goto Exit0; } nRetCode = (int)ApplyOnSingle(pBullet); if (nRetCode != (int)SKILL_RESULT_CODE.srcSuccess) { return((SKILL_RESULT_CODE)nRetCode); } nRetCode = (int)ApplyOnArea(pBullet, fTargetX, fTargetZ); if (nRetCode != (int)SKILL_RESULT_CODE.srcSuccess) { return((SKILL_RESULT_CODE)nRetCode); } } nResult = SKILL_RESULT_CODE.srcSuccess; Exit0: return(nResult); }
public SKILL_RESULT_CODE ApplyOnSingle(KSKILL_BULLET pBullet) { SKILL_RESULT_CODE nResult = SKILL_RESULT_CODE.srcFailed; int nRetCode = 0; TARGET_TYPE eTargetType = TARGET_TYPE.ttInvalid; KCharacter pCharacter = null; eTargetType = pBullet.pTarget.GetTargetType(); switch (eTargetType) { case TARGET_TYPE.ttNoTarget: break; case TARGET_TYPE.ttCoordination: break; case TARGET_TYPE.ttNpc: case TARGET_TYPE.ttPlayer: nRetCode = pBullet.pTarget.GetTarget(ref pCharacter); if (nRetCode == 0 || pCharacter == null) { goto Exit0; } pCharacter.ApplyBullet(pBullet); break; default: goto Exit0; break; } nResult = SKILL_RESULT_CODE.srcSuccess; Exit0: return(nResult); }
int SetupBullet(KSKILL_BULLET pBullet, KCharacter pCaster, ref KTarget rTarget) { int nResult = 0; int nRetCode = 0; float fCasterX = 0f; float fCasterZ = 0f; float fTargetX = 0f; float fTargetZ = 0f; KCharacter pTarget = null; float fTouchRange = 0f; float fDistance = 0f; float fHitDelay = 0f; if (pBullet == null) { goto Exit0; } if (pCaster == null) { goto Exit0; } if (rTarget == null) { goto Exit0; } pBullet.dwBulletID = FirstFightMgr.Instance().m_SkillManager.m_dwBulletIDIndex++; pBullet.pTarget = rTarget; pBullet.pSkillSrc = pCaster; pBullet.dwSkillSrcID = pCaster.m_dwID; pBullet.pSkillPointer = this; pBullet.pNext = null; switch (m_pBaseInfo.nCastMode) { case KSKILL_CAST_MODE.scmTargetSingle: break; default: break; } pCaster.GetAbsoluteCoordinate(ref fCasterX, ref fCasterZ); rTarget.GetTarget(ref fTargetX, ref fTargetZ); nRetCode = rTarget.GetTarget(ref pTarget); if (pTarget != null) { fTouchRange = pTarget.m_fTouchRange; } fDistance = KAI_SEARCH_CHARACTER.s_GetDistance2(fCasterX, fCasterZ, fTargetX, fTargetZ); if (fDistance > fTouchRange) { fDistance -= fTouchRange; } if (m_fBulletVelocity > 0f) { fHitDelay = (fDistance / m_fBulletVelocity); } int nHitDelay = ((int)(fHitDelay * 16)) + (int)FirstFightMgr.Instance().m_nGameLoop + m_pBaseInfo.nHitDelay; pBullet.nEndFrame = nHitDelay; nResult = 1; Exit0: return(nResult); }