예제 #1
0
 public virtual bool IsSkillCanBreak(SkillNode node, int breaktype, out bool isinterrupt, out string skillmessage)
 {
     isinterrupt  = false;
     skillmessage = "";
     if (node == null)
     {
         return(true);
     }
     return(false);
 }
예제 #2
0
 private void AutoStopAttack(SkillNode nextAttackNode)
 {
     if (nextAttackNode == null || nextAttackNode.NextSkillNode == null)
     {
         if (m_ControlMode == SkillControlMode.kTouch)
         {
             m_IsAttacking = false;
         }
     }
 }
예제 #3
0
        protected SkillNode AddAttackNode()
        {
            SkillNode node = null;

            if (CanInput(SkillCategory.kAttack))
            {
                node = AddCategorySkillNode(SkillCategory.kAttack);
            }
            return(node);
        }
예제 #4
0
        public void LearnSkill(int skillid)
        {
            SkillNode node = GetSkillNodeById(skillid);

            if (node != null)
            {
                node.IsLocked = false;
                m_UnlockedSkills.Add(skillid);
            }
        }
예제 #5
0
        public virtual void StartAttack()
        {
            CancelBreakSkillTask();
            SkillNode node = AddAttackNode();

            if (node != null)
            {
                node.TargetPos = Vector3.Zero;
            }
            m_IsAttacking = true;
        }
        private int GetSkillNodeBreakType(SkillNode node)
        {
            int       breaktype  = MOVE_BREAK_TYPE;
            SkillInfo next_skill = GetSkillInfoByNode(node);

            if (next_skill != null)
            {
                breaktype = next_skill.ConfigData.BreakType;
            }
            return(breaktype);
        }
예제 #7
0
        protected virtual void BeginSkillCategoryCD(SkillCategory category)
        {
            SkillNode head = null;

            if (m_SkillCategoryDict.TryGetValue(category, out head))
            {
                GfxSystem.PublishGfxEvent("ge_cast_skill_cd", "ui",
                                          GetCategoryName(head.Category),
                                          GetSkillCD(head));
            }
        }
        public override bool IsSkillCanBreak(SkillNode node, int breaktype, out bool isinterrupt, out string skillmessage)
        {
            isinterrupt  = false;
            skillmessage = "";
            SkillInfo cur_skill = GetSkillInfoByNode(node);

            if (cur_skill == null)
            {
                return(true);
            }
            return(cur_skill.CanBreak(breaktype, TimeUtility.GetLocalMilliseconds(), out isinterrupt, out skillmessage));
        }
 protected override void BeginSkillCategoryCD(SkillCategory category)
 {
     if (null != m_Owner && WorldSystem.Instance.PlayerSelfId == m_Owner.GetId())
     {
         SkillNode head = null;
         if (m_SkillCategoryDict.TryGetValue(category, out head))
         {
             GfxSystem.PublishGfxEvent("ge_cast_skill_cd", "ui",
                                       GetCategoryName(head.Category),
                                       GetSkillCD(head));
         }
     }
 }
