Esempio n. 1
0
        public void InitFollowFx()
        {
            if (m_attacker == null)
            {
                DestroyFx();
                return;
            }
            bStart      = true;
            bDestory    = false;
            m_targetObj = m_attacker.GetTargetGameObject();
            ISkillPart skillPart = m_attacker.GetSkillPart();

            if (skillPart != null)
            {
                m_SkillTarget = skillPart.GetSkillTarget();

                table.SkillDatabase db = GameTableManager.Instance.GetTableItem <table.SkillDatabase>((uint)m_skillId, 1);
                if (db != null)
                {
                    if (db.flyspeed != 0)
                    {
                        m_speed = db.flyspeed * 1.0f / 100;
                    }
                }
            }

            // m_targetNode = m_attacker.GetTargetHitNode();
            m_startTime = Time.time;
            castPos     = m_attacker.GetTargetHitNodePos(m_SkillTarget, targetHitNode);
            float dis = GetVectorDistance(transform.position, castPos);

            totalTime = dis / m_speed;
        }
Esempio n. 2
0
        // 进入状态
        public override void Enter(object param)
        {
            IEntity target = skillPart.GetSkillTarget();

            // 只有主角会进入战斗状态
            if (skillPart.GetSkillPartType() == SkillPartType.SKILL_PLAYERPART && EntitySystem.EntityHelper.IsMainPlayer(skillPart.GetMaster()))
            {
                PlayerSkillPart playerSkill = skillPart as PlayerSkillPart;
                if (playerSkill != null)
                {
                    playerSkill.SkillStartPlayTime = Time.realtimeSinceStartup;
                    playerSkill.SetFighting(true);
                }
            }
            SkillDatabase skilltable = skillPart.GetCurSkillDataBase();

            if (skilltable == null)
            {
                return;
            }
            // 朝向目标
            if (target != null)
            {
                if (skilltable.targetType != (int)SkillTargetType.TargetForwardPoint)
                {
                    skillPart.GetMaster().SendMessage(EntityMessage.EntityCommand_LookTarget, target.GetPos());
                }
            }

            database = skilltable;
            //准备时间结束 发送结束消息
            if (SkillSystem.GetClientGlobal().IsMainPlayer(skillPart.GetMaster()) && skilltable.dwReadTime > 0) // 非瞬发技能
            {                                                                                                   //读条技能
                Client.stUninterruptMagic evenparam = new Client.stUninterruptMagic();
                evenparam.time = database.dwReadTime;
                evenparam.type = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ;
                evenparam.uid  = skillPart.GetMaster().GetUID();
                EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, evenparam);
            }

            preparetime = 0;
        }
