Exemple #1
0
 static SystemMagicAction()
 {
     for (MagicActionIDs id = 0; id < MagicActionIDs.MAX; id++)
     {
         string name = id.ToString().ToLower();
         MagicActionIDsDict.Add(name, id);
     }
 }
 static SystemMagicAction()
 {
     for (MagicActionIDs id = MagicActionIDs.FOREVER_ADDHIT; id < MagicActionIDs.MAX; id++)
     {
         string name = id.ToString().ToLower();
         SystemMagicAction.MagicActionIDsDict.Add(name, id);
     }
 }
Exemple #3
0
 /// <summary>
 /// 删除技能辅助项
 /// </summary>
 /// <param name="magicActionID"></param>
 /// <param name="magicActionParams"></param>
 public void RemoveMagicHelper(MagicActionIDs magicActionID)
 {
     lock (_MagicHelperDict)
     {
         if (_MagicHelperDict.ContainsKey(magicActionID))
         {
             _MagicHelperDict.Remove(magicActionID);
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// 添加技能辅助项
        /// </summary>
        /// <param name="magicActionID"></param>
        /// <param name="magicActionParams"></param>
        public void AddMagicHelper(MagicActionIDs magicActionID, double[] magicActionParams, int objID)
        {
            MagicHelperItem magicHelperItem = new MagicHelperItem()
            {
                MagicActionID     = magicActionID,
                MagicActionParams = magicActionParams,
                StartedTicks      = DateTime.Now.Ticks,
                LastTicks         = 0,
                ExecutedNum       = 0,
                ObjectID          = objID,
            };

            lock (_MagicHelperDict)
            {
                _MagicHelperDict[magicActionID] = magicHelperItem;
            }
        }
        public void AddMagicHelper(MagicActionIDs magicActionID, double[] magicActionParams, int objID)
        {
            MagicHelperItem magicHelperItem = new MagicHelperItem
            {
                MagicActionID     = magicActionID,
                MagicActionParams = magicActionParams,
                StartedTicks      = TimeUtil.NOW() * 10000L,
                LastTicks         = 0L,
                ExecutedNum       = 0,
                ObjectID          = objID
            };

            lock (this._MagicHelperDict)
            {
                this._MagicHelperDict[magicActionID] = magicHelperItem;
            }
        }
        /// <summary>
        /// 添加技能辅助项(扩展)
        /// </summary>
        /// <param name="magicActionID"></param>
        /// <param name="magicActionParams"></param>
        /// <param name="mapCode"></param>
        /// <param name="centerGridXY"></param>
        /// <param name="gridWidthNum"></param>
        /// <param name="gridHeightNum"></param>
        /// <param name="copyMapID"></param>
        public void AddMagicHelperEx(MagicActionIDs magicActionID, double[] magicActionParams, int mapCode, int posX, int posY, int copyMapID = -1)
        {
            if (copyMapID < 0)
            {
                copyMapID = -1;
            }

            GameMap gameMap = GameManager.MapMgr.DictMaps[mapCode];

            ///障碍上边,不能放火墙
            if (Global.InOnlyObs(ObjectTypes.OT_CLIENT, mapCode, posX, posY))
            {
                return;
            }

            GridMagicHelperItemKey itemKey = new GridMagicHelperItemKey()
            {
                PosX          = posX,
                PosY          = posY,
                CopyMapID     = copyMapID,
                MagicActionID = magicActionID,
            };

            GridMagicHelperItemEx magicHelperItem = new GridMagicHelperItemEx()
            {
                MagicActionID     = magicActionID,
                MagicActionParams = magicActionParams,
                StartedTicks      = TimeUtil.NOW(),
                LastTicks         = TimeUtil.NOW(),
                ExecutedNum       = 0,
                MapCode           = mapCode,
            };

            lock (_GridMagicHelperDictEx)
            {
                if (_GridMagicHelperDictEx.ContainsKey(itemKey))
                {
                    return;//一个格子上边,同时只能有一个buffer
                }
                _GridMagicHelperDictEx.Add(itemKey, magicHelperItem);
            }
        }
        /// <summary>
        /// 添加技能辅助项
        /// </summary>
        /// <param name="magicActionID"></param>
        /// <param name="magicActionParams"></param>
        public bool ExistsMagicHelper(MagicActionIDs magicActionID, int gridX, int gridY, int copyMapID = -1)
        {
            if (copyMapID < 0)
            {
                copyMapID = -1;
            }

            string key = string.Format("{0}_{1}_{2}", gridX, gridY, copyMapID);
            Dictionary <MagicActionIDs, GridMagicHelperItem> dict = null;

            lock (_GridMagicHelperDict)
            {
                if (!_GridMagicHelperDict.TryGetValue(key, out dict) || null == dict)
                {
                    return(false);
                }
            }

            lock (dict)
            {
                return(dict.ContainsKey(magicActionID));
            }
        }
Exemple #8
0
        //属性更新
        private void ProcessAction(GameClient client, MagicActionIDs id, double[] actionParams, int nPropsSystemTypes, sbyte sShengWu_slot, sbyte sBuJian_slot)
        {
            switch (id)
            {
            case MagicActionIDs.POTION:                 //药水效果:Potion,百分比 药水:GoodsID=1010、1011、1012、1013、1110、1111 效果:基础效果(1+ X.X)
            case MagicActionIDs.HOLYWATER:              //圣水效果:HolyWater,百分比 圣水:GoodsID=1000、1001、1002、1100、1101、1102 效果:基础效果(1+ X.X)
            case MagicActionIDs.RECOVERLIFEV:           //自动恢复生命效果:RecoverLifeV,百分比 效果:基础恢复生命效果*(1+X.X)
            case MagicActionIDs.ADDDEFENSE:
            case MagicActionIDs.ADDATTACK:              //对应SystemMagicAction属性枚举
            case MagicActionIDs.FATALHURT:              //卓越伤害加成:FatalHurt,百分比 效果:卓越一击伤害加成*(1+X.X)
            case MagicActionIDs.HITV:
            case MagicActionIDs.ADDATTACKINJURE:
            case MagicActionIDs.LIFESTEAL:             //击中恢复效果:LifeStealV,固定值 效果:击中恢复生命+XX
            case MagicActionIDs.DAMAGETHORN:
            case MagicActionIDs.COUNTERACTINJUREVALUE:
            case MagicActionIDs.DODGE:
            case MagicActionIDs.MAXLIFEPERCENT:
            case MagicActionIDs.AddAttackPercent:
            case MagicActionIDs.AddDefensePercent:

                //case MagicActionIDs.RECOVERMAGICV:      //自动恢复魔法效果:RecoverMagicV,百分比 效果:基础恢复魔法效果+X.X
                //case MagicActionIDs.LIFESTEALPERCENT:   //击中恢复效果:LifeStealPercent,百分比 效果:击中恢复生命*(1+X.X)
            {
                ExtPropIndexes eExtProp = ExtPropIndexes.Max;

                switch (id)
                {
                case MagicActionIDs.AddAttackPercent:
                    eExtProp = ExtPropIndexes.AddAttackPercent;
                    break;

                case MagicActionIDs.AddDefensePercent:
                    eExtProp = ExtPropIndexes.AddDefensePercent;
                    break;

                case MagicActionIDs.MAXLIFEPERCENT:
                    eExtProp = ExtPropIndexes.MaxLifePercent;
                    break;

                case MagicActionIDs.POTION:
                    eExtProp = ExtPropIndexes.Potion;
                    break;

                case MagicActionIDs.HOLYWATER:
                    eExtProp = ExtPropIndexes.Holywater;
                    break;

                case MagicActionIDs.RECOVERLIFEV:
                    eExtProp = ExtPropIndexes.RecoverLifeV;
                    break;

                //case MagicActionIDs.RECOVERMAGICV:
                //    eExtProp = ExtPropIndexes.RecoverMagicV;
                //    break;
                case MagicActionIDs.LIFESTEAL:
                    eExtProp = ExtPropIndexes.LifeSteal;
                    break;

                //case MagicActionIDs.LIFESTEALPERCENT:
                //    eExtProp = ExtPropIndexes.LifeStealPercent;
                //    break;
                case MagicActionIDs.FATALHURT:
                    eExtProp = ExtPropIndexes.Fatalhurt;
                    break;

                case MagicActionIDs.ADDATTACK:
                    eExtProp = ExtPropIndexes.AddAttack;
                    break;

                case MagicActionIDs.ADDATTACKINJURE:
                    eExtProp = ExtPropIndexes.AddAttackInjure;
                    break;

                case MagicActionIDs.HITV:
                    eExtProp = ExtPropIndexes.HitV;
                    break;

                case MagicActionIDs.ADDDEFENSE:
                    eExtProp = ExtPropIndexes.AddDefense;
                    break;

                case MagicActionIDs.COUNTERACTINJUREVALUE:
                    eExtProp = ExtPropIndexes.CounteractInjureValue;
                    break;

                case MagicActionIDs.DAMAGETHORN:
                    eExtProp = ExtPropIndexes.DamageThorn;
                    break;

                case MagicActionIDs.DODGE:
                    eExtProp = ExtPropIndexes.Dodge;
                    break;
                }

                if (eExtProp == ExtPropIndexes.Max)
                {
                    break;
                }

                client.ClientData.PropsCacheManager.SetExtPropsSingle(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, 1000, (int)eExtProp, actionParams[0]);
            }
            break;

            case MagicActionIDs.CONSTITUTION:
                client.ClientData.PropsCacheManager.SetBaseProps(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, (int)UnitPropIndexes.Constitution, new double[] { 0.0d, 0.0d, 0.0d, actionParams[0] });
                break;

            case MagicActionIDs.DEXTERITY:
                client.ClientData.PropsCacheManager.SetBaseProps(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, (int)UnitPropIndexes.Dexterity, new double[] { 0.0d, 0.0d, actionParams[0], 0.0d });
                break;

            case MagicActionIDs.INTELLIGENCE:
                client.ClientData.PropsCacheManager.SetBaseProps(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, (int)UnitPropIndexes.Intelligence, new double[] { 0.0d, actionParams[0], 0.0d, 0.0d });
                break;

            case MagicActionIDs.STRENGTH:
                client.ClientData.PropsCacheManager.SetBaseProps(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, (int)UnitPropIndexes.Strength, new double[] { actionParams[0], 0.0d, 0.0d, 0.0d });
                break;
            }
        }
Exemple #9
0
        public static double GetNegativeRate(IObject self, IObject obj, double baseRate, ExtPropIndexes extPropIndex, MagicActionIDs actionId)
        {
            int selfZhuanSheng = 0;

            if (self is GameClient)
            {
                selfZhuanSheng = (self as GameClient).ClientData.ChangeLifeCount;
                baseRate       = RoleAlgorithm.GetRoleNegativeRate(self as GameClient, baseRate, extPropIndex);
            }
            else if (self is Monster)
            {
                selfZhuanSheng = (self as Monster).MonsterInfo.ChangeLifeCount;
            }
            int objZhuanSheng = 0;

            if (obj is GameClient)
            {
                if ((obj as GameClient).buffManager.IsBuffEnabled(116))
                {
                    return(0.0);
                }
                if (actionId != MagicActionIDs.MU_ADD_JITUI && (obj as GameClient).buffManager.IsBuffEnabled(113))
                {
                    return(0.0);
                }
                if (CaiJiLogic.IsCaiJiState(obj as GameClient) && (extPropIndex == ExtPropIndexes.StateDingShen || extPropIndex == ExtPropIndexes.StateMoveSpeed || extPropIndex == ExtPropIndexes.StateJiTui || extPropIndex == ExtPropIndexes.StateHunMi))
                {
                    return(0.0);
                }
                objZhuanSheng = (obj as GameClient).ClientData.ChangeLifeCount;
            }
            else if (obj is Monster)
            {
                objZhuanSheng = (obj as Monster).MonsterInfo.ChangeLifeCount;
            }
            else if (obj is FakeRoleItem)
            {
                objZhuanSheng = (obj as FakeRoleItem).GetFakeRoleData().MyRoleDataMini.ChangeLifeCount;
            }
            double result;

            if (selfZhuanSheng > objZhuanSheng)
            {
                result = baseRate + 0.1 * Math.Pow((double)(selfZhuanSheng - objZhuanSheng), 2.0);
            }
            else
            {
                result = baseRate - 0.1 * Math.Pow((double)(selfZhuanSheng - objZhuanSheng), 2.0);
            }
            return(result);
        }
        private void ProcessAction(GameClient client, MagicActionIDs id, double[] actionParams, int nPropsSystemTypes, sbyte sShengWu_slot, sbyte sBuJian_slot)
        {
            switch (id)
            {
            case MagicActionIDs.POTION:
            case MagicActionIDs.HOLYWATER:
            case MagicActionIDs.RECOVERLIFEV:
            case MagicActionIDs.LIFESTEAL:
            case MagicActionIDs.FATALHURT:
            case MagicActionIDs.ADDATTACK:
            case MagicActionIDs.ADDATTACKINJURE:
            case MagicActionIDs.HITV:
            case MagicActionIDs.ADDDEFENSE:
            case MagicActionIDs.COUNTERACTINJUREVALUE:
            case MagicActionIDs.DAMAGETHORN:
            case MagicActionIDs.DODGE:
            case MagicActionIDs.MAXLIFEPERCENT:
            case MagicActionIDs.AddAttackPercent:
            case MagicActionIDs.AddDefensePercent:
            case MagicActionIDs.HitPercent:
            {
                ExtPropIndexes eExtProp = ExtPropIndexes.Max;
                switch (id)
                {
                case MagicActionIDs.POTION:
                    eExtProp = ExtPropIndexes.Potion;
                    break;

                case MagicActionIDs.HOLYWATER:
                    eExtProp = ExtPropIndexes.Holywater;
                    break;

                case MagicActionIDs.RECOVERLIFEV:
                    eExtProp = ExtPropIndexes.RecoverLifeV;
                    break;

                case MagicActionIDs.LIFESTEAL:
                    eExtProp = ExtPropIndexes.LifeSteal;
                    break;

                case MagicActionIDs.FATALHURT:
                    eExtProp = ExtPropIndexes.Fatalhurt;
                    break;

                case MagicActionIDs.ADDATTACK:
                    eExtProp = ExtPropIndexes.AddAttack;
                    break;

                case MagicActionIDs.ADDATTACKINJURE:
                    eExtProp = ExtPropIndexes.AddAttackInjure;
                    break;

                case MagicActionIDs.HITV:
                    eExtProp = ExtPropIndexes.HitV;
                    break;

                case MagicActionIDs.ADDDEFENSE:
                    eExtProp = ExtPropIndexes.AddDefense;
                    break;

                case MagicActionIDs.COUNTERACTINJUREVALUE:
                    eExtProp = ExtPropIndexes.CounteractInjureValue;
                    break;

                case MagicActionIDs.DAMAGETHORN:
                    eExtProp = ExtPropIndexes.DamageThorn;
                    break;

                case MagicActionIDs.DODGE:
                    eExtProp = ExtPropIndexes.Dodge;
                    break;

                case MagicActionIDs.MAXLIFEPERCENT:
                    eExtProp = ExtPropIndexes.MaxLifePercent;
                    break;

                case MagicActionIDs.AddAttackPercent:
                    eExtProp = ExtPropIndexes.AddAttackPercent;
                    break;

                case MagicActionIDs.AddDefensePercent:
                    eExtProp = ExtPropIndexes.AddDefensePercent;
                    break;

                case MagicActionIDs.HitPercent:
                    eExtProp = ExtPropIndexes.HitPercent;
                    break;
                }
                if (eExtProp != ExtPropIndexes.Max)
                {
                    client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[]
                        {
                            nPropsSystemTypes,
                            (int)sShengWu_slot,
                            (int)sBuJian_slot,
                            1000,
                            (int)eExtProp,
                            actionParams[0]
                        });
                }
                break;
            }

            case MagicActionIDs.STRENGTH:
            {
                PropsCacheManager propsCacheManager = client.ClientData.PropsCacheManager;
                object[]          array             = new object[5];
                array[0] = nPropsSystemTypes;
                array[1] = (int)sShengWu_slot;
                array[2] = (int)sBuJian_slot;
                array[3] = 0;
                object[] array2 = array;
                int      num    = 4;
                double[] array3 = new double[4];
                array3[0]   = actionParams[0];
                array2[num] = array3;
                propsCacheManager.SetBaseProps(array);
                break;
            }

            case MagicActionIDs.CONSTITUTION:
                client.ClientData.PropsCacheManager.SetBaseProps(new object[]
                {
                    nPropsSystemTypes,
                    (int)sShengWu_slot,
                    (int)sBuJian_slot,
                    3,
                    new double[]
                    {
                        0.0,
                        0.0,
                        0.0,
                        actionParams[0]
                    }
                });
                break;

            case MagicActionIDs.DEXTERITY:
            {
                PropsCacheManager propsCacheManager2 = client.ClientData.PropsCacheManager;
                object[]          array = new object[5];
                array[0] = nPropsSystemTypes;
                array[1] = (int)sShengWu_slot;
                array[2] = (int)sBuJian_slot;
                array[3] = 2;
                object[] array4 = array;
                int      num2   = 4;
                double[] array3 = new double[4];
                array3[2]    = actionParams[0];
                array4[num2] = array3;
                propsCacheManager2.SetBaseProps(array);
                break;
            }

            case MagicActionIDs.INTELLIGENCE:
            {
                PropsCacheManager propsCacheManager3 = client.ClientData.PropsCacheManager;
                object[]          array = new object[5];
                array[0] = nPropsSystemTypes;
                array[1] = (int)sShengWu_slot;
                array[2] = (int)sBuJian_slot;
                array[3] = 1;
                object[] array5 = array;
                int      num3   = 4;
                double[] array3 = new double[4];
                array3[1]    = actionParams[0];
                array5[num3] = array3;
                propsCacheManager3.SetBaseProps(array);
                break;
            }
            }
        }
        /// <summary>
        /// 添加技能辅助项
        /// </summary>
        /// <param name="magicActionID"></param>
        /// <param name="magicActionParams"></param>
        public void AddMagicHelper(MagicActionIDs magicActionID, double[] magicActionParams, int mapCode, Point centerGridXY, int gridWidthNum, int gridHeightNum, int copyMapID = -1)
        {
            if (copyMapID < 0)
            {
                copyMapID = -1;
            }

            GameMap gameMap = GameManager.MapMgr.DictMaps[mapCode];

            List <Point> pts = new List <Point>();

            pts.Add(centerGridXY);

            for (int i = (int)centerGridXY.X - gridWidthNum; i <= centerGridXY.X + gridWidthNum; i++)
            {
                for (int j = (int)centerGridXY.Y - gridHeightNum; j <= centerGridXY.Y + gridHeightNum; j++)
                {
                    pts.Add(new Point(i, j));
                }
            }

            for (int i = 0; i < pts.Count; i++)
            {
                ///障碍上边,不能放火墙
                if (Global.InOnlyObs(ObjectTypes.OT_CLIENT, mapCode, (int)pts[i].X, (int)pts[i].Y))
                {
                    continue;
                }

                Dictionary <MagicActionIDs, GridMagicHelperItem> dict = null;
                string key = string.Format("{0}_{1}_{2}", pts[i].X, pts[i].Y, copyMapID);
                lock (_GridMagicHelperDict)
                {
                    if (!_GridMagicHelperDict.TryGetValue(key, out dict))
                    {
                        dict = new Dictionary <MagicActionIDs, GridMagicHelperItem>();
                        _GridMagicHelperDict[key] = dict;
                    }
                }

                lock (dict)
                {
                    if (dict.ContainsKey(magicActionID)) //一个格子上边,同时只能有一个buffer
                    {
                        continue;
                    }
                }

                GridMagicHelperItem magicHelperItem = new GridMagicHelperItem()
                {
                    MagicActionID     = magicActionID,
                    MagicActionParams = magicActionParams,
                    StartedTicks      = TimeUtil.NOW(),
                    LastTicks         = TimeUtil.NOW(),
                    ExecutedNum       = 0,
                    MapCode           = mapCode,
                };

                lock (dict)
                {
                    dict[magicHelperItem.MagicActionID] = magicHelperItem;
                }
            }
        }