예제 #10
0
        public virtual void StartAttack(Vector3 targetpos)
        {
            LogSystem.Debug("-----start attack");
            CancelBreakSkillTask();
            SetFaceDir(targetpos);
            SkillNode node = AddAttackNode();

            if (node != null)
            {
                node.TargetPos = targetpos;
            }
            m_IsAttacking = true;
        }
        public override bool StopSkill(SkillNode node, int breaktype)
        {
            if (!IsSkillActive(node))
            {
                return(true);
            }
            bool   isinterrupt;
            string skillmessage;

            if (!IsSkillCanBreak(node, breaktype, out isinterrupt, out skillmessage))
            {
                return(false);
            }
            CharacterView view = EntityManager.Instance.GetCharacterViewById(m_Owner.GetId());

            if (view != null)
            {
                if (!string.IsNullOrEmpty(skillmessage))
                {
                    GfxSystem.QueueGfxAction(m_GfxSkillSystem.SendMessage, view.Actor, node.SkillId, skillmessage);
                    return(false);
                }
                //技能打断时逻辑层处理状态(包括技能激活状态与移动控制状态)并通知服务器,Gfx层不再处理状态
                if (isinterrupt)
                {
                    m_Owner.GetMovementStateInfo().IsSkillMoving = false;
                    view.ObjectInfo.IsSkillGfxMoveControl   = false;
                    view.ObjectInfo.IsSkillGfxRotateControl = false;
                    view.ObjectInfo.IsSkillGfxAnimation     = false;
                    SkillInfo skillInfo = m_Owner.GetSkillStateInfo().GetSkillInfoById(node.SkillId);
                    if (null != skillInfo)
                    {
                        skillInfo.IsSkillActivated = false;
                        //LogSystem.Debug("---------StopSkill " + node.SkillId);
                    }
                    if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene())
                    {
                        if (m_Owner.GetId() == WorldSystem.Instance.PlayerSelfId || m_Owner.OwnerId == WorldSystem.Instance.PlayerSelfId)
                        {
                            Network.NetworkSystem.Instance.SyncGfxMoveControlStop(m_Owner, node.SkillId, true);
                            Network.NetworkSystem.Instance.SyncPlayerStopSkill(m_Owner, node.SkillId);
                        }
                    }
                }
                //通知Gfx停止技能
                GfxSystem.QueueGfxAction(m_GfxSkillSystem.StopSkill, view.Actor, isinterrupt);
                SimulateStopSkill(m_Owner);
            }
            return(true);
        }
        internal SkillInfo GetSkillInfoByNode(SkillNode node)
        {
            SkillInfo result = null;

            if (node != null)
            {
                SkillStateInfo state = m_Owner.GetSkillStateInfo();
                if (state != null)
                {
                    result = state.GetSkillInfoById(node.SkillId);
                }
            }
            return(result);
        }
        public override float GetLockInputTime(SkillNode node, SkillCategory next_category)
        {
            if (node == null)
            {
                return(0);
            }
            SkillInfo skill = m_Owner.GetSkillStateInfo().GetSkillInfoById(node.SkillId);

            if (skill == null)
            {
                return(0);
            }
            return(skill.StartTime + skill.GetLockInputTime(next_category));
        }
예제 #14
0
        protected SkillNode GetSkillNodeById(int skillid)
        {
            SkillNode result = null;

            foreach (SkillNode head in m_SkillCategoryDict.Values)
            {
                result = FindSkillNodeInChildren(head, skillid);
                if (result != null)
                {
                    return(result);
                }
            }
            return(result);
        }
        private bool IsCostEnough(SkillNode node)
        {
            SkillInfo info = m_Owner.GetSkillStateInfo().GetSkillInfoById(node.SkillId);

            if (info == null)
            {
                return(false);
            }
            if (m_Owner.Energy >= info.ConfigData.CostEnergy &&
                m_Owner.Rage >= info.ConfigData.CostRage)
            {
                return(true);
            }
            return(false);
        }
        public override float GetSkillCD(SkillNode node)
        {
            if (node == null)
            {
                return(0);
            }
            SkillNode head = GetHead(node.Category);

            if (head == null)
            {
                return(0);
            }
            SkillInfo head_info = m_Owner.GetSkillStateInfo().GetSkillInfoById(head.SkillId);

            return(head_info.GetCD(TimeUtility.GetLocalMilliseconds() / 1000.0f));
        }
        public override bool IsSkillInCD(SkillNode node)
        {
            if (node == null)
            {
                return(false);
            }
            SkillNode head = GetHead(node.Category);

            if (node.SkillId != head.SkillId)
            {
                return(false);
            }
            SkillInfo head_info = m_Owner.GetSkillStateInfo().GetSkillInfoById(head.SkillId);

            return(head_info.IsInCd(TimeUtility.GetLocalMilliseconds() / 1000.0f));
        }
예제 #18
0
        public virtual List <SkillNode> QuerySkillQE(SkillCategory category, int times)
        {
            List <SkillNode> result = new List <SkillNode>();
            SkillNode        node   = QuerySkillNode(category, times);

            if (node != null)
            {
                if (node.SkillQ != null)
                {
                    result.Add(node.SkillQ);
                }
                if (node.SkillE != null)
                {
                    result.Add(node.SkillE);
                }
            }
            return(result);
        }
        public override float GetWaitInputTime(SkillNode node)
        {
            if (node == null)
            {
                return(0);
            }
            SkillInfo skill = m_Owner.GetSkillStateInfo().GetSkillInfoById(node.SkillId);

            if (skill == null)
            {
                return(0);
            }
            if (skill.IsInterrupted)
            {
                return(0);
            }
            return(skill.StartTime + skill.CastTime + skill.ConfigData.NextInputTime);
        }
        private void SimulateStartSkill(CharacterInfo owner, int skillid)
        {
            SkillNode node = GetSkillNodeById(skillid);

            if (node != null && node.Category == SkillCategory.kEx)
            {
                return;
            }
            List <NpcInfo> summons = owner.GetSkillStateInfo().GetSummonObject();

            foreach (NpcInfo npc in summons)
            {
                if (npc.IsSimulateMove)
                {
                    npc.SkillController.ForceStartSkill(skillid);
                }
            }
        }
