Beispiel #1
0
        /// <summary>
        /// 单人技能的tick,这个需要手动调用
        /// </summary>
        /// <param name="self"></param>
        public static void Tick_Battle(SkillObj self)
        {
            if (self.IsDead())
            {
                return;
            }
            var skillList = self.GetSkillList(true);
            var buffList  = self.GetBuffList(true);
            var CDKeyList = self.GetCDKeyList();

            //buff
            if (buffList != null)
            {
                foreach (var buffInfo in buffList)
                {
                    BuffLogic buffLogic = GetBuffLogic(buffInfo, self);
                    if (buffLogic != null)
                    {
                        int            buffId     = self.GetBuffID(buffInfo);
                        BuffConfig_New buffConfig = self.GetBuffConfig(buffId);
                        buffLogic.Tick(self, buffInfo, buffConfig);
                    }
                    else
                    {
                        self.LogInfo("something error {0}".F(self.GetBuffID(buffInfo)));
                    }
                }
            }
            //技能
            if (skillList != null)
            {
                foreach (var skillInfo in skillList)
                {
                    SkillLogic skillLogic = GetSkillLogic(skillInfo, self);
                    if (skillLogic != null)
                    {
                        int             skillId     = self.GetSkillID(skillInfo);
                        SkillConfig_New skillConfig = self.GetSkillConfig(skillId);
                        skillLogic.Tick(self, skillInfo, skillConfig);
                    }
                    else
                    {
                        self.LogInfo("something error2 {0}".F(self.GetSkillID(skillInfo)));
                    }
                }
            }
            //CD
            if (CDKeyList != null)
            {
                foreach (var key in CDKeyList)
                {
                    self.SetCD(key, self.GetCD(key) - self.GetDeltaTime());
                }
            }
        }
Beispiel #2
0
 public virtual bool CheckCD(SkillObj self, SkillConfig_New skillConfig)
 {
     string key = self.GetSkillCDKey(skillConfig);
     if(key == null || key.Equals(""))
     {
         return true;
     }
     double time = self.GetCD(key);
     if(time <= 0)
     {
         return true;
     }
     return false;
 }
Beispiel #3
0
        public virtual bool CheckCD(SkillObj self, SkillConfig_New skillConfig)
        {
            string key = self.GetSkillCDKey(skillConfig);

            if (key == null || key.Equals(""))
            {
                return(true);
            }
            double time = self.GetCD(key);

            if (time <= 0)
            {
                return(true);
            }
            return(false);
        }
Beispiel #4
0
 public virtual void BeginCD(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     string key = self.GetSkillCDKey(skillConfig);
     if (key == null || key.Equals(""))
     {
         return ;
     }
     double time = self.GetSkillCD(skillConfig);
     if (time <= 0)
     {
         return ;
     }
     self.SetCD(key, time);
     self.NotifySkillInfo(skillInfo, BattleInfoNotifyType.CD_Skill, BattleNotifyTime.TickEnd);
     self.LogInfo("skill:[{0}] CD Begin [{1}]".F(self.GetSkillID(skillInfo), self.GetCD(key)));
     return ;
 }
Beispiel #5
0
        public virtual void BeginCD(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            string key = self.GetSkillCDKey(skillConfig);

            if (key == null || key.Equals(""))
            {
                return;
            }
            double time = self.GetSkillCD(skillConfig);

            if (time <= 0)
            {
                return;
            }
            self.SetCD(key, time);
            self.NotifySkillInfo(skillInfo, BattleInfoNotifyType.CD_Skill, BattleNotifyTime.TickEnd);
            self.LogInfo("skill:[{0}] CD Begin [{1}]".F(self.GetSkillID(skillInfo), self.GetCD(key)));
            return;
        }
