Exemple #1
0
 public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);
     if (ret == LogicStateTickRet.TimeFinish)
     {
         return ret;
     }
     double effectTickTime = self.GetSkillStateDoubleParam(skillConfig, key_EffectTickTime, self.GetSkillStateIndex(skillInfo));
     if (effectTickTime < 0)
     {
         self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Effect effectTickTime< 0".F(self.GetID(), self.GetSkillID(skillInfo)));
         return LogicStateTickRet.TimeFinish;
     }
     self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
     var leftTickTime = self.GetSkillDoubleParam(skillInfo, key_ticlLeftTime_SkillInfo);
     if (leftTickTime - self.GetSkillStateTime(skillInfo) >= effectTickTime)
     {
         self.SetSkillDoubleParam(skillInfo, leftTickTime - effectTickTime, key_ticlLeftTime_SkillInfo);
         self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Effect".F(self.GetID(), self.GetSkillID(skillInfo)));
         ret = LogicStateTickRet.OnEffect;
     }
     else if (self.GetSkillStateTime(skillInfo) <= 0)
     {
         ret = LogicStateTickRet.NextState;
         self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
     }
     else
     {
         ret = LogicStateTickRet.None;
     }
     return ret;
 }
Exemple #2
0
        public static SkillObj Summon(int id, SkillObj srcObj, SkillObj tarObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            SkillObj summonObj = null;

            if (srcObj != null)
            {
                summonObj = srcObj.Summon(id, tarObj, skillInfo, skillConfig);
                var srcBuffList = srcObj.GetBuffList();
                //Source buff fix
                if (srcBuffList != null)
                {
                    foreach (var buffInfo in srcBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, srcObj);
                        int       buffId    = srcObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = srcObj.GetBuffConfig(buffId);
                            buffLogic.OnSummon(id, srcObj, summonObj, buffInfo, buffConfig);
                        }
                        else
                        {
                            srcObj.LogInfo("something error in BattleModule.Summon src buff:[{0}]".F(buffId));
                        }
                    }
                }
            }
            return(summonObj);
        }
Exemple #3
0
 public override void InitState(SkillObj self, SkillInfo_New biffInfo, SkillConfig_New skillConfig, double fixTime)
 {
     int index = self.GetSkillStateIndex(biffInfo);
     var time = self.GetSkillStateTime(skillConfig, index) + fixTime;
     self.SetSkillStateTime(biffInfo, time);
     self.SetSkillDoubleParam(biffInfo, time, key_ticlLeftTime_SkillInfo);
 }
Exemple #4
0
        public override IEnumerable <SkillObj> GetTargets(SkillObj skillObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            double width  = skillObj.GetTargetSelectDoubleParam(skillConfig, key_Width);
            double height = skillObj.GetTargetSelectDoubleParam(skillConfig, key_Height);

            return(GetTargets(skillObj, width, height));
        }
Exemple #5
0
        /// <summary>
        /// 使用技能,这个需要手动调用
        /// </summary>
        /// <param name="self"></param>
        /// <param name="skillId"></param>
        /// <returns></returns>
        public static UseSkillRet UseSkill(SkillObj self, int skillId)
        {
            UseSkillRet ret = UseSkillRet.Success;

            if (BattleModule.IsActionLimited(self, ActionLimitType.UseSkill))
            {
                return(UseSkillRet.ActionLimit);
            }
            if (self.IsDead())
            {
                return(UseSkillRet.Dead);
            }
            //检查特殊状态
            if (!self.CanUseSkill(skillId))
            {
                return(UseSkillRet.None);
            }
            SkillConfig_New skillConfig = self.GetSkillConfig(skillId);

            if (skillConfig == null)
            {
                return(UseSkillRet.None);
            }
            //检查技能消耗
            if (!UseSkillCheckDeplete(self, skillConfig))
            {
                return(UseSkillRet.Deplete);
            }
            string skillLogicId = self.GetSkillLogicId(skillConfig);

            if (!SkillLogics.ContainsKey(skillLogicId))
            {
                return(UseSkillRet.None);
            }

            SkillLogic skillLogic = SkillLogics[skillLogicId];

            if (skillLogic != null)
            {
                //检查CD
                if (!skillLogic.CheckCD(self, skillConfig))
                {
                    string key = self.GetSkillCDKey(skillConfig);
                    self.LogInfo("skill:[{0}] CD ing [{1}]:[{2}]".F(self.GetSkillID(skillConfig), key, self.GetCD(key)));
                    return(UseSkillRet.CD);
                }
                SkillInfo_New skillInfo = skillLogic.Begin(self, skillConfig);
                if (skillInfo != null)
                {
                    skillLogic.BeginCD(self, skillInfo, skillConfig);
                    self.AddSkillList(skillInfo);
                    self.LogInfo("Skill Begin Successed [{0}]".F(skillId));
                }
                else
                {
                    self.LogInfo("Skill Begin Failed [{0}]".F(skillId));
                }
            }
            return(ret);
        }
