Пример #1
0
 public override void OnDamageTarget(SkillObj self, SkillObj target, Damage damage, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     var buffIds = self.GetBuffIntParams(buffConfig).Skip(Key_Int_SummonObjBuffId_BuffConfig+1);
     foreach (var buffId in buffIds.Where(b=>b>0))
     {
         BattleModule.AddBuff(target, self, buffId, BattleReason.Buff);
     }
     return ;
 }
Пример #2
0
		public override void OnDamageTarget(SkillObj self, SkillObj target, Damage damage, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
		{
			if(damage.value > 0 && self != target)
			{
				double addTime = self.GetBuffDoubleParam(buffConfig, Key_Double_AddTime_BuffConfig);
				self.SetBuffTime(buffInfo, self.GetBuffTime(buffInfo) + addTime);
				self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) + addTime);
				self.NotifyBuffInfo(buffInfo, BattleInfoNotifyType.Time_Buff, BattleNotifyTime.TickEnd);
			}
		}
Пример #3
0
 public override Damage BeHurtDamageFix(SkillObj self, SkillObj source, Damage damage, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     int shield = self.GetBuffIntParam(buffInfo, AbsorbDamageKey);
     if(shield > damage.value)
     {
         shield -= damage.value;
         damage.value = 0;
     }
     else
     {
         damage.value -= shield;
         shield = 0;
         BuffOnEnd(self, buffInfo, buffConfig);
     }
     return damage;
 }
Пример #4
0
        /// <summary>
        /// 造成伤害或治疗
        /// </summary>
        /// <param name="tarObj"></param>
        /// <param name="srcObj"></param>
        /// <param name="damage">大于0是伤害,小于0是治疗</param>
        public static void DamageTarget(SkillObj tarObj, SkillObj srcObj, Damage damage)
        {
            SkillObj realSrcObj = srcObj;
            if(tarObj == null || tarObj.IsDead())
            {
                return;
            }
            if(realSrcObj != null && damage.srcId > 0 && realSrcObj.GetID() != damage.srcId)
            {
                realSrcObj = tarObj.GetSkillObj(damage.srcId);
            }
            BattleModule.CalcDamage(tarObj, realSrcObj, damage);
            //先修正伤害
            BattleModule.DamageFix(tarObj, realSrcObj, damage);
            //质量和造成伤害都是这个
            //造成伤害
            if(damage.value >= 0)
            {
                tarObj.OnDamage(damage, realSrcObj);
            }
            else
            {
                tarObj.OnDamage(damage, realSrcObj);
            }
            //检查技能与BUFF的相应触发
            if (realSrcObj != null && !realSrcObj.IsDead())
            {
                var srcSkillList = realSrcObj.GetSkillList();
                var srcBuffList = realSrcObj.GetBuffList();
                //Source skill fix
                if (srcSkillList != null)
                {
                    foreach (var skillInfo in srcSkillList)
                    {
                        SkillLogic skillLogic = GetSkillLogic(skillInfo, realSrcObj);
                        int skillId = realSrcObj.GetSkillID(skillInfo);
                        if (skillLogic != null)
                        {
                            SkillConfig_New skillConfig = realSrcObj.GetSkillConfig(skillId);
                            if (damage.value >= 0)
                            {
                                skillLogic.OnDamageTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig);
                            }
                            else
                            {
                                skillLogic.OnHealTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig);
                            }
                        }
                        else
                        {
                            realSrcObj.LogInfo("something error in BattleModule.DamageTarget src skill:[{0}]".F(skillId));
                        }
                    }
                }
                //Source buff fix
                if (srcBuffList != null)
                {
                    foreach (var buffInfo in srcBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, realSrcObj);
                        int buffId = realSrcObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = realSrcObj.GetBuffConfig(buffId);
                            if (damage.value >= 0)
                            {
                                buffLogic.OnDamageTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig);
                            }
                            else
                            {
                                buffLogic.OnHealTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig);
                            }
                        }
                        else
                        {
                            realSrcObj.LogInfo("something error in BattleModule.DamageTarget src buff:[{0}]".F(buffId));
                        }
                    }
                }
            }

            var tarSkillList = tarObj.GetSkillList();
            var tarBuffList = tarObj.GetBuffList();
            //Target skill fix
            if(!tarObj.IsDead())
            {
                if (tarSkillList != null)
                {
                    foreach (var skillInfo in tarSkillList)
                    {
                        SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj);
                        int skillId = tarObj.GetSkillID(skillInfo);
                        if (skillLogic != null)
                        {
                            SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId);
                            if (damage.value >= 0)
                            {
                                skillLogic.OnBeHurt(tarObj, realSrcObj, damage, skillInfo, skillConfig);
                            }
                            else
                            {
                                skillLogic.OnBeHeal(tarObj, realSrcObj, damage, skillInfo, skillConfig);
                            }
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId));
                        }
                    }
                }
                //Target buff fix
                if (tarBuffList != null)
                {
                    foreach (var buffInfo in tarBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj);
                        int buffId = tarObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId);
                            if (damage.value >= 0)
                            {
                                buffLogic.OnBeHurt(tarObj, realSrcObj, damage, buffInfo, buffConfig);
                            }
                            else
                            {
                                buffLogic.OnBeHeal(tarObj, realSrcObj, damage, buffInfo, buffConfig);
                            }
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId));
                        }
                    }
                }
            }

            if (tarObj.IsDead())
            {
                if (tarSkillList != null)
                {
                    foreach (var skillInfo in tarSkillList)
                    {
                        SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj);
                        int skillId = tarObj.GetSkillID(skillInfo);
                        if (skillLogic != null)
                        {
                            SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId);
                            skillLogic.OnDie(tarObj, realSrcObj, skillInfo, skillConfig);
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId));
                        }
                    }
                }
                //Target buff fix
                if (tarBuffList != null)
                {
                    foreach (var buffInfo in tarBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj);
                        int buffId = tarObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId);
                            buffLogic.OnDie(tarObj, realSrcObj, buffInfo, buffConfig);
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId));
                        }
                    }
                }
                bool ret = tarObj.OnDie(realSrcObj);
            }
        }