예제 #21
0
        private void OnSkillStart(SkillNode node)
        {
            HideSkillTip(SkillCategory.kNone);
            m_LastSkillNode            = m_CurSkillNode;
            m_CurSkillNode             = node;
            m_CurSkillNode.StartTime   = TimeUtility.GetLocalMilliseconds() / 1000.0f;
            m_CurSkillNode.IsCDChecked = false;
            //m_CurSkillNode.IsAlreadyPressUp = false;

            m_WaiteSkillBuffer.RemoveAt(m_WaiteSkillBuffer.Count - 1);
            List <SkillNode> new_buffer_element = new List <SkillNode>();

            new_buffer_element.AddRange(m_WaiteSkillBuffer);
            m_WaiteSkillBuffer.Clear();

            if (m_CurSkillNode.NextSkillNode != null)
            {
                if (new_buffer_element.Count >= 1)
                {
                    SkillNode last = new_buffer_element[new_buffer_element.Count - 1];
                    if (m_CurSkillNode != null && last != null &&
                        last.Category == m_CurSkillNode.Category)
                    {
                        PushSkill(last.Category, Vector3.Zero);
                        new_buffer_element.Clear();
                    }
                }
            }

            if (m_LastSkillNode != null && m_LastSkillNode.Category != SkillCategory.kAttack &&
                m_LastSkillNode.Category != m_CurSkillNode.Category)
            {
                if (!m_LastSkillNode.IsCDChecked)
                {
                    BeginSkillCategoryCD(m_LastSkillNode.Category);
                    m_LastSkillNode.IsCDChecked = true;
                }
            }

            if (null != m_SkillStartHandler)
            {
                m_SkillStartHandler();
            }
        }
        public override void ForceInterruptCurSkill()
        {
            //LogSystem.Debug("----forceInterruptCurskill! " + m_Owner.GetId());
            CharacterView view = EntityManager.Instance.GetCharacterViewById(m_Owner.GetId());

            if (null != view)
            {
                m_Owner.GetMovementStateInfo().IsSkillMoving = false;
                view.ObjectInfo.IsSkillGfxMoveControl   = false;
                view.ObjectInfo.IsSkillGfxRotateControl = false;
                view.ObjectInfo.IsSkillGfxAnimation     = false;
                SkillInfo skill_info = m_Owner.GetSkillStateInfo().GetCurSkillInfo();
                if (skill_info != null)
                {
                    if (skill_info.IsSkillActivated)
                    {
                        if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene())
                        {
                            if (m_Owner.GetId() == WorldSystem.Instance.PlayerSelfId || m_Owner.OwnerId == WorldSystem.Instance.PlayerSelfId)
                            {
                                Network.NetworkSystem.Instance.SyncGfxMoveControlStop(m_Owner, skill_info.SkillId, true);
                                Network.NetworkSystem.Instance.SyncPlayerStopSkill(m_Owner, skill_info.SkillId);
                            }
                        }
                        skill_info.IsInterrupted = true;
                        if (m_WaiteSkillBuffer.Count > 0)
                        {
                            SkillNode last      = m_WaiteSkillBuffer[m_WaiteSkillBuffer.Count - 1];
                            SkillInfo last_info = m_Owner.GetSkillStateInfo().GetSkillInfoById(last.SkillId);
                            m_WaiteSkillBuffer.Clear();
                            if (last_info != null && last_info.ConfigData.CanStartWhenStiffness)
                            {
                                m_WaiteSkillBuffer.Add(last);
                            }
                        }
                    }
                    skill_info.IsSkillActivated = false;
                    LogSystem.Debug("skill force interrupted " + skill_info.SkillId);
                }
                GfxSystem.QueueGfxAction(m_GfxSkillSystem.StopSkill, view.Actor, true);
                SimulateStopSkill(m_Owner);
            }
        }
        private bool MakeSkillCost(SkillNode node)
        {
            SkillInfo info = m_Owner.GetSkillStateInfo().GetSkillInfoById(node.SkillId);

            if (info == null)
            {
                return(false);
            }
            if (m_Owner.Energy < info.ConfigData.CostEnergy)
            {
                return(false);
            }
            if (m_Owner.Rage < info.ConfigData.CostRage)
            {
                return(false);
            }
            m_Owner.SetEnergy(Operate_Type.OT_Relative, -info.ConfigData.CostEnergy);
            m_Owner.SetRage(Operate_Type.OT_Relative, -info.ConfigData.CostRage);
            return(true);
        }
        public override bool IsSkillCanStart(SkillNode node, out SkillCannotCastType reason)
        {
            SkillStateInfo state = m_Owner.GetSkillStateInfo();
            SkillInfo      info  = state.GetSkillInfoById(node.SkillId);

            reason = SkillCannotCastType.kUnknow;
            if (info == null)
            {
                reason = SkillCannotCastType.kNotFindSkill;
                return(false);
            }
            if (m_Owner.IsDead())
            {
                reason = SkillCannotCastType.kOwnerDead;
                return(false);
            }
            if (state != null && m_Owner.IsUnderControl() && !CanStartWhenImpactControl(info))
            {
                reason = SkillCannotCastType.kCannotCtrol;
                return(false);
            }
            if (IsSkillInCD(node))
            {
                reason = SkillCannotCastType.kInCD;
                return(false);
            }
            if (!IsCostEnough(node))
            {
                reason = SkillCannotCastType.kCostNotEnough;
                return(false);
            }
            SkillInfo skillinfo = m_Owner.GetSkillStateInfo().GetCurSkillInfo();

            if (skillinfo != null && skillinfo.IsForbidNextSkill &&
                skillinfo.ConfigData != null && skillinfo.ConfigData.NextSkillId == node.SkillId)
            {
                reason = SkillCannotCastType.kUnknow;
                return(false);
            }
            return(true);
        }
 internal void InitSkills(List <SkillInfo> skills)
 {
     m_SkillCategoryDict.Clear();
     foreach (SkillInfo ss in skills)
     {
         if (IsCategoryContain(ss.SkillId))
         {
             continue;
         }
         SkillNode first_node = InitCategorySkillNode(skills, ss);
         m_SkillCategoryDict[ss.Category] = first_node;
     }
     foreach (int id in m_UnlockedSkills)
     {
         SkillNode node = GetSkillNodeById(id);
         if (node != null)
         {
             node.IsLocked = false;
         }
     }
 }
        public override bool StartSkill(SkillNode node)
        {
            if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene())
            {
                if (m_Owner.GetId() == WorldSystem.Instance.PlayerSelfId || m_Owner.OwnerId == WorldSystem.Instance.PlayerSelfId)
                {
                    Network.NetworkSystem.Instance.SyncPlayerSkill(m_Owner, node.SkillId);
                }
            }
            else
            {
                if (!MakeSkillCost(node))
                {
                    return(false);
                }
            }
            m_Owner.ResetCross2StandRunTime();
            m_Owner.GetSkillStateInfo().SetCurSkillInfo(node.SkillId);
            SkillInfo cur_skill = m_Owner.GetSkillStateInfo().GetCurSkillInfo();

            if (null == cur_skill)
            {
                LogSystem.Error("----------SkillError: {0} set cur skill {1} failed! it's not exist", m_Owner.GetId(), node.SkillId);
                return(false);
            }
            cur_skill.IsSkillActivated = true;
            cur_skill.IsInterrupted    = false;
            cur_skill.StartTime        = TimeUtility.GetLocalMilliseconds() / 1000.0f;
            UpdateSkillCD(node);
            //LogSystem.Debug("---start skill at {0}--{1}", cur_skill.SkillId, cur_skill.StartTime);
            CharacterView view = EntityManager.Instance.GetCharacterViewById(m_Owner.GetId());

            if (view != null)
            {
                GfxSystem.QueueGfxAction(m_GfxSkillSystem.StartSkill, view.Actor, node.SkillId, m_Owner.GetMovementStateInfo().GetWantFaceDir());
            }
            SimulateStartSkill(m_Owner, node.SkillId);
            return(true);
        }