Exemple #6
0
        public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);

            if (ret == LogicStateTickRet.TimeFinish)
            {
                return(ret);
            }
            double effectTickTime = self.GetSkillStateDoubleParam(skillConfig, key_EffectTickTime, self.GetSkillStateIndex(skillInfo));

            if (effectTickTime < 0)
            {
                self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Effect effectTickTime< 0".F(self.GetID(), self.GetSkillID(skillInfo)));
                return(LogicStateTickRet.TimeFinish);
            }
            self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
            var leftTickTime = self.GetSkillDoubleParam(skillInfo, key_ticlLeftTime_SkillInfo);

            if (leftTickTime - self.GetSkillStateTime(skillInfo) >= effectTickTime)
            {
                self.SetSkillDoubleParam(skillInfo, leftTickTime - effectTickTime, key_ticlLeftTime_SkillInfo);
                self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Effect".F(self.GetID(), self.GetSkillID(skillInfo)));
                ret = LogicStateTickRet.OnEffect;
            }
            else if (self.GetSkillStateTime(skillInfo) <= 0)
            {
                ret = LogicStateTickRet.NextState;
                self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
            }
            else
            {
                ret = LogicStateTickRet.None;
            }
            return(ret);
        }
 public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
 {
     int index = self.GetSkillStateIndex(skillInfo);
     var time = self.GetSkillStateTime(skillConfig, index);
     self.SetSkillStateTime(skillInfo, time + fixTime);
     self.LogInfo("State [{0}] NowTime bEGIN:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetNowTime()));
 }
Exemple #8
0
 public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     int iDamamge = self.GetSkillIntParam(skillConfig, DamegeKey);
     Damage damage = BattleModule.CreateDamage(iDamamge);
     BattleModule.DamageTarget(target, self, damage);
     return true;
 }
Exemple #9
0
        public override bool IsActionLimited(SkillObj self, ActionLimitType limit, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            int iLimit = -1;

            switch (limit)
            {
            case ActionLimitType.Attack:
                iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionAttackLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
                break;

            case ActionLimitType.Move:
                iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionMoveLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
                break;

            case ActionLimitType.UseSkill:
                iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionUseSkillLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
                break;

            default:
                System.Diagnostics.Debug.Assert(false, "limit == default IsActionLimited:[{0}]".F(limit));
                break;
            }
            if (iLimit == 1)
            {
                return(true);
            }
            return(false);
        }
Exemple #10
0
        public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
        {
            int index = self.GetSkillStateIndex(skillInfo);
            var time  = self.GetSkillStateTime(skillConfig, index);

            self.SetSkillStateTime(skillInfo, time + fixTime);
        }
Exemple #11
0
        public override IEnumerable <SkillObj> GetTargets(SkillObj skillObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            List <SkillObj> tarList = new List <SkillObj>();

            tarList.Add(skillObj);
            return(tarList);
        }
Exemple #12
0
        public override void InitState(SkillObj self, SkillInfo_New biffInfo, SkillConfig_New skillConfig, double fixTime)
        {
            int index = self.GetSkillStateIndex(biffInfo);
            var time  = self.GetSkillStateTime(skillConfig, index) + fixTime;

            self.SetSkillStateTime(biffInfo, time);
            self.SetSkillDoubleParam(biffInfo, time, key_ticlLeftTime_SkillInfo);
        }