Пример #5
0
 private static void DamageFix(SkillObj tarObj, SkillObj srcObj, Damage damage)
 {
     if(tarObj == null)
     {
         return;
     }
     if(srcObj != null)
     {
         var srcSkillList = srcObj.GetSkillList();
         var srcBuffList = srcObj.GetBuffList();
         //Source skill fix
         if(srcSkillList != null)
         {
             foreach (var skillInfo in srcSkillList)
             {
                 SkillLogic skillLogic = GetSkillLogic(skillInfo, srcObj);
                 int skillId = srcObj.GetSkillID(skillInfo);
                 if (skillLogic != null)
                 {
                     SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId);
                     skillLogic.DamageTargetFix(srcObj, tarObj, damage, skillInfo, skillConfig);
                 }
                 else
                 {
                     srcObj.LogInfo("something error in BattleModule.DamageFix src skill:[{0}]".F(skillId));
                 }
             }
         }
         //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 skillConfig = srcObj.GetBuffConfig(buffId);
                     buffLogic.DamageTargetFix(srcObj, tarObj, damage, buffInfo, skillConfig);
                 }
                 else
                 {
                     srcObj.LogInfo("something error in BattleModule.DamageFix src buff:[{0}]".F(buffId));
                 }
             }
         }
     }
     {
         var tarBuffList = tarObj.GetBuffList();
         var tarSkillList = tarObj.GetSkillList();
         //Target skill fix
         if (tarSkillList != null)
         {
             foreach (var skillInfo in tarSkillList)
             {
                 SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj);
                 int skillId = tarObj.GetSkillID(skillInfo);
                 if (skillLogic != null)
                 {
                     SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId);
                     skillLogic.BeHurtDamageFix(tarObj, srcObj, damage, skillInfo, skillConfig);
                 }
                 else
                 {
                     tarObj.LogInfo("something error in BattleModule.DamageFix tar skill:[{0}]".F(skillId));
                 }
             }
         }
         //Target buff fix
         if (tarBuffList != null)
         {
             foreach (var buffInfo in tarBuffList)
             {
                 BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj);
                 int buffId = tarObj.GetBuffID(buffInfo);
                 if (buffLogic != null)
                 {
                     BuffConfig_New skillConfig = tarObj.GetBuffConfig(buffId);
                     buffLogic.BeHurtDamageFix(tarObj, srcObj, damage, buffInfo, skillConfig);
                 }
                 else
                 {
                     tarObj.LogInfo("something error in BattleModule.DamageFix tar buff:[{0}]".F(buffId));
                 }
             }
         }
     }
 }
