Beispiel #1
0
    public void Execute(GameCmd.stMultiAttackDownMagicUserCmd_S cmd)
    {
        EntityType type      = EntitySystem.EntityHelper.GetEntityEtype(cmd.byAttackerType);
        ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.dwAttackerID, type);

        if (skillPart == null)
        {
            Engine.Utility.Log.Error("获取type :{0} id:{1}技能部件失败!", type, cmd.dwAttackerID);
            return;
        }
        // 处理技能结果
        skillPart.OnDamage(cmd);
        //服务器发送打断
    }
Beispiel #2
0
 public void AddDamage(GameCmd.stMultiAttackDownMagicUserCmd_S cmd, long uid)
 {
     if (damageDic.ContainsKey(uid))
     {
         List <stMultiAttackDownMagicUserCmd_S> damageList = damageDic[uid];
         if (!damageList.Contains(cmd))
         {
             damageList.Add(cmd);
         }
     }
     else
     {
         List <stMultiAttackDownMagicUserCmd_S> damageList = new List <stMultiAttackDownMagicUserCmd_S>();
         damageList.Add(cmd);
         damageDic.Add(uid, damageList);
     }
 }
        void ShowDamage(GameCmd.stMultiAttackDownMagicUserCmd_S cmd)
        {
            Profiler.BeginSample("ShowDamage");
            uint skillID = cmd.wdSkillID;

            stShowDemage st = new stShowDemage();
            st.uid = Master.GetUID();
            st.skillid = skillID;
            st.defenerList = cmd.data;
            st.attackID = cmd.dwAttackerID;
            st.attacktype = (uint)cmd.byAttackerType;
            st.filterList = null;
            //Dictionary<uint, List<stMultiAttackDownMagicUserCmd_S.stDefender>> dic = new Dictionary<uint, List<stMultiAttackDownMagicUserCmd_S.stDefender>>();
            //dic.Add(skillID, cmd.data);
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSTEM_SHOWDAMAGE, (object)st);
          //  damagerManager.RemoveDamage(cmd, m_Master.GetUID());
            Profiler.EndSample();
        }
        //-------------------------------------------------------------------------------------------------------
        //// 伤害处理
        public void OnDamage(GameCmd.stMultiAttackDownMagicUserCmd_S cmd)
        {
         
            List<stMultiAttackDownMagicUserCmd_S.stDefender> targetList = cmd.data;
            if (targetList.Count > 0)
            {
                uint targetID = targetList[0].dwDefencerID;
                IEntity target = EntitySystem.EntityHelper.GetEntity(targetList[0].byDefencerType, targetID);
                if (target != null)
                {
                    if (SkillTarget == null)
                    {
                        SkillTarget = target;
                    }
                }
            }
            //tmpid 不做变化 
            //if (cmd.tmpid == 0)
            //{
            //    cmd.tmpid = m_uDamageID;
            //}
            //else
            //{//此处为自己受伤赋值给skillid 修改看不到自己掉血
            //    m_uDamageID = cmd.tmpid;
            //}
            if (CurSkillID == 0)
            {
                //如果直接赋值会影响连击的判断
                CurSkillID = cmd.wdSkillID;
            }

            //引导类型的直接飘伤害
            SkillDatabase db = GetCurSkillDataBase();
            if (db == null)
            {
                db = GetSkillDataBase(cmd.wdSkillID);
            }
            if (db == null)
            {
                Log.Error("技能数据获取失败 id{0}:", cmd.wdSkillID);
                return;
            }
            //if (db.dwUseMethod == (int)UseMethod.ContinueLock)
            //{
            //    // 链式攻击特效
            //    string strEffectID = db.beLinkAttactEffect;
            //    string[] strids = strEffectID.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
            //    uint[] ids = new uint[strids.Length];
            //    for (int i = 0; i < strids.Length; ++i)
            //    {
            //        ids[i] = uint.Parse(strids[i]);
            //    }
            //    uint effectID = ids[UnityEngine.Random.Range(0, ids.Length)];
            //    EffectViewFactory.Instance().CreateEffect(SkillTarget.GetUID(), effectID);
            //    PlayDefenerAni(cmd);
            //}
            //if (db.useSkillType == (int)(UseSkillType.GuideSlider) || db.useSkillType == (int)UseSkillType.GuideNoSlider)
            //{
            //    ShowDamage(cmd);
            //    PlayDefenerAni(cmd);
            //    return;
            //}
   
            ShowDamage(cmd);
            PlayDefenerAni(cmd);
            return;
            //if(Master.GetEntityType() == EntityType.EntityType_NPC)
            //{
            //    ShowDamage(cmd);
            //    PlayDefenerAni(cmd);
            //    return;
            //}
            //else
            //{
            //    // 处理伤害
            //    if (hitDic.ContainsKey(cmd.tmpid))
            //    {
            //        //飘字 已经过了伤害时间帧的技能 不加入伤害列表直接飘字
            //        ShowDamage(cmd);
            //        hitDic.Remove(cmd.tmpid);
            //    }
            //    else
            //    {
            //        damagerManager.AddDamage(cmd, m_Master.GetUID());
            //    }
            //}

        }
        /// <summary>
        /// 播放防御者受击动作
        /// </summary>
        /// <param name="cmd"></param>
        private bool PlayDefenerAni(GameCmd.stMultiAttackDownMagicUserCmd_S cmd)
        {
            if (cmd == null)
            {
                return(false);
            }
            SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>(cmd.wdSkillID, 1);

            if (db != null)
            {
                for (int i = 0; i < db.beAttactEffect.Count; i++)
                {
                    var           effectid = db.beAttactEffect[i];
                    FxResDataBase edb      = GameTableManager.Instance.GetTableItem <FxResDataBase>(effectid);
                    if (edb != null)
                    {
                        if (cmd != null)
                        {
                            for (int j = 0; j < cmd.data.Count; j++)
                            {
                                var    item    = cmd.data[j];
                                string aniName = edb.targetAniName;

                                IEntity defender = EntityHelper.GetEntity(item.byDefencerType, item.dwDefencerID);
                                if (defender == null)
                                {
                                    //Log.Error( "死亡状态不能播放受击动作" );
                                    return(false);
                                }
                                if (defender is INPC)
                                {
                                    INPC npc = defender as INPC;
                                    if (npc != null)
                                    {
                                        if (npc.IsTrap())
                                        {
                                            return(false);
                                        }
                                    }
                                }
                                if (edb.playAudio != 0)
                                {
                                    ResourceDataBase rdb = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.playAudio);
                                    if (rdb != null)
                                    {
                                        Transform trans = defender.GetTransForm();
                                        if (trans == null)
                                        {
                                            return(false);
                                        }
                                        PlayAudio(trans.gameObject, rdb.strPath);
                                    }
                                }



                                EffectViewFactory.Instance().CreateEffect(defender.GetUID(), effectid);
                                if (item.byDamType != (uint)GameCmd.AttackType.ATTACK_TYPE_HD)
                                {
                                    SendPlayDefenerAniMessage(defender, aniName);
                                }
                            }
                        }
                    }
                }
            }

            return(true);
        }