Beispiel #6
0
        /// <summary>
        /// 技能的late tick,这是处理一些技能时间到,buff时间到之后的后续处理,需要手动调用
        /// </summary>
        /// <param name="self"></param>
        public static void Tick_Battle_Late(SkillObj self)
        {
            self.Tick_Battle_Late();
            //这个时候已经不再使用buff的迭代器,可以改变集合了,因为这里边的buff已经认为是被加在角色身上了,所以需要有后续处理得先加进去
            foreach (var b in self.GetTempBuffList())
            {
                self.AddBuffList(b);
            }
            self.ClearTempBuffList();
            IEnumerable <BuffInfo_New> detachBuffs = null;

            if (self.IsDead())
            {
                detachBuffs = self.RemoveAllBuffs((b) => true);
                self.RemoveAllSkills((s) => true);
                self.RemoveAllCDKey((c) => true);
            }
            else
            {
                detachBuffs = self.RemoveAllBuffs(b => self.GetBuffTime(b) <= 0);
                self.RemoveAllSkills(s => self.GetSkillTime(s) <= 0);
                self.RemoveAllCDKey(s => self.GetCD(s) <= 0);
            }
            foreach (var delBuf in detachBuffs)
            {
                var buffConfig = self.GetBuffConfig(self.GetBuffID(delBuf));
                if (buffConfig == null)
                {
                    continue;
                }
                //foreach (var buff in GetTankData().BuffInfos)
                {
                    BattleModule.DetachBuff(self, null, delBuf, buffConfig);
                }
            }
        }
Beispiel #7
0
 /// <summary>
 /// 技能的late tick,这是处理一些技能时间到,buff时间到之后的后续处理,需要手动调用
 /// </summary>
 /// <param name="self"></param>
 public static void Tick_Battle_Late(SkillObj self)
 {
     self.Tick_Battle_Late();
     //这个时候已经不再使用buff的迭代器,可以改变集合了,因为这里边的buff已经认为是被加在角色身上了,所以需要有后续处理得先加进去
     foreach (var b in self.GetTempBuffList())
     {
         self.AddBuffList(b);
     }
     self.ClearTempBuffList();
     IEnumerable<BuffInfo_New> detachBuffs = null;
     if (self.IsDead())
     {
         detachBuffs = self.RemoveAllBuffs((b) => true);
         self.RemoveAllSkills((s) => true);
         self.RemoveAllCDKey((c) => true);
     }else
     {
         detachBuffs = self.RemoveAllBuffs(b => self.GetBuffTime(b) <= 0);
         self.RemoveAllSkills(s => self.GetSkillTime(s) <= 0);
         self.RemoveAllCDKey(s => self.GetCD(s) <= 0);
     }
     foreach (var delBuf in detachBuffs)
     {
         var buffConfig = self.GetBuffConfig(self.GetBuffID(delBuf));
         if (buffConfig == null)
         {
             continue;
         }
         //foreach (var buff in GetTankData().BuffInfos)
         {
             BattleModule.DetachBuff(self, null, delBuf, buffConfig);
         }
     }
 }
Beispiel #8
0
 /// <summary>
 /// 单人技能的tick,这个需要手动调用
 /// </summary>
 /// <param name="self"></param>
 public static void Tick_Battle(SkillObj self)
 {
     if (self.IsDead())
     {
         return;
     }
     var skillList = self.GetSkillList(true);
     var buffList = self.GetBuffList(true);
     var CDKeyList = self.GetCDKeyList();
     //buff
     if (buffList != null)
     {
         foreach (var buffInfo in buffList)
         {
             BuffLogic buffLogic = GetBuffLogic(buffInfo, self);
             if (buffLogic != null)
             {
                 int buffId = self.GetBuffID(buffInfo);
                 BuffConfig_New buffConfig = self.GetBuffConfig(buffId);
                 buffLogic.Tick(self, buffInfo, buffConfig);
             }
             else
             {
                 self.LogInfo("something error {0}".F(self.GetBuffID(buffInfo)));
             }
         }
     }
     //技能
     if (skillList != null)
     {
         foreach (var skillInfo in skillList)
         {
             SkillLogic skillLogic = GetSkillLogic(skillInfo, self);
             if (skillLogic != null)
             {
                 int skillId = self.GetSkillID(skillInfo);
                 SkillConfig_New skillConfig = self.GetSkillConfig(skillId);
                 skillLogic.Tick(self, skillInfo, skillConfig);
             }
             else
             {
                 self.LogInfo("something error2 {0}".F(self.GetSkillID(skillInfo)));
             }
         }
     }
     //CD
     if(CDKeyList != null)
     {
         foreach (var key in CDKeyList)
         {
             self.SetCD(key, self.GetCD(key) - self.GetDeltaTime());
         }
     }
 }
Beispiel #9
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;
        }
Beispiel #10
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);
        }