예제 #27
0
        private SkillNode AddQESkillNode(SkillCategory category)
        {
            float now = TimeUtility.GetLocalMilliseconds() / 1000.0f;

            if (m_CurSkillNode == null)
            {
                return(null);
            }
            SkillNode parent          = m_CurSkillNode;
            bool      isHaveWaiteNode = false;

            if (m_WaiteSkillBuffer.Count > 0)
            {
                parent          = m_WaiteSkillBuffer[m_WaiteSkillBuffer.Count - 1];
                isHaveWaiteNode = true;
            }
            if (parent == null)
            {
                return(null);
            }
            if (isHaveWaiteNode || now < GetWaitInputTime(m_CurSkillNode))
            {
                SkillNode target = null;
                if (category == SkillCategory.kSkillQ)
                {
                    target = parent.SkillQ;
                }
                if (category == SkillCategory.kSkillE)
                {
                    target = parent.SkillE;
                }
                if (target != null && !target.IsLocked)
                {
                    m_WaiteSkillBuffer.Add(target);
                    return(target);
                }
            }
            return(null);
        }
        public override void StartImpact(CharacterInfo obj, int impactId)
        {
            if (null == obj)
            {
                return;
            }
            ImpactInfo impactInfo = obj.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (impactInfo.ConfigData.ExtraParams.Count < 2)
            {
                return;
            }
            SkillCategory category     = (SkillCategory)(int.Parse(impactInfo.ConfigData.ExtraParams[0]));
            int           head_skillid = int.Parse(impactInfo.ConfigData.ExtraParams[1]);
            SkillInfo     head_skill   = obj.GetSkillStateInfo().GetSkillInfoById(head_skillid);

            if (head_skill == null)
            {
                return;
            }
            ChangeSkillCategory(obj, head_skill.SkillId, category);
            // change category head to new skill
            List <SkillInfo> player_skills = obj.GetSkillStateInfo().GetAllSkill();

            /*
             * foreach (SkillInfo info in player_skills) {
             * player_skill_config.Add(info.ConfigData);
             * }*/
            if (null != obj.SkillController)
            {
                SkillNode new_head = obj.SkillController.InitCategorySkillNode(player_skills, head_skill);
                if (new_head != null)
                {
                    SkillNode old_head = obj.SkillController.ChangeCategorySkill(category, new_head);
                    impactInfo.LogicDatas.AddData <SkillNode>(old_head);
                }
            }
        }
 public override bool BreakCurSkill(int breaktype, SkillCategory category)
 {
     if (category == m_CurSkillNode.Category)
     {
         bool result = StopSkill(m_CurSkillNode, breaktype);
         if (!result)
         {
             if (!m_CurSkillNode.IsAlreadyPressUp)
             {
                 m_CurSkillNode.IsAlreadyPressUp = true;
                 SkillNode head      = GetHead(m_CurSkillNode.Category);
                 SkillInfo skillInfo = m_Owner.GetSkillStateInfo().GetSkillInfoById(head.SkillId);
                 if (skillInfo != null)
                 {
                     skillInfo.CalcuteCastTime(TimeUtility.GetLocalMilliseconds() / 1000f, m_CurSkillNode.SkillId);
                 }
             }
             else
             {
                 SkillNode skillnode = m_WaiteSkillBuffer.Find(s => s.Category == category && s.IsAlreadyPressUp == false);
                 if (skillnode != null)
                 {
                     skillnode.IsAlreadyPressUp = true;
                 }
             }
         }
         return(result);
     }
     else
     {
         SkillNode skillnode = m_WaiteSkillBuffer.Find(s => s.Category == category && s.IsAlreadyPressUp == false);
         if (skillnode != null)
         {
             skillnode.IsAlreadyPressUp = true;
         }
     }
     return(false);
 }
        public override void StopImpact(CharacterInfo obj, int impactId)
        {
            ImpactInfo impactInfo = obj.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (impactInfo == null)
            {
                return;
            }
            if (impactInfo.ConfigData.ExtraParams.Count < 2)
            {
                return;
            }
            SkillCategory category     = (SkillCategory)(int.Parse(impactInfo.ConfigData.ExtraParams[0]));
            int           head_skillid = int.Parse(impactInfo.ConfigData.ExtraParams[1]);
            //change category skill back
            SkillNode old_head = impactInfo.LogicDatas.GetData <SkillNode>();

            if (old_head != null && null != obj.SkillController)
            {
                SkillNode head = obj.SkillController.ChangeCategorySkill(category, old_head);
                ChangeSkillCategory(obj, head_skillid, SkillCategory.kNone);
            }
            impactInfo.m_IsActivated = false;
        }