Exemple #13
0
        public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
        {
            int index = self.GetSkillStateIndex(skillInfo);
            var time  = self.GetSkillStateTime(skillConfig, index);

            self.SetSkillStateTime(skillInfo, time + fixTime);
            self.LogInfo("State [{0}] NowTime bEGIN:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetNowTime()));
        }
Exemple #14
0
        public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            int    iDamamge = self.GetSkillIntParam(skillConfig, DamegeKey);
            Damage damage   = BattleModule.CreateDamage(iDamamge);

            BattleModule.DamageTarget(target, self, damage);
            return(true);
        }
Exemple #15
0
 // 		private const int key_BuffId1_SkillConfig = 0;
 // 		private const int key_BuffId2_SkillConfig = 1;
 // 		private const int key_BuffId3_SkillConfig = 2;
 public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     var buffIds = self.GetSkillIntParams(skillConfig);
     foreach(var buffId in buffIds)
     {
         BattleModule.AddBuff(target, self, buffId, BattleReason.Skill);
     }
     return true;
 }
Exemple #16
0
        public override bool InitSkillInfo(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            bool ret = base.InitSkillInfo(self, skillInfo, skillConfig);

            var targetSelectName = "Range";
            var targetSelect     = BattleModule.GetTargetSelect(targetSelectName);

            if (targetSelect == null)
            {
                self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName));
                Debug.Assert(false, "targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName));
                return(false);
            }
            var targetTypeName = "Harm";
            var targetType     = BattleModule.GetTargetType(targetTypeName);

            if (targetType == null)
            {
                self.LogInfo("targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName));
                Debug.Assert(false, "targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName));
                return(false);
            }
            var targets = BattleModule.GetTargets(self, targetSelect, targetType, skillInfo, skillConfig).ToList();

            if (targets == null || targets.Count <= 0)
            {
                return(true);
            }
            int count     = self.GetSkillIntParam(skillConfig, key_SummonCount_SkillConfig);
            int realCount = 0;
            int index     = 0;

            foreach (var tar in targets)
            {
                if (index < count)
                {
                    self.SetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + index++, tar.GetID());
                    realCount++;
                }
                else
                {
                    break;
                }
            }
            if (index < count)
            {
                var tank = targets.OrderBy(t => t.GetHP()).FirstOrDefault();
                for (int i = index; i < count; i++)
                {
                    self.SetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + i, tank.GetID());
                    realCount++;
                }
            }
            self.SetSkillIntParam(skillInfo, key_SummonIdx_SkillInfo, 0);
            ret = true;
            return(ret);
        }
Exemple #17
0
//      private const int key_BuffId1_SkillConfig = 0;
//      private const int key_BuffId2_SkillConfig = 1;
//      private const int key_BuffId3_SkillConfig = 2;
        public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            var buffIds = self.GetSkillIntParams(skillConfig);

            foreach (var buffId in buffIds)
            {
                BattleModule.AddBuff(target, self, buffId, BattleReason.Skill);
            }
            return(true);
        }
