}; //技能释放顺序表 public bool SelectSpell() { if (mCurrSpellNode >= mSpellSNodes.Count()) { mCurrSpellNode = 0; } int spellId = SkillMgr.getElementByIndex(mSpellSNodes[mCurrSpellNode] - 1).ID; ASkillObject skbase = mSkillMgr.GetSkill(spellId); if (skbase == null) { return(false); } var sk = skbase as SkillActive; if (sk == null) { return(false); } if (!sk.SkillCD.IsCoolDown() || !SkillCD.IsCoolDown()) { return(false); } mCurrentSpellID = spellId; CSTable.SkillActiveData skillTplData = sk.Data as CSTable.SkillActiveData; mCastSpellDistance = skillTplData.range; return(true); }
public bool CastSpell(SkillActive skill, ulong targetId) { if (null == skill || null == skill.Data) { return(false); } skill.mResult = eSkillResult.CastFailed; if (mPlayerStatus.IsHasBuffStatus(eBuffStatusType.眩晕)) { return(false); } if (skill.mStatus != eSkillStatus.Valid) { return(false); } if (skill.mStep != eSkillStep.Init) { return(false); } //检查条件 RoleActor target = mHostMap.GetRole(targetId); if (null != skill.Checker) { skill.mStep = eSkillStep.Check; //预选择目标检查 if (!skill.Checker.PreSelectTarget(this, skill, target)) { skill.Reset(); return(false); } if (null != target) { skill.mDistance = Util.DistanceH(target.GetPosition(), GetPosition()); } if (!skill.Checker.CheckSkillCondition(this, skill)) { skill.Reset(); return(false); } } //检查消耗 if (null != skill.Consumer) { skill.mStep = eSkillStep.Consume; if (!skill.Consumer.CheckSkillConsume(this, skill)) { skill.Reset(); return(false); } //实际消耗 //if (!skill.Consumer.SkillConsume(this, skill)) //{ // skill.Reset(); // return false; //} } if (skill.SkillData.cdTime > 0) { //技能CD float cdTime = skill.SkillData.cdTime; cdTime -= GameSet.Instance.SkillCDTimeSync; skill.SkillCD.AddCoolDown(cdTime, Time.time + cdTime); float protectTime = new float[] { skill.SkillData.protectTime, CSCommon.SCDefine.cCommonCD }.Max(); protectTime -= GameSet.Instance.SkillCDTimeSync; SkillCD.AddCoolDown(protectTime, Time.time + protectTime); } //广播技能效果 var pkg = new RPC.PackageWriter(); Wuxia.H_RpcRoot.smInstance.HIndex(pkg, Id).RPC_SpellSkill(pkg, skill.ID, skill.mTargetId); HostMap.SendPkg2Clients(null, this.GetPosition(), pkg); mCurrSkill = skill; //实际释放技能 return(DoCastSkill(skill)); }