Beispiel #1
0
        public static void CheckHitEffectAfter(LiveMonster src, LiveMonster dest, HitDamage dam)
        {
            if (!src.BuffManager.HasBuff(BuffEffectTypes.NoSkill))
            {
                src.SkillManager.CheckHitEffectAfter(src, dest, dam);
            }

            if (!dest.BuffManager.HasBuff(BuffEffectTypes.NoSkill))
            {
                dest.SkillManager.CheckHitEffectAfter(src, dest, dam);
            }
        }
Beispiel #2
0
 public FlowDamageInfo(HitDamage dam, Point point) 
     : base("", point, 3, "Coral", 0, -10, 0, 2, 30)
 {
     damage = dam;
     word = damage.Value.ToString();
     if (damage.IsCrt)
     {
         size += 6;//±©»÷×ÖÌå·Å´ó£¬Òƶ¯ËٶȼõÂý
         font.Dispose();
         font = new Font("΢ÈíÑźÚ", this.size * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
         speedY --;//-4
         word = damage.Value.ToString() + "!";
     }
 }
Beispiel #3
0
        public static HitDamage GetDamage(LiveMonster src, LiveMonster dest)
        {
            HitDamage damage;
            double attrRateOn = 1; //属性相克的伤害修正
            bool isCrt = false;
            if (dest.Avatar.MonsterConfig.AttrDef != null)
            {
                attrRateOn -= dest.Avatar.MonsterConfig.AttrDef[src.AttackType];
            }

            if (src.RealCrt > 0)//存在暴击率
            {
                if (MathTool.GetRandom(100) < src.RealCrt * GameConstants.CrtToRate)
                {
                    attrRateOn *= (GameConstants.DefaultCrtDamage + src.CrtDamAddRate);
                    isCrt = true;
                }
            }

            var realAttackType = MonsterBook.HasTag(src.CardId, "mattack") ? src.Attr : src.AttackType;
            if (realAttackType == 0)//物理攻击
            {
                var damValue = Math.Max(1, (int)(src.RealAtk*(100-dest.RealDef*GameConstants.DefToRate)/100f * attrRateOn));//至少有1点伤害
                var noDefDamValue = (int)(src.RealAtk * attrRateOn);
                damage = new HitDamage(damValue, noDefDamValue, 0, DamageTypes.Physical);
            }
            else
            {
                var damValue = (int)(src.RealAtk * (100 + src.RealMag * GameConstants.MagToRate) / 100f * attrRateOn);
                damage = new HitDamage(damValue, damValue, realAttackType, DamageTypes.Magic);
                dest.CheckMagicDamage(damage);
            }
            damage.IsCrt = isCrt;

            bool nodef = false; //无视防御
            if (!src.BuffManager.HasBuff(BuffEffectTypes.NoSkill))
            {
                src.SkillManager.CheckDamage(src, dest, true, damage, ref nodef);
            }
            if (!dest.BuffManager.HasBuff(BuffEffectTypes.NoSkill))
            {
                dest.SkillManager.CheckDamage(src, dest, false, damage, ref nodef);
            }

            damage.SetDamage(DamageTypes.All, damage.Value);
            return damage;
        }
Beispiel #4
0
 public void OnMagicDamage(IMonster source, double damage, int element)
 {
     var dam = new HitDamage((int) damage, (int) damage, element, DamageTypes.Magic);
     Life -= SkillAssistant.GetMagicDamage(this, dam);
     lastDamagerId = source == null ? 0 : source.Id;
     OnDamage(dam);
 }
Beispiel #5
0
 private void OnDamage(HitDamage damage)
 {
     BattleManager.Instance.BattleInfo.GetPlayer(!IsLeft).DamageTotal+=damage.Value;
     BattleManager.Instance.FlowWordQueue.Add(new FlowDamageInfo(damage, CenterPosition), false);//掉血显示
 }
Beispiel #6
0
        private void CheckDamageBuffEffect(LiveMonster src, HitDamage dam)
        {
            if (dam.Dtype == DamageTypes.Physical)
            {
                if (BuffManager.HasBuff(BuffEffectTypes.Chaos) && MathTool.GetRandom(100) < 25)
                {
                    src.Life -= dam.Value;
                    dam.SetDamage(DamageTypes.Physical, 0);
                }
            }

            if (BuffManager.HasBuff(BuffEffectTypes.Shield))
            {
                dam.SetDamage(DamageTypes.All, 1);
            }
        }
Beispiel #7
0
 public void CheckMagicDamage(HitDamage damage)
 {
     if (damage.Element>0&&antiMagic[damage.Element-1]>0)
     {
         damage.SetDamage(DamageTypes.Magic,Math.Max(damage.Value*(100 - antiMagic[damage.Element - 1])/100,0));
     }
 }
Beispiel #8
0
 public static int GetMagicDamage(LiveMonster dest, HitDamage damage)
 {
     if (damage.Dtype == DamageTypes.Magic)
     {
         dest.CheckMagicDamage(damage);
     }
     return damage.Value;
 }
Beispiel #9
0
 /// <summary>
 /// 判定伤害后技能影响
 /// </summary>
 /// <param name="src">攻击者</param>
 /// <param name="dest">受击者</param>
 /// <param name="damage">伤害值</param>
 public void CheckHitEffectAfter(LiveMonster src, LiveMonster dest, HitDamage damage)
 {
     foreach (MemBaseSkill skill in Skills.ToArray())
     {
         var key = MemBaseSkill.GetBurstKey(src.Id, dest.Id);
         if (skill.IsBurst(key))
         {
             skill.CheckHitEffectAfter(src, dest, damage, key);
         }
     }
 }
Beispiel #10
0
 /// <summary>
 /// 判定伤害技能影响
 /// </summary>
 /// <param name="src">攻击者</param>
 /// <param name="dest">受击者</param>
 /// <param name="isActive">是否主动</param>
 /// <param name="damage">伤害值</param>
 /// <param name="nodef">无视防御</param>
 public void CheckDamage(LiveMonster src, LiveMonster dest, bool isActive, HitDamage damage, ref bool nodef)
 {
     foreach (var skill in Skills.ToArray())
     {
         var key = MemBaseSkill.GetBurstKey(src.Id, dest.Id);
         if (skill.IsBurst(key))
         {
             skill.CheckDamage(src, dest, isActive, damage, ref nodef, key);
         }
     }
 }
Beispiel #11
0
        public void CheckHitEffectAfter(LiveMonster src, LiveMonster dest, HitDamage damage, int key)
        {
            if (SkillInfo.SkillConfig.AfterHit != null)
            {
                SkillInfo.SkillConfig.AfterHit(SkillInfo, src, dest, damage, Level);
                SendSkillIcon(key);
                if (SkillInfo.SkillConfig.EffectArea != "")
                {
                    SendAreaEffect(SkillInfo.SkillConfig.PointSelf ? Self.Position : dest.Position);
                }
            }

            if (SkillInfo.SkillConfig.DeathHit != null && !dest.IsAlive)
            {
                SkillInfo.SkillConfig.DeathHit(SkillInfo, src, dest, damage, Level);
                SendSkillIcon(key);
                if (SkillInfo.SkillConfig.EffectArea != "")
                {
                    SendAreaEffect(SkillInfo.SkillConfig.PointSelf ? Self.Position : dest.Position);
                }
            }

        }
Beispiel #12
0
 public void CheckDamage(LiveMonster src, LiveMonster dest, bool isActive, HitDamage damage, ref bool nodef, int key)
 {
     if (SkillInfo.SkillConfig.CheckDamage != null)
     {
         SkillInfo.SkillConfig.CheckDamage(src, dest, isActive, damage, ref nodef, Level);
         SendSkillIcon(key);
     }
 }