Exemple #18
0
        public static SkillLogicState GetSkillLogicState(SkillInfo_New skillInfo, SkillObj logObj)
        {
            string          stateName = logObj.GetSkillLogicStateName(skillInfo);
            SkillLogicState state     = GetSkillLogicState(stateName);

            if (state == null && logObj != null)
            {
                logObj.LogInfo("SkillLogicStates not found stateName[{0}]".F(stateName));
            }
            return(state);
        }
        public override bool InitSkillInfo(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            bool ret = base.InitSkillInfo(self, skillInfo, skillConfig);

            var targetSelectName = "Range";
            var targetSelect = BattleModule.GetTargetSelect(targetSelectName);
            if (targetSelect == null)
            {
                self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName));
                Debug.Assert(false, "targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName));
                return false;
            }
            var targetTypeName = "Harm";
            var targetType = BattleModule.GetTargetType(targetTypeName);
            if (targetType == null)
            {
                self.LogInfo("targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName));
                Debug.Assert(false, "targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName));
                return false;
            }
            var targets = BattleModule.GetTargets(self, targetSelect, targetType, skillInfo, skillConfig).ToList();
            if(targets == null || targets.Count <= 0)
            {
                return true;
            }
            int count = self.GetSkillIntParam(skillConfig, key_SummonCount_SkillConfig);
            int realCount = 0;
            int index = 0;
            foreach (var tar in targets)
            {
                if(index < count)
                {
                    self.SetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + index++, tar.GetID());
                    realCount++;
                }
                else
                {
                    break;
                }
            }
            if(index < count)
            {
                var tank = targets.OrderBy(t => t.GetHP()).FirstOrDefault();
                for (int i = index; i < count; i++)
                {
                    self.SetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + i, tank.GetID());
                    realCount++;
                }
            }
            self.SetSkillIntParam(skillInfo, key_SummonIdx_SkillInfo, 0);
            ret = true;
            return ret;
        }
 public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);
     if (ret == LogicStateTickRet.TimeFinish)
     {
         return ret;
     }
     self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
     if (self.GetSkillStateTime(skillInfo) <= 0)
     {
         ret = LogicStateTickRet.NextState;
         self.LogInfo("ShowEffectSkillState:skillObj[{0}] skill:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
     }
     return ret;
 }
Exemple #21
0
        public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);

            if (ret == LogicStateTickRet.TimeFinish)
            {
                return(ret);
            }
            self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
            if (self.GetSkillStateTime(skillInfo) <= 0)
            {
                ret = LogicStateTickRet.NextState;
                self.LogInfo("ShowEffectSkillState:skillObj[{0}] skill:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
            }
            return(ret);
        }
 public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);
     if(ret == LogicStateTickRet.TimeFinish)
     {
         return ret;
     }
     self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
     //self.LogInfo("State [{0}] Time:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetSkillStateTime(skillInfo)));
     if (self.GetSkillStateTime(skillInfo) <= 0)
     {
         self.LogInfo("State [{0}] NowTime fINISH:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetNowTime()));
         ret = LogicStateTickRet.NextState;
         self.LogInfo("ChargeState:skillObj[{0}] skill:[{1}] Charge Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
     }
     return ret;
 }
Exemple #23
0
        // 		private const int key_BuffId3_SkillConfig = 2;
        public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            var buffId1 = self.GetSkillIntParam(skillConfig, key_BuffId1_SkillConfig);
            var buffId2 = self.GetSkillIntParam(skillConfig, key_BuffId2_SkillConfig);
            var tarBuff = target.GetBuffList().Where(b => target.GetBuffID(b) == buffId1);
            if (tarBuff != null && tarBuff.FirstOrDefault() != null)
            {
                BattleModule.AddBuff(target, self, buffId2, BattleReason.Skill);
                BattleModule.RemoveBuff(target, self, buffId1, BattleReason.Skill);
            }
            else
            {
                BattleModule.AddBuff(target, self, buffId1, BattleReason.Skill);
                BattleModule.RemoveBuff(target, self, buffId2, BattleReason.Skill);
            }

            return true;
        }
 public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);
     if (ret == LogicStateTickRet.TimeFinish)
     {
         return ret;
     }
     if(self.GetSkillStateIntParam(skillInfo, key) == NotEffect)
     {
         self.SetSkillStateIntParam(skillInfo, key, Effected);
         return LogicStateTickRet.OnEffect;
     }
     else
     {
         return LogicStateTickRet.NextState;
     }
     return ret;
 }
Exemple #25
0
        public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);

            if (ret == LogicStateTickRet.TimeFinish)
            {
                return(ret);
            }
            self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
            //self.LogInfo("State [{0}] Time:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetSkillStateTime(skillInfo)));
            if (self.GetSkillStateTime(skillInfo) <= 0)
            {
                self.LogInfo("State [{0}] NowTime fINISH:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetNowTime()));
                ret = LogicStateTickRet.NextState;
                self.LogInfo("ChargeState:skillObj[{0}] skill:[{1}] Charge Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
            }
            return(ret);
        }
Exemple #26
0
        public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            int id    = self.GetSkillIntParam(skillConfig, key_SummonId_SkillConfig);
            int count = self.GetSkillIntParam(skillConfig, key_SummonCount_SkillConfig);
            int idx   = self.GetSkillIntParam(skillInfo, key_SummonIdx_SkillInfo);

            if (idx < count)
            {
                int tarId = self.GetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + idx);
                var tar   = self.GetTargetById(tarId);
                if (tar != null)
                {
                    var summonTar = BattleModule.Summon(id, self, tar, skillInfo, skillConfig);
                }
                self.SetSkillIntParam(skillInfo, key_SummonIdx_SkillInfo, idx + 1);
            }

            return(true);
        }