Пример #6
0
 private static void CalcDamage(SkillObj tarObj, SkillObj srcObj, Damage damage)
 {
     if (tarObj == null)
     {
         return;
     }
     tarObj.CalcDamage(damage, srcObj);
 }
Пример #7
0
        /// <summary>
        /// 造成伤害或治疗
        /// </summary>
        /// <param name="tarObj"></param>
        /// <param name="srcObj"></param>
        /// <param name="damage">大于0是伤害,小于0是治疗</param>
        public static void DamageTarget(SkillObj tarObj, SkillObj srcObj, Damage damage)
        {
            SkillObj realSrcObj = srcObj;

            if (tarObj == null || tarObj.IsDead())
            {
                return;
            }
            if (realSrcObj != null && damage.srcId > 0 && realSrcObj.GetID() != damage.srcId)
            {
                realSrcObj = tarObj.GetSkillObj(damage.srcId);
            }
            BattleModule.CalcDamage(tarObj, realSrcObj, damage);
            //先修正伤害
            BattleModule.DamageFix(tarObj, realSrcObj, damage);
            //质量和造成伤害都是这个
            //造成伤害
            if (damage.value >= 0)
            {
                tarObj.OnDamage(damage, realSrcObj);
            }
            else
            {
                tarObj.OnDamage(damage, realSrcObj);
            }
            //检查技能与BUFF的相应触发
            if (realSrcObj != null && !realSrcObj.IsDead())
            {
                var srcSkillList = realSrcObj.GetSkillList();
                var srcBuffList  = realSrcObj.GetBuffList();
                //Source skill fix
                if (srcSkillList != null)
                {
                    foreach (var skillInfo in srcSkillList)
                    {
                        SkillLogic skillLogic = GetSkillLogic(skillInfo, realSrcObj);
                        int        skillId    = realSrcObj.GetSkillID(skillInfo);
                        if (skillLogic != null)
                        {
                            SkillConfig_New skillConfig = realSrcObj.GetSkillConfig(skillId);
                            if (damage.value >= 0)
                            {
                                skillLogic.OnDamageTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig);
                            }
                            else
                            {
                                skillLogic.OnHealTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig);
                            }
                        }
                        else
                        {
                            realSrcObj.LogInfo("something error in BattleModule.DamageTarget src skill:[{0}]".F(skillId));
                        }
                    }
                }
                //Source buff fix
                if (srcBuffList != null)
                {
                    foreach (var buffInfo in srcBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, realSrcObj);
                        int       buffId    = realSrcObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = realSrcObj.GetBuffConfig(buffId);
                            if (damage.value >= 0)
                            {
                                buffLogic.OnDamageTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig);
                            }
                            else
                            {
                                buffLogic.OnHealTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig);
                            }
                        }
                        else
                        {
                            realSrcObj.LogInfo("something error in BattleModule.DamageTarget src buff:[{0}]".F(buffId));
                        }
                    }
                }
            }

            var tarSkillList = tarObj.GetSkillList();
            var tarBuffList  = tarObj.GetBuffList();

            //Target skill fix
            if (!tarObj.IsDead())
            {
                if (tarSkillList != null)
                {
                    foreach (var skillInfo in tarSkillList)
                    {
                        SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj);
                        int        skillId    = tarObj.GetSkillID(skillInfo);
                        if (skillLogic != null)
                        {
                            SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId);
                            if (damage.value >= 0)
                            {
                                skillLogic.OnBeHurt(tarObj, realSrcObj, damage, skillInfo, skillConfig);
                            }
                            else
                            {
                                skillLogic.OnBeHeal(tarObj, realSrcObj, damage, skillInfo, skillConfig);
                            }
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId));
                        }
                    }
                }
                //Target buff fix
                if (tarBuffList != null)
                {
                    foreach (var buffInfo in tarBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj);
                        int       buffId    = tarObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId);
                            if (damage.value >= 0)
                            {
                                buffLogic.OnBeHurt(tarObj, realSrcObj, damage, buffInfo, buffConfig);
                            }
                            else
                            {
                                buffLogic.OnBeHeal(tarObj, realSrcObj, damage, buffInfo, buffConfig);
                            }
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId));
                        }
                    }
                }
            }

            if (tarObj.IsDead())
            {
                if (tarSkillList != null)
                {
                    foreach (var skillInfo in tarSkillList)
                    {
                        SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj);
                        int        skillId    = tarObj.GetSkillID(skillInfo);
                        if (skillLogic != null)
                        {
                            SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId);
                            skillLogic.OnDie(tarObj, realSrcObj, skillInfo, skillConfig);
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId));
                        }
                    }
                }
                //Target buff fix
                if (tarBuffList != null)
                {
                    foreach (var buffInfo in tarBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj);
                        int       buffId    = tarObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId);
                            buffLogic.OnDie(tarObj, realSrcObj, buffInfo, buffConfig);
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId));
                        }
                    }
                }
                bool ret = tarObj.OnDie(realSrcObj);
            }
        }
