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; }
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 SKILL_RESULT_CODE CastSkill(uint dwSkillID, ref KTarget pTarget) { int nRetCode = 0; SKILL_RESULT_CODE nResult = SKILL_RESULT_CODE.srcFailed; KCharacter pTargetCharacter = null; if (m_pEntity == null) { return(SKILL_RESULT_CODE.srcFailed); } ISkillPart skillPart = m_pEntity.GetPart(EntityPart.Skill) as ISkillPart; if (skillPart == null) { return(SKILL_RESULT_CODE.srcFailed); } if (pTarget == null) { return(SKILL_RESULT_CODE.srcFailed); } nRetCode = pTarget.GetTarget(ref pTargetCharacter); if (nRetCode == 0 || pTargetCharacter == null) { return(SKILL_RESULT_CODE.srcFailed); } IEntity targetEntity = pTargetCharacter.m_pEntity; if (targetEntity == null) { return(SKILL_RESULT_CODE.srcFailed); } skillPart.ReqNpcUseSkill(targetEntity, dwSkillID); // KSkill pSkill = FirstFightMgr.Instance().m_SkillManager.GetSkill(dwSkillID); pSkill.Cast(this, this, ref pTarget); //测试代码 // 伤害飘子 //FlyFontDataManager.Instance.ShowDamage(999, 1, pTargetCharacter.m_dwID, EntityType.EntityType_NPC, 1000000); //pTargetCharacter.Test_ConcludeResult(); nResult = SKILL_RESULT_CODE.srcSuccess; Exit0: return(nResult); }
public KSkill GetSkill(uint uSkillID) { KSkill pSkill = null; if (m_SkillList.TryGetValue(uSkillID, out pSkill)) { return(pSkill); } return(pSkill); }
public static int CastSkill(KCharacter pCharacter, uint dwSkillID, uint dwSkillLevel, int nAISkillType) { int nResult = 0; int nRetCode = 0; KCharacter pTarget = null; KSkill pSkill = null; if (!(pCharacter.m_eMoveState < CHARACTER_MOVE_STATE.cmsOnDeath)) { return(2); } pCharacter.m_pSkillTarget = pCharacter.m_pSelectTarget; if (pCharacter.m_pSkillTarget.GetTargetType() == TARGET_TYPE.ttNpc || pCharacter.m_pSkillTarget.GetTargetType() == TARGET_TYPE.ttPlayer) { nRetCode = pCharacter.m_pSkillTarget.GetTarget(ref pTarget); if (nRetCode == 0 || pTarget == null) { goto Exit0; } } pSkill = FirstFightMgr.Instance().m_SkillManager.GetSkill(dwSkillID); if (pSkill == null) { goto Exit0; } nRetCode = (int)pSkill.CanCast(pCharacter, ref pCharacter.m_pSkillTarget); switch (nRetCode) { case (int)SKILL_RESULT_CODE.srcInvalidTarget: case (int)SKILL_RESULT_CODE.srcTooCloseTarget: case (int)SKILL_RESULT_CODE.srcTooFarTarget: break; } if (nRetCode != (int)SKILL_RESULT_CODE.srcSuccess) { return(2); } nRetCode = (int)pCharacter.CastSkill(dwSkillID, ref pCharacter.m_pSkillTarget); if (nRetCode != (int)SKILL_RESULT_CODE.srcSuccess) { return(2); } nResult = 1; Exit0: return(nResult); }
public KSkillManager() { KSkill pSkill = new KSkill(); //------------------------------------------------------------------- { // 技能1, 飞虫的技能 uint uSkillID = 10005; pSkill.Init(); pSkill.m_pBaseInfo.dwSkillID = uSkillID; pSkill.m_pBaseInfo.nCastMode = KSKILL_CAST_MODE.scmTargetSingle;// 对单体对象(指定目标)施放 pSkill.m_fMaxRadius = 8f; pSkill.m_fBulletVelocity = 5f; pSkill.m_pBaseInfo.nHitDelay = 0; m_SkillList[uSkillID] = pSkill; } //------------------------------------------------------------------- { pSkill = new KSkill(); uint uSkillID = 10001; pSkill.Init(); pSkill.m_pBaseInfo.dwSkillID = uSkillID; pSkill.m_pBaseInfo.nCastMode = KSKILL_CAST_MODE.scmTargetSingle;// 对单体对象(指定目标)施放 pSkill.m_fMaxRadius = 2f; pSkill.m_fBulletVelocity = 0f; pSkill.m_pBaseInfo.nHitDelay = 5; m_SkillList[uSkillID] = pSkill; } //------------------------------------------------------------------- { // 法师冰 pSkill = new KSkill(); uint uSkillID = 10131; pSkill.Init(); pSkill.m_pBaseInfo.dwSkillID = uSkillID; pSkill.m_pBaseInfo.nCastMode = KSKILL_CAST_MODE.scmTargetSingle;// 对单体对象(指定目标)施放 pSkill.m_fMaxRadius = 8f; pSkill.m_fBulletVelocity = 0f; pSkill.m_pBaseInfo.nHitDelay = 5; m_SkillList[uSkillID] = pSkill; } }
public static int AINpcKeepSkillCastRange(KCharacter pCharacter, KAIAction pActionData) { int nResult = 0; int nRetCode = 0; int nBranchInRange = 1; int nBranchKeep = 2; float fMinRange = 0f; float fMaxRange = 0f; uint dwSkillID = 0; KNpc pNpc = null; KSkill pSkill = null; pNpc = (KNpc)pCharacter; dwSkillID = pNpc.m_pTemplate.dwSkillIDList[pNpc.m_nSkillSelectIndex]; if (dwSkillID == 10001) { int gg = 0; } pSkill = FirstFightMgr.Instance().m_SkillManager.GetSkill(dwSkillID); if (pSkill == null) { goto Exit0; } fMinRange = pSkill.m_fMinRadius; fMaxRange = pSkill.m_fMaxRadius; nRetCode = KeepRange(pCharacter, fMinRange, fMaxRange); if (!(nRetCode > 0)) { goto Exit0; } if (nRetCode == 1) { nResult = nBranchInRange; goto Exit0; } nResult = nBranchKeep; Exit0: return(nResult); }