Ejemplo n.º 1
0
            public static uint MagicPlayerVsPlayer(Entities.Character Attacker, Entities.Character Attacked, Skills.Skill Skill)
            {
                uint Damage = 0;

                switch (Skill.SkillInfo.DamageType)
                {
                    #region Magic
                case Enums.DamageType.Magic:
                {
                    Damage = Skill.SkillInfo.Damage;
                    Damage = (uint)((double)(Damage + Attacker.MagicAttack) * (1 + ((double)Attacker.PhoenixGemBonus / 100)));
                    Damage = (uint)((double)Damage * (1 - ((double)Attacked.MDefenseByPct / 100)));
                    if (Attacked.MDefenseByVal >= Damage)
                    {
                        Damage = 1;
                    }
                    else
                    {
                        Damage -= Attacked.MDefenseByVal;
                    }
                    Damage = (uint)((double)(Damage * Skill.SkillInfo.EffectValue));
                    break;
                }

                    #endregion
                    #region Ranged
                case Enums.DamageType.Ranged:
                {
                    Damage = (uint)Program.Random.Next(Attacker.MinAttack, Attacker.MaxAttack);
                    Damage = (uint)((double)Damage * (1 + (Attacker.DragonGemBonus / 100)));
                    Damage = (uint)((double)Damage * Skill.SkillInfo.EffectValue);
                    Damage = (uint)((double)Damage * ((double)(210 - Attacked.Dodge) / 100));
                    Damage = (uint)(Math.Min(1, Damage * (Attacked.Dodge * .01)));
                    Damage = (uint)((double)Damage * .15);
                    break;
                }

                    #endregion
                    #region Melee
                case Enums.DamageType.Melee:
                {
                    Damage = (uint)Program.Random.Next(Attacker.MinAttack, Attacker.MaxAttack);
                    Damage = (uint)((double)Damage * (1 + (Attacker.DragonGemBonus / 100)));
                    Damage = (uint)((double)Damage * Skill.SkillInfo.EffectValue);
                    if (Attacked.PDefense >= Damage)
                    {
                        Damage = 1;
                    }
                    else
                    {
                        Damage -= Attacked.PDefense;
                    }
                    break;
                }

                    #endregion
                    #region HealHP
                case Enums.DamageType.HealHP: return(Skill.SkillInfo.Damage);

                    #endregion
                    #region HealMP
                case Enums.DamageType.HealMP: return(Skill.SkillInfo.Damage);

                    #endregion
                default: break;
                }
                return(Math.Max(1, Damage));
            }
Ejemplo n.º 2
0
            public static uint MagicPlayerVsMonster(Entities.Character Attacker, Entities.Monster Attacked, Skills.Skill Skill)
            {
                uint Damage = 0;

                switch (Skill.SkillInfo.DamageType)
                {
                    #region Magic
                case Enums.DamageType.Magic:
                {
                    Damage = Skill.SkillInfo.Damage;
                    Damage = (uint)((double)(Damage + Attacker.MagicAttack) * (1 + ((double)Attacker.PhoenixGemBonus / 100)));
                    if (Attacked.Info.MagicDefense >= Damage)
                    {
                        Damage = 1;
                    }
                    else
                    {
                        Damage -= Attacked.Info.MagicDefense;
                    }
                    Damage = (uint)((double)(Damage * Skill.SkillInfo.EffectValue));
                    break;
                }

                    #endregion
                    #region Ranged
                case Enums.DamageType.Ranged:
                {
                    Damage = (uint)Program.Random.Next(Attacker.MinAttack, Attacker.MaxAttack);
                    Damage = (uint)((double)Damage * (1 + (Attacker.DragonGemBonus / 100)));
                    Damage = (uint)((double)Damage * ((double)(210 - Attacked.Info.Dodge) / 100));
                    Damage = (uint)((double)Damage * Skill.SkillInfo.EffectValue);
                    Damage = (uint)(Math.Min(1, Damage * (Attacked.Info.Dodge * .01)));
                    break;
                }

                    #endregion
                    #region Melee
                case Enums.DamageType.Melee:
                {
                    Damage = (uint)Program.Random.Next(Attacker.MinAttack, Attacker.MaxAttack);
                    Damage = (uint)((double)Damage * (1 + (Attacker.DragonGemBonus / 100)));
                    if (Attacked.Info.Defense >= Damage)
                    {
                        Damage = 1;
                    }
                    else
                    {
                        Damage -= Attacked.Info.Defense;
                    }
                    Damage = (uint)((double)Damage * Skill.SkillInfo.EffectValue);
                    break;
                }

                    #endregion
                    #region HealHP
                case Enums.DamageType.HealHP: return(Skill.SkillInfo.Damage);

                    #endregion
                    #region HealMP
                case Enums.DamageType.HealMP: return(Skill.SkillInfo.Damage);

                    #endregion
                default: break;
                }
                if (Attacker.Level > Attacked.Info.Level)
                {
                    int dLvl = Attacker.Level - Attacked.Info.Level;
                    if (dLvl >= 3 && dLvl <= 5)
                    {
                        Damage = (uint)(Damage * 1.5);
                    }
                    else if (dLvl > 5 && dLvl <= 10)
                    {
                        Damage *= 2;
                    }
                    else if (dLvl > 10 && dLvl <= 20)
                    {
                        Damage *= 3;
                    }
                    else if (dLvl > 20)
                    {
                        Damage = (uint)(Damage * (1 + (.3 * dLvl / 5)));
                    }
                }
                return(Math.Max(1, Damage));
            }