Inheritance: MonsterObject
Exemple #1
0
        public void MagicAttack(NetMsg.MsgAttackInfo info)
        {
            if (!play.GetMagicSystem().isMagic(info.usType)) return;
            //检测施法速度
            ushort magiclv = play.GetMagicSystem().GetMagicLevel(info.usType);
            if (!play.GetMagicSystem().CheckMagicAttackSpeed((ushort)info.usType, (byte)magiclv))
            {
                return;
            }
            //--------------------------------------------------------------------------
             //暗黑龙骑--焰魂枪·裂地三段斩
            if (info.usType == GameStruct.MagicTypeInfo.YANHUNQIANG_LIEDI)
            {
                uint nMagicId = info.usType + mnYanHunQiangIndex;
                //没有下一段技能
                if (!play.GetMagicSystem().isMagic(nMagicId))
                {
                    mnYanHunQiangIndex = 0;
                    nMagicId = info.usType;
                }
                info.usType = nMagicId;
                mnYanHunQiangIndex++;
                if (mnYanHunQiangIndex >= 3) mnYanHunQiangIndex = 0;
            }
            //--------------------------------------------------------------------------
            //暗黑龙骑- 焰魂枪·流焰 四段斩
            if (info.usType == GameStruct.MagicTypeInfo.YANHUNQIANG_LIUYAN)
            {
                uint nMagicId = info.usType + mnYanHunQiangExIndex;
                //没有下一段技能
                if (!play.GetMagicSystem().isMagic(nMagicId))
                {
                    mnYanHunQiangExIndex = 0;
                    nMagicId = info.usType;
                }
                info.usType = nMagicId;
                mnYanHunQiangExIndex++;
                if (mnYanHunQiangExIndex >= 4) mnYanHunQiangExIndex = 0;
            }
            //------------------------------------------------------------------------
            GameStruct.MagicTypeInfo typeinfo = ConfigManager.Instance().GetMagicTypeInfo(info.usType);
            if (typeinfo == null) return;
            uint injured = 0;
            BaseObject targetobj = null;

            //xp技能校验-
            if (typeinfo.use_xp > 0 && play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_XPFULL_ATTACK) == null) return;
            //加经验
            if (typeinfo.need_exp > 0 && play.GetBaseAttr().level >= typeinfo.need_level)
            {
                play.GetMagicSystem().AddMagicExp(info.usType, 1);
            }
            if (typeinfo.use_ep > 0 && play.GetBaseAttr().sp < typeinfo.use_ep)
            {
                return;
            }
            if (typeinfo.use_mp > 0 && play.GetBaseAttr().mana < typeinfo.use_mp) return;
            //消耗体力
            if (typeinfo.use_ep > 0 && play.GetBaseAttr().sp > typeinfo.use_ep)
            {
                play.ChangeAttribute(UserAttribute.SP, (int)-typeinfo.use_ep);
            }
            //消耗魔法
            if (typeinfo.use_mp > 0 && play.GetBaseAttr().mana > typeinfo.use_mp)
            {
                play.ChangeAttribute(UserAttribute.MANA, (int)-typeinfo.use_mp);
            }
            switch (typeinfo.sort)
            {
                case GameStruct.MagicTypeInfo.MAGICSORT_ATTACK:
                case GameStruct.MagicTypeInfo.MAGICSORT_JUMP_ATTACK: //跳斩单体攻击
                    {
                        targetobj = play.GetGameMap().FindObjectForID(info.idTarget);
                        if (targetobj == null)
                        {
                            return;
                        }
                        if (targetobj.IsDie()) return;
                        if (targetobj.IsLock()) return; //被锁定了
                        byte bdir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), targetobj.GetCurrentX(), targetobj.GetCurrentY());
                        play.SetDir(bdir);
                        //距离判断,防止非法封包
                        if (Math.Abs(play.GetCurrentX() - targetobj.GetCurrentY()) > typeinfo.distance &&
                            Math.Abs(play.GetCurrentY() - targetobj.GetCurrentY()) > typeinfo.distance)
                        { return; }
                        //连击技能
                        if (!play.CanPK(targetobj)) return;
                        if (IsComboMagic(typeinfo.typeid))
                        {
                            this.ComboMagic(info, targetobj);
                            //血袭- 增加buff与状态
                            if (info.usType == GameStruct.MagicTypeInfo.XUEXI)
                            {
                                play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_XUEXI, Define.XUEXI_TIME);
                            }
                            return;
                        }
                        //单体魔法攻击
                        injured = BattleSystem.AdjustDamage(play, targetobj, true);
                        //怪物承受XP技能加倍伤害
                        if (targetobj.type == OBJECTTYPE.MONSTER &&
                            typeinfo.use_xp > 0)
                        {
                            injured = injured * Define.XP_MULTIPLE;
                        }
                        NetMsg.MsgMonsterMagicInjuredInfo magicattack = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicattack.time = System.Environment.TickCount;
                        magicattack.roleid = play.GetTypeId();
                        magicattack.role_x = play.GetCurrentX();
                        magicattack.role_y = play.GetCurrentY();

                        magicattack.monsterid = targetobj.GetTypeId();
                        magicattack.tag = 21;
                        magicattack.magicid = (ushort)info.usType;
                        magicattack.magiclv = magiclv;
                        play.BroadcastBuffer(magicattack.GetBuffer(), true);

                        NetMsg.MsgGroupMagicAttackInfo magicattackex = new NetMsg.MsgGroupMagicAttackInfo();
                        //有轨迹的魔法--
                        magicattackex.SetSigleAttack(targetobj.GetTypeId());
                        magicattackex.nID = play.GetTypeId();
                        //magicattackex.nX = (short)info.usPosX;
                        //magicattackex.nY = (short)info.usPosY;

                        magicattackex.nMagicID = (ushort)info.usType;
                        magicattackex.nMagicLv = magiclv;
                        magicattackex.bDir = play.GetDir();
                        magicattackex.AddObject(targetobj.GetTypeId(),(int) injured);
                        play.BroadcastBuffer(magicattackex.GetBuffer(),true);

                        targetobj.Injured(play, injured, info);
                        ////跳斩单体攻击
                        //位置还没计算好..2015.10.27 暂时搁置
                        //位置已解决- 2015.11.1
                        if (typeinfo.sort == GameStruct.MagicTypeInfo.MAGICSORT_JUMP_ATTACK)
                        {
                            int nNewX = targetobj.GetCurrentX() - (DIR._DELTA_X[bdir] + DIR._DELTA_X[bdir]);
                            int nNewY = targetobj.GetCurrentY() - (DIR._DELTA_Y[bdir] + DIR._DELTA_Y[bdir]);
                            play.SetPoint((short)nNewX,(short) nNewY);
                        }
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_BOMB: //范围攻击
                case GameStruct.MagicTypeInfo.MAGICSORT_JUMPBOMB: //跳斩范围攻击
                case GameStruct.MagicTypeInfo.MAGICSORT_POINTBOMB: //指定鼠标位置攻击
                    {
                         byte bdir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(bdir);
                        //亡灵巫师巫怒噬魂
                        if (typeinfo.typeid == GameStruct.MagicTypeInfo.WUNUSHIHUN)
                        {
                            if (targetobj == null)
                            {
                                return;
                            }
                            int nNewX = targetobj.GetCurrentX() - (DIR._DELTA_X[bdir] + DIR._DELTA_X[bdir]);
                            int nNewY = targetobj.GetCurrentY() - (DIR._DELTA_Y[bdir] + DIR._DELTA_Y[bdir]);
                            play.SetPoint((short)nNewX, (short)nNewY);
                            targetobj = play.GetGameMap().FindObjectForID(info.idTarget);

                        }

                        if (typeinfo.sort == GameStruct.MagicTypeInfo.MAGICSORT_JUMPBOMB)   //跳斩
                        {
                            if (Math.Abs(play.GetCurrentX() - info.usPosX) > typeinfo.distance &&
                               Math.Abs(play.GetCurrentY() - info.usPosY) > typeinfo.distance)
                            { return; }
                            play.SetPoint((short)info.usPosX, (short)info.usPosY); //跳斩嘛。先跳过去
                        }

                        NetMsg.MsgGroupMagicAttackInfo magicattackex = new NetMsg.MsgGroupMagicAttackInfo();
                        magicattackex.nID = play.GetTypeId();
                        magicattackex.nX = play.GetCurrentX();
                        magicattackex.nY = play.GetCurrentY();
                        if (typeinfo.sort == GameStruct.MagicTypeInfo.MAGICSORT_POINTBOMB)
                        {

                            magicattackex.nX = (short)info.usPosX;
                            magicattackex.nY = (short)info.usPosY;
                        }
                        magicattackex.nMagicID = (ushort)info.usType;
                        magicattackex.nMagicLv = magiclv;
                        magicattackex.bDir = play.GetDir();

                        //被攻击的对象
                        List<BaseObject> list = this.RefreshMagicVisibleObject(typeinfo.typeid,info);
                        if (list != null)
                        {
                            for (int i = 0; i < list.Count; i++)
                            {

                                injured = BattleSystem.AdjustDamage(play, list[i], true);
                                //怪物承受XP技能加倍伤害
                                if (list[i].type == OBJECTTYPE.MONSTER &&
                                    typeinfo.use_xp > 0)
                                {
                                    injured = injured * Define.XP_MULTIPLE;
                                }
                                list[i].Injured(play, injured, info);
                                magicattackex.AddObject(list[i].GetTypeId(), (int)injured);
                            }
                        }

                        byte[] msg = magicattackex.GetBuffer();

                        play.BroadcastBuffer(msg, true);
                        //血族 血雨旋涡
                        if (typeinfo.typeid == GameStruct.MagicTypeInfo.XUEYUXUANWO)
                        {
                            int nAddX = 0;
                            int nAddY = 0;
                                switch(bdir)
                                {
                                    case DIR.LEFT_DOWN:
                                    case DIR.RIGHT_UP:
                                        {
                                            nAddX = 10;
                                            nAddY = 15;
                                            break;
                                        }
                                    case DIR.LEFT:
                                    case DIR.UP:
                                    case DIR.RIGHT:
                                    case DIR.DOWN:
                                        {
                                            nAddY = 10;
                                            nAddX = 10;
                                            break;
                                        }
                                    case DIR.LEFT_UP:
                                    case DIR.RIGHT_DOWN:
                                        {
                                            nAddX = 15; nAddY = 10;
                                            break;
                                        }
                                }
                            int nNewX = play.GetCurrentX() + (DIR._DELTA_X[bdir] * nAddX);
                            int nNewY = play.GetCurrentY() + (DIR._DELTA_Y[bdir] * nAddY);
                            play.SetPoint((short)nNewX, (short)nNewY);
                        }

                        break;
                    }

                case GameStruct.MagicTypeInfo.MAGICSORT_FAN: //扇形攻击
                    {

                        byte bdir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(bdir);
                        NetMsg.MsgGroupMagicAttackInfo magicattackex = new NetMsg.MsgGroupMagicAttackInfo();
                        magicattackex.nID = play.GetTypeId();
                        magicattackex.nX = play.GetCurrentX();
                        magicattackex.nY = play.GetCurrentY();
                        magicattackex.nMagicID = (ushort)info.usType;
                        magicattackex.nMagicLv = magiclv;
                        magicattackex.bDir = bdir;
                        //被攻击的对象
                        List<BaseObject> list = this.RefreshMagicVisibleObject(typeinfo.typeid, info);
                        if (list != null)
                        {
                            for (int i = 0; i < list.Count; i++)
                            {
                                injured = BattleSystem.AdjustDamage(play, list[i], true);
                                //怪物承受XP技能加倍伤害
                                if (list[i].type == OBJECTTYPE.MONSTER &&
                                    typeinfo.use_xp > 0)
                                {
                                    injured = injured * Define.XP_MULTIPLE;
                                }
                                list[i].Injured(play, injured, info);
                                magicattackex.AddObject(list[i].GetTypeId(), (int)injured);
                            }
                        }

                        byte[] msg = magicattackex.GetBuffer();
                        play.BroadcastBuffer(msg, true);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_LINE: //直线型攻击
                    {

                        byte bByte = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(bByte);

                        NetMsg.MsgMonsterMagicInjuredInfo magicattack = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicattack.roleid = play.GetTypeId();
                        magicattack.role_x = play.GetCurrentX();
                        magicattack.role_y = play.GetCurrentY();
                        magicattack.tag = 21;
                        magicattack.magicid = (ushort)info.usType;
                        magicattack.magiclv = magiclv;
                        play.BroadcastBuffer(magicattack.GetBuffer(), true);

                        NetMsg.MsgGroupMagicAttackInfo magicattackex = new NetMsg.MsgGroupMagicAttackInfo();
                        magicattackex.nID = play.GetTypeId();
                        magicattackex.nX = (short)info.usPosX;
                        magicattackex.nY = (short)info.usPosY;
                        magicattackex.nMagicID = (ushort)info.usType;
                        magicattackex.nMagicLv = magiclv;
                        magicattackex.bDir = play.GetDir();
                        List<BaseObject> list = this.RefreshMagicVisibleObject(typeinfo.typeid, info);
                        if (list != null)
                        {
                            for (int i = 0; i < list.Count; i++)
                            {
                                injured = BattleSystem.AdjustDamage(play, list[i], true);
                                //怪物承受XP技能加倍伤害
                                if (list[i].type == OBJECTTYPE.MONSTER &&
                                    typeinfo.use_xp > 0)
                                {
                                    injured = injured * Define.XP_MULTIPLE;
                                }
                                list[i].Injured(play, injured, info);
                                magicattackex.AddObject(list[i].GetTypeId(), (int)injured);
                            }
                        }
                        play.BroadcastBuffer(magicattackex.GetBuffer(), true);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_ATTACHSTATUS: //引诱
                    {
                        foreach (RefreshObject refobj in play.GetVisibleList().Values)
                        {
                            BaseObject obj = refobj.obj;
                            if (obj.type == OBJECTTYPE.MONSTER)
                            {
                                if ((obj as MonsterObject).GetAi().GetTargetObject() == null)
                                {
                                    (obj as MonsterObject).GetAi().SetAttackTarget(play);
                                }

                            }
                        }
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg,true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_STEALTH:    //潜行
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_STEALTH, Define.STEALTH_TIME);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_HIDEDEN://隐身
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);
                        if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_HIDDEN) != null)
                        {
                            play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_HIDDEN);
                        }
                        else
                        {
                            play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_HIDDEN, Define.HIDEDEM_TIME);
                        }

                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_YUANSUZHANGKONG:        //法师 元素掌控
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);
                        if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_YUANSUZHANGKONG) != null)
                        {
                            play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_YUANSUZHANGKONG);
                            //流星陨火要清空
                            mnLiuXingYunHuoCount = 0;
                            play.ChangeAttribute(UserAttribute.LIUXINGYUNHUO, mnLiuXingYunHuoCount);
                        }
                        else
                        {
                            play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_YUANSUZHANGKONG, 0);
                        }

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_LIUXINGYUNHUO:  //法师 流星陨石
                    {
                        targetobj = play.GetGameMap().FindObjectForID(info.idTarget);
                        if (targetobj == null)
                        {
                            return;
                        }
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        if (mnLiuXingYunHuoCount <= 0) break;

                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        for (int i = 0; i < mnLiuXingYunHuoCount; i++)
                        {
                            injured = BattleSystem.AdjustDamage(play, targetobj, true);
                            NetMsg.MsgGroupMagicAttackInfo magicattackex = new NetMsg.MsgGroupMagicAttackInfo();
                            //有轨迹的魔法--
                            magicattackex.SetSigleAttack(targetobj.GetTypeId());
                            magicattackex.nID = play.GetTypeId();

                            magicattackex.nMagicID = (ushort)info.usType;
                            magicattackex.nMagicLv = magiclv;
                            magicattackex.bDir = play.GetDir();
                            magicattackex.AddObject(targetobj.GetTypeId(), (int)injured);
                            play.BroadcastBuffer(magicattackex.GetBuffer(), true);

                            targetobj.Injured(play, injured, info);

                        }
                            mnLiuXingYunHuoCount = 0;
                        play.ChangeAttribute(UserAttribute.LIUXINGYUNHUO, mnLiuXingYunHuoCount);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_JUYANSHENGDUN://法师 巨岩圣盾
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);

                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);
                        play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_JUYANSHENGDUN, 0);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_YUANSUZHAOHUAN: //法师 元素召唤
                    {
                        if (play.IsMountState()) play.TakeOffMount(0);
                        else play.TakeMount(0,Define.YUANSUZHAOHUAN_MOUNTID);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_GULINGQIYUE: //亡灵巫师 骨灵契约
                    {
                        if (play.IsMountState()) play.TakeOffMount(0);
                        else play.TakeMount(0,Define.GULINGQIYUE_MOUNTID);
                        break;

                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_ZHAOHUANWUHUAN:
                    {

                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = play.GetDir();
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);
                        if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_ZHAOHUANWUHUAN) != null)
                        {
                            play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_ZHAOHUANWUHUAN);
                        }
                        else
                        {
                            play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_ZHAOHUANWUHUAN);
                        }
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_JIANGLINGZHOUYU:    //亡灵巫师- 降灵咒雨
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        EffectObject _effobj = new EffectObject(play, Define.JIANGLINGZHOUYU, 10, 14, Define.JIANGLINGZHOUYU_TIME, (short)info.usPosX, (short)info.usPosY);
                        play.GetGameMap().AddObject(_effobj);
                        _effobj.RefreshVisibleObject();
                        _effobj.SendInfo(play);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_ANSHAXIELONG:   //暗沙邪龙
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_ANSHAXIELONG);

                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_MINGGUOSHENGNV: //冥国圣女
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_MINGGUOSHENGNV);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_WANGNIANWULING: //亡念巫灵
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_WANGNIANWULING);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_SHENYUANELING: //深渊恶灵
                case GameStruct.MagicTypeInfo.MAGICSORT_DIYUXIEFU: //地狱邪蝠
                case GameStruct.MagicTypeInfo.MAGICSORT_SHIHUNWULING://蚀魂巫灵
                    {
                        targetobj = play.GetGameMap().FindObjectForID(info.idTarget);
                        if (targetobj == null)
                        {
                            return;
                        }
                        uint monster_id = Define.SHENYUANELING_MONSTER_ID;
                        if (typeinfo.sort == GameStruct.MagicTypeInfo.MAGICSORT_DIYUXIEFU)
                        {
                            monster_id = Define.DIYUXIEFU_MONSTER_ID;
                        }
                        else if (typeinfo.sort == GameStruct.MagicTypeInfo.MAGICSORT_SHIHUNWULING)
                        {
                            monster_id = Define.SHIHUNWULING_MONSTER_ID;
                        }
                        GameStruct.MonsterInfo monster_info = ConfigManager.Instance().GetMonsterInfo(monster_id);
                        if(monster_info == null)
                        {
                            Log.Instance().WriteLog("获取深渊恶灵怪物ID失败");
                            break;
                        }
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);
                        //play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_SHENYUANELING);

                        int nNewX = targetobj.GetCurrentX() - DIR._DELTA_X[play.GetDir()];
                        int nNewY = targetobj.GetCurrentY() - DIR._DELTA_Y[play.GetDir()];
                        MonsterObject Object_CALL = null;
                        if (typeinfo.sort == GameStruct.MagicTypeInfo.MAGICSORT_DIYUXIEFU)
                        {
                            Object_CALL = new DiYuXieFu(play, targetobj, (short)nNewX, (short)nNewY, play.GetDir(), monster_info.id, monster_info.ai);
                        }
                        else if (typeinfo.sort == GameStruct.MagicTypeInfo.MAGICSORT_SHIHUNWULING)
                        {
                            Object_CALL = new ShiHunWuLing(play, targetobj, (short)nNewX, (short)nNewY, play.GetDir(), monster_info.id, monster_info.ai);
                        }
                        else if (typeinfo.sort == GameStruct.MagicTypeInfo.MAGICSORT_SHENYUANELING)
                        {
                           Object_CALL= new ShenYuanELing(play, targetobj, (short)nNewX, (short)nNewY, play.GetDir(), monster_info.id, monster_info.ai);
                        }

                        play.GetGameMap().AddObject(Object_CALL, null);
                       // Object_CALL.RefreshVisibleObject();
                        Object_CALL.Alive(false);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_DRAGON_MOLONGSHOUHU: //暗黑龙骑魔龙守护
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_MOLONGSHOUHU, Define.STATUS_MOLONGSHOUHU_TIME, true);
                        //添加buff图标

                        break;
                    }

                case GameStruct.MagicTypeInfo.MAGICSORT_DRAGON_QISHITUANSHOUHU: //骑士团守护
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        //创建四个守护骑士
                        GuardKnightObject obj = null;
                        GameStruct.MonsterInfo monster = ConfigManager.Instance().GetMonsterInfo(Define.GUARDKNIGHTID);
                        if (monster == null)
                        {
                            Log.Instance().WriteLog("创建守护骑士失败!!,无此怪物id!");
                            break;
                        }
                        if (mListQiShiTuanGuard == null)
                        {mListQiShiTuanGuard = new List<BaseObject>();}
                       // else
                       // {
                            RemoveQiShiTuanGuardEffect();
                       // }
                        short[] _x = { -5, -5, +5, +5 };
                        short[] _y = { +5, -5, -5, +5 };
                        byte[] _dir = { DIR.LEFT_DOWN, DIR.LEFT_UP, DIR.RIGHT_UP, DIR.RIGHT_DOWN };
                        for (int i = 0; i < _x.Length; i++)
                        {
                            short x = (short)(play.GetCurrentX() + _x[i]);
                            short y = (short)(play.GetCurrentY() + _y[i]);

                            obj = new GuardKnightObject(play,  x, y, _dir[i], monster.id, monster.ai);
                            play.GetGameMap().AddObject(obj,null);
                            obj.RefreshVisibleObject();
                            obj.SendInfo(play);
                            mListQiShiTuanGuard.Add(obj);

                            play.AddVisibleObject(obj, true);
                        }
                        //地面特效-
                        EffectObject _effobj = new EffectObject(play, Define.GUARDKNIGHT_EFFID, 10, 15, Define.GUARDKNIGHT_TIME, play.GetCurrentX(), play.GetCurrentY());
                        play.GetGameMap().AddObject(_effobj);
                        _effobj.RefreshVisibleObject();
                        _effobj.SendInfo(play);
                        mListQiShiTuanGuard.Add(_effobj);

                        play.AddVisibleObject(_effobj, true);

                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_DRAGON_QISHITUANCHONGFENG: //骑士团冲锋
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);
                        //创建四个冲锋骑士
                        FightKnightObject obj = null;
                        GameStruct.MonsterInfo monster = ConfigManager.Instance().GetMonsterInfo(Define.FIGHTKNIGHTID);
                        if (monster == null)
                        {
                            Log.Instance().WriteLog("创建黑暗骑士失败!!,无此怪物id!");
                            break;
                        }
                      //先不管这个技能了---烦
                        short[] _x = { -5, -5, +5, +5 };
                        short[] _y = { +5, -5, -5, +5 };
                        byte[] _dir = { DIR.LEFT_DOWN, DIR.LEFT_UP, DIR.RIGHT_UP, DIR.RIGHT_DOWN };
                        for (int i = 0; i < Define.FIGHTKNIGHT_AMOUNT; i++)
                        {

                            short x = (short)(play.GetCurrentX() + _x[i]);
                            short y = (short)(play.GetCurrentY()+ _y[i] );

                            obj = new FightKnightObject(x, y, play.GetDir(), monster.id, Define.FIGHTKNIGHT_TIME);
                            play.GetGameMap().AddObject(obj, null);
                            obj.RefreshVisibleObject();
                            obj.SendInfo(play);

                            play.AddVisibleObject(obj, true);
                        }
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_MIXINSHU:   //血族 迷心术
                    {
                        byte dir = DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), (short)info.usPosX, (short)info.usPosY);
                        play.SetDir(dir);
                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = dir;
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);
                        play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_MIXINSHU,Define.MIXINSHU_TIME);
                        break;
                    }
                case GameStruct.MagicTypeInfo.MAGICSORT_SINGLE_DANCING: //单人舞
                case GameStruct.MagicTypeInfo.MAGICSORT_DOUBLE_DANCING: //双人舞
                    {

                        NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                        magicinfo.roleid = play.GetTypeId();
                        magicinfo.role_x = play.GetCurrentX();
                        magicinfo.role_y = play.GetCurrentY();
                        magicinfo.injuredvalue = 0;
                        magicinfo.monsterid = play.GetTypeId();
                        magicinfo.tag = 21;
                        magicinfo.magicid = (ushort)info.usType;
                        magicinfo.magiclv = magiclv;
                        byte[] msg = magicinfo.GetBuffer();
                        play.BroadcastBuffer(msg, true);

                        NetMsg.MsgMagicAttackInfo _info = new NetMsg.MsgMagicAttackInfo();
                        _info.id = _info.targetid = play.GetTypeId();
                        _info.magicid = (ushort)info.usType;
                        _info.level = magiclv;
                        _info.dir = play.GetDir();
                        msg = _info.GetBuffer();
                        play.BroadcastBuffer(msg, true);
                        play.SetDancing((short)info.usType);
                        break;
                    }

                    //{
                    //    break;
                    //}
                    //{
                    //    break;
                    //}
            }

               // lastattacktime = System.Environment.TickCount;
        }
        protected override void ProcessAction_Injured(GameStruct.Action act)
        {
            BaseObject target = act.GetObject(0) as BaseObject;
            uint value = (uint)act.GetObject(1);

            if (!IsDie())
            {

                //亡灵巫师- 被攻击后如果有召唤巫环状态- 就同时召唤出三个亡灵攻击对方。
                if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_ZHAOHUANWUHUAN) != null &&
                    this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING) != null && mZhaoHuanWuHuanObj == null)
                {
                    int nNewX = target.GetCurrentX() - DIR._DELTA_X[this.GetDir()];
                    int nNewY = target.GetCurrentY() - DIR._DELTA_Y[this.GetDir()];
                    MonsterObject Object_CALL = null;
                    uint[] CallObj_ID = { GameBase.Config.Define.DIYUXIEFU_MONSTER_ID, GameBase.Config.Define.SHIHUNWULING_MONSTER_ID, GameBase.Config.Define.SHENYUANELING_MONSTER_ID };
                    for (int i = 0; i < CallObj_ID.Length; i++)
                    {
                        GameStruct.MonsterInfo monster_info = ConfigManager.Instance().GetMonsterInfo(CallObj_ID[i]);
                        if (monster_info != null)
                        {
                            Object_CALL = new DiYuXieFu(this, target, (short)nNewX, (short)nNewY, this.GetDir(), monster_info.id, monster_info.ai);
                            this.GetGameMap().AddObject(Object_CALL, null);
                            Object_CALL.Alive(false);
                        }
                    }
                    SetZhaoHuanWuHuanObj(target);
                }
            }
            mTarget = target;
        }