Exemple #27
0
        public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);

            if (ret == LogicStateTickRet.TimeFinish)
            {
                return(ret);
            }
            if (self.GetSkillStateIntParam(skillInfo, key) == NotEffect)
            {
                self.SetSkillStateIntParam(skillInfo, key, Effected);
                return(LogicStateTickRet.OnEffect);
            }
            else
            {
                return(LogicStateTickRet.NextState);
            }
            return(ret);
        }
Exemple #28
0
//      private const int key_BuffId3_SkillConfig = 2;
        public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            var buffId1 = self.GetSkillIntParam(skillConfig, key_BuffId1_SkillConfig);
            var buffId2 = self.GetSkillIntParam(skillConfig, key_BuffId2_SkillConfig);
            var tarBuff = target.GetBuffList().Where(b => target.GetBuffID(b) == buffId1);

            if (tarBuff != null && tarBuff.FirstOrDefault() != null)
            {
                BattleModule.AddBuff(target, self, buffId2, BattleReason.Skill);
                BattleModule.RemoveBuff(target, self, buffId1, BattleReason.Skill);
            }
            else
            {
                BattleModule.AddBuff(target, self, buffId1, BattleReason.Skill);
                BattleModule.RemoveBuff(target, self, buffId2, BattleReason.Skill);
            }

            return(true);
        }
Exemple #29
0
        private static SkillLogic GetSkillLogic(SkillInfo_New skillInfo, SkillObj logObj)
        {
            int             skillId    = logObj.GetSkillID(skillInfo);
            SkillConfig_New buffConfig = logObj.GetSkillConfig(skillId);

            if (buffConfig == null)
            {
                logObj.LogInfo("SkillConfig not found skillid[{0}]".F(skillId));
                return(null);
            }
            string skillLogicId = logObj.GetSkillLogicId(buffConfig);

            if (!SkillLogics.ContainsKey(skillLogicId))
            {
                logObj.LogInfo("SkillLogic not found skillid[{0}] SkillLogicId[{1}]".F(skillId, skillLogicId));
                return(null);
            }
            SkillLogic skillLogic = SkillLogics[skillLogicId];

            return(skillLogic);
        }
 public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     int id = self.GetSkillIntParam(skillConfig, key_SummonId);
     var summonTar = BattleModule.Summon(id, self, target, skillInfo, skillConfig);
     if(summonTar != null)
     {
         var buffIds = self.GetSkillIntParams(skillConfig);
         foreach (var buffId in buffIds.Skip(key_SummonId + 1))
         {
             BattleModule.AddBuff(summonTar, self, buffId, BattleReason.Skill);
         }
     }
     {
         //int iBuffId = self.GetSkillIntParam(skillConfig, key_BuffId);
         //if (iBuffId > 0)
         //{
         //	BattleModule.AddBuff(summonTar, self, iBuffId, BattleReason.Skill);
         //}
     }
     return true;
 }
        public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            int id        = self.GetSkillIntParam(skillConfig, key_SummonId);
            var summonTar = BattleModule.Summon(id, self, target, skillInfo, skillConfig);

            if (summonTar != null)
            {
                var buffIds = self.GetSkillIntParams(skillConfig);
                foreach (var buffId in buffIds.Skip(key_SummonId + 1))
                {
                    BattleModule.AddBuff(summonTar, self, buffId, BattleReason.Skill);
                }
            }
            {
                //int iBuffId = self.GetSkillIntParam(skillConfig, key_BuffId);
                //if (iBuffId > 0)
                //{
                //	BattleModule.AddBuff(summonTar, self, iBuffId, BattleReason.Skill);
                //}
            }
            return(true);
        }
 //private const int Key_Double_BuffBegin_SkillConfig = 0;
 public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     if(self.GetCamp()!=target.GetCamp())
     {
         int iDamamge = self.GetSkillIntParam(skillConfig, Key_Damege_SkillConfig);
         Damage damage = BattleModule.CreateDamage(iDamamge);
         BattleModule.DamageTarget(target, self, damage);
         var buffIds = self.GetSkillIntParams(skillConfig).Skip(Key_Damege_SkillConfig + 1);
         foreach (var buffId in buffIds)
         {
             BattleModule.AddBuff(target, self, buffId, BattleReason.Skill);
         }
     }
     else
     {
         var buffIds = self.GetSkillDoubleParams(skillConfig).Select(d=>(int)d);
         foreach (var buffId in buffIds)
         {
             BattleModule.AddBuff(target, self, buffId, BattleReason.Skill);
         }
     }
     return true;
 }