Пример #8
0
 private static void DamageFix(SkillObj tarObj, SkillObj srcObj, Damage damage)
 {
     if (tarObj == null)
     {
         return;
     }
     if (srcObj != null)
     {
         var srcSkillList = srcObj.GetSkillList();
         var srcBuffList  = srcObj.GetBuffList();
         //Source skill fix
         if (srcSkillList != null)
         {
             foreach (var skillInfo in srcSkillList)
             {
                 SkillLogic skillLogic = GetSkillLogic(skillInfo, srcObj);
                 int        skillId    = srcObj.GetSkillID(skillInfo);
                 if (skillLogic != null)
                 {
                     SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId);
                     skillLogic.DamageTargetFix(srcObj, tarObj, damage, skillInfo, skillConfig);
                 }
                 else
                 {
                     srcObj.LogInfo("something error in BattleModule.DamageFix src skill:[{0}]".F(skillId));
                 }
             }
         }
         //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 skillConfig = srcObj.GetBuffConfig(buffId);
                     buffLogic.DamageTargetFix(srcObj, tarObj, damage, buffInfo, skillConfig);
                 }
                 else
                 {
                     srcObj.LogInfo("something error in BattleModule.DamageFix src buff:[{0}]".F(buffId));
                 }
             }
         }
     }
     {
         var tarBuffList  = tarObj.GetBuffList();
         var tarSkillList = tarObj.GetSkillList();
         //Target skill fix
         if (tarSkillList != null)
         {
             foreach (var skillInfo in tarSkillList)
             {
                 SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj);
                 int        skillId    = tarObj.GetSkillID(skillInfo);
                 if (skillLogic != null)
                 {
                     SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId);
                     skillLogic.BeHurtDamageFix(tarObj, srcObj, damage, skillInfo, skillConfig);
                 }
                 else
                 {
                     tarObj.LogInfo("something error in BattleModule.DamageFix tar skill:[{0}]".F(skillId));
                 }
             }
         }
         //Target buff fix
         if (tarBuffList != null)
         {
             foreach (var buffInfo in tarBuffList)
             {
                 BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj);
                 int       buffId    = tarObj.GetBuffID(buffInfo);
                 if (buffLogic != null)
                 {
                     BuffConfig_New skillConfig = tarObj.GetBuffConfig(buffId);
                     buffLogic.BeHurtDamageFix(tarObj, srcObj, damage, buffInfo, skillConfig);
                 }
                 else
                 {
                     tarObj.LogInfo("something error in BattleModule.DamageFix tar buff:[{0}]".F(buffId));
                 }
             }
         }
     }
 }
Пример #9
0
 public virtual Damage BeHurtDamageFix(SkillObj self, SkillObj source, Damage damage, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     return(damage);
 }
Пример #10
0
 public virtual Damage BeHealFix(SkillObj self, SkillObj source, Damage heal, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     return(heal);
 }
Пример #11
0
 //public virtual double HitRateRefix(SkillObj self, int skillId, double rate, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { return rate; }
 //public virtual double CriticalRateRefix(SkillObj self, int skillId, double rate, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { return rate; }
 public virtual Damage DamageTargetFix(SkillObj self, SkillObj target, Damage damage, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     return(damage);
 }
Пример #12
0
 public virtual void OnHealTarget(SkillObj self, SkillObj target, Damage heal, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     //OnDamageTarget(self, target, -heal, buffInfo, buffConfig);
 }
Пример #13
0
 public virtual void OnDamageTarget(SkillObj self, SkillObj target, Damage damage, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
 }
Пример #14
0
 public virtual void OnBeHeal(SkillObj self, SkillObj attacker, Damage heal, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     //OnBeHurt(self, attacker, -heal, buffInfo, buffConfig);
 }
Пример #15
0
 public virtual void OnBeHurt(SkillObj self, SkillObj attacker, Damage damage, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
 }