Esempio n. 3
0
    public void ExecuteSkillFailed(GameCmd.stMultiAttackReturnMagicUserCmd_S cmd)
    {
        ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.dwUserID, EntityType.EntityType_Player);

        if (skillPart == null)
        {
            Engine.Utility.Log.Error("获取主角技能部件失败!");
            return;
        }
        else
        {
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSBREAK,
                                                                new stGuildBreak()
            {
                action = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ, uid = cmd.dwUserID, skillid = cmd.wdSkillID
            });
            TimerAxis.Instance().KillTimer(m_uReadSliderTimerID, this);
            string str = "";// "skill error code = " + cmd.fail_code + " ";
            if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_success)
            {
                //使用成功
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_break)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengbeidaduan);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_use)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengzhengzaishiyong);
                Log.Error("使用过程 error code {0}", cmd.fail_code);
            }

            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_outRange)
            {
                Client.IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();
                if (cs != null)
                {
                    Client.ICombatRobot robot = cs.GetCombatRobot();
                    if (robot != null && robot.Status == CombatRobotStatus.RUNNING)
                    {
                        if (MainPlayerHelper.GetMainPlayer() == null)
                        {
                            return;
                        }
                        ISkillPart sp = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as ISkillPart;
                        if (sp == null)
                        {
                            return;
                        }

                        if (sp.GetSkillTarget() != null)
                        {
                            Move    move     = new Move();
                            Vector3 targePos = sp.GetSkillTarget().GetPos();
                            Vector3 dir      = targePos - MainPlayerHelper.GetMainPlayer().GetPos();
                            targePos           = targePos - dir.normalized * 1f;
                            move.m_target      = targePos;
                            move.m_ignoreStand = true;
                            Log.Error("自动挂机,打不到,朝向目标移动");

                            IController ctr = cs.GetActiveCtrl();
                            if (ctr != null)
                            {
                                ctr.MoveToTarget(targePos);
                            }
                            //MainPlayerHelper.GetMainPlayer().SendMessage(EntityMessage.EntityCommand_MoveTo, (object)move);
                            // Vector3 lookat = playerSkill.GetSkillTarget().GetNode().GetTransForm().forward;
                            return;
                        }
                    }
                }

                str = GetLocalText(LocalTextType.Skill_Commond_mubiaochaochugongjijuli);
                Log.Error("技能使用超超出范围 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_shapeErr)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_bianshenzhuangtaixiabunengshiyongjineng);
                Log.Error("变身不能使用技能 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_petFight)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_chongwuweichuzhanbunengshiyongjineng);
                Log.Error("宠物未出战不能使用技能 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_notExist)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengbucunzai);
                Log.Error("技能不存在 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_none)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengweizhicuowu);
                Log.Error("技能未知 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_needAim)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_shifanggaijinengxuyaoxuanzemubiao);
                Log.Error("技能需要目标error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_aimErr)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_mubiaoxuanzecuowu);
                Log.Error("技能目标错误 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_cantAtt)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_dangqianmubiaowufagongji);
                Log.Error("目标无法攻击 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_inCD)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinenglengquezhong);
                Log.Error("技能冷却中 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_lackSP)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_fashuzhibuzu);
                Log.Error("缺蓝 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_flagsErr)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_dangqianjinengzhuangtaicuowu);
                Log.Error("flags error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_NeedItemNumNotEnough)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_shiyongchongwujinnegsuoxudaojubuzu);
                Log.Error("使用宠物技能所需道具不足{0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_rideCantUse)
            {
                NetService.Instance.Send(new GameCmd.stDownRideUserCmd_C()
                {
                });
                return;
                //str = GetLocalText(LocalTextType.Skill_Commond_qichengzhuangtaiwufashiyongzhujuejineng);
                //Log.Error("骑乘无法使用技能{0}", cmd.fail_code);
            }
            else if (cmd.fail_code == 16)
            {                        //协议未更新 先写数字防止后期忘了
                str = "眩晕状态,技能不能使用"; // GetLocalText(LocalTextType.Skill_Commond_qichengzhuangtaiwufashiyongzhujuejineng);
                Log.Error("瞬移技能不能使用{0}", cmd.fail_code);
            }
            else
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengweizhicuowu);
                Log.Error("技能未知错误 ");
            }
            if (cmd.dwUserID == MainPlayerHelper.GetPlayerID())
            {
                TipsManager.Instance.ShowTips(str);
            }
        }

        skillPart.OnUseSkillFailed(cmd.dwUserID, cmd.wdSkillID);
    }
Esempio n. 4
0
    public void Execuete(GameCmd.stReturnObjectPosMagicUserCmd_S cmd)
    {
        //冲锋应该是goto  瞬移应该是enumMoveType_Immediate  此处待后台修改 前台先山寨一下
        if (cmd.byMoveType == stReturnObjectPosMagicUserCmd_S.enumMoveType.enumMoveType_GoTo || cmd.byMoveType == stReturnObjectPosMagicUserCmd_S.enumMoveType.enumMoveType_Immediate)
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("GetEntitySystem failed!");
                return;
            }

            stEntryPosition userPos = cmd.userpos;
            if (userPos != null)
            {
                IEntity player = es.FindEntity <IPlayer>(userPos.dwTempID);
                if (player != null)
                {
                    //MapVector2 mapPos = MapVector2.FromCoordinate(userPos.x, userPos.y);
                    Vector3    pos       = new Vector3(userPos.cur_pos.x * 0.01f, 0, -userPos.cur_pos.y * 0.01f); // 服务器到客户端坐标转换
                    ISkillPart skillPart = SkillHelper.GetSkillPart(userPos.dwTempID, EntityType.EntityType_Player);

                    if (skillPart != null)
                    {
                        if (skillPart.IsFastMove())
                        {
                            Move move = new Move();
                            move.m_target      = pos;
                            move.m_ignoreStand = true;
                            player.SendMessage(EntityMessage.EntityCommand_MoveTo, (object)move);
                        }
                        else
                        {
                            //不是在释放快速移动技能 立刻设置位置 否则延迟设置

                            player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
                            //Vector3 rot = GameUtil.S2CDirection(userPos.byDir);
                            //player.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot);
                        }
                        IEntity skillTarget = skillPart.GetSkillTarget();
                        if (skillTarget != null && skillTarget.GetUID() != player.GetUID())
                        {
                            SkillDatabase db = skillPart.GetCurSkillDataBase();
                            if (db != null)
                            {
                                if (db.targetType == (int)SkillTargetType.TargetForwardPoint)
                                {
                                    return;
                                }
                            }
                            player.SendMessage(EntityMessage.EntityCommand_LookTarget, skillTarget.GetPos());
                        }
                    }
                }
            }

            if (cmd.npcpos != null)
            {
                INPC npc = es.FindEntity <INPC>(cmd.npcpos.dwTempID);
                if (npc != null)
                {
                    //MapVector2 mapPos = MapVector2.FromCoordinate(cmd.npcpos.x, cmd.npcpos.y);
                    Vector3    pos       = new Vector3(cmd.npcpos.cur_pos.x * 0.01f, 0, -cmd.npcpos.cur_pos.y * 0.01f); // 服务器到客户端坐标转换
                    ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.npcpos.dwTempID, EntityType.EntityType_NPC);

                    if (skillPart != null)
                    {  //不是在释放快速移动技能 立刻设置位置 否则延迟设置
                        npc.SendMessage(EntityMessage.EntityCommand_StopMove, (object)pos);
                    }
                }
            }

            EventEngine.Instance().DispatchEvent((int)GameEventID.CAMERA_MOVE_END);
        }
    }
Esempio n. 5
0
        public override void Update(float dt)
        {
            IEntity casetr = skillPart.GetMaster();

            if (m_caster == null)
            {
                m_Statemachine.ChangeState((int)SkillState.Over, null);
                return;
            }

            m_caster.Update(dt);
            m_fTotalTime += dt;
            if (skillPart.GetSkillPartType() == SkillPartType.SKILL_PLAYERPART)
            {
                PlayerSkillPart playerSkill = skillPart as PlayerSkillPart;
                //  if (m_caster.IsCasting == false)
                {
                    if (m_skillDatabase.useSkillType == (int)UseSkillType.GuideSlider || m_skillDatabase.useSkillType == (int)UseSkillType.GuideNoSlider)
                    {
                        if (m_skillDatabase.dwGuideTime > 0)
                        {
                            if (m_fTotalTime * 1000 > m_skillDatabase.dwGuideTime)
                            {
                                //接收招动作
                                m_Statemachine.ChangeState((int)SkillState.Over, playerSkill);
                            }
                            return;
                        }
                        else
                        {
                            Log.LogGroup("ZDY", "引导类型技能 {0} 的引导时间为0", m_skillDatabase.wdID);
                        }
                    }
                    float tmeptime      = Time.realtimeSinceStartup;
                    float delta         = tmeptime - playerSkill.SkillStartPlayTime;
                    uint  skillPlaytime = (uint)(delta * 1000);

                    uint    skillRunJiangzhiTime = (uint)(playerSkill.SkillStiffTime * 1000);
                    IEntity target = skillPart.GetSkillTarget();
                    if (target == null)
                    {
                        if (skillRunJiangzhiTime > m_uDbJiangzhiTime) // 播放时间大于僵直时间
                        {
                            m_Statemachine.ChangeState((int)SkillState.Over, playerSkill);
                        }

                        return;
                    }
                    if (target.GetCurState() == CreatureState.Dead)
                    {
                        Log.LogGroup("ZDY", "target dead 去除连击时无法切换状态的bug ");
                        m_Statemachine.ChangeState((int)SkillState.Over, null);
                        return;
                    }
                    playerSkill.OnDoLongPressNextSkillID();
                    if ((playerSkill.NextSkillID != 0))
                    {
                        //CurSkillID

                        //   m_skillDoubleDb = GameTableManager.Instance.GetTableItem<SkillDoubleHitDataBase>(playerSkill.CurSkillID);
                        SkillDoubleHitDataBase db = m_skillDoubleDb;
                        if (db != null)
                        {
                            //    if (playerSkill.NextSkillID == 101)
                            //    {
                            //        Log.Error("连击 nextskillid " + playerSkill.NextSkillID.ToString() + " skillPlay time is " + skillPlaytime +
                            //"  db.beginChangeTime " + db.beginChangeTime + " db.doublehitend " + db.doublehitend);
                            //    }

                            if (skillPlaytime >= db.beginChangeTime && skillPlaytime <= db.doublehitend)
                            {
                                //大于僵直时间 并且小于连击生效时间可以变招
                                SkillEffect skillEffect = m_caster.EffectNode;
                                if (skillEffect != null)
                                {
                                    //  skillEffect.Stop();
                                }
                                //    Log.LogGroup("ZDY", "连击 nextskillid " + playerSkill.NextSkillID.ToString());
                                playerSkill.SkillStiffTime = 0;
                                //如果已经触发连击,接着播放连击技能
                                DoCastSkill((uint)playerSkill.NextSkillID);
                                playerSkill.SkillStartPlayTime = Time.realtimeSinceStartup;
                                playerSkill.SyncSkill((uint)playerSkill.CurSkillID, target, Vector3.zero);
                                SkillDatabase curDataBase = m_skillDatabase;// GameTableManager.Instance.GetTableItem<SkillDatabase>(playerSkill.CurSkillID, 1);
                                if (curDataBase != null)
                                {
                                    m_uDbJiangzhiTime = curDataBase.wdStiffTime;
                                }
                                else
                                {
                                    if (Engine.Utility.Log.MaxLogLevel >= Engine.Utility.LogLevel.LogLevel_Group)
                                    {
                                        Log.LogGroup("ZDY", "curdatabase is null skill id is " + playerSkill.CurSkillID);
                                    }
                                }
                                //普攻没有cd 不需要派发
                                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSTEM_USESKILL, playerSkill.CurSkillID);
                            }
                            else
                            {
                                if (skillPlaytime > db.doublehitend) // 播放时间大于连击生效时间
                                {
                                    if (Engine.Utility.Log.MaxLogLevel >= Engine.Utility.LogLevel.LogLevel_Group)
                                    {
                                        Log.LogGroup("ZDY", "播放时间大于连击生效时间 切换到over skillPlaytime is " + skillPlaytime + " 连击生效时间 " + db.doublehitend);
                                    }
                                    //接收招动作
                                    m_Statemachine.ChangeState((int)SkillState.Over, playerSkill);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (skillRunJiangzhiTime > m_uDbJiangzhiTime) // 大于僵直时间
                        {
                            if (Engine.Utility.Log.MaxLogLevel >= Engine.Utility.LogLevel.LogLevel_Group)
                            {
                                Log.LogGroup("ZDY", "达到僵直时间切换到over runjiangzhitime is " + skillRunJiangzhiTime);
                            }
                            //接收招动作
                            m_Statemachine.ChangeState((int)SkillState.Over, playerSkill);
                        }
                        else
                        {//连击不要在这里触发
                         //   m_skillDoubleDb = GameTableManager.Instance.GetTableItem<SkillDoubleHitDataBase>(playerSkill.CurSkillID);

                            /* if (m_skillDoubleDb != null && IsMainPlayer())
                             * {
                             *   IControllerSystem cs = playerSkill.GetCtrollerSys();
                             *   if (cs == null)
                             *   {
                             *       Log.Error("ExecuteCmd: ControllerSystem is null");
                             *       return;
                             *   }
                             *
                             *   if (cs.GetCombatRobot().Status != CombatRobotStatus.STOP)
                             *   {
                             *       //   Log.LogGroup("ZDY", "======================= skillPlaytime is " + skillPlaytime + " start " + m_skillDoubleDb.doublehitBegin + " end " + m_skillDoubleDb.doublehitend);
                             *       if (skillPlaytime >= m_skillDoubleDb.doublehitBegin && skillPlaytime <= m_skillDoubleDb.doublehitend && m_bSendDoubleHitCmd == false)
                             *       {
                             *           m_bSendDoubleHitCmd = true;
                             *           Engine.Utility.Log.LogGroup("ZCX", "连击{0} next ", playerSkill.CurSkillID, playerSkill.NextSkillID);
                             *           SkillDoubleHitDataBase skilldoubleDb = m_skillDoubleDb;// GameTableManager.Instance.GetTableItem<SkillDoubleHitDataBase>(playerSkill.CurSkillID);
                             *
                             *           if (skilldoubleDb != null)
                             *           {
                             *               stSkillDoubleHit skillDhHit = new stSkillDoubleHit();
                             *               skillDhHit.doubleHitEnd = skilldoubleDb.beginskillid == skilldoubleDb.nextskillid;
                             *               skillDhHit.skillID = skilldoubleDb.nextskillid;
                             *               Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ROBOTCOMBAT_NEXTCMD, skillDhHit);
                             *           }
                             *       }
                             *   }
                             *
                             * }*/
                        }
                    }
                }
                //else
                //{

                //}
            }
        }