Exemple #33
0
 //private const int Key_Double_BuffBegin_SkillConfig = 0;
 public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     if (self.GetCamp() != target.GetCamp())
     {
         int    iDamamge = self.GetSkillIntParam(skillConfig, Key_Damege_SkillConfig);
         Damage damage   = BattleModule.CreateDamage(iDamamge);
         BattleModule.DamageTarget(target, self, damage);
         var buffIds = self.GetSkillIntParams(skillConfig).Skip(Key_Damege_SkillConfig + 1);
         foreach (var buffId in buffIds)
         {
             BattleModule.AddBuff(target, self, buffId, BattleReason.Skill);
         }
     }
     else
     {
         var buffIds = self.GetSkillDoubleParams(skillConfig).Select(d => (int)d);
         foreach (var buffId in buffIds)
         {
             BattleModule.AddBuff(target, self, buffId, BattleReason.Skill);
         }
     }
     return(true);
 }
 public override bool IsActionLimited(SkillObj self, ActionLimitType limit, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     int iLimit = -1;
     switch (limit)
     {
         case ActionLimitType.Attack:
             iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionAttackLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
             break;
         case ActionLimitType.Move:
             iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionMoveLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
             break;
         case ActionLimitType.UseSkill:
             iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionUseSkillLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
             break;
         default:
             System.Diagnostics.Debug.Assert(false, "limit == default IsActionLimited:[{0}]".F(limit));
             break;
     }
     if (iLimit == 1)
     {
         return true;
     }
     return false;
 }
Exemple #35
0
 public static IEnumerable<SkillObj> GetTargets(SkillObj skillObj, TargetSelect select, TargetType tType, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     if (select == null || tType == null)
     {
         return null;
     }
     var ret = select.GetTargets(skillObj, skillInfo, skillConfig).Where(t=> tType.IsTarget(skillObj, t));
     return ret;
 }
Exemple #36
0
        public static IEnumerable <SkillObj> GetTargets(SkillObj skillObj, TargetSelect select, TargetType tType, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            if (select == null || tType == null)
            {
                return(null);
            }
            var ret = select.GetTargets(skillObj, skillInfo, skillConfig).Where(t => tType.IsTarget(skillObj, t));

            return(ret);
        }
Exemple #37
0
 public virtual IEnumerable <SkillObj> GetTargets(SkillObj skillObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     return(null);
 }
Exemple #38
0
 public virtual void Init(SkillObj skillObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     return;
 }
Exemple #39
0
 public override IEnumerable<SkillObj> GetTargets(SkillObj skillObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     double range = skillObj.GetTargetSelectDoubleParam(skillConfig, key_Range);
     return GetTargets(skillObj, range);
 }
Exemple #40
0
 public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
 {
     self.SetSkillStateIntParam(skillInfo, key, NotEffect);
 }
 public override double OnStateChanged(string tarState, SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     self.LogInfo("State [{0}] finish".F(self.GetSkillLogicStateName(skillInfo)));
     return self.GetSkillStateTime(skillInfo);
 }
