Example #1
0
        /// <summary>
        /// 释放动作
        /// </summary>
        public override bool Cast(RoleActor target, SkillActive skill)
        {
            if (!base.Cast(target, skill))
            {
                return(false);
            }

            RoleActor owner = skill.Owner;

            if (null == owner)
            {
                return(false);
            }

            HealImpact impact = new HealImpact();

            impact.Init(skill, target);
            impact.Run();

            return(true);
        }
Example #2
0
        /// <summary>
        /// 释放动作
        /// </summary>
        public override bool Cast(RoleActor target, SkillActive skill)
        {
            if (!base.Cast(target, skill))
            {
                return(false);
            }

            RoleActor owner = skill.Owner;

            if (null == owner || null == target || owner == target)
            {
                return(false);
            }

            AttackImpact impact = new AttackImpact();

            impact.Init(skill, target);
            impact.Run();
            if (impact.HitType == eHitType.Miss)
            {
                return(false);
            }
            switch (owner.GameType)
            {
            case eActorGameType.Player:
            {
            }
            break;

            case  eActorGameType.Npc:
            {
            }
            break;
            }

            return(true);
        }
Example #3
0
        private bool _DoSkillRealEffect(SkillActive skill, RoleActor target)
        {
            if (skill.Selector.TargetFilter(this, skill, target, eRelationType.Enemy))
            {
                if (!CanAttack(target))
                {
                    return(false);
                }

                if (skill.ActionGroupData.limit >= skill.LvData.areaCount)
                {
                    return(false);
                }

                ActionGroup tempGroup = skill.ActionGroupData;
                tempGroup.limit      += 1;
                skill.ActionGroupData = tempGroup;
                bool isEffect = true; //是否命中
                foreach (var action in skill.ActionGroupData.actions)
                {
                    skill.mAction = action;
                    if (action.actionLogic.OnInit(target, skill))
                    {
                        isEffect = action.actionLogic.Cast(target, skill);
                        action.actionLogic.OnEnd(target, skill);
                    }
                    skill.mAction = default(Action);
                    if (!isEffect)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Example #4
0
        private bool AddBuffBySkill(Buff buff, SkillActive skill)
        {
            if (null == buff)
            {
                return(false);
            }

            buff.SetOwner(mOwner);
            buff.SetCaster(skill.Owner);
            Buff oldBuff = GetBuff(buff.BuffId);

            if (null == oldBuff)
            {
                mBuffers[buff.Id] = buff;
                buff.RegisteBuffEffectType();
                mOwner.PlayerStatus.BuffAddStatusType(buff.Data, mOwner);
                buff.SendAddBuff();
                return(true);
            }
            else
            {
                if (buff.Data.replaceMode == (int)eBuffReplaceMode.StackNum)
                {
                    mBuffers[buff.Id] = buff;
                    buff.RegisteBuffEffectType();
                }
                else
                {
                    oldBuff.Init(buff.LevelData);
                    oldBuff.SendUpdateBuff();
                    oldBuff.ReComputeAffectValue();
                }
            }

            return(false);
        }
Example #5
0
 /// <summary>
 /// 发送技能投射物飞行延迟事件
 /// </summary>
 private void DelayDoSkillRealEffect(SkillActive skill, float flyTime)
 {
     TimerManager.doOnce(flyTime, OnSkillRealEffectEvent, skill);
 }
Example #6
0
 /// <summary>
 /// 发送技能分段计算延迟事件
 /// </summary>
 private void DelayDoSkillEffect(SkillActive skill, float hitTime)
 {
     skill.mStep = eSkillStep.Delay;
     TimerManager.doOnce(hitTime, OnSkillEffectEvent, skill);
 }
Example #7
0
        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));
        }