Exemple #42
0
 private static SkillLogic GetSkillLogic(SkillInfo_New skillInfo, SkillObj logObj)
 {
     int skillId = logObj.GetSkillID(skillInfo);
     SkillConfig_New buffConfig = logObj.GetSkillConfig(skillId);
     if (buffConfig == null)
     {
         logObj.LogInfo("SkillConfig not found skillid[{0}]".F(skillId));
         return null;
     }
     string skillLogicId = logObj.GetSkillLogicId(buffConfig);
     if (!SkillLogics.ContainsKey(skillLogicId))
     {
         logObj.LogInfo("SkillLogic not found skillid[{0}] SkillLogicId[{1}]".F(skillId, skillLogicId));
         return null;
     }
     SkillLogic skillLogic = SkillLogics[skillLogicId];
     return skillLogic;
 }
Exemple #43
0
        public override IEnumerable <SkillObj> GetTargets(SkillObj skillObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            double range = skillObj.GetTargetSelectDoubleParam(skillConfig, key_Range);

            return(GetTargets(skillObj, range));
        }
 public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
 {
     self.SetSkillStateIntParam(skillInfo, key, NotEffect);
 }
Exemple #45
0
 public static SkillLogicState GetSkillLogicState(SkillInfo_New skillInfo, SkillObj logObj)
 {
     string stateName = logObj.GetSkillLogicStateName(skillInfo);
     SkillLogicState state = GetSkillLogicState(stateName);
     if (state == null && logObj != null)
     {
         logObj.LogInfo("SkillLogicStates not found stateName[{0}]".F(stateName));
     }
     return state;
 }
Exemple #46
0
 public override double OnStateChanged(string tarState, SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     self.LogInfo("State [{0}] finish".F(self.GetSkillLogicStateName(skillInfo)));
     return(self.GetSkillStateTime(skillInfo));
 }
Exemple #47
0
 public override IEnumerable<SkillObj> GetTargets(SkillObj skillObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     double width = skillObj.GetTargetSelectDoubleParam(skillConfig, key_Width);
     double height = skillObj.GetTargetSelectDoubleParam(skillConfig, key_Height);
     return GetTargets(skillObj, width, height);
 }
Exemple #48
0
 public static SkillObj Summon(int id, SkillObj srcObj, SkillObj tarObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     SkillObj summonObj = null;
     if (srcObj != null)
     {
         summonObj = srcObj.Summon(id, tarObj, skillInfo, skillConfig);
         var srcBuffList = srcObj.GetBuffList();
         //Source buff fix
         if (srcBuffList != null)
         {
             foreach (var buffInfo in srcBuffList)
             {
                 BuffLogic buffLogic = GetBuffLogic(buffInfo, srcObj);
                 int buffId = srcObj.GetBuffID(buffInfo);
                 if (buffLogic != null)
                 {
                     BuffConfig_New buffConfig = srcObj.GetBuffConfig(buffId);
                     buffLogic.OnSummon(id, srcObj, summonObj, buffInfo, buffConfig);
                 }
                 else
                 {
                     srcObj.LogInfo("something error in BattleModule.Summon src buff:[{0}]".F(buffId));
                 }
             }
         }
     }
     return summonObj;
 }
Exemple #49
0
 public virtual IEnumerable<SkillObj> GetTargets(SkillObj skillObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     return null;
 }
Exemple #50
0
 public virtual void Init(SkillObj skillObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     return;
 }
        public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            int id = self.GetSkillIntParam(skillConfig, key_SummonId_SkillConfig);
            int count = self.GetSkillIntParam(skillConfig, key_SummonCount_SkillConfig);
            int idx = self.GetSkillIntParam(skillInfo, key_SummonIdx_SkillInfo);
            if(idx < count)
            {
                int tarId = self.GetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + idx);
                var tar = self.GetTargetById(tarId);
                if(tar != null)
                {
                    var summonTar = BattleModule.Summon(id, self, tar, skillInfo, skillConfig);
                }
                self.SetSkillIntParam(skillInfo, key_SummonIdx_SkillInfo, idx + 1);
            }

            return true;
        }
 public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
 {
     int index = self.GetSkillStateIndex(skillInfo);
     var time = self.GetSkillStateTime(skillConfig, index);
     self.SetSkillStateTime(skillInfo, time + fixTime);
 }