Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using COServer.Network.GamePackets;
- using COServer.Game.ConquerStructures;
- namespace COServer.Game.Attacking
- {
- public class Calculate
- {
- #region Nuevos Magics
- public static int CreatePenetration(Player attacker, Player attacked, ref MsgInteract Packet, int Damage)
- {
- //EfectosPerfectos effect = EfectosPerfectos.InvisibleArrow;
- //byte chance = 0;
- //new MsgRefineEffect().HandleInvisibleArrow(attacker, ref chance);
- //if (attacked != null && Kernel.Rate(chance))
- //{
- // new MsgRefineEffect().SendEffect(attacker, attacked, effect);
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);
- // Packet.Effect1 |= Attack.AttackEffects1.Penetration;
- //}
- if (Kernel.Rate((float)attacker.Penetration / 10f))
- {
- Damage = (Int32)Math.Floor((float)Damage * 1.2);
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- return Damage;
- }
- public static int CalculateSkillCryitical(Player AttackerClient, Player AttackedClient, ref MsgInteract Packet, int damage)
- {
- //if (AttackerClient != null && AttackerClient.EntityFlag == EntityFlag.Player)
- //{
- // EfectosPerfectos effect = EfectosPerfectos.CoreStrike;
- // byte chance = 0;
- // new MsgRefineEffect().HandleCoreStrike(AttackerClient, ref chance);
- // if (Kernel.Rate(chance))
- // {
- // new MsgRefineEffect().SendEffect(AttackerClient, AttackedClient, effect);
- // Packet.Effect1 |= Attack.AttackEffects1.CriticalStrike;
- // return damage *= (int)1.5;
- // }
- //}
- if (AttackedClient == null && AttackerClient != null && AttackerClient.PlayerFlag == PlayerFlag.Player)
- {
- int Critical = AttackerClient.SkillCStrike / 100;
- Critical /= 2;
- if (Kernel.Rate(Critical))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- return damage *= (int)1.5;
- }
- }
- if (AttackerClient.SkillCStrike == AttackedClient.Immunity)
- return damage;
- if (AttackerClient.SkillCStrike > AttackedClient.Immunity)
- {
- int Critical = AttackerClient.SkillCStrike / 100;
- int Immunity = AttackedClient.Immunity / 100;
- int Power = Critical - Immunity;
- if (Kernel.Rate(Power))
- {
- return damage *= (int)1.5;
- }
- }
- return damage;
- }
- public static int CalculateMagicPotencyDamage(Player AttackerClient, Player AttackedClient, int damage)
- {
- if (AttackerClient.BattlePower == AttackedClient.BattlePower)
- return damage;
- if (AttackerClient.BattlePower > AttackedClient.BattlePower)
- {
- int power = (int)(AttackerClient.BattlePower - AttackedClient.BattlePower);
- if (power > 12)
- power = 12;
- damage += (damage * power) / 30;
- }
- else
- {
- int power = (int)(AttackedClient.BattlePower - AttackerClient.BattlePower);
- if (power > 12)
- power = 12;
- damage -= (damage * power) / 30;
- }
- return damage;
- }
- public static Boolean ChanceSuccess(Double Chance, Double offset = 0)
- {
- Random Rand = new Random();
- if (Chance <= 0) return false;
- else if (Chance >= 100) return true;
- return ((float)Rand.Next(1, 1000000) / 10000d >= (100d + offset) - Chance);
- }
- public static uint AtaquesMagicos(Player Attacker, Player Attacked, Database.SpellInformation SInfo, ref MsgInteract Packet, byte SkillSoul = 0)
- {
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- BlessEffect.Process(Attacked);
- }
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- GemEffect.Process(Attacker);
- }
- Boolean CritImmune = false;
- switch (Attacked.PlayerFlag)
- {
- case PlayerFlag.Player:
- {
- Int32 Damage = 0;
- Int32 Defence = 0;
- #region Float Inmunnity - Contra Otros
- if (ChanceSuccess((float)Attacked.Immunity / 100f))
- {
- CritImmune = true;
- }
- #endregion
- #region Tesoros
- Int32 Fan = 0, Tower = 0, WingThunder = 0, WingGlory = 0;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- Fan = Attacker.getFan(true);
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- WingThunder = Attacker.getWingsThunder(true);
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- Tower = Attacked.getTower(true);
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- WingGlory = Attacked.getWingsGlory(true);
- #endregion
- #region Codigo Base Ataque / Defensa
- Double attack = SInfo.Power;
- attack += (uint)Attacker.MagicAttack;
- Damage = (int)attack;// (int)Attacker.MagicAttack;
- Defence = (Int32)Attacked.MagicDefence;
- Defence += (Int32)Attacked.MagicDamageDecrease;
- #endregion
- #region Tesoros
- Damage += Fan;
- Damage += WingThunder;
- Damage -= Tower;
- Damage -= WingGlory;
- #endregion
- #region Variable + Damage
- #region MagicDamage Increase Stat
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- Damage += Attacker.MagicDamageIncrease;
- #endregion
- #region Daño Extra Por Reborns
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Attacked.Reborn == 1)
- Damage = (Int32)(Damage * 0.40);
- if (Attacked.Reborn == 2)
- Damage = (Int32)(Damage * 0.60);
- }
- #endregion
- #endregion
- #region Variable - Damage
- Damage -= Defence;
- #endregion
- #region Atributos
- #region SkillCriticalStrike
- if (Kernel.Rate((int)(Attacker.SkillCStrike - Attacked.Immunity) / 100))//Para Taoistas
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- {
- Damage = (int)(Damage * 1.6);
- }
- }
- if (!CritImmune)//Para Otras Clases
- {
- if (ChanceSuccess((float)Attacker.SkillCStrike / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- Damage = (Int32)Math.Floor((float)Damage * 1.6);
- }
- }
- #endregion
- #region Block
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (ChanceSuccess((float)Attacked.Block / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- Damage = (Int32)Math.Floor((float)Damage / 2);
- }
- }
- #endregion
- #region Penetration
- Damage = CreatePenetration(Attacker, null, ref Packet, Damage);
- #endregion
- #region GemBounes
- var bonus = attacker.Gems[0];
- if (bonus > 0)
- {
- Damage += MathHelper.MulDiv((int)Damage, (int)bonus, (int)100);
- }
- #endregion
- /// ATRIBUTOS PERFECTOS ///
- #region All MagicsAttack
- //new MsgRefineEffect().HandleMagicPerfectsAttacks(Attacker, Attacked, ref Damage);
- #endregion
- #endregion
- #region BattlePower
- if (Attacker.BattlePower >= 379 && Attacker.BattlePower <= 406)
- {
- if (Attacker.SkillCStrike > 0)
- {
- if (Attacker.SkillCStrike > Attacked.Immunity)
- {
- double Power = (double)(Attacker.SkillCStrike - Attacked.Immunity);
- Power = (double)(Power / 100);
- if (MyMath.Success(Power))
- Damage += Damage * 25 / 100;
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- }
- else
- Packet.Effect |= MsgInteract.InteractEffects.Immu;
- }
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- //Damage += Damage * CustomSettings.AttackBattle.BattlePower.PowHighEnd / 100;
- }
- if (Attacker.BattlePower >= 309 && Attacker.BattlePower <= 378)
- {
- if (Attacker.Penetration > 0)
- {
- if (Attacker.Penetration > Attacked.Counteraction)
- {
- double Power = (double)(Attacker.Penetration - Attacked.Counteraction);
- Power = (double)(Power / 100);
- if (MyMath.Success(Power))
- Damage += Damage * 30 / 100;
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- else
- Packet.Effect |= MsgInteract.InteractEffects.Immu;
- }
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- //Damage += Damage * CustomSettings.AttackBattle.BattlePower.PowHighEnd / 100;
- }
- #endregion
- #region Extra Effect Skill Soul [Arte Marcial
- // Damage += (Damage * (SkillSoul * 10) / 100);// 10% Total Dmg From Skill Soul Level Skills
- #endregion
- AutoRespone(Attacker, Attacked, ref Damage);
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- if (Attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (Constants.Damage1Map.Contains(Attacker.MapID))
- Damage = 1;
- if (Damage <= 0)
- Damage = 1;
- return (uint)Damage;
- }
- case PlayerFlag.Monster:
- {
- Int32 Damage = 0;
- Int32 Defence = 0;
- Int32 Fan = 0;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- Fan = Attacker.getFan(true);
- Damage = (int)Attacker.MagicAttack;
- if (SInfo != null)
- Damage += (int)SInfo.Power;
- Defence = Attacked.MonsterInfo.Level * 20;
- if (Attacked.MonsterInfo != null)
- if (Attacked.Name == "Guard1")
- Damage = 1;
- Damage += Fan;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- Damage += Attacker.MagicDamageIncrease;
- Damage *= (int)(2.5);
- //Damage += (int)bpdamage;
- Damage -= Defence;
- if (!CritImmune)
- {
- if (ChanceSuccess((float)Attacker.SkillCStrike / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- Damage = (Int32)Math.Floor((float)Damage * 1.2);
- }
- }
- if (Damage <= 1) Damage = 1;
- if (Constants.Damage1Map.Contains(Attacker.MapID))
- Damage = 1;
- return (UInt32)Damage;
- }
- }
- return 0;
- }
- #endregion
- #region NEW MELEE TO TEST
- public static int MulDiv(int number, int numerator, int denominator)
- {
- return (number * numerator /*+ denominator / 2*/) / denominator;
- }
- public static long BigMulDiv(long number, long numerator, long denominator)
- {
- return (number * numerator + denominator / 2) / denominator;
- }
- public static int CalculatePotencyDamage(int Damage, int AttackerBattle, int TargetBattle, bool range = false)
- {
- if (AttackerBattle == TargetBattle)
- return Damage;
- int power = AttackerBattle - TargetBattle;
- if (power != 0)
- {
- power = power * (range ? 10 : 3);
- //3
- if (power > 0)
- {
- power = Math.Min(60, power);
- }
- else if (power < 0)
- {
- power = Math.Max(-60, power);
- }
- Damage = MulDiv(Damage, 100 + power, 100);
- }
- return Damage;
- }
- public static uint NewWork(Player attacker, Player attacked, ref MsgInteract Packet, Database.SpellInformation spell = null)
- {
- if (attacked.Name == "SilverOctopus") return 1;
- if (attacked.Name == "GoldenOctopus") return 1;
- if (Packet != null)
- {
- Packet.Effect = MsgInteract.InteractEffects.None;
- }
- if (attacked.Name == "Guard1" && attacker.PlayerFlag == PlayerFlag.Monster)
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- #region CheakMiss
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.DragonSwing))
- if (Kernel.ChanceSuccess(30))
- {
- MsgName str = new MsgName(true);
- str.UID = attacked.UID;
- str.TextsCount = 1;
- str.Type = MsgName.Effect;
- str.Texts.Add("poisonmiss");
- attacked.Owner.SendScreen(str, true);
- return 0;
- }
- #endregion
- }
- #region PvP -- Player Vs Player -- Jugador Contra Jugador
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (attacked.ContainsFlag((ulong)1UL << 53))
- return 1;
- Double Damage = 0;
- Double Reborn = 1.00;
- if (attacked.Reborn == 1)
- Reborn -= 0.30;
- else if (attacked.Reborn >= 2)
- Reborn -= 0.50;
- Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- #region AzureShield
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (Damage > attacked.AzureShieldDefence)
- {
- Damage -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- }
- else
- {
- CreateAzureDmg((uint)Damage, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)Damage;
- attacked.AzureShieldPacket();
- Damage = 1;
- }
- }
- #endregion
- #region Viejos Smash & Criticos
- //#region Breakthrough
- //if (attacker.PlayerFlag == PlayerFlag.Player)
- //{
- // if (attacker.BattlePower < attacked.BattlePower)
- // {
- // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 5f) - (float)(attacked.Counteraction / 5f)))
- // {
- // Damage = (Int32)Math.Floor((float)Damage * 1.2);// 10%
- // Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- // }
- // }
- //}
- //#endregion
- //#region Breakthrough -- Smash
- //if (attacker.PlayerFlag == PlayerFlag.Player)
- //{
- // if (attacker.BattlePower >= attacked.BattlePower)
- // {
- // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 5f) - (float)(attacked.Counteraction / 5f)))
- // {
- // Damage = (Int32)Math.Floor((float)Damage * 1.2);
- // Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- // }
- // }
- //}
- //#endregion
- //#region CriticalStrike
- //if (attacker.PlayerFlag == PlayerFlag.Player)
- //{
- // if (attacker.BattlePower < attacked.BattlePower)
- // {
- // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // Damage = (UInt32)Math.Floor((float)Damage * 1.2);
- // }
- // }
- //}
- //#endregion
- //#region CriticalStrike
- //if (attacker.PlayerFlag == PlayerFlag.Player)
- //{
- // if (attacker.BattlePower >= attacked.BattlePower)
- // {
- // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 50f) - ((float)attacked.Immunity / 50f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // Damage = (UInt32)Math.Floor((float)Damage * 1.3);
- // }
- // }
- //}
- //#endregion
- #endregion
- //Damage -= attacked.Defence;
- Damage *= Reborn;
- Boolean canBT = false, CritImmune = false;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- canBT = true;
- }
- }
- else canBT = false;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (canBT)
- {
- if (Kernel.Rate(((float)attacker.Breaktrough / 1f - (float)attacked.Counteraction / 2f)))
- {
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- Damage = (Int32)Math.Floor((float)Damage * 1.2);//20% de Daño
- }
- }
- }
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower >= attacked.BattlePower)
- {
- CritImmune = true;
- }
- }
- else CritImmune = false;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (CritImmune)
- {
- if (Kernel.Rate(((float)attacker.CriticalStrike / 1f - (float)attacked.Immunity / 2f)))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- Damage = (Int32)Math.Floor((float)Damage * 1.4);
- }
- }
- }
- #region Bless Reduction
- var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- Damage -= Damage * reduce / 90;
- }
- #endregion
- if (Damage < 1)
- Damage = 1;
- #region Sepll Bounes
- if (spell != null)
- {
- if (spell.ID != 12290)
- {
- if (spell.PowerPercent != 0)
- {
- Damage = (Double)(Damage * spell.PowerPercent);
- }
- }
- }
- #endregion
- #region GemBounes
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- Damage += MathHelper.MulDiv((int)Damage, (int)bonus, (int)100);
- }
- #endregion
- #region Superman & Stigma
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed && Damage > 1)
- Damage = (long)(Damage * 1.17);
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- Damage *= 1.0; //PvP Reduction!
- #endregion
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Action == Enums.ConquerAction.Sit)
- if (attacked.Stamina > 20)
- attacked.Stamina -= 20;
- else
- attacked.Stamina = 0;
- attacked.Action = Enums.ConquerAction.None;
- }
- if (attacker != null)
- {
- Damage += (Double)attacker.PhysicalDamageIncrease;
- }
- if (attacked != null)
- {
- Damage -= (Double)attacked.PhysicalDamageDecrease;
- }
- AutoRespone(attacker, attacked, ref Damage);
- #region Ataque segun Nobleza - by Angel Gabriel
- #region Rey
- if (attacker.NobilityRank == ConquerStructures.NobilityRank.Rey)
- {
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Rey)
- {
- Damage = (int)((double)Damage * 1.50);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duque)
- {
- Damage = (int)((double)Damage * 1.5);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Marques)
- {
- Damage = (int)((double)Damage * 1.6);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Conde)
- {
- Damage = (int)((double)Damage * 1.7);
- }
- }
- #endregion
- #region Prince
- if (attacker.NobilityRank == ConquerStructures.NobilityRank.Duque)
- {
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Rey)
- {
- Damage = (int)((double)Damage * 1.50);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duque)
- {
- Damage = (int)((double)Damage * 1.80);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Marques)
- {
- Damage = (int)((double)Damage * 1.55);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Conde)
- {
- Damage = (int)((double)Damage * 1.5);
- }
- }
- #endregion Prince
- #region Duke
- if (attacker.NobilityRank == ConquerStructures.NobilityRank.Marques)
- {
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Rey)
- {
- Damage = (int)((double)Damage * 1.43);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duque)
- {
- Damage = (int)((double)Damage * 1.48);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Marques)
- {
- Damage = (int)((double)Damage * 1.80);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Conde)
- {
- Damage = (int)((double)Damage * 1.5);
- }
- }
- #endregion Duke
- #region Conde
- if (attacker.NobilityRank == ConquerStructures.NobilityRank.Conde)
- {
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Rey)
- {
- Damage = (int)((double)Damage * 1.5);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duque)
- {
- Damage = (int)((double)Damage * 1.5);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Marques)
- {
- Damage = (int)((double)Damage * 1.5);
- }
- if (attacked.NobilityRank == ConquerStructures.NobilityRank.Conde)
- {
- Damage = (int)((double)Damage * 1.6);
- }
- }
- #endregion Earl
- #endregion
- #region Block
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(22))
- {
- if (attacked.Block > 0)
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- Damage = (Int32)Math.Floor((float)Damage / 2);
- }
- }
- }
- #endregion
- #region Reduction!
- #region tortoise
- double torist = (double)(attacked.Gems[GemTypes.Tortoise] / 100d);
- torist = (double)(1 - torist);
- torist = Math.Max(torist, 0.5);
- Damage *= torist;
- #endregion
- #region Clac Defence
- int nDef, defmain;
- if (!attacker.Transformed)
- nDef = defmain = attacked.Defence;
- else
- nDef = defmain = attacked.TransformationDefence;
- nDef = Handle.ShieldDefence(attacked, nDef);
- if (attacked.IsDefensiveStance)
- nDef *= 10;
- #endregion End Defence
- #region MagicShield
- if (!attacked.Transformed)
- {
- if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.MagicShield))
- {
- if (attacked.ShieldTime > 0)
- {
- if (Damage > (int)attacked.Defence)
- {
- Damage -= (int)attacked.Defence;
- }
- else
- Damage = 1;
- }
- else
- {
- if (Damage > (ushort)(attacked.Defence * attacked.MagicShieldIncrease))
- Damage -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- else
- Damage = 1;
- }
- }
- else
- {
- if (Damage > (int)attacked.Defence)
- {
- Damage -= (int)attacked.Defence;
- }
- else
- Damage = 1;
- }
- }
- else
- {
- if (Damage > attacked.TransformationDefence)
- {
- Damage -= attacked.TransformationDefence;
- }
- else
- Damage = 1;
- }
- #endregion
- #endregion
- if (Damage < 1)
- Damage = 1;
- return (UInt32)Math.Round(Damage, (Int32)0);
- }
- #endregion
- #region Player Vs Monster
- else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- {
- int Damage = 0;
- Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Melee, ref Packet);
- CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- return (uint)Damage;
- }
- #endregion
- else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (attacked.ContainsFlag((ulong)1UL << 53))
- return 1;
- Double Damage = 0;
- Double Reborn = 1.00;
- if (attacked.Reborn == 1)
- Reborn -= 0.30; //30%
- else if (attacked.Reborn >= 2)
- Reborn -= 0.50; //50%
- Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- Damage = AdjustDamageMonster2Player(Damage, attacker, attacked);
- Damage -= attacked.Defence;
- Damage *= Reborn;
- #region Bless Reduction
- var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- Damage -= Damage * reduce / 100;
- }
- #endregion
- if (Damage < 1)
- Damage = 1;
- Damage = AdjustMinDamageMonster2Player(Damage, attacker, attacked);
- #region Sell Bounes
- if (spell != null)
- {
- if (spell.PowerPercent != 0)
- {
- Damage = (long)(Damage * spell.PowerPercent);
- }
- }
- #endregion
- Damage -= attacked.PhysicalDamageDecrease;
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Action == Enums.ConquerAction.Sit)
- if (attacked.Stamina > 20)
- attacked.Stamina -= 20;
- else
- attacked.Stamina = 0;
- attacked.Action = Enums.ConquerAction.None;
- }
- if (attacker.OnSuperman())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- if (attacked.MonsterInfo.Boss)
- Damage *= 2;
- if (attacker.OnSuperman())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- Damage *= 2;
- if (attacker.OnFatalStrike())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- if (!attacked.MonsterInfo.Boss)
- Damage *= 5;
- else Damage += (int)(Damage * .1);
- if (Damage < 1)
- Damage = 1;
- #region Reduction!
- #region Clac Defence
- int nDef, defmain;
- if (!attacker.Transformed)
- nDef = defmain = attacked.Defence;
- else
- nDef = defmain = attacked.TransformationDefence;
- nDef = Handle.ShieldDefence(attacked, nDef);
- if (attacked.IsDefensiveStance)
- nDef *= 10;
- #endregion End Defence
- #endregion
- if (Damage < 1)
- Damage = 1;
- return (UInt32)Math.Round(Damage, (Int32)0);
- }
- if (attacker == null || attacked == null)
- return 0;
- long attack = 0;
- int defense = 0;
- if (attacker.PlayerFlag == PlayerFlag.Monster)
- if (attacked.PlayerFlag == PlayerFlag.Player)
- if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
- return 0;
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (attacked.ContainsFlag((ulong)1UL << 53))
- return 1;
- if (!attacker.Transformed)
- attack = attacker.MinAttack + random.Next((int)(attacker.MaxAttack - attacker.MinAttack));
- else
- attack = attacker.TransformationMinAttack +
- random.Next((int)(attacker.TransformationMaxAttack - attacker.TransformationMinAttack));
- if (attacker != null)
- {
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- attack += MathHelper.MulDiv((int)attack, (int)bonus, (int)100);
- }
- // TODO: proficiency bonus
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed && attack > 1)
- attack = (long)(attack * 1.05);
- if (spell != null)
- {
- if (spell.PowerPercent != 0)
- {
- attack = (long)(attack * spell.PowerPercent);
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reducee = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- if (reducee > 0)
- {
- attack -= (attack / 2) * reducee / 100;
- }
- }
- if (!attacked.Transformed)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.MagicShield))
- {
- if (attacked.ShieldTime > 0)
- attack -= attacked.Defence;
- else
- attack -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- }
- else
- {
- defense = attacked.Defence;
- }
- }
- else
- {
- attack -= attacked.TransformationDefence;
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- {
- defense = (defense * 70) / 100;
- }
- var damage = Math.Max(1, attack - defense);
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- {
- damage = CalcDamageUser2Monster((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- damage = MathHelper.MulDiv((int)damage, 10000, 10000);
- damage = AdjustMinDamageUser2Monster((int)damage, attacker, attacked);
- }
- else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- {
- damage = CalcDamageMonster2User((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- damage = MathHelper.MulDiv((int)damage, (attacked.Reborn != 0 && attacked.Class % 10 >= 3) ? 7000 : 10000,
- 10000);
- damage = AdjustMinDamageMonster2User((int)damage, attacker, attacked);
- }
- var reduceee = 10;
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (!attacked.Owner.Equipment.Free(3))
- {
- switch (attacked.Owner.Equipment.TryGetItem(3).ID % 10)
- {
- case 9:
- reduceee = 1000;
- break;
- case 8:
- reduceee = 500;
- break;
- case 7:
- reduceee = 200;
- break;
- case 6:
- reduceee = 100;
- break;
- }
- }
- }
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- var n = Math.Max(1, attacker.Owner.Player.Strength / reduceee);
- if (n > damage)
- {
- damage = n;
- }
- }
- damage = Math.Max(1, damage);
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- }
- if (attacked != null)
- {
- var reduces = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- if (reduces > 0)
- {
- damage -= damage * reduces / 100;
- }
- }
- if (attacker != null)
- {
- damage += attacker.PhysicalDamageIncrease;
- }
- if (attacked != null)
- {
- damage -= attacked.PhysicalDamageDecrease;
- }
- AutoRespone(attacker, attacked, ref damage);
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Oblivion))
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage *= 2;
- if (attacked.Action == Enums.ConquerAction.Sit)
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Stamina >= 20)
- attacked.Stamina -= 20;
- else
- attacked.Stamina = 0;
- }
- if (attacker.OnSuperman())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- if (attacked.MonsterInfo.Boss)
- damage *= 2;
- if (attacker.OnSuperman())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage *= 2;
- if (attacker.OnFatalStrike())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage *= 5;
- return Math.Max((uint)1, (uint)damage);
- }
- #endregion
- private static float
- reduceValue = 0.6f,
- goldPrizePsyAttackCoefficient = .2f,
- goldPrizeMagAttackCoefficient = .2f;
- public static int DefaultDefense2 = 10000;
- public static RandomLite random = new RandomLite();
- private static Int32 AdjustDamageMonster2Player(Double Damage, Player Attacker, Player Target)
- {
- Byte Level = 120;
- if (Attacker.Level < 120)
- Level = (Byte)Attacker.Level;
- if (Attacker.IsRed(Target))
- Damage *= 1.5;
- else if (Attacker.IsBlack(Target))
- {
- Int32 DeltaLvl = Target.Level - Level;
- if (DeltaLvl >= -10 && DeltaLvl <= -5)
- Damage *= 2.0;
- else if (DeltaLvl >= -20 && DeltaLvl < -10)
- Damage *= 3.5;
- else if (DeltaLvl < -20)
- Damage *= 5.0;
- }
- return Math.Max(0, (Int32)Damage);
- }
- private static Int32 AdjustMinDamagePlayer2Monster(Double Damage, Player Attacker, Player Target)
- {
- Int32 MinDmg = 1;
- MinDmg += (Int32)(Attacker.Level / 10);
- if (!Attacker.Owner.Equipment.Free(4))
- {
- MsgItemInfo Item = Attacker.Owner.Equipment.TryGetItem(4);
- if (Item != null)
- MinDmg += (int)Item.ID % 10;
- }
- return Math.Max(MinDmg, (Int32)Damage);
- }
- private static Int32 AdjustDamagePlayer2Monster(Double Damage, Player Attacker, Player Target)
- {
- if (!Target.IsGreen(Attacker))
- return Math.Max(0, (Int32)Damage);
- Int32 DeltaLvl = Attacker.Level - Target.Level;
- if (DeltaLvl >= 3 && DeltaLvl <= 5)
- Damage *= 1.5;
- else if (DeltaLvl > 5 && DeltaLvl <= 10)
- Damage *= 2;
- else if (DeltaLvl > 10 && DeltaLvl <= 20)
- Damage *= 2.5;
- else if (DeltaLvl > 20)
- Damage *= 3;
- else
- Damage *= 1;
- return Math.Max(0, (Int32)Damage);
- }
- private static Int32 AdjustMinDamageMonster2Player(Double Damage, Player Attacker, Player Target)
- {
- MsgItemInfo Item = null;
- Int32 MinDmg = 7;
- if (Damage >= MinDmg || Target.Level <= 15)
- return (Int32)Damage;
- MinDmg += (Int32)(Attacker.Level / 10);
- if (!Target.Owner.Equipment.Free(3))
- {
- Item = Target.Owner.Equipment.TryGetItem(3);
- if (Item != null)
- MinDmg -= ((int)Item.ID % 10);
- }
- if (Item != null && (Item.ID % 10) == 0)
- MinDmg = 1;
- MinDmg = Math.Max(1, MinDmg);
- return Math.Max(MinDmg, (Int32)Damage);
- }
- public static int GetDefense2(Client.GameState target, Client.GameState attacker)
- {
- if (attacker == null) return DefaultDefense2;
- if (target == null) return DefaultDefense2;
- if (attacker.Player.PlayerFlag == PlayerFlag.Player && target.Player.PlayerFlag == PlayerFlag.Player)
- {
- if (target.Player.Reborn == 0) return DefaultDefense2;
- var defense2 = (target.Player.Class % 10) >= 3 ? 7000 : DefaultDefense2;
- if (target.Player.Reborn < 2)
- {
- return defense2;
- }
- var targetHero = target as Client.GameState;
- if (targetHero != null)
- {
- if (attacker.Player.Reborn < 2)
- {
- return targetHero.Player.Reborn == 2 ? 5000 : 7000;
- }
- }
- return defense2;
- }
- else
- {
- return DefaultDefense2;
- }
- }
- private static int AdjustMinDamageUser2Monster(int nDamage, Player attacker, Player attacked)
- {
- int nMinDamage = 1;
- nMinDamage += attacker.Level / 10;
- if (!(attacker.PlayerFlag == PlayerFlag.Player))
- return (nMinDamage >= nDamage) ? nMinDamage : nDamage;
- if (!attacker.Owner.Equipment.Free(Network.GamePackets.MsgItemInfo.RightWeapon))
- {
- MsgItemInfo item = attacker.Owner.Equipment.TryGetItem(Network.GamePackets.MsgItemInfo.RightWeapon);
- nMinDamage += (int)(item.ID % 10);
- }
- return (nMinDamage >= nDamage) ? nMinDamage : nDamage;
- }
- private static int AdjustMinDamageMonster2User(int nDamage, Player attacker, Player attacked)
- {
- int nMinDamage = 7;
- if (nDamage >= nMinDamage || attacked.Level <= 15)
- return nDamage;
- if (!(attacked.PlayerFlag == PlayerFlag.Player))
- return (nMinDamage >= nDamage) ? nMinDamage : nDamage;
- for (int i = 1; i < 12; i++)
- {
- switch (i)
- {
- case 1:
- case 2:
- case 3:
- {
- if (!attacked.Owner.Equipment.Free((byte)i))
- {
- MsgItemInfo item = attacked.Owner.Equipment.TryGetItem((byte)i);
- nMinDamage -= (int)(item.ID % 10) / 5;
- }
- break;
- }
- }
- }
- nMinDamage = (1 >= nMinDamage) ? 1 : nMinDamage;
- return (nMinDamage >= nDamage) ? nMinDamage : nDamage;
- }
- public static int AdjustRebirthDamage(Client.GameState target, Client.GameState attacker, int damage)
- {
- return MathHelper.MulDiv(damage, GetDefense2(target, attacker), DefaultDefense2);
- }
- private static int CalcDamageMonster2User(int nAtk, int nDef, int nAtkLev, int nDefLev, int nDamage)
- {
- if (nAtkLev > 120)
- nAtkLev = 120;
- MONSTER_NAME_TYPE nNameType = GetNameType(nDefLev, nAtkLev);
- if (nNameType == MONSTER_NAME_TYPE.NAME_RED)
- {
- nDamage = (int)(((float)nAtk * 1.5F) - nDef);
- }
- else if (nNameType == MONSTER_NAME_TYPE.NAME_BLACK)
- {
- int nDeltaLev = nDefLev - nAtkLev;
- if (nDeltaLev >= -10 && nDeltaLev <= -5)
- nAtk *= 2;
- else if (nDeltaLev >= -20 && nDeltaLev < -10)
- nAtk = (int)((float)nAtk * 3.5F);
- else if (nDeltaLev < -20)
- nAtk *= 5;
- nDamage = nAtk - nDef;
- }
- return (0 >= nDamage) ? 0 : nDamage;
- }
- private static int CalcDamageUser2Monster(int nAtk, int nDef, int nAtkLev, int nDefLev, int nDamage)
- {
- if (nAtkLev > 120)
- nAtkLev = 120;
- if (GetNameType(nAtkLev, nDefLev) != MONSTER_NAME_TYPE.NAME_GREEN)
- return (0 >= nDamage) ? 0 : nDamage;
- int nDeltaLev = nAtkLev - nDefLev;
- if (nDeltaLev >= 3 && nDeltaLev <= 5)
- nAtk = (int)((float)nAtk * 1.5F);
- else if (nDeltaLev > 5 && nDeltaLev <= 10)
- nAtk *= 2;
- else if (nDeltaLev > 10 && nDeltaLev <= 20)
- nAtk = (int)((float)nAtk * 2.5F);
- else if (nDeltaLev > 20)
- nAtk *= 3;
- return (0 >= nAtk - nDef) ? 0 : nAtk - nDef;
- }
- private enum MONSTER_NAME_TYPE
- {
- NAME_GREEN,
- NAME_WHITE,
- NAME_RED,
- NAME_BLACK,
- }
- private static MONSTER_NAME_TYPE GetNameType(int nAtkerLev, int nMonsterLev)
- {
- int nDeltaLev = nAtkerLev - nMonsterLev;
- if (nDeltaLev >= 3)
- return MONSTER_NAME_TYPE.NAME_GREEN;
- else if (nDeltaLev >= 0)
- return MONSTER_NAME_TYPE.NAME_WHITE;
- else if (nDeltaLev >= -5)
- return MONSTER_NAME_TYPE.NAME_RED;
- else
- return MONSTER_NAME_TYPE.NAME_BLACK;
- }
- #region Calculate
- public static void Immu(Player Attacked)
- {
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- MsgName str = new MsgName(true);
- str.UID = Attacked.UID;
- str.TextsCount = 1;
- str.Type = MsgName.Effect;
- str.Texts.Add("bossimmunity");
- Attacked.Owner.SendScreen(str, true);
- }
- }
- public static long RemoveExcessDamageNinja(long CurrentDamage, Player Attacker, Player Opponent)
- {
- if (Opponent.PlayerFlag != PlayerFlag.Player)
- return CurrentDamage;
- if (Opponent.Reborn == 1)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.8));
- else if (Opponent.Reborn == 2)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.8));
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * (Math.Max(0.1, 1.00 - (Opponent.ItemBless * 0.01)))));
- CurrentDamage -= CurrentDamage * Math.Min(Opponent.Gems[7], (ushort)75) / 100;
- return CurrentDamage;
- }
- public static long RemoveExcessDamageMonje(long CurrentDamage, Player Attacker, Player Opponent)
- {
- if (Opponent.PlayerFlag != PlayerFlag.Player)
- return CurrentDamage;
- if (Opponent.Reborn == 1)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.9));
- else if (Opponent.Reborn == 2)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.8));
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * (Math.Max(0.1, 1.00 - (Opponent.ItemBless * 0.01)))));
- CurrentDamage -= CurrentDamage * Math.Min(Opponent.Gems[7], (ushort)75) / 100;
- return CurrentDamage;
- }
- public static long RemoveExcessDamageWindMelee(long CurrentDamage, Player Attacker, Player Opponent)
- {
- if (Opponent.PlayerFlag != PlayerFlag.Player)
- return CurrentDamage;
- if (Opponent.Reborn == 1)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.8));
- else if (Opponent.Reborn == 2)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.7));
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * (Math.Max(0.1, 1.00 - (Opponent.ItemBless * 0.01)))));
- CurrentDamage -= CurrentDamage * Math.Min(Opponent.Gems[7], (ushort)75) / 100;
- return CurrentDamage;
- }
- public static long RemoveExcessDamageTroy(long CurrentDamage, Player Attacker, Player Opponent)
- {
- if (Opponent.PlayerFlag != PlayerFlag.Player)
- return CurrentDamage;
- if (Opponent.Reborn == 1)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.8));
- else if (Opponent.Reborn == 2)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.7));
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * (Math.Max(0.1, 1.00 - (Opponent.ItemBless * 0.01)))));
- CurrentDamage -= CurrentDamage * Math.Min(Opponent.Gems[7], (ushort)75) / 100;
- return CurrentDamage;
- }
- public static long RemoveExcessDamageGuerrero(long CurrentDamage, Player Attacker, Player Opponent)
- {
- if (Opponent.PlayerFlag != PlayerFlag.Player)
- return CurrentDamage;
- if (Opponent.Reborn == 1)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.8));
- else if (Opponent.Reborn == 2)
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * 1.7));
- CurrentDamage = (long)Math.Round((double)(CurrentDamage * (Math.Max(0.1, 1.00 - (Opponent.ItemBless * 0.01)))));
- CurrentDamage -= CurrentDamage * Math.Min(Opponent.Gems[7], (ushort)75) / 100;
- return CurrentDamage;
- }
- //public static uint LinearSpells(Player attacker, Player attacked, ref MsgInteract Packet, Database.SpellInformation spell = null)
- //{
- // if (attacked.Name == "InfernalEpico") return 1;
- // if (attacked.Name == "SilverOctopus") return 1;
- // if (attacked.Name == "GoldenOctopus") return 1;
- // if (Packet != null)
- // {
- // Packet.Effect = MsgInteract.InteractEffects.None;
- // }
- // if (attacked.Name == "Guard1" && attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // #region CheakMiss
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.DragonSwing))
- // if (Kernel.ChanceSuccess(30))
- // {
- // MsgName str = new MsgName(true);
- // str.UID = attacked.UID;
- // str.TextsCount = 1;
- // str.Type = MsgName.Effect;
- // str.Texts.Add("poisonmiss");
- // attacked.Owner.SendScreen(str, true);
- // return 0;
- // }
- // #endregion
- // }
- // #region PvP -- Player Vs Player -- Jugador Contra Jugador
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30;
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50;
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Boolean canBT = false, CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower < attacked.BattlePower)
- // {
- // canBT = true;
- // }
- // }
- // else canBT = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (canBT)
- // {
- // if (Kernel.Rate(((float)attacker.Breaktrough / 1f - (float)attacked.Counteraction / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);//30% de Daño
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower >= attacked.BattlePower)
- // {
- // CritImmune = true;
- // }
- // }
- // else CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (CritImmune)
- // {
- // if (Kernel.Rate(((float)attacker.CriticalStrike / 1f - (float)attacked.Immunity / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);
- // }
- // }
- // }
- // //#region Breakthrough -- Potencias Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.4);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // }
- // // }
- // //}
- // //#endregion
- // #region Breakthrough -- Potencias Altas ((DESACTIVADO))
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.05);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // }
- // // }
- // //}
- // #endregion
- // Damage *= Reborn;
- // //#region Ataque segun Nobleza
- // //#region Rey
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.King)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion
- // //#region Duque
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion Prince
- // //#region Marques
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.2);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion Duke
- // //#region Conde
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // //}
- // //#endregion Earl
- // //#endregion
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 100;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // #region Sepll Bounes
- // if (spell != null)
- // {
- // if (spell.ID != 12290)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (Double)(Damage * spell.PowerPercent);
- // }
- // }
- // }
- // #endregion
- // //#region CriticalStrike -- Potencias Altas VS Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower > attacked.BattlePower)
- // // {
- // // if (attacker.CriticalStrike + 10000 > attacked.Immunity)
- // // {
- // // if (Kernel.Rate(50))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (Int32)Math.Floor((float)Damage * 1.2);
- // // attacker.Owner.Send("Le Has Dado un Criticaso!!");
- // // }
- // // }
- // // else
- // // {
- // // Immu(attacked);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Immu;
- // // attacker.Owner.Send("Te Anulo tu Criticaso!");
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.2);
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Altas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike) - ((float)attacked.Immunity)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.4);
- // // }
- // // }
- // //}
- // //#endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // #region DragonGem
- // var DragonBonus = attacker.Gems[GemTypes.Dragon];
- // if (DragonBonus > 0)
- // Damage += MathHelper.MulDiv((int)Damage, DragonBonus, 100);
- // if (attacker.Gems[GemTypes.Dragon] >= 210)
- // Damage += Damage * 50 / 100;
- // #endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker != null)
- // {
- // Damage += (Double)attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // Damage -= (Double)attacked.PhysicalDamageDecrease;
- // }
- // AutoRespone(attacker, attacked, ref Damage);
- // #region Block
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (Kernel.Rate(22))
- // {
- // if (attacked.Block > 0)
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Block;
- // Damage = (Int32)Math.Floor((float)Damage / 2);
- // }
- // }
- // }
- // #endregion
- // #region MagicShield
- // if (!attacked.Transformed)
- // {
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.MagicShield))
- // {
- // if (attacked.ShieldTime > 0)
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // else
- // {
- // if (Damage > (ushort)(attacked.Defence * attacked.MagicShieldIncrease))
- // Damage -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > attacked.TransformationDefence)
- // {
- // Damage -= attacked.TransformationDefence;
- // }
- // else
- // Damage = 1;
- // }
- // #endregion
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion End Defence
- // #endregion
- // Damage = RemoveExcessDamageTroy((long)Damage, attacker, attacked);
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // #endregion
- // #region Player Vs Monster
- // else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // int Damage = 0;
- // Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Melee, ref Packet);
- // CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- // return (uint)Damage;
- // }
- // #endregion
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30; //30%
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50; //50%
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Damage = AdjustDamageMonster2Player(Damage, attacker, attacked);
- // Damage -= attacked.Defence;
- // Damage *= Reborn;
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 100;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // Damage = AdjustMinDamageMonster2Player(Damage, attacker, attacked);
- // #region Sell Bounes
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (long)(Damage * spell.PowerPercent);
- // }
- // }
- // #endregion
- // Damage -= attacked.PhysicalDamageDecrease;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // Damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // Damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (!attacked.MonsterInfo.Boss)
- // Damage *= 5;
- // else Damage += (int)(Damage * .1);
- // if (Damage < 1)
- // Damage = 1;
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion End Defence
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // if (attacker == null || attacked == null)
- // return 0;
- // long attack = 0;
- // int defense = 0;
- // if (attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
- // return 0;
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // if (!attacker.Transformed)
- // attack = attacker.MinAttack + random.Next((int)(attacker.MaxAttack - attacker.MinAttack));
- // else
- // attack = attacker.TransformationMinAttack +
- // random.Next((int)(attacker.TransformationMaxAttack - attacker.TransformationMinAttack));
- // if (attacker != null)
- // {
- // var bonus = attacker.Gems[1];
- // if (bonus > 0)
- // {
- // attack += MathHelper.MulDiv((int)attack, (int)bonus, (int)100);
- // }
- // // TODO: proficiency bonus
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && attack > 1)
- // attack = (long)(attack * 1.17);
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // attack = (long)(attack * spell.PowerPercent);
- // }
- // }
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // var reducee = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- // if (reducee > 0)
- // {
- // attack -= (attack / 2) * reducee / 100;
- // }
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // {
- // defense = (defense * 70) / 100;
- // }
- // var damage = Math.Max(1, attack - defense);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // damage = CalcDamageUser2Monster((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, 10000, 10000);
- // damage = AdjustMinDamageUser2Monster((int)damage, attacker, attacked);
- // }
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = CalcDamageMonster2User((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, (attacked.Reborn != 0 && attacked.Class % 10 >= 3) ? 7000 : 10000,
- // 10000);
- // damage = AdjustMinDamageMonster2User((int)damage, attacker, attacked);
- // }
- // var reduceee = 10;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (!attacked.Owner.Equipment.Free(3))
- // {
- // switch (attacked.Owner.Equipment.TryGetItem(3).ID % 10)
- // {
- // case 9:
- // reduceee = 1000;
- // break;
- // case 8:
- // reduceee = 500;
- // break;
- // case 7:
- // reduceee = 200;
- // break;
- // case 6:
- // reduceee = 100;
- // break;
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // var n = Math.Max(1, attacker.Owner.Player.Strength / reduceee);
- // if (n > damage)
- // {
- // damage = n;
- // }
- // }
- // damage = Math.Max(1, damage);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- // }
- // if (attacked != null)
- // {
- // var reduces = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduces > 0)
- // {
- // damage -= damage * reduces / 100;
- // }
- // }
- // if (attacker != null)
- // {
- // damage += attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // damage -= attacked.PhysicalDamageDecrease;
- // }
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- // {
- // if (attacked.AzureDamage >= damage)
- // {
- // attacked.AzureDamage -= (int)damage;
- // int sec = 60 - (Time32.Now - attacked.MagicShieldStamp).TotalMilliseconds;
- // attacked.Owner.Send(Constants.Shield(attacked.AzureDamage, sec));
- // return 1;
- // }
- // else
- // {
- // damage -= attacked.AzureDamage;
- // attacked.AzureDamage = 0;
- // attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- // }
- // }
- // AutoRespone(attacker, attacked, ref damage);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Oblivion))
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Stamina >= 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 5;
- // return Math.Max((uint)1, (uint)damage);
- //}
- //public static uint Guerrero(Player attacker, Player attacked, ref MsgInteract Packet, Database.SpellInformation spell = null)
- //{
- // if (attacked.Name == "InfernalEpico") return 1;
- // if (attacked.Name == "SilverOctopus") return 1;
- // if (attacked.Name == "GoldenOctopus") return 1;
- // if (Packet != null)
- // {
- // Packet.Effect = MsgInteract.InteractEffects.None;
- // }
- // if (attacked.Name == "Guard1" && attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // #region CheakMiss
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.DragonSwing))
- // if (Kernel.ChanceSuccess(30))
- // {
- // MsgName str = new MsgName(true);
- // str.UID = attacked.UID;
- // str.TextsCount = 1;
- // str.Type = MsgName.Effect;
- // str.Texts.Add("poisonmiss");
- // attacked.Owner.SendScreen(str, true);
- // return 0;
- // }
- // #endregion
- // }
- // #region PvP -- Player Vs Player -- Jugador Contra Jugador
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30;
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50;
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // #region Critico e Inmunidad
- // Boolean canBT = false, CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower < attacked.BattlePower)
- // {
- // canBT = true;
- // }
- // }
- // else canBT = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (canBT)
- // {
- // if (Kernel.Rate(((float)attacker.Breaktrough / 1f - (float)attacked.Counteraction / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);//30% de Daño
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower >= attacked.BattlePower)
- // {
- // CritImmune = true;
- // }
- // }
- // else CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (CritImmune)
- // {
- // if (Kernel.Rate(((float)attacker.CriticalStrike / 1f - (float)attacked.Immunity / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);
- // }
- // }
- // }
- // #endregion
- // //Damage -= attacked.Defence;
- // #region AzureShield
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- // {
- // if (Damage > attacked.AzureShieldDefence)
- // {
- // Damage -= attacked.AzureShieldDefence;
- // CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- // attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- // }
- // else
- // {
- // CreateAzureDmg((uint)Damage, attacker, attacked);
- // attacked.AzureShieldDefence -= (ushort)Damage;
- // attacked.AzureShieldPacket();
- // Damage = 1;
- // }
- // }
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield))
- // {
- // if (Damage > attacked.AzureShieldDefence)
- // {
- // Damage -= attacked.AzureShieldDefence;
- // CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- // attacked.RemoveFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield);
- // }
- // else
- // {
- // CreateAzureDmg((uint)Damage, attacker, attacked);
- // attacked.AzureShieldDefence -= (ushort)Damage;
- // attacked.AzureShieldPacket();
- // Damage = 1;
- // }
- // }
- // #endregion
- // #region Breakthrough -- Potencias Altas ((DESACTIVADO))
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.05);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // }
- // // }
- // //}
- // #endregion
- // Damage *= Reborn;
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 100;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // #region Sepll Bounes
- // if (spell != null)
- // {
- // if (spell.ID != 12290)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (Double)(Damage * spell.PowerPercent);
- // }
- // }
- // }
- // #endregion
- // #region Codigos QUE NO SE USAN POR EL MOMENTO
- // //#region Breakthrough -- Potencias Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.4);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Altas VS Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower > attacked.BattlePower)
- // // {
- // // if (attacker.CriticalStrike + 10000 > attacked.Immunity)
- // // {
- // // if (Kernel.Rate(50))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (Int32)Math.Floor((float)Damage * 1.2);
- // // attacker.Owner.Send("Le Has Dado un Criticaso!!");
- // // }
- // // }
- // // else
- // // {
- // // Immu(attacked);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Immu;
- // // attacker.Owner.Send("Te Anulo tu Criticaso!");
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.2);
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Altas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike) - ((float)attacked.Immunity)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.4);
- // // }
- // // }
- // //}
- // //#endregion
- // #endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // #region DragonGem
- // var DragonBonus = attacker.Gems[GemTypes.Dragon];
- // if (DragonBonus > 0)
- // Damage += MathHelper.MulDiv((int)Damage, DragonBonus, 100);
- // if (attacker.Gems[GemTypes.Dragon] >= 210)
- // Damage += Damage * 50 / 100;
- // #endregion
- // #region Efectos Perfectos
- // /*
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // if (Kernel.ChanceSuccess(40))//30% Probabilidad de Que Salga
- // {
- // if (attacker.PrefictionLevel > attacked.PrefictionLevel)
- // {
- // Network.Writer.WriteUInt16((ushort)(1 << 10), 36, Packet.ToArray());
- // attacker.Owner.SendScreen(MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.LuckyStrike));
- // Damage += Damage * 0.8;
- // }
- // else
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // }
- // }
- // }
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.LuckyStrike);
- // Damage += Damage;
- // }
- // eff = attacker.PrefictionEffect.GetCalmWind();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.CalmWind);
- // foreach (var item in attacker.Owner.Spells.Values)
- // item.AttackStamp = Time64.Now.AddSeconds(-50);
- // }
- // eff = attacker.PrefictionEffect.GetDrainingTouch();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.DrainingTouch);
- // attacker.Hitpoints = attacker.MaxHitpoints;
- // attacker.Mana = attacker.MaxMana;
- // }
- // eff = attacker.PrefictionEffect.GetKillingFlash();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.MirrorofSin);
- // attacker.Owner.XPCount = 100;
- // }
- // if (attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // if (Damage >= attacked.MaxHitpoints / 2)
- // {
- // eff = attacker.PrefictionEffect.GetLightofStamina();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.LightofStamina);
- // attacker.Stamina = 150;
- // }
- // }
- // }
- // }
- // #region Prefiction on attacked from monster
- // if (attacked.PrefictionEffect != null)
- // {
- // var eff = attacked.PrefictionEffect.GetStrikeLock();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // return 0;
- // }
- // eff = attacked.PrefictionEffect.GetBloodSpawn();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.BloodSpawn);
- // attacked.Hitpoints = attacked.MaxHitpoints;
- // attacked.Mana = attacked.MaxMana;
- // }
- // eff = attacked.PrefictionEffect.GetMirrorofSin();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, 0, prefeff.MirrorofSin);
- // attacked.Owner.XPCount = 100;
- // }
- // if (attacked != null && attacked.PrefictionLevel >= attacker.PrefictionLevel)
- // {
- // eff = attacker.PrefictionEffect.GetShieldBreak();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.ShieldBreak);
- // attacked.AddFlag3(MsgUpdate.Flags.ShieldBreak);
- // attacked.ShieldBreakStamp = Time64.Now;
- // }
- // }
- // if (attacked != null && attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // eff = attacked.PrefictionEffect.GetDivineGuard();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, 0, prefeff.DivineGuard);
- // attacked.AddFlag3(MsgUpdate.Flags.DivineGuard);
- // attacked.DivineGuardStamp = Time64.Now;
- // }
- // }
- // }
- // #endregion
- // */
- // #endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker != null)
- // {
- // Damage += (Double)attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // Damage -= (Double)attacked.PhysicalDamageDecrease;
- // }
- // AutoRespone(attacker, attacked, ref Damage);
- // #region Block
- // #region Block 1
- // int nAtk = attacked.Defence;
- // uint remove = 0;
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShieldBreak))
- // remove = 2000;
- // if (Kernel.Rate(((attacked.Block - remove) / 100)) && attacked.Block > 0)
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Block;
- // int blockdamage = ((nAtk * (attacked.Block / 100)) / 100);
- // if (Damage > blockdamage)
- // Damage -= blockdamage;
- // else
- // Damage = 1;
- // }
- // #endregion
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (Kernel.Rate(22))
- // {
- // if (attacked.Block > 0)
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Block;
- // Damage = (Int32)Math.Floor((float)Damage / 2);
- // }
- // }
- // }
- // #endregion
- // #region MagicShield
- // if (!attacked.Transformed)
- // {
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.MagicShield))
- // {
- // if (attacked.ShieldTime > 0)
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // else
- // {
- // if (Damage > (ushort)(attacked.Defence * attacked.MagicShieldIncrease))
- // Damage -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > attacked.TransformationDefence)
- // {
- // Damage -= attacked.TransformationDefence;
- // }
- // else
- // Damage = 1;
- // }
- // #endregion
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // //
- // //
- // #endregion
- // #endregion
- // //Test
- // Damage -= nDef;
- // Damage = RemoveExcessDamageGuerrero((long)Damage, attacker, attacked);
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // #endregion
- // #region Player Vs Monster
- // else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // int Damage = 0;
- // Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Melee, ref Packet);
- // CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- // return (uint)Damage;
- // }
- // #endregion
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30; //30%
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50; //50%
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Damage = AdjustDamageMonster2Player(Damage, attacker, attacked);
- // Damage -= attacked.Defence;
- // Damage *= Reborn;
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 100;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // Damage = AdjustMinDamageMonster2Player(Damage, attacker, attacked);
- // #region Sell Bounes
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (long)(Damage * spell.PowerPercent);
- // }
- // }
- // #endregion
- // Damage -= attacked.PhysicalDamageDecrease;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // Damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // Damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (!attacked.MonsterInfo.Boss)
- // Damage *= 5;
- // else Damage += (int)(Damage * .1);
- // if (Damage < 1)
- // Damage = 1;
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion End Defence
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // if (attacker == null || attacked == null)
- // return 0;
- // long attack = 0;
- // int defense = 0;
- // if (attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
- // return 0;
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // if (!attacker.Transformed)
- // attack = attacker.MinAttack + random.Next((int)(attacker.MaxAttack - attacker.MinAttack));
- // else
- // attack = attacker.TransformationMinAttack +
- // random.Next((int)(attacker.TransformationMaxAttack - attacker.TransformationMinAttack));
- // if (attacker != null)
- // {
- // var bonus = attacker.Gems[1];
- // if (bonus > 0)
- // {
- // attack += MathHelper.MulDiv((int)attack, (int)bonus, (int)100);
- // }
- // // TODO: proficiency bonus
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && attack > 1)
- // attack = (long)(attack * 1.17);
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // attack = (long)(attack * spell.PowerPercent);
- // }
- // }
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // var reducee = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- // if (reducee > 0)
- // {
- // attack -= (attack / 2) * reducee / 100;
- // }
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // {
- // defense = (defense * 70) / 100;
- // }
- // var damage = Math.Max(1, attack - defense);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // damage = CalcDamageUser2Monster((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, 10000, 10000);
- // damage = AdjustMinDamageUser2Monster((int)damage, attacker, attacked);
- // }
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = CalcDamageMonster2User((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, (attacked.Reborn != 0 && attacked.Class % 10 >= 3) ? 7000 : 10000,
- // 10000);
- // damage = AdjustMinDamageMonster2User((int)damage, attacker, attacked);
- // }
- // var reduceee = 10;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (!attacked.Owner.Equipment.Free(3))
- // {
- // switch (attacked.Owner.Equipment.TryGetItem(3).ID % 10)
- // {
- // case 9:
- // reduceee = 1000;
- // break;
- // case 8:
- // reduceee = 500;
- // break;
- // case 7:
- // reduceee = 200;
- // break;
- // case 6:
- // reduceee = 100;
- // break;
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // var n = Math.Max(1, attacker.Owner.Player.Strength / reduceee);
- // if (n > damage)
- // {
- // damage = n;
- // }
- // }
- // damage = Math.Max(1, damage);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- // }
- // if (attacked != null)
- // {
- // var reduces = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduces > 0)
- // {
- // damage -= damage * reduces / 100;
- // }
- // }
- // if (attacker != null)
- // {
- // damage += attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // damage -= attacked.PhysicalDamageDecrease;
- // }
- // AutoRespone(attacker, attacked, ref damage);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Oblivion))
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Stamina >= 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 5;
- // return Math.Max((uint)1, (uint)damage);
- //}
- //public static uint Troy(Player attacker, Player attacked, ref MsgInteract Packet, Database.SpellInformation spell = null)
- //{
- // if (attacked.Name == "InfernalEpico") return 1;
- // if (attacked.Name == "SilverOctopus") return 1;
- // if (attacked.Name == "GoldenOctopus") return 1;
- // if (Packet != null)
- // {
- // Packet.Effect = MsgInteract.InteractEffects.None;
- // }
- // if (attacked.Name == "Guard1" && attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // #region CheakMiss
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.DragonSwing))
- // if (Kernel.ChanceSuccess(35))
- // {
- // MsgName str = new MsgName(true);
- // str.UID = attacked.UID;
- // str.TextsCount = 1;
- // str.Type = MsgName.Effect;
- // str.Texts.Add("poisonmiss");
- // attacked.Owner.SendScreen(str, true);
- // return 0;
- // }
- // #endregion
- // }
- // #region PvP -- Player Vs Player -- Jugador Contra Jugador
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30;
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50;
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Boolean canBT = false, CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower < attacked.BattlePower)
- // {
- // canBT = true;
- // }
- // }
- // else canBT = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (canBT)
- // {
- // if (Kernel.Rate(((float)attacker.Breaktrough / 1f - (float)attacked.Counteraction / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- // Damage = (Int32)Math.Floor((float)Damage * 1.4);//40% de Daño
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower >= attacked.BattlePower)
- // {
- // CritImmune = true;
- // }
- // }
- // else CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (CritImmune)
- // {
- // if (Kernel.Rate(((float)attacker.CriticalStrike / 1f - (float)attacked.Immunity / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);
- // }
- // }
- // }
- // #region Breakthrough -- Potencias Altas ((DESACTIVADO))
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.05);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // }
- // // }
- // //}
- // #endregion
- // Damage *= Reborn;
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield))
- // {
- // if (Damage > attacked.AzureShieldDefence)
- // {
- // Damage -= attacked.AzureShieldDefence;
- // CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- // attacked.RemoveFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield);
- // }
- // else
- // {
- // CreateAzureDmg((uint)Damage, attacker, attacked);
- // attacked.AzureShieldDefence -= (ushort)Damage;
- // attacked.AzureShieldPacket();
- // Damage = 1;
- // }
- // }
- // //#region Ataque segun Nobleza
- // //#region Rey
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.King)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion
- // //#region Duque
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion Prince
- // //#region Marques
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.2);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion Duke
- // //#region Conde
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // //}
- // //#endregion Earl
- // //#endregion
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 110;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // #region Sepll Bounes
- // if (spell != null)
- // {
- // if (spell.ID != 12290)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (Double)(Damage * spell.PowerPercent);
- // }
- // }
- // }
- // #endregion
- // //#region CriticalStrike -- Potencias Altas VS Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower > attacked.BattlePower)
- // // {
- // // if (attacker.CriticalStrike + 10000 > attacked.Immunity)
- // // {
- // // if (Kernel.Rate(50))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (Int32)Math.Floor((float)Damage * 1.2);
- // // attacker.Owner.Send("Le Has Dado un Criticaso!!");
- // // }
- // // }
- // // else
- // // {
- // // Immu(attacked);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Immu;
- // // attacker.Owner.Send("Te Anulo tu Criticaso!");
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.2);
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Altas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike) - ((float)attacked.Immunity)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.4);
- // // }
- // // }
- // //}
- // //#endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // #region DragonGem
- // var DragonBonus = attacker.Gems[GemTypes.Dragon];
- // if (DragonBonus > 0)
- // Damage += MathHelper.MulDiv((int)Damage, DragonBonus, 100);
- // if (attacker.Gems[GemTypes.Dragon] >= 210)
- // Damage += Damage * 50 / 100;
- // #endregion
- // #region TortoiseGem -- LO LEE DESDE EL CODIGO DE REMOVEEXCESS
- // //double torist = (double)(attacked.Gems[COServer.AttackBedan.GemTypes.Tortoise] / 100d);
- // //torist = (double)(1 - torist);
- // //torist = Math.Max(torist, 0.5);
- // //Damage *= torist;
- // //Pezzi
- // #endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker != null)
- // {
- // Damage += (Double)attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // Damage -= (Double)attacked.PhysicalDamageDecrease;
- // }
- // AutoRespone(attacker, attacked, ref Damage);
- // #region Efectos Perfectos
- // /*
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // if (Kernel.ChanceSuccess(30))//30% Probabilidad de Que Salga
- // {
- // if (attacker.PrefictionLevel > attacked.PrefictionLevel)
- // {
- // Network.Writer.WriteUInt16((ushort)(1 << 10), 36, Packet.ToArray());
- // attacker.Owner.SendScreen(MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.LuckyStrike));
- // Damage += Damage / 2;
- // }
- // else
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // }
- // }
- // }
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.LuckyStrike);
- // Damage += Damage;
- // }
- // eff = attacker.PrefictionEffect.GetCalmWind();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.CalmWind);
- // foreach (var item in attacker.Owner.Spells.Values)
- // item.AttackStamp = Time64.Now.AddSeconds(-50);
- // }
- // eff = attacker.PrefictionEffect.GetDrainingTouch();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.DrainingTouch);
- // attacker.Hitpoints = attacker.MaxHitpoints;
- // attacker.Mana = attacker.MaxMana;
- // }
- // eff = attacker.PrefictionEffect.GetKillingFlash();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.MirrorofSin);
- // attacker.Owner.XPCount = 100;
- // }
- // if (attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // if (Damage >= attacked.MaxHitpoints / 2)
- // {
- // eff = attacker.PrefictionEffect.GetLightofStamina();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.LightofStamina);
- // attacker.Stamina = 150;
- // }
- // }
- // }
- // var eff1 = attacked.PrefictionEffect.GetStrikeLock();
- // if (Kernel.Rate(eff1.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // return 0;
- // }
- // eff1 = attacked.PrefictionEffect.GetBloodSpawn();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.BloodSpawn);
- // attacked.Hitpoints = attacked.MaxHitpoints;
- // attacked.Mana = attacked.MaxMana;
- // }
- // eff1 = attacked.PrefictionEffect.GetMirrorofSin();
- // if (attacked != null && attacked.PrefictionLevel >= attacker.PrefictionLevel)
- // {
- // eff1 = attacker.PrefictionEffect.GetShieldBreak();
- // if (Kernel.Rate(eff1.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.ShieldBreak);
- // attacked.AddFlag3(MsgUpdate.Flags.ShieldBreak);
- // attacked.ShieldBreakStamp = Time64.Now;
- // }
- // }
- // if (attacked != null && attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // eff1 = attacked.PrefictionEffect.GetDivineGuard();
- // if (Kernel.Rate(eff1.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, 0, prefeff.DivineGuard);
- // attacked.AddFlag3(MsgUpdate.Flags.DivineGuard);
- // attacked.DivineGuardStamp = Time64.Now;
- // }
- // }
- // }
- // */
- // #endregion
- // #region Block
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (Kernel.Rate(22))
- // {
- // if (attacked.Block > 0)
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Block;
- // Damage = (Int32)Math.Floor((float)Damage / 2);
- // }
- // }
- // }
- // #endregion
- // #region MagicShield
- // if (!attacked.Transformed)
- // {
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.MagicShield))
- // {
- // if (attacked.ShieldTime > 0)
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // else
- // {
- // if (Damage > (ushort)(attacked.Defence * attacked.MagicShieldIncrease))
- // Damage -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > attacked.TransformationDefence)
- // {
- // Damage -= attacked.TransformationDefence;
- // }
- // else
- // Damage = 1;
- // }
- // #endregion
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion End Defence
- // #endregion
- // Damage = RemoveExcessDamageTroy((long)Damage, attacker, attacked);
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // #endregion
- // #region Player Vs Monster
- // else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // int Damage = 0;
- // Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Melee, ref Packet);
- // CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- // return (uint)Damage;
- // }
- // #endregion
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30; //30%
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50; //50%
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Damage = AdjustDamageMonster2Player(Damage, attacker, attacked);
- // Damage -= attacked.Defence;
- // Damage *= Reborn;
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 100;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // Damage = AdjustMinDamageMonster2Player(Damage, attacker, attacked);
- // #region Sell Bounes
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (long)(Damage * spell.PowerPercent);
- // }
- // }
- // #endregion
- // Damage -= attacked.PhysicalDamageDecrease;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // Damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // Damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (!attacked.MonsterInfo.Boss)
- // Damage *= 5;
- // else Damage += (int)(Damage * .1);
- // if (Damage < 1)
- // Damage = 1;
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion End Defence
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // if (attacker == null || attacked == null)
- // return 0;
- // long attack = 0;
- // int defense = 0;
- // if (attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
- // return 0;
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // if (!attacker.Transformed)
- // attack = attacker.MinAttack + random.Next((int)(attacker.MaxAttack - attacker.MinAttack));
- // else
- // attack = attacker.TransformationMinAttack +
- // random.Next((int)(attacker.TransformationMaxAttack - attacker.TransformationMinAttack));
- // if (attacker != null)
- // {
- // var bonus = attacker.Gems[1];
- // if (bonus > 0)
- // {
- // attack += MathHelper.MulDiv((int)attack, (int)bonus, (int)100);
- // }
- // // TODO: proficiency bonus
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && attack > 1)
- // attack = (long)(attack * 1.17);
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // attack = (long)(attack * spell.PowerPercent);
- // }
- // }
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // var reducee = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- // if (reducee > 0)
- // {
- // attack -= (attack / 2) * reducee / 100;
- // }
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // {
- // defense = (defense * 70) / 100;
- // }
- // var damage = Math.Max(1, attack - defense);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // damage = CalcDamageUser2Monster((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, 10000, 10000);
- // damage = AdjustMinDamageUser2Monster((int)damage, attacker, attacked);
- // }
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = CalcDamageMonster2User((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, (attacked.Reborn != 0 && attacked.Class % 10 >= 3) ? 7000 : 10000,
- // 10000);
- // damage = AdjustMinDamageMonster2User((int)damage, attacker, attacked);
- // }
- // var reduceee = 10;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (!attacked.Owner.Equipment.Free(3))
- // {
- // switch (attacked.Owner.Equipment.TryGetItem(3).ID % 10)
- // {
- // case 9:
- // reduceee = 1000;
- // break;
- // case 8:
- // reduceee = 500;
- // break;
- // case 7:
- // reduceee = 200;
- // break;
- // case 6:
- // reduceee = 100;
- // break;
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // var n = Math.Max(1, attacker.Owner.Player.Strength / reduceee);
- // if (n > damage)
- // {
- // damage = n;
- // }
- // }
- // damage = Math.Max(1, damage);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- // }
- // if (attacked != null)
- // {
- // var reduces = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduces > 0)
- // {
- // damage -= damage * reduces / 100;
- // }
- // }
- // if (attacker != null)
- // {
- // damage += attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // damage -= attacked.PhysicalDamageDecrease;
- // }
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- // {
- // if (attacked.AzureDamage >= damage)
- // {
- // attacked.AzureDamage -= (int)damage;
- // int sec = 60 - (Time32.Now - attacked.MagicShieldStamp).TotalMilliseconds;
- // attacked.Owner.Send(Constants.Shield(attacked.AzureDamage, sec));
- // return 1;
- // }
- // else
- // {
- // damage -= attacked.AzureDamage;
- // attacked.AzureDamage = 0;
- // attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- // }
- // }
- // AutoRespone(attacker, attacked, ref damage);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Oblivion))
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Stamina >= 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 5;
- // return Math.Max((uint)1, (uint)damage);
- //}
- //public static uint WindwalkerMelee(Player attacker, Player attacked, ref MsgInteract Packet, Database.SpellInformation spell = null)
- //{
- // if (attacked.Name == "InfernalEpico") return 1;
- // if (attacked.Name == "SilverOctopus") return 1;
- // if (attacked.Name == "GoldenOctopus") return 1;
- // if (Packet != null)
- // {
- // Packet.Effect = MsgInteract.InteractEffects.None;
- // }
- // if (attacked.Name == "Guard1" && attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // #region CheakMiss
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.DragonSwing))
- // if (Kernel.ChanceSuccess(35))
- // {
- // MsgName str = new MsgName(true);
- // str.UID = attacked.UID;
- // str.TextsCount = 1;
- // str.Type = MsgName.Effect;
- // str.Texts.Add("poisonmiss");
- // attacked.Owner.SendScreen(str, true);
- // return 0;
- // }
- // #endregion
- // }
- // #region PvP -- Player Vs Player -- Jugador Contra Jugador
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30;
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50;
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Boolean canBT = false, CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower < attacked.BattlePower)
- // {
- // canBT = true;
- // }
- // }
- // else canBT = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (canBT)
- // {
- // if (Kernel.Rate(((float)attacker.Breaktrough / 1f - (float)attacked.Counteraction / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);//30% de Daño
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower >= attacked.BattlePower)
- // {
- // CritImmune = true;
- // }
- // }
- // else CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (CritImmune)
- // {
- // if (Kernel.Rate(((float)attacker.CriticalStrike / 1f - (float)attacked.Immunity / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);
- // }
- // }
- // }
- // //Damage -= attacked.Defence;
- // #region AzureShield
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- // {
- // if (Damage > attacked.AzureShieldDefence)
- // {
- // Damage -= attacked.AzureShieldDefence;
- // CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- // attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- // }
- // else
- // {
- // CreateAzureDmg((uint)Damage, attacker, attacked);
- // attacked.AzureShieldDefence -= (ushort)Damage;
- // attacked.AzureShieldPacket();
- // Damage = 1;
- // }
- // }
- // #endregion
- // //#region Breakthrough -- Potencias Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.4);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // }
- // // }
- // //}
- // //#endregion
- // #region Breakthrough -- Potencias Altas ((DESACTIVADO))
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.05);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // }
- // // }
- // //}
- // #endregion
- // Damage *= Reborn;
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield))
- // {
- // if (Damage > attacked.AzureShieldDefence)
- // {
- // Damage -= attacked.AzureShieldDefence;
- // CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- // attacked.RemoveFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield);
- // }
- // else
- // {
- // CreateAzureDmg((uint)Damage, attacker, attacked);
- // attacked.AzureShieldDefence -= (ushort)Damage;
- // attacked.AzureShieldPacket();
- // Damage = 1;
- // }
- // }
- // //#region Ataque segun Nobleza
- // //#region Rey
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.King)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion
- // //#region Duque
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion Prince
- // //#region Marques
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.2);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion Duke
- // //#region Conde
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // //}
- // //#endregion Earl
- // //#endregion
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 100;//Entre mas Sube Mas Daño le hace!
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // #region Sepll Bounes
- // if (spell != null)
- // {
- // if (spell.ID != 12290)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (Double)(Damage * spell.PowerPercent);
- // }
- // }
- // }
- // #endregion
- // //#region CriticalStrike -- Potencias Altas VS Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower > attacked.BattlePower)
- // // {
- // // if (attacker.CriticalStrike + 10000 > attacked.Immunity)
- // // {
- // // if (Kernel.Rate(50))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (Int32)Math.Floor((float)Damage * 1.2);
- // // attacker.Owner.Send("Le Has Dado un Criticaso!!");
- // // }
- // // }
- // // else
- // // {
- // // Immu(attacked);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Immu;
- // // attacker.Owner.Send("Te Anulo tu Criticaso!");
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.2);
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Altas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike) - ((float)attacked.Immunity)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.4);
- // // }
- // // }
- // //}
- // //#endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // #region DragonGem
- // var DragonBonus = attacker.Gems[GemTypes.Dragon];
- // if (DragonBonus > 0)
- // Damage += MathHelper.MulDiv((int)Damage, DragonBonus, 100);
- // if (attacker.Gems[GemTypes.Dragon] >= 210)
- // Damage += Damage * 50 / 100;
- // #endregion
- // #region TortoiseGem -- LO LEE DESDE EL CODIGO DE REMOVEEXCESS
- // //double torist = (double)(attacked.Gems[COServer.AttackBedan.GemTypes.Tortoise] / 100d);
- // //torist = (double)(1 - torist);
- // //torist = Math.Max(torist, 0.5);
- // //Damage *= torist;
- // //Pezzi
- // #endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // #region Efectos Perfectos
- // /*
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // if (Kernel.ChanceSuccess(30))//30% Probabilidad de Que Salga
- // {
- // if (attacker.PrefictionLevel > attacked.PrefictionLevel)
- // {
- // Network.Writer.WriteUInt16((ushort)(1 << 10), 36, Packet.ToArray());
- // attacker.Owner.SendScreen(MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.LuckyStrike));
- // Damage += Damage / 2;
- // }
- // else
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // }
- // }
- // }
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.LuckyStrike);
- // Damage += Damage;
- // }
- // eff = attacker.PrefictionEffect.GetCalmWind();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.CalmWind);
- // foreach (var item in attacker.Owner.Spells.Values)
- // item.AttackStamp = Time64.Now.AddSeconds(-50);
- // }
- // eff = attacker.PrefictionEffect.GetDrainingTouch();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.DrainingTouch);
- // attacker.Hitpoints = attacker.MaxHitpoints;
- // attacker.Mana = attacker.MaxMana;
- // }
- // eff = attacker.PrefictionEffect.GetKillingFlash();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.MirrorofSin);
- // attacker.Owner.XPCount = 100;
- // }
- // if (attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // if (Damage >= attacked.MaxHitpoints / 2)
- // {
- // eff = attacker.PrefictionEffect.GetLightofStamina();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.LightofStamina);
- // attacker.Stamina = 150;
- // }
- // }
- // }
- // }
- // #region Prefiction on attacked from monster
- // if (attacked.PrefictionEffect != null)
- // {
- // var eff = attacked.PrefictionEffect.GetStrikeLock();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // return 0;
- // }
- // eff = attacked.PrefictionEffect.GetBloodSpawn();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.BloodSpawn);
- // attacked.Hitpoints = attacked.MaxHitpoints;
- // attacked.Mana = attacked.MaxMana;
- // }
- // eff = attacked.PrefictionEffect.GetMirrorofSin();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, 0, prefeff.MirrorofSin);
- // attacked.Owner.XPCount = 100;
- // }
- // if (attacked != null && attacked.PrefictionLevel >= attacker.PrefictionLevel)
- // {
- // eff = attacker.PrefictionEffect.GetShieldBreak();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.ShieldBreak);
- // attacked.AddFlag3(MsgUpdate.Flags.ShieldBreak);
- // attacked.ShieldBreakStamp = Time64.Now;
- // }
- // }
- // if (attacked != null && attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // eff = attacked.PrefictionEffect.GetDivineGuard();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, 0, prefeff.DivineGuard);
- // attacked.AddFlag3(MsgUpdate.Flags.DivineGuard);
- // attacked.DivineGuardStamp = Time64.Now;
- // }
- // }
- // }
- // #endregion
- // */
- // #endregion
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker != null)
- // {
- // Damage += (Double)attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // Damage -= (Double)attacked.PhysicalDamageDecrease;
- // }
- // AutoRespone(attacker, attacked, ref Damage);
- // #region Block
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (Kernel.Rate(22))
- // {
- // if (attacked.Block > 0)
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Block;
- // Damage = (Int32)Math.Floor((float)Damage / 2);
- // }
- // }
- // }
- // #endregion
- // #region MagicShield
- // if (!attacked.Transformed)
- // {
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.MagicShield))
- // {
- // if (attacked.ShieldTime > 0)
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // else
- // {
- // if (Damage > (ushort)(attacked.Defence * attacked.MagicShieldIncrease))
- // Damage -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > attacked.TransformationDefence)
- // {
- // Damage -= attacked.TransformationDefence;
- // }
- // else
- // Damage = 1;
- // }
- // #endregion
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion End Defence
- // #endregion
- // Damage = RemoveExcessDamageWindMelee((long)Damage, attacker, attacked);//2
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // #endregion
- // #region Player Vs Monster
- // else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // int Damage = 0;
- // Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Melee, ref Packet);
- // CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- // return (uint)Damage;
- // }
- // #endregion
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30; //30%
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50; //50%
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Damage = AdjustDamageMonster2Player(Damage, attacker, attacked);
- // Damage -= attacked.Defence;
- // Damage *= Reborn;
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 100;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // Damage = AdjustMinDamageMonster2Player(Damage, attacker, attacked);
- // #region Sell Bounes
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (long)(Damage * spell.PowerPercent);
- // }
- // }
- // #endregion
- // Damage -= attacked.PhysicalDamageDecrease;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // Damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // Damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (!attacked.MonsterInfo.Boss)
- // Damage *= 5;
- // else Damage += (int)(Damage * .1);
- // if (Damage < 1)
- // Damage = 1;
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion End Defence
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // if (attacker == null || attacked == null)
- // return 0;
- // long attack = 0;
- // int defense = 0;
- // if (attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
- // return 0;
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // if (!attacker.Transformed)
- // attack = attacker.MinAttack + random.Next((int)(attacker.MaxAttack - attacker.MinAttack));
- // else
- // attack = attacker.TransformationMinAttack +
- // random.Next((int)(attacker.TransformationMaxAttack - attacker.TransformationMinAttack));
- // if (attacker != null)
- // {
- // var bonus = attacker.Gems[1];
- // if (bonus > 0)
- // {
- // attack += MathHelper.MulDiv((int)attack, (int)bonus, (int)100);
- // }
- // // TODO: proficiency bonus
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && attack > 1)
- // attack = (long)(attack * 1.17);
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // attack = (long)(attack * spell.PowerPercent);
- // }
- // }
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // var reducee = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- // if (reducee > 0)
- // {
- // attack -= (attack / 2) * reducee / 100;
- // }
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // {
- // defense = (defense * 70) / 100;
- // }
- // var damage = Math.Max(1, attack - defense);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // damage = CalcDamageUser2Monster((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, 10000, 10000);
- // damage = AdjustMinDamageUser2Monster((int)damage, attacker, attacked);
- // }
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = CalcDamageMonster2User((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, (attacked.Reborn != 0 && attacked.Class % 10 >= 3) ? 7000 : 10000,
- // 10000);
- // damage = AdjustMinDamageMonster2User((int)damage, attacker, attacked);
- // }
- // var reduceee = 10;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (!attacked.Owner.Equipment.Free(3))
- // {
- // switch (attacked.Owner.Equipment.TryGetItem(3).ID % 10)
- // {
- // case 9:
- // reduceee = 1000;
- // break;
- // case 8:
- // reduceee = 500;
- // break;
- // case 7:
- // reduceee = 200;
- // break;
- // case 6:
- // reduceee = 100;
- // break;
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // var n = Math.Max(1, attacker.Owner.Player.Strength / reduceee);
- // if (n > damage)
- // {
- // damage = n;
- // }
- // }
- // damage = Math.Max(1, damage);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- // }
- // if (attacked != null)
- // {
- // var reduces = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduces > 0)
- // {
- // damage -= damage * reduces / 100;
- // }
- // }
- // if (attacker != null)
- // {
- // damage += attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // damage -= attacked.PhysicalDamageDecrease;
- // }
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- // {
- // if (attacked.AzureDamage >= damage)
- // {
- // attacked.AzureDamage -= (int)damage;
- // int sec = 60 - (Time32.Now - attacked.MagicShieldStamp).TotalMilliseconds;
- // attacked.Owner.Send(Constants.Shield(attacked.AzureDamage, sec));
- // return 1;
- // }
- // else
- // {
- // damage -= attacked.AzureDamage;
- // attacked.AzureDamage = 0;
- // attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- // }
- // }
- // AutoRespone(attacker, attacked, ref damage);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Oblivion))
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Stamina >= 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 5;
- // return Math.Max((uint)1, (uint)damage);
- //}
- //public static uint Ninja(Player attacker, Player attacked, ref MsgInteract Packet, Database.SpellInformation spell = null)
- //{
- // if (attacked.Name == "InfernalEpico") return 1;
- // if (attacked.Name == "SilverOctopus") return 1;
- // if (attacked.Name == "GoldenOctopus") return 1;
- // if (Packet != null)
- // {
- // Packet.Effect = MsgInteract.InteractEffects.None;
- // }
- // if (attacked.Name == "Guard1" && attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // #region CheakMiss
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.DragonSwing))
- // if (Kernel.ChanceSuccess(35))
- // {
- // MsgName str = new MsgName(true);
- // str.UID = attacked.UID;
- // str.TextsCount = 1;
- // str.Type = MsgName.Effect;
- // str.Texts.Add("poisonmiss");
- // attacked.Owner.SendScreen(str, true);
- // return 0;
- // }
- // #endregion
- // }
- // #region PvP -- Player Vs Player -- Jugador Contra Jugador
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30;
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50;
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // #region Efectos Perfectos
- // /*
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // if (Kernel.ChanceSuccess(40))//40% Probabilidad de Que Salga
- // {
- // if (attacker.PrefictionLevel > attacked.PrefictionLevel)
- // {
- // Network.Writer.WriteUInt16((ushort)(1 << 10), 36, Packet.ToArray());
- // attacker.Owner.SendScreen(MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.LuckyStrike));
- // Damage += Damage * 0.8;
- // }
- // else
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // }
- // }
- // }
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // eff = attacker.PrefictionEffect.GetCalmWind();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.CalmWind);
- // foreach (var item in attacker.Owner.Spells.Values)
- // item.AttackStamp = Time64.Now.AddSeconds(-50);
- // }
- // eff = attacker.PrefictionEffect.GetDrainingTouch();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.DrainingTouch);
- // attacker.Hitpoints = attacker.MaxHitpoints;
- // attacker.Mana = attacker.MaxMana;
- // }
- // eff = attacker.PrefictionEffect.GetKillingFlash();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.MirrorofSin);
- // attacker.Owner.XPCount = 100;
- // }
- // if (attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // if (Damage >= attacked.MaxHitpoints / 2)
- // {
- // eff = attacker.PrefictionEffect.GetLightofStamina();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.LightofStamina);
- // attacker.Stamina = 150;
- // }
- // }
- // }
- // }
- // #region Prefiction on attacked from monster
- // if (attacked.PrefictionEffect != null)
- // {
- // var eff = attacked.PrefictionEffect.GetStrikeLock();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // return 0;
- // }
- // eff = attacked.PrefictionEffect.GetBloodSpawn();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.BloodSpawn);
- // attacked.Hitpoints = attacked.MaxHitpoints;
- // attacked.Mana = attacked.MaxMana;
- // }
- // eff = attacked.PrefictionEffect.GetMirrorofSin();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, 0, prefeff.MirrorofSin);
- // attacked.Owner.XPCount = 100;
- // }
- // if (attacked != null && attacked.PrefictionLevel >= attacker.PrefictionLevel)
- // {
- // eff = attacker.PrefictionEffect.GetShieldBreak();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.ShieldBreak);
- // attacked.AddFlag3(MsgUpdate.Flags.ShieldBreak);
- // attacked.ShieldBreakStamp = Time64.Now;
- // }
- // }
- // if (attacked != null && attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // eff = attacked.PrefictionEffect.GetDivineGuard();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, 0, prefeff.DivineGuard);
- // attacked.AddFlag3(MsgUpdate.Flags.DivineGuard);
- // attacked.DivineGuardStamp = Time64.Now;
- // }
- // }
- // }
- // #endregion
- // */
- // #endregion
- // #region Critico & Smash
- // Boolean canBT = false, CritInmmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower < attacked.BattlePower)
- // {
- // canBT = true;
- // }
- // }
- // else canBT = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (canBT)
- // {
- // if (Kernel.Rate(((float)attacker.Breaktrough / 1f - (float)attacked.Counteraction / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- // Damage = (Int32)Math.Floor((float)Damage * 1.5);
- // }
- // }
- // else
- // {
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower >= attacked.BattlePower)
- // {
- // CritInmmune = true;
- // }
- // }
- // else CritInmmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (CritInmmune)
- // {
- // if (Kernel.Rate(((float)attacker.CriticalStrike / 1f - (float)attacked.Immunity / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);
- // }
- // }
- // else
- // {
- // Immu(attacked);
- // }
- // }
- // #endregion
- // #region Breakthrough -- Potencia Baja ((DESACTIVADO)
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 5f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.3);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // attacker.Owner.Send("Le Has Dado un Smash!");
- // // }
- // // }
- // //}
- // #endregion
- // #region Breakthrough -- Potencia Alta ((DESACTIVADO))
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.2);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // attacker.Owner.Send("Successs Smashhh");
- // // }
- // // }
- // //}
- // #endregion
- // //Damage -= attacked.Defence;
- // #region MagicShield
- // if (!attacked.Transformed)
- // {
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.MagicShield))
- // {
- // if (attacked.ShieldTime > 0)
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // else
- // {
- // if (Damage > (ushort)(attacked.Defence * attacked.MagicShieldIncrease))
- // Damage -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > attacked.TransformationDefence)
- // {
- // Damage -= attacked.TransformationDefence;
- // }
- // else
- // Damage = 1;
- // }
- // #endregion
- // Damage *= Reborn;
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield))
- // {
- // if (Damage > attacked.AzureShieldDefence)
- // {
- // Damage -= attacked.AzureShieldDefence;
- // CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- // attacked.RemoveFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield);
- // }
- // else
- // {
- // CreateAzureDmg((uint)Damage, attacker, attacked);
- // attacked.AzureShieldDefence -= (ushort)Damage;
- // attacked.AzureShieldPacket();
- // Damage = 1;
- // }
- // }
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // if (attacked.Class == 165)
- // {
- // Damage -= Damage * reduce / 100;//Daño Aunmentado contra Windwalker
- // }
- // else
- // {
- // Damage -= Damage * reduce / 100;//Daño Reducido contra otras Clases
- // }
- // }
- // #endregion
- // #region Sepll Bounes
- // if (spell != null)
- // {
- // if (spell.ID != 12290)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (Double)(Damage * spell.PowerPercent);
- // }
- // }
- // }
- // #endregion
- // //////TESTT/////////
- // //if (attacker.CriticalStrike > attacked.Immunity)
- // //{
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (Int32)Math.Floor((float)Damage * 1.2);
- // // // attacker.Owner.Send("Critico V0");
- // //}
- // //else
- // //{
- // // Immu(attacked);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Immu;
- // // // attacker.Owner.Send("Critico V0 Anulado");
- // //}
- // /////////////////////
- // //#region CriticalStrike -- Potencia Baja
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 5f) - ((float)attacked.Immunity / 10f)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.3);
- // // }
- // // else
- // // {
- // // Immu(attacked);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Immu;
- // // // attacker.Owner.Send("Critico V0 Anulado");
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencia Alta
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 10f) - ((float)attacked.Immunity / 10f)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.2);
- // // }
- // // else
- // // {
- // // Immu(attacked);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Immu;
- // // // attacker.Owner.Send("Critico V0 Anulado");
- // // }
- // // }
- // //}
- // //#endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.2);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // #region DragonGem
- // var DragonBonus = attacker.Gems[GemTypes.Dragon];
- // if (DragonBonus > 0)
- // Damage += MathHelper.MulDiv((int)Damage, DragonBonus, 100);
- // if (attacker.Gems[GemTypes.Dragon] >= 210)
- // Damage += Damage * 50 / 100;
- // #endregion
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker != null)
- // {
- // Damage += (Double)attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // Damage -= (Double)attacked.PhysicalDamageDecrease;
- // }
- // AutoRespone(attacker, attacked, ref Damage);
- // #region Block
- // #region Block 1
- // int nAtk = attacked.Defence;
- // uint remove = 0;
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShieldBreak))
- // remove = 2000;
- // if (Kernel.Rate(((attacked.Block - remove) / 100)) && attacked.Block > 0)
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Block;
- // int blockdamage = ((nAtk * (attacked.Block / 100)) / 100);
- // if (Damage > blockdamage)
- // Damage -= blockdamage;
- // else
- // Damage = 1;
- // }
- // #endregion
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (Kernel.Rate(22))
- // {
- // if (attacked.Block > 0)
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Block;
- // Damage = (Int32)Math.Floor((float)Damage / 2);
- // }
- // }
- // }
- // #endregion
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion
- // #endregion
- // Damage = RemoveExcessDamageNinja((long)Damage, attacker, attacked);
- // //Damage -= nDef;
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // #endregion
- // #region Player Vs Monster
- // else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // int Damage = 0;
- // Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Melee, ref Packet);
- // CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- // return (uint)Damage;
- // }
- // #endregion
- // #region Monster Vs Player
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30; //30%
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50; //50%
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Damage = AdjustDamageMonster2Player(Damage, attacker, attacked);
- // Damage -= attacked.Defence;
- // Damage *= Reborn;
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 100;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // Damage = AdjustMinDamageMonster2Player(Damage, attacker, attacked);
- // #region Sell Bounes
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (long)(Damage * spell.PowerPercent);
- // }
- // }
- // #endregion
- // Damage -= attacked.PhysicalDamageDecrease;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // Damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // Damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (!attacked.MonsterInfo.Boss)
- // Damage *= 5;
- // else Damage += (int)(Damage * .1);
- // if (Damage < 1)
- // Damage = 1;
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // #endregion
- // #region Codigos Extras
- // if (attacker == null || attacked == null)
- // return 0;
- // long attack = 0;
- // int defense = 0;
- // if (attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
- // return 0;
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // if (!attacker.Transformed)
- // attack = attacker.MinAttack + random.Next((int)(attacker.MaxAttack - attacker.MinAttack));
- // else
- // attack = attacker.TransformationMinAttack +
- // random.Next((int)(attacker.TransformationMaxAttack - attacker.TransformationMinAttack));
- // if (attacker != null)
- // {
- // var bonus = attacker.Gems[1];
- // if (bonus > 0)
- // {
- // attack += MathHelper.MulDiv((int)attack, (int)bonus, (int)100);
- // }
- // // TODO: proficiency bonus
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && attack > 1)
- // attack = (long)(attack * 1.17);
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // attack = (long)(attack * spell.PowerPercent);
- // }
- // }
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // var reducee = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- // if (reducee > 0)
- // {
- // attack -= (attack / 2) * reducee / 100;
- // }
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // {
- // defense = (defense * 70) / 100;
- // }
- // var damage = Math.Max(1, attack - defense);
- // #endregion
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // damage = CalcDamageUser2Monster((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, 10000, 10000);
- // damage = AdjustMinDamageUser2Monster((int)damage, attacker, attacked);
- // }
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = CalcDamageMonster2User((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, (attacked.Reborn != 0 && attacked.Class % 10 >= 3) ? 7000 : 10000,
- // 10000);
- // damage = AdjustMinDamageMonster2User((int)damage, attacker, attacked);
- // }
- // var reduceee = 10;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (!attacked.Owner.Equipment.Free(3))
- // {
- // switch (attacked.Owner.Equipment.TryGetItem(3).ID % 10)
- // {
- // case 9:
- // reduceee = 1000;
- // break;
- // case 8:
- // reduceee = 500;
- // break;
- // case 7:
- // reduceee = 200;
- // break;
- // case 6:
- // reduceee = 100;
- // break;
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // var n = Math.Max(1, attacker.Owner.Player.Strength / reduceee);
- // if (n > damage)
- // {
- // damage = n;
- // }
- // }
- // damage = Math.Max(1, damage);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- // }
- // if (attacked != null)
- // {
- // var reduces = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduces > 0)
- // {
- // damage -= damage * reduces / 100;
- // }
- // }
- // if (attacker != null)
- // {
- // damage += attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // damage -= attacked.PhysicalDamageDecrease;
- // }
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- // {
- // if (attacked.AzureDamage >= damage)
- // {
- // attacked.AzureDamage -= (int)damage;
- // int sec = 60 - (Time32.Now - attacked.MagicShieldStamp).TotalMilliseconds;
- // attacked.Owner.Send(Constants.Shield(attacked.AzureDamage, sec));
- // return 1;
- // }
- // else
- // {
- // damage -= attacked.AzureDamage;
- // attacked.AzureDamage = 0;
- // attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- // }
- // }
- // AutoRespone(attacker, attacked, ref damage);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Oblivion))
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Stamina >= 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 5;
- // return Math.Max((uint)1, (uint)damage);
- //}
- //public static uint Monje(Player attacker, Player attacked, ref MsgInteract Packet, Database.SpellInformation spell = null)
- //{
- // if (attacked.Name == "InfernalEpico") return 1;
- // if (attacked.Name == "SilverOctopus") return 1;
- // if (attacked.Name == "GoldenOctopus") return 1;
- // if (Packet != null)
- // {
- // Packet.Effect = MsgInteract.InteractEffects.None;
- // }
- // if (attacked.Name == "Guard1" && attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // #region CheakMiss
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.DragonSwing))
- // if (Kernel.ChanceSuccess(30))
- // {
- // MsgName str = new MsgName(true);
- // str.UID = attacked.UID;
- // str.TextsCount = 1;
- // str.Type = MsgName.Effect;
- // str.Texts.Add("poisonmiss");
- // attacked.Owner.SendScreen(str, true);
- // return 0;
- // }
- // #endregion
- // }
- // #region PvP -- Player Vs Player -- Jugador Contra Jugador
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30;
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50;
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Boolean canBT = false, CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower < attacked.BattlePower)
- // {
- // canBT = true;
- // }
- // }
- // else canBT = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (canBT)
- // {
- // if (Kernel.Rate(((float)attacker.Breaktrough / 1f - (float)attacked.Counteraction / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- // Damage = (Int32)Math.Floor((float)Damage * 1.6);//60% de Daño
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacker.BattlePower >= attacked.BattlePower)
- // {
- // CritImmune = true;
- // }
- // }
- // else CritImmune = false;
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // if (CritImmune)
- // {
- // if (Kernel.Rate(((float)attacker.CriticalStrike / 1f - (float)attacked.Immunity / 2f)))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // Damage = (Int32)Math.Floor((float)Damage * 1.3);
- // }
- // }
- // }
- // //Damage -= attacked.Defence;
- // #region AzureShield
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- // {
- // if (Damage > attacked.AzureShieldDefence)
- // {
- // Damage -= attacked.AzureShieldDefence;
- // CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- // attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- // }
- // else
- // {
- // CreateAzureDmg((uint)Damage, attacker, attacked);
- // attacked.AzureShieldDefence -= (ushort)Damage;
- // attacked.AzureShieldPacket();
- // Damage = 1;
- // }
- // }
- // #endregion
- // //#region Breakthrough -- Potencias Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.4);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // }
- // // }
- // //}
- // //#endregion
- // #region Breakthrough -- Potencias Altas ((DESACTIVADO))
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- // // {
- // // Damage = (Int32)Math.Floor((float)Damage * 1.05);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Penetration;
- // // }
- // // }
- // //}
- // #endregion
- // Damage *= Reborn;
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield))
- // {
- // if (Damage > attacked.AzureShieldDefence)
- // {
- // Damage -= attacked.AzureShieldDefence;
- // CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- // attacked.RemoveFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield);
- // }
- // else
- // {
- // CreateAzureDmg((uint)Damage, attacker, attacked);
- // attacked.AzureShieldDefence -= (ushort)Damage;
- // attacked.AzureShieldPacket();
- // Damage = 1;
- // }
- // }
- // //#region Ataque segun Nobleza
- // //#region Rey
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.King)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion
- // //#region Duque
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion Prince
- // //#region Marques
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.2);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.0);
- // // }
- // //}
- // //#endregion Duke
- // //#region Conde
- // //if (attacker.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // //{
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // // if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
- // // {
- // // Damage = (int)((double)Damage * 1.5);
- // // }
- // //}
- // //#endregion Earl
- // //#endregion
- // #region Efectos Perfectos
- // /*
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // if (Kernel.ChanceSuccess(30))//30% Probabilidad de Que Salga
- // {
- // if (attacker.PrefictionLevel > attacked.PrefictionLevel)
- // {
- // Network.Writer.WriteUInt16((ushort)(1 << 10), 36, Packet.ToArray());
- // attacker.Owner.SendScreen(MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.LuckyStrike));
- // Damage += Damage / 2;
- // }
- // else
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // }
- // }
- // }
- // if (attacker.PrefictionEffect != null)
- // {
- // var eff = attacker.PrefictionEffect.GetLuckyStrike();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.LuckyStrike);
- // Damage += Damage;
- // }
- // eff = attacker.PrefictionEffect.GetCalmWind();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.CalmWind);
- // foreach (var item in attacker.Owner.Spells.Values)
- // item.AttackStamp = Time64.Now.AddSeconds(-50);
- // }
- // eff = attacker.PrefictionEffect.GetDrainingTouch();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, attacked.UID, prefeff.DrainingTouch);
- // attacker.Hitpoints = attacker.MaxHitpoints;
- // attacker.Mana = attacker.MaxMana;
- // }
- // eff = attacker.PrefictionEffect.GetKillingFlash();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.MirrorofSin);
- // attacker.Owner.XPCount = 100;
- // }
- // if (attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // if (Damage >= attacked.MaxHitpoints / 2)
- // {
- // eff = attacker.PrefictionEffect.GetLightofStamina();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.LightofStamina);
- // attacker.Stamina = 150;
- // }
- // }
- // }
- // }
- // #region Prefiction on attacked from monster
- // if (attacked.PrefictionEffect != null)
- // {
- // var eff = attacked.PrefictionEffect.GetStrikeLock();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.Stricklock);
- // return 0;
- // }
- // eff = attacked.PrefictionEffect.GetBloodSpawn();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, attacker.UID, prefeff.BloodSpawn);
- // attacked.Hitpoints = attacked.MaxHitpoints;
- // attacked.Mana = attacked.MaxMana;
- // }
- // eff = attacked.PrefictionEffect.GetMirrorofSin();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, 0, prefeff.MirrorofSin);
- // attacked.Owner.XPCount = 100;
- // }
- // if (attacked != null && attacked.PrefictionLevel >= attacker.PrefictionLevel)
- // {
- // eff = attacker.PrefictionEffect.GetShieldBreak();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacker.UID, 0, prefeff.ShieldBreak);
- // attacked.AddFlag3(MsgUpdate.Flags.ShieldBreak);
- // attacked.ShieldBreakStamp = Time64.Now;
- // }
- // }
- // if (attacked != null && attacked.PrefictionLevel > attacker.PrefictionLevel)
- // {
- // eff = attacked.PrefictionEffect.GetDivineGuard();
- // if (Kernel.Rate(eff.Percant))
- // {
- // MsgRefineEffect.SendPrefictioneffect(attacked.UID, 0, prefeff.DivineGuard);
- // attacked.AddFlag3(MsgUpdate.Flags.DivineGuard);
- // attacked.DivineGuardStamp = Time64.Now;
- // }
- // }
- // }
- // #endregion
- // */
- // #endregion
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 115;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // #region Sepll Bounes
- // if (spell != null)
- // {
- // if (spell.ID != 12290)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (Double)(Damage * spell.PowerPercent);
- // }
- // }
- // }
- // #endregion
- // //#region CriticalStrike -- Potencias Altas VS Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower > attacked.BattlePower)
- // // {
- // // if (attacker.CriticalStrike + 10000 > attacked.Immunity)
- // // {
- // // if (Kernel.Rate(50))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (Int32)Math.Floor((float)Damage * 1.2);
- // // attacker.Owner.Send("Le Has Dado un Criticaso!!");
- // // }
- // // }
- // // else
- // // {
- // // Immu(attacked);
- // // Packet.Effect1 |= MsgInteract.InteractEffects.Immu;
- // // attacker.Owner.Send("Te Anulo tu Criticaso!");
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Bajas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower < attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.2);
- // // }
- // // }
- // //}
- // //#endregion
- // //#region CriticalStrike -- Potencias Altas
- // //if (attacker.PlayerFlag == PlayerFlag.Player)
- // //{
- // // if (attacker.BattlePower >= attacked.BattlePower)
- // // {
- // // if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike) - ((float)attacked.Immunity)))
- // // {
- // // Packet.Effect1 |= MsgInteract.InteractEffects.CriticalStrike;
- // // Damage = (UInt32)Math.Floor((float)Damage * 1.4);
- // // }
- // // }
- // //}
- // //#endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // #region DragonGem
- // var DragonBonus = attacker.Gems[GemTypes.Dragon];
- // if (DragonBonus > 0)
- // Damage += MathHelper.MulDiv((int)Damage, DragonBonus, 100);
- // if (attacker.Gems[GemTypes.Dragon] >= 210)
- // Damage += Damage * 50 / 100;
- // #endregion
- // #region TortoiseGem -- LO LEE DESDE EL CODIGO DE REMOVEEXCESS
- // //double torist = (double)(attacked.Gems[COServer.AttackBedan.GemTypes.Tortoise] / 100d);
- // //torist = (double)(1 - torist);
- // //torist = Math.Max(torist, 0.5);
- // //Damage *= torist;
- // //Pezzi
- // #endregion
- // #region Superman & Stigma
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && Damage > 1)
- // Damage = (long)(Damage * 1.12);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // Damage *= 1.0; //PvP Reduction!
- // #endregion
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker != null)
- // {
- // Damage += (Double)attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // Damage -= (Double)attacked.PhysicalDamageDecrease;
- // }
- // AutoRespone(attacker, attacked, ref Damage);
- // #region Block
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (Kernel.Rate(22))
- // {
- // if (attacked.Block > 0)
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.Block;
- // Damage = (Int32)Math.Floor((float)Damage / 2);
- // }
- // }
- // }
- // #endregion
- // #region MagicShield
- // if (!attacked.Transformed)
- // {
- // if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.MagicShield))
- // {
- // if (attacked.ShieldTime > 0)
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // else
- // {
- // if (Damage > (ushort)(attacked.Defence * attacked.MagicShieldIncrease))
- // Damage -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > (int)attacked.Defence)
- // {
- // Damage -= (int)attacked.Defence;
- // }
- // else
- // Damage = 1;
- // }
- // }
- // else
- // {
- // if (Damage > attacked.TransformationDefence)
- // {
- // Damage -= attacked.TransformationDefence;
- // }
- // else
- // Damage = 1;
- // }
- // #endregion
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion End Defence
- // #endregion
- // Damage = RemoveExcessDamageMonje((long)Damage, attacker, attacked);//1
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // #endregion
- // #region Player Vs Monster
- // else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // int Damage = 0;
- // Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Melee, ref Packet);
- // CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- // return (uint)Damage;
- // }
- // #endregion
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // Double Damage = 0;
- // Double Reborn = 1.00;
- // if (attacked.Reborn == 1)
- // Reborn -= 0.30; //30%
- // else if (attacked.Reborn >= 2)
- // Reborn -= 0.50; //50%
- // Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- // Damage = AdjustDamageMonster2Player(Damage, attacker, attacked);
- // Damage -= attacked.Defence;
- // Damage *= Reborn;
- // #region Bless Reduction
- // var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduce > 0)
- // {
- // Damage -= Damage * reduce / 100;
- // }
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // Damage = AdjustMinDamageMonster2Player(Damage, attacker, attacked);
- // #region Sell Bounes
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // Damage = (long)(Damage * spell.PowerPercent);
- // }
- // }
- // #endregion
- // Damage -= attacked.PhysicalDamageDecrease;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.Stamina > 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // attacked.Action = Enums.ConquerAction.None;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // Damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // Damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (!attacked.MonsterInfo.Boss)
- // Damage *= 5;
- // else Damage += (int)(Damage * .1);
- // if (Damage < 1)
- // Damage = 1;
- // #region Reduction!
- // #region Clac Defence
- // int nDef, defmain;
- // if (!attacker.Transformed)
- // nDef = defmain = attacked.Defence;
- // else
- // nDef = defmain = attacked.TransformationDefence;
- // nDef = Handle.ShieldDefence(attacked, nDef);
- // if (attacked.IsDefensiveStance)
- // nDef *= 3;
- // #endregion End Defence
- // #endregion
- // if (Damage < 1)
- // Damage = 1;
- // return (UInt32)Math.Round(Damage, (Int32)0);
- // }
- // if (attacker == null || attacked == null)
- // return 0;
- // long attack = 0;
- // int defense = 0;
- // if (attacker.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
- // return 0;
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- // return 1;
- // if (attacked.ContainsFlag((ulong)1UL << 53))
- // return 1;
- // if (!attacker.Transformed)
- // attack = attacker.MinAttack + random.Next((int)(attacker.MaxAttack - attacker.MinAttack));
- // else
- // attack = attacker.TransformationMinAttack +
- // random.Next((int)(attacker.TransformationMaxAttack - attacker.TransformationMinAttack));
- // if (attacker != null)
- // {
- // var bonus = attacker.Gems[1];
- // if (bonus > 0)
- // {
- // attack += MathHelper.MulDiv((int)attack, (int)bonus, (int)100);
- // }
- // // TODO: proficiency bonus
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- // if (!attacker.Transformed && attack > 1)
- // attack = (long)(attack * 1.17);
- // if (spell != null)
- // {
- // if (spell.PowerPercent != 0)
- // {
- // attack = (long)(attack * spell.PowerPercent);
- // }
- // }
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // var reducee = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- // if (reducee > 0)
- // {
- // attack -= (attack / 2) * reducee / 100;
- // }
- // }
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- // {
- // defense = (defense * 70) / 100;
- // }
- // var damage = Math.Max(1, attack - defense);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- // {
- // damage = CalcDamageUser2Monster((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, 10000, 10000);
- // damage = AdjustMinDamageUser2Monster((int)damage, attacker, attacked);
- // }
- // else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = CalcDamageMonster2User((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- // damage = MathHelper.MulDiv((int)damage, (attacked.Reborn != 0 && attacked.Class % 10 >= 3) ? 7000 : 10000,
- // 10000);
- // damage = AdjustMinDamageMonster2User((int)damage, attacker, attacked);
- // }
- // var reduceee = 10;
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (!attacked.Owner.Equipment.Free(3))
- // {
- // switch (attacked.Owner.Equipment.TryGetItem(3).ID % 10)
- // {
- // case 9:
- // reduceee = 1000;
- // break;
- // case 8:
- // reduceee = 500;
- // break;
- // case 7:
- // reduceee = 200;
- // break;
- // case 6:
- // reduceee = 100;
- // break;
- // }
- // }
- // }
- // if (attacker.PlayerFlag == PlayerFlag.Player)
- // {
- // var n = Math.Max(1, attacker.Owner.Player.Strength / reduceee);
- // if (n > damage)
- // {
- // damage = n;
- // }
- // }
- // damage = Math.Max(1, damage);
- // if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- // }
- // if (attacked != null)
- // {
- // var reduces = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- // if (reduces > 0)
- // {
- // damage -= damage * reduces / 100;
- // }
- // }
- // if (attacker != null)
- // {
- // damage += attacker.PhysicalDamageIncrease;
- // }
- // if (attacked != null)
- // {
- // damage -= attacked.PhysicalDamageDecrease;
- // }
- // if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- // {
- // if (attacked.AzureDamage >= damage)
- // {
- // attacked.AzureDamage -= (int)damage;
- // int sec = 60 - (Time32.Now - attacked.MagicShieldStamp).TotalMilliseconds;
- // attacked.Owner.Send(Constants.Shield(attacked.AzureDamage, sec));
- // return 1;
- // }
- // else
- // {
- // damage -= attacked.AzureDamage;
- // attacked.AzureDamage = 0;
- // attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- // }
- // }
- // AutoRespone(attacker, attacked, ref damage);
- // if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Oblivion))
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacked.Action == Enums.ConquerAction.Sit)
- // if (attacked.PlayerFlag == PlayerFlag.Player)
- // {
- // if (attacked.Stamina >= 20)
- // attacked.Stamina -= 20;
- // else
- // attacked.Stamina = 0;
- // }
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // if (attacked.MonsterInfo.Boss)
- // damage *= 2;
- // if (attacker.OnSuperman())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 2;
- // if (attacker.OnFatalStrike())
- // if (attacked.PlayerFlag == PlayerFlag.Monster)
- // damage *= 5;
- // return Math.Max((uint)1, (uint)damage);
- //}
- #endregion
- public static uint Melee(Player attacker, MsgNpcInfoEX attacked, ref MsgInteract Packet)
- {
- long Damage = 0;
- Boolean CritImmune = false;
- Durability(attacker, null, null);
- if (!attacker.Transformed)
- Damage = Kernel.Random.Next((int)Math.Min((long)attacker.MinAttack, (long)attacker.MaxAttack),
- (int)Math.Max((long)attacker.MinAttack, (long)attacker.MaxAttack) + 1);
- else
- Damage = Kernel.Random.Next((int)attacker.TransformationMinAttack,
- (int)attacker.TransformationMaxAttack + 1);
- if (attacker.Gems[1] != 0)
- {
- Damage += (uint)Math.Floor(Damage * (double)(attacker.Gems[1] * 0.01));
- }
- if (attacker.WearsGoldPrize) Damage += (long)(Damage * goldPrizePsyAttackCoefficient);
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed)
- Damage = (long)(Damage * 1.1);
- Damage += attacker.PhysicalDamageIncrease;
- if (Kernel.ChanceSuccess(5))
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.Owner.BlessTime > 0)
- {
- Damage *= 2;
- MsgName str = new MsgName(true);
- str.UID = attacker.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- attacker.Owner.SendScreen(str, true);
- }
- }
- }
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (!CritImmune)
- {
- if (Kernel.ChanceSuccess((float)attacker.CriticalStrike / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- Damage = (Int32)Math.Floor((float)Damage * 1.0);
- }
- }
- }
- Damage = Damage * 2;
- if (Damage <= 0)
- Damage = 1;
- return (uint)(Damage * reduceValue);
- }
- public static int RemoveExcessDamage(int CurrentDamage, Player Attacker, Player Opponent)
- {
- if (Opponent.PlayerFlag != PlayerFlag.Player)
- return CurrentDamage;
- if (Opponent.Reborn == 1)
- CurrentDamage = (int)Math.Round((double)(CurrentDamage * 1.6));
- else if (Opponent.Reborn == 2)
- CurrentDamage = (int)Math.Round((double)(CurrentDamage * 1.4));
- CurrentDamage = (int)Math.Round((double)(CurrentDamage * (Math.Max(0.1, 1.00 - (Opponent.ItemBless * 0.01)))));
- CurrentDamage -= CurrentDamage * Math.Min(Opponent.Gems[7], (ushort)75) / 100;
- return CurrentDamage;
- }
- public static uint Fisicos(Player attacker, Player attacked, ref MsgInteract Packet, Database.SpellInformation spell = null)
- {
- if (attacked.Name == "InfernalEpico") return 1;
- if (attacked.Name == "SilverOctopus") return 1;
- if (attacked.Name == "GoldenOctopus") return 1;
- if (Packet != null)
- {
- Packet.Effect = MsgInteract.InteractEffects.None;
- }
- if (attacked.Name == "Guard1" && attacker.PlayerFlag == PlayerFlag.Monster)
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- #region CheakMiss
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.DragonSwing))
- if (Kernel.ChanceSuccess(30))
- {
- MsgName str = new MsgName(true);
- str.UID = attacked.UID;
- str.TextsCount = 1;
- str.Type = MsgName.Effect;
- str.Texts.Add("poisonmiss");
- attacked.Owner.SendScreen(str, true);
- return 0;
- }
- #endregion
- }
- #region PvP -- Player Vs Player -- Jugador Contra Jugador
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (attacked.ContainsFlag((ulong)1UL << 53))
- return 1;
- Double Damage = 0;
- Double Reborn = 1.00;
- if (attacked.Reborn == 1)
- Reborn -= 0.30;
- else if (attacked.Reborn >= 2)
- Reborn -= 0.50;
- Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- #region AzureShield
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (Damage > attacked.AzureShieldDefence)
- {
- Damage -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- }
- else
- {
- CreateAzureDmg((uint)Damage, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)Damage;
- attacked.AzureShieldPacket();
- Damage = 1;
- }
- }
- #endregion
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- {
- Damage = (Int32)Math.Floor((float)Damage * 1.4);
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower >= attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- {
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- //Damage -= attacked.Defence;
- Damage *= Reborn;
- if (attacked.ContainsFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield))
- {
- if (Damage > attacked.AzureShieldDefence)
- {
- Damage -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)Network.GamePackets.MsgUpdate.Flags.AzureShield);
- }
- else
- {
- CreateAzureDmg((uint)Damage, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)Damage;
- attacked.AzureShieldPacket();
- Damage = 1;
- }
- }
- #region Bless Reduction
- var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- Damage -= Damage * reduce / 100;
- }
- #endregion
- if (Damage < 1)
- Damage = 1;
- #region Sepll Bounes
- if (spell != null)
- {
- if (spell.ID != 12290)
- {
- if (spell.PowerPercent != 0)
- {
- Damage = (Double)(Damage * spell.PowerPercent);
- }
- }
- }
- #endregion
- #region CriticalStrike
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- Damage = (UInt32)Math.Floor((float)Damage * 1.1);
- }
- }
- }
- #endregion
- #region CriticalStrike
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower >= attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- Damage = (UInt32)Math.Floor((float)Damage * 1.4);
- }
- }
- }
- #endregion
- #region Superman & Stigma
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed && Damage > 1)
- Damage = (long)(Damage * 1.12);
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- Damage *= 1.0; //PvP Reduction!
- #endregion
- #region DragonGem
- var DragonBonus = attacker.Gems[GemTypes.Dragon];
- if (DragonBonus > 0)
- Damage += MathHelper.MulDiv((int)Damage, DragonBonus, 100);
- if (attacker.Gems[GemTypes.Dragon] >= 210)
- Damage += Damage * 50 / 100;
- #endregion
- #region TortoiseGem -- LO LEE DESDE EL CODIGO DE REMOVEEXCESS
- //double torist = (double)(attacked.Gems[COServer.AttackBedan.GemTypes.Tortoise] / 100d);
- //torist = (double)(1 - torist);
- //torist = Math.Max(torist, 0.5);
- //Damage *= torist;
- //Pezzi
- #endregion
- #region Superman & Stigma
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed && Damage > 1)
- Damage = (long)(Damage * 1.12);
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- Damage *= 1.0; //PvP Reduction!
- #endregion
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Action == Enums.ConquerAction.Sit)
- if (attacked.Stamina > 20)
- attacked.Stamina -= 20;
- else
- attacked.Stamina = 0;
- attacked.Action = Enums.ConquerAction.None;
- }
- if (attacker != null)
- {
- Damage += (Double)attacker.PhysicalDamageIncrease;
- }
- if (attacked != null)
- {
- Damage -= (Double)attacked.PhysicalDamageDecrease;
- }
- AutoRespone(attacker, attacked, ref Damage);
- #region Block
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(22))
- {
- if (attacked.Block > 0)
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- Damage = (Int32)Math.Floor((float)Damage / 2);
- }
- }
- }
- #endregion
- #region Reduction!
- #region Clac Defence
- int nDef, defmain;
- if (!attacker.Transformed)
- nDef = defmain = attacked.Defence;
- else
- nDef = defmain = attacked.TransformationDefence;
- nDef = Handle.ShieldDefence(attacked, nDef);
- if (attacked.IsDefensiveStance)
- nDef *= 3;
- #endregion End Defence
- #endregion
- //Damage = RemoveExcessDamage((long)Damage, attacker, attacked);
- if (Damage < 1)
- Damage = 1;
- return (UInt32)Math.Round(Damage, (Int32)0);
- }
- #endregion
- #region Player Vs Monster
- else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- {
- int Damage = 0;
- Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Melee, ref Packet);
- CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- return (uint)Damage;
- }
- #endregion
- else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (attacked.ContainsFlag((ulong)1UL << 53))
- return 1;
- Double Damage = 0;
- Double Reborn = 1.00;
- if (attacked.Reborn == 1)
- Reborn -= 0.30; //30%
- else if (attacked.Reborn >= 2)
- Reborn -= 0.50; //50%
- Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- Damage = AdjustDamageMonster2Player(Damage, attacker, attacked);
- Damage -= attacked.Defence;
- Damage *= Reborn;
- #region Bless Reduction
- var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- Damage -= Damage * reduce / 100;
- }
- #endregion
- if (Damage < 1)
- Damage = 1;
- Damage = AdjustMinDamageMonster2Player(Damage, attacker, attacked);
- #region Sell Bounes
- if (spell != null)
- {
- if (spell.PowerPercent != 0)
- {
- Damage = (long)(Damage * spell.PowerPercent);
- }
- }
- #endregion
- Damage -= attacked.PhysicalDamageDecrease;
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Action == Enums.ConquerAction.Sit)
- if (attacked.Stamina > 20)
- attacked.Stamina -= 20;
- else
- attacked.Stamina = 0;
- attacked.Action = Enums.ConquerAction.None;
- }
- if (attacker.OnSuperman())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- if (attacked.MonsterInfo.Boss)
- Damage *= 2;
- if (attacker.OnSuperman())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- Damage *= 2;
- if (attacker.OnFatalStrike())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- if (!attacked.MonsterInfo.Boss)
- Damage *= 5;
- else Damage += (int)(Damage * .1);
- if (Damage < 1)
- Damage = 1;
- #region Reduction!
- #region Clac Defence
- int nDef, defmain;
- if (!attacker.Transformed)
- nDef = defmain = attacked.Defence;
- else
- nDef = defmain = attacked.TransformationDefence;
- nDef = Handle.ShieldDefence(attacked, nDef);
- if (attacked.IsDefensiveStance)
- nDef *= 3;
- #endregion End Defence
- #endregion
- if (Damage < 1)
- Damage = 1;
- return (UInt32)Math.Round(Damage, (Int32)0);
- }
- if (attacker == null || attacked == null)
- return 0;
- long attack = 0;
- int defense = 0;
- if (attacker.PlayerFlag == PlayerFlag.Monster)
- if (attacked.PlayerFlag == PlayerFlag.Player)
- if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
- return 0;
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (attacked.ContainsFlag((ulong)1UL << 53))
- return 1;
- if (!attacker.Transformed)
- attack = attacker.MinAttack + random.Next((int)(attacker.MaxAttack - attacker.MinAttack));
- else
- attack = attacker.TransformationMinAttack +
- random.Next((int)(attacker.TransformationMaxAttack - attacker.TransformationMinAttack));
- if (attacker != null)
- {
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- attack += MathHelper.MulDiv((int)attack, (int)bonus, (int)100);
- }
- // TODO: proficiency bonus
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed && attack > 1)
- attack = (long)(attack * 1.17);
- if (spell != null)
- {
- if (spell.PowerPercent != 0)
- {
- attack = (long)(attack * spell.PowerPercent);
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reducee = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- if (reducee > 0)
- {
- attack -= (attack / 2) * reducee / 100;
- }
- }
- if (!attacked.Transformed)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.MagicShield))
- {
- if (attacked.ShieldTime > 0)
- attack -= attacked.Defence;
- else
- attack -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- }
- else
- {
- defense = attacked.Defence;
- }
- }
- else
- {
- attack -= attacked.TransformationDefence;
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- {
- defense = (defense * 70) / 100;
- }
- var damage = Math.Max(1, attack - defense);
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- {
- damage = CalcDamageUser2Monster((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- damage = MathHelper.MulDiv((int)damage, 10000, 10000);
- damage = AdjustMinDamageUser2Monster((int)damage, attacker, attacked);
- }
- else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- {
- damage = CalcDamageMonster2User((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- damage = MathHelper.MulDiv((int)damage, (attacked.Reborn != 0 && attacked.Class % 10 >= 3) ? 7000 : 10000,
- 10000);
- damage = AdjustMinDamageMonster2User((int)damage, attacker, attacked);
- }
- var reduceee = 10;
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (!attacked.Owner.Equipment.Free(3))
- {
- switch (attacked.Owner.Equipment.TryGetItem(3).ID % 10)
- {
- case 9:
- reduceee = 1000;
- break;
- case 8:
- reduceee = 500;
- break;
- case 7:
- reduceee = 200;
- break;
- case 6:
- reduceee = 100;
- break;
- }
- }
- }
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- var n = Math.Max(1, attacker.Owner.Player.Strength / reduceee);
- if (n > damage)
- {
- damage = n;
- }
- }
- damage = Math.Max(1, damage);
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- }
- if (attacked != null)
- {
- var reduces = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- if (reduces > 0)
- {
- damage -= damage * reduces / 100;
- }
- }
- if (attacker != null)
- {
- damage += attacker.PhysicalDamageIncrease;
- }
- if (attacked != null)
- {
- damage -= attacked.PhysicalDamageDecrease;
- }
- AutoRespone(attacker, attacked, ref damage);
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Oblivion))
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage *= 2;
- if (attacked.Action == Enums.ConquerAction.Sit)
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Stamina >= 20)
- attacked.Stamina -= 20;
- else
- attacked.Stamina = 0;
- }
- if (attacker.OnSuperman())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- if (attacked.MonsterInfo.Boss)
- damage *= 2;
- if (attacker.OnSuperman())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage *= 2;
- if (attacker.OnFatalStrike())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage *= 5;
- return Math.Max((uint)1, (uint)damage);
- }
- public static uint Melee(Player attacker, Player attacked, ref MsgInteract Packet, Database.SpellInformation spell = null)
- {
- if (Packet != null)
- {
- Packet.Effect = MsgInteract.InteractEffects.None;
- }
- #region HideGui
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- MsgAction Data = new MsgAction(true);
- Data.UID = attacker.UID;
- Data.UID = attacked.UID;
- Data.ID = MsgAction.Mode.HideGui;
- attacker.Owner.Send(Data);
- attacked.Owner.Send(Data);
- }
- #endregion
- #region MyClones
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.MyClones.Count > 0)
- {
- foreach (var item in attacked.MyClones.Values)
- {
- attacked.Owner.Map.RemoveEntity(item);
- MsgAction data = new MsgAction(true);
- data.UID = item.UID;
- data.ID = MsgAction.Mode.RemoveEntity;
- item.MonsterInfo.SendScreen(data);
- }
- attacked.MyClones.Clear();
- return 0;
- }
- }
- #endregion
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- int Damage = 0;
- AutoRespone(attacker, attacked, ref Damage);
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.DragonSwing))
- {
- if (Kernel.Rate(20))
- {
- MsgName str = new MsgName(true);
- str.UID = attacked.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("poisonmiss");
- if (attacked.PlayerFlag == PlayerFlag.Player)
- attacked.Owner.SendScreen(str, true);
- return 0;
- }
- }
- }
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- Durability(attacker, attacked, null);
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- Double Damage = 0;
- Double Reborn = 1.00;
- if (attacked.Reborn == 1)
- Reborn -= 0.30;
- else if (attacked.Reborn >= 2)
- Reborn -= 0.50;
- Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- {
- Damage = (Int32)attacker.MaxAttack;
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- #region GemBounes
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- Damage += MathHelper.MulDiv((int)Damage, (int)bonus, (int)100);
- }
- #endregion
- Damage -= attacked.Defence;
- Damage *= Reborn;
- #region Bless Reduction
- var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- Damage -= Damage * reduce / 100;
- }
- #endregion
- if (Damage < 1)
- Damage = 1;
- #region LuckyTime Bounes
- if (Kernel.ChanceSuccess(5))
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.Owner.BlessTime > 0)
- {
- Damage *= 2;
- MsgName str = new MsgName(true);
- str.UID = attacker.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- attacker.Owner.SendScreen(str, true);
- }
- }
- }
- if (Kernel.ChanceSuccess(5))
- {
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Owner.BlessTime > 0)
- {
- Damage = 1;
- MsgName str = new MsgName(true);
- str.UID = attacked.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- attacked.Owner.SendScreen(str, true);
- }
- }
- }
- #endregion
- #region Sepll Bounes
- if (spell != null)
- {
- if (spell.ID != 12290)
- {
- if (spell.PowerPercent != 0)
- {
- Damage = (Double)(Damage * spell.PowerPercent);
- }
- }
- }
- #endregion
- int strike = Math.Max(110, 130);
- if (attacker.CriticalStrike > 0u)
- {
- if (Base.GetRefinery((uint)attacker.CriticalStrike / 100, (uint)attacked.Immunity / 100))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- Damage = Base.MulDiv((int)Damage, strike, 100);
- }
- }
- #region Superman & Stigma
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed && Damage > 1)
- Damage = (long)(Damage * 1.1);
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- Damage *= 0.2;
- #endregion
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- uint TortoisePercent = attacked.Owner.GemValues(Enums.Gem.NormalTortoiseGem);
- if (TortoisePercent > 0u) Damage -= Damage * Math.Min((int)TortoisePercent, 20) / 150;
- }
- if (attacked.Action == Enums.ConquerAction.Sit)
- {
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Stamina >= 0)
- attacked.Stamina = (byte)(attacked.Stamina / 2);
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Ride))
- {
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Stamina >= 0)
- attacked.Stamina = (byte)(attacked.Stamina / 1.60);
- }
- }
- if (attacker != null)
- {
- Damage += (Double)attacker.PhysicalDamageIncrease;
- }
- if (attacked != null)
- {
- Damage -= (Double)attacked.PhysicalDamageDecrease;
- }
- AutoRespone(attacker, attacked, ref Damage);
- if (attacker.OnIntensify && Time32.Now >= attacker.IntensifyStamp.AddSeconds(4))
- {
- Damage *= 2;
- attacker.OnIntensify = false;
- attacker.RemoveFlag((ulong)MsgUpdate.Flags.Intensify);
- }
- #region Block
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.ChanceSuccess((float)attacked.Block / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- Damage = (Int32)Math.Floor((float)Damage / 2);
- }
- }
- #endregion
- #region Reduction!
- if (attacked.IsDefensiveStance)
- {
- if (attacked.FatigueSecs > 120)
- {
- Damage -= attacked.Defence + (Double)(attacked.Defence * 0.40);
- }
- else
- {
- Damage -= attacked.Defence + (Double)(attacked.Defence * 0.20);
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (Damage > attacked.AzureShieldDefence)
- {
- Damage -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.AzuredShield = true;
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- }
- else
- {
- CreateAzureDmg((uint)Damage, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)Damage;
- attacked.AzureShieldPacket();
- Damage = 1;
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (Damage > attacked.IronShieldDefence)
- {
- Damage -= (int)attacked.IronShieldDefence;
- CreateAzureDmg(attacked.IronShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)Damage, attacker, attacked);
- attacked.IronShieldDefence -= (uint)Damage;
- attacked.IronShieldPacket();
- Damage = 1;
- }
- }
- #endregion
- if (Damage < 1)
- Damage = 1;
- return (UInt32)Math.Round(Damage, (Int32)0);
- }
- else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- {
- int Damage = 0;
- Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Melee, ref Packet);
- CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- return (uint)Damage;
- }
- else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- {
- Durability(attacker, attacked, null);
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- Double Damage = 0;
- Double Reborn = 1.00;
- if (attacked.Reborn == 1)
- Reborn -= 0.30;
- else if (attacked.Reborn >= 2)
- Reborn -= 0.50;
- Damage = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- Damage = AdjustDamageMonster2Player(Damage, attacker, attacked);
- Damage -= attacked.Defence;
- Damage *= Reborn;
- #region Bless Reduction
- var reduce = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- Damage -= Damage * reduce / 100;
- }
- #endregion
- if (Damage < 1)
- Damage = 1;
- Damage = AdjustMinDamageMonster2Player(Damage, attacker, attacked);
- #region LuckyTime Bounes
- if (Kernel.ChanceSuccess(5))
- {
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Owner.BlessTime > 0)
- {
- Damage = 1;
- MsgName str = new MsgName(true);
- str.UID = attacked.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- attacked.Owner.SendScreen(str, true);
- }
- }
- }
- #endregion
- #region Sell Bounes
- if (spell != null)
- {
- if (spell.PowerPercent != 0)
- {
- Damage = (long)(Damage * spell.PowerPercent);
- }
- }
- #endregion
- Damage -= attacked.PhysicalDamageDecrease;
- if (attacked.Action == Enums.ConquerAction.Sit)
- {
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Stamina >= 0)
- attacked.Stamina = (byte)(attacked.Stamina / 2);
- }
- }
- if (Damage < 1)
- Damage = 1;
- #region Reduction!
- if (attacked.IsDefensiveStance)
- {
- if (attacked.FatigueSecs > 120)
- {
- Damage -= attacked.Defence + (Double)(attacked.Defence * 0.40);
- }
- else
- {
- Damage -= attacked.Defence + (Double)(attacked.Defence * 0.20);
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (Damage > attacked.AzureShieldDefence)
- {
- Damage -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- attacked.AzuredShield = true;
- }
- else
- {
- CreateAzureDmg((uint)Damage, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)Damage;
- attacked.AzureShieldPacket();
- Damage = 1;
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (Damage > attacked.IronShieldDefence)
- {
- Damage -= (int)attacked.IronShieldDefence;
- CreateAzureDmg(attacked.IronShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)Damage, attacker, attacked);
- attacked.IronShieldDefence -= (uint)Damage;
- attacked.IronShieldPacket();
- Damage = 1;
- }
- }
- #endregion
- if (Damage < 1)
- Damage = 1;
- return (UInt32)Math.Round(Damage, (Int32)0);
- }
- if (attacker == null || attacked == null) return 0;
- long attack = 0;
- int defense = 0;
- if (attacker.PlayerFlag == PlayerFlag.Monster)
- if (attacked.PlayerFlag == PlayerFlag.Player)
- if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
- return 0;
- Durability(attacker, attacked, null);
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (!attacker.Transformed)
- attack = attacker.MinAttack + Kernel.Random.Next((int)(attacker.MaxAttack - attacker.MinAttack));
- else
- attack = attacker.TransformationMinAttack + Kernel.Random.Next((int)(attacker.TransformationMaxAttack - attacker.TransformationMinAttack));
- if (attacker != null)
- {
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- attack += MathHelper.MulDiv((int)attack, (int)bonus, (int)100);
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed && attack > 1)
- attack = (long)(attack * 1.1);
- if (spell != null)
- {
- if (spell.PowerPercent != 0)
- {
- attack = (long)(attack * spell.PowerPercent);
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reducee = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- if (reducee > 0)
- {
- attack -= (attack / 2) * reducee / 10;
- }
- }
- if (!attacked.Transformed)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.MagicShield))
- {
- if (attacked.ShieldTime > 0)
- attack -= attacked.Defence;
- else
- attack -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
- }
- else
- {
- defense = attacked.Defence;
- }
- }
- else
- {
- attack -= attacked.TransformationDefence;
- }
- if (attacked.IsDefensiveStance)
- {
- if (attacked.FatigueSecs > 120)
- {
- attack -= attacked.Defence + (long)(attacked.Defence * 0.40);
- }
- else
- {
- attack -= attacked.Defence + (long)(attacked.Defence * 0.20);
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Superman))
- {
- defense = (defense * 50) / 100;
- }
- var damage = Math.Max(1, attack - defense);
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- {
- damage = CalcDamageUser2Monster((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- damage = MathHelper.MulDiv((int)damage, 10000, 10000);
- damage = AdjustMinDamageUser2Monster((int)damage, attacker, attacked);
- }
- else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- {
- damage = CalcDamageMonster2User((int)attack, defense, attacker.Level, attacked.Level, (int)damage);
- damage = MathHelper.MulDiv((int)damage, (attacked.Reborn != 0 && attacked.Class % 10 >= 3) ? 7000 : 10000,
- 10000);
- damage = AdjustMinDamageMonster2User((int)damage, attacker, attacked);
- }
- #region LuckyTime Bounes
- if (Kernel.ChanceSuccess(5))
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.Owner.BlessTime > 0)
- {
- attack *= 2;
- MsgName str = new MsgName(true);
- str.UID = attacker.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- attacker.Owner.SendScreen(str, true);
- }
- }
- }
- if (Kernel.ChanceSuccess(5))
- {
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Owner.BlessTime > 0)
- {
- attack = 1;
- MsgName str = new MsgName(true);
- str.UID = attacked.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- attacked.Owner.SendScreen(str, true);
- }
- }
- }
- #endregion
- var reduceee = 10;
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (!attacked.Owner.Equipment.Free(3))
- {
- switch (attacked.Owner.Equipment.TryGetItem(3).ID % 10)
- {
- case 9:
- reduceee = 1000;
- break;
- case 8:
- reduceee = 500;
- break;
- case 7:
- reduceee = 200;
- break;
- case 6:
- reduceee = 100;
- break;
- }
- }
- }
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- var n = Math.Max(1, attacker.Owner.Player.Strength / reduceee);
- if (n > damage)
- {
- damage = n;
- }
- }
- damage = Math.Max(1, damage);
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- }
- if (attacked != null)
- {
- var reduces = Math.Max(0, Math.Min((int)100, (int)attacked.ItemBless));
- if (reduces > 0)
- {
- damage -= damage * reduces / 100;
- }
- }
- if (attacker != null)
- {
- damage += attacker.PhysicalDamageIncrease;
- }
- if (attacked != null)
- {
- damage -= attacked.PhysicalDamageDecrease;
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (damage > attacked.AzureShieldDefence)
- {
- damage -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- attacked.AzuredShield = true;
- }
- else
- {
- CreateAzureDmg((uint)damage, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)damage;
- attacked.AzureShieldPacket();
- damage = 1;
- }
- }
- #region IronShield
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (damage > attacked.IronShieldDefence)
- {
- damage -= (int)attacked.IronShieldDefence;
- CreateAzureDmg(attacked.IronShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)damage, attacker, attacked);
- attacked.IronShieldDefence -= (uint)damage;
- attacked.IronShieldPacket();
- damage = 1;
- }
- }
- #endregion
- AutoRespone(attacker, attacked, ref damage);
- if (attacker.NobilityRank < attacked.NobilityRank)
- {
- var dif = attacked.NobilityRank - attacker.NobilityRank;
- switch (dif)
- {
- case 1:
- damage = (damage * 70) / 100;
- break;
- case 2:
- damage = (damage * 60) / 100;
- break;
- case 3:
- damage = (damage * 50) / 100;
- break;
- case 4:
- damage = (damage * 40) / 100;
- break;
- case 5:
- damage = (damage * 30) / 100;
- break;
- default:
- damage = (damage * 30) / 100;
- break;
- }
- }
- //if (attacker.Assassin())
- //{
- // damage = damage * (random.Next(20, 25)) / 100;
- //}
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Oblivion))
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage *= 2;
- if (attacked.Action == Enums.ConquerAction.Sit)
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Stamina >= 20)
- attacked.Stamina -= 20;
- else
- attacked.Stamina = 0;
- }
- if (attacker.OnFatalStrike())
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage *= 5;
- return Math.Max((uint)1, (uint)damage);
- }
- public static uint Magic(Player Attacker, Player Attacked, Database.SpellInformation SInfo, ref MsgInteract Packet)
- {
- if (Attacker == null) return 0;
- if (Attacked == null) return 0;
- #region HideGui
- if (Attacker.PlayerFlag == PlayerFlag.Player && Attacked.PlayerFlag == PlayerFlag.Player)
- {
- MsgAction Data = new MsgAction(true);
- Data.UID = Attacker.UID;
- Data.UID = Attacked.UID;
- Data.ID = MsgAction.Mode.HideGui;
- Attacker.Owner.Send(Data);
- Attacked.Owner.Send(Data);
- }
- #endregion
- #region MyClones
- if (Attacker.PlayerFlag == PlayerFlag.Player && Attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Attacked.MyClones.Count > 0)
- {
- foreach (var item in Attacked.MyClones.Values)
- {
- MsgAction data = new MsgAction(true);
- data.UID = item.UID;
- data.ID = MsgAction.Mode.RemoveEntity;
- item.MonsterInfo.SendScreen(data);
- Attacked.Owner.Map.RemoveEntity(item);
- Attacked.Owner.Send(data);
- }
- Attacked.MyClones.Clear();
- return 0;
- }
- }
- #endregion
- if (Attacker.PlayerFlag == PlayerFlag.Player && Attacked.PlayerFlag == PlayerFlag.Player)
- {
- Durability(Attacker, Attacked, null);
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(50))
- {
- GemEffect.Process(Attacker);
- }
- }
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- if (Attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex)) return 1;
- Double attack = SInfo.Power;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- attack += (uint)Attacker.MagicAttack;
- }
- AutoRespone(Attacker, Attacked, ref attack);
- #region Breakthrough
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Attacker.BattlePower < Attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)Attacker.Breaktrough / 10f) - (float)(Attacked.Counteraction / 10f)))
- {
- attack = (Int32)Attacker.MagicAttack;
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- var defense = Attacked.MagicDefence;
- attack -= defense;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- var effect = Attacker.Gems[0];
- attack += attack * effect / 100;
- if (effect >= 180)
- {
- attack += attack / 20;
- }
- #region LuckyTime Bounes
- if (Kernel.ChanceSuccess(5))
- {
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Attacker.Owner.BlessTime > 0)
- {
- attack *= 2;
- MsgName str = new MsgName(true);
- str.UID = Attacker.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- Attacker.Owner.SendScreen(str, true);
- }
- }
- }
- if (Kernel.ChanceSuccess(5))
- {
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Attacked.Owner.BlessTime > 0)
- {
- attack = 1;
- MsgName str = new MsgName(true);
- str.UID = Attacked.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- Attacked.Owner.SendScreen(str, true);
- }
- }
- }
- #endregion
- }
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- attack -= (attack / 2) * Attacked.Gems[7] / 10;
- }
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attack > 0)
- {
- uint TortoisePercent = Attacked.Owner.GemValues(Enums.Gem.NormalTortoiseGem);
- if (TortoisePercent > 0u) attack -= attack * Math.Min((int)TortoisePercent, 20) / 150;
- }
- }
- attack = Math.Max(0, attack);
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- attack = (uint)AdjustRebirthDamage(Attacked.Owner, Attacker.Owner, (int)attack);
- }
- }
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)Attacked.ItemBless));
- if (reduce > 0)
- {
- attack -= (uint)(attack * reduce / 100);
- }
- }
- Double Damage = attack;
- if (Damage < 1)
- Damage = 1;
- AutoRespone(Attacker, Attacked, ref Damage);
- if (Attacker != null)
- {
- Damage += Attacker.MagicDamageIncrease;
- }
- if (Attacked != null)
- {
- Damage -= Attacked.MagicDamageDecrease;
- }
- if (Attacked.HasMagicDefender && (Attacker.BattlePower - Attacked.BattlePower) <= 3)
- {
- Damage = 0;
- MsgName str = new MsgName(true);
- str.UID = Attacked.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("bossimmunity");
- Attacked.Owner.SendScreen(str, true);
- }
- else
- {
- Attacked.RemoveMagicDefender();
- }
- #region CriticalStrike
- int strike = Math.Max(110, 120);
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Base.GetRefinery((uint)Attacker.CriticalStrike / 100, (uint)Attacked.Immunity / 100))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- Damage = Base.MulDiv((int)Damage, strike, 100);
- }
- }
- #endregion
- #region Reduction!
- if (Attacked.IsDefensiveStance)
- {
- if (Attacked.FatigueSecs > 120)
- {
- Damage -= Attacked.Defence + (Double)(Attacked.Defence * 0.40);
- }
- else
- {
- Damage -= Attacked.Defence + (Double)(Attacked.Defence * 0.20);
- }
- }
- if (Attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (Damage > Attacked.AzureShieldDefence)
- {
- Damage -= Attacked.AzureShieldDefence;
- CreateAzureDmg(Attacked.AzureShieldDefence, Attacker, Attacked);
- Attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- Attacked.AzuredShield = true;
- }
- else
- {
- CreateAzureDmg((uint)Damage, Attacker, Attacked);
- Attacked.AzureShieldDefence -= (ushort)Damage;
- Attacked.AzureShieldPacket();
- Damage = 1;
- }
- }
- if (Attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (Damage > Attacked.IronShieldDefence)
- {
- Damage -= (int)Attacked.IronShieldDefence;
- CreateAzureDmg(Attacked.IronShieldDefence, Attacker, Attacked);
- Attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)Damage, Attacker, Attacked);
- Attacked.IronShieldDefence -= (uint)Damage;
- Attacked.IronShieldPacket();
- Damage = 1;
- }
- }
- #endregion
- if (SInfo.ID == 10310)
- {
- Damage = Damage / 2;
- }
- if (Damage < 1)
- Damage = 1;
- return Math.Max(1, (uint)Damage);
- }
- else
- {
- switch (Attacker.PlayerFlag)
- {
- case PlayerFlag.Monster:
- {
- long Damage = 0;
- Int32 Defence = 0;
- if (Kernel.ChanceSuccess((float)Attacked.Immunity / 100f))
- {
- }
- Int32 Fan = 0, Tower = 0;
- #region Resist
- if (Attacker.PlayerFlag == PlayerFlag.Monster && Attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Attacker.Name == "SnowBanshee")
- {
- if (Kernel.Rate((float)Attacked.WaterResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.WaterResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.WoodResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.WoodResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- }
- if (Attacker.Name == "SnowBansheeSoul" || Attacker.Name == "PurpleBanshee")
- {
- if (Kernel.Rate((float)Attacked.WaterResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.WaterResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.MetalResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.MetalResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.WoodResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.WoodResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- }
- if (Attacker.Name == "SwordMaster")
- {
- if (Kernel.Rate((float)Attacked.MetalResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.MetalResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.WoodResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.WoodResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- }
- if (Attacker.Name == "TeratoDragon")
- {
- if (Kernel.Rate((float)Attacked.FireResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.FireResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.WoodResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.WoodResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- }
- if (Attacker.Name == "ThrillingSpook" || Attacker.Name == "ThrillingSpook2" || Attacker.Name == "ThrillingSpook2" || Attacker.Name == "ChillingSpook")
- {
- if (Kernel.Rate((float)Attacked.EarthResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.EarthResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.WoodResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.WoodResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- }
- if (Attacker.Name == "NemesisTyrant")
- {
- if (Kernel.Rate((float)Attacked.MetalResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.MetalResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.FireResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.FireResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.EarthResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.EarthResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.WaterResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.WaterResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- else if (Kernel.Rate((float)Attacked.WoodResistance / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.WoodResist;
- Damage = (Int32)Math.Floor((float)Damage * 1.1);
- }
- }
- }
- #endregion
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- Fan = Attacker.getFan(true);
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- Tower = Attacked.getTower(true);
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- if (Attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex)) return 1;
- Defence = (Int32)Attacked.MagicDefence;
- if (Attacker.Penetration > 0)
- Defence -= (ushort)((float)Defence / 100 * (Attacker.Penetration / 100));
- Damage = (Int32)Attacker.BaseMagicAttack;
- Damage += (Int32)SInfo.Power;
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Attacked.Reborn == 1)
- Damage = (Int32)(Damage * 0.69);
- if (Attacked.Reborn == 2)
- Damage = (Int32)(Damage * 0.49);
- }
- Damage += Fan;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- Damage += Attacker.MagicDamageIncrease;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Damage > 0)
- {
- Damage +=
- (Int32)(Math.Floor((Double)Damage * Attacker.GemBonus(ItemSocket.Phoenix)));
- }
- }
- Damage -= Defence;
- Damage -= Tower;
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.ChanceSuccess((float)Attacked.Block / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- Damage = (Int32)Math.Floor((float)Damage / 2);
- }
- }
- if (Attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Damage > 0)
- {
- uint TortoisePercent = Attacked.Owner.GemValues(Enums.Gem.NormalTortoiseGem);
- if (TortoisePercent > 0u) Damage -= Damage * Math.Min((int)TortoisePercent, 20) / 150;
- }
- }
- if (Damage <= 0)
- Damage = 1;
- Damage = Damage / 6;
- AutoRespone(Attacker, Attacked, ref Damage);
- #region AzureShield
- if (Attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (Damage > Attacked.AzureShieldDefence)
- {
- Damage -= Attacked.AzureShieldDefence;
- CreateAzureDmg(Attacked.AzureShieldDefence, Attacker, Attacked);
- Attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- Attacked.AzuredShield = true;
- }
- else
- {
- CreateAzureDmg((uint)Damage, Attacker, Attacked);
- Attacked.AzureShieldDefence -= (ushort)Damage;
- Attacked.AzureShieldPacket();
- Damage = 1;
- }
- }
- #endregion
- if (Attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (Damage > Attacked.IronShieldDefence)
- {
- Damage -= (int)Attacked.IronShieldDefence;
- CreateAzureDmg(Attacked.IronShieldDefence, Attacker, Attacked);
- Attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)Damage, Attacker, Attacked);
- Attacked.IronShieldDefence -= (uint)Damage;
- Attacked.IronShieldPacket();
- Damage = 1;
- }
- }
- if (Attacked.HasMagicDefender && (Attacker.BattlePower - Attacked.BattlePower) <= 3)
- {
- Damage = 0;
- MsgName str = new MsgName(true);
- str.UID = Attacked.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("bossimmunity");
- Attacked.Owner.SendScreen(str, true);
- }
- else
- Attacked.RemoveMagicDefender();
- return (uint)Damage;
- }
- case PlayerFlag.Player:
- {
- long Damage = 0;
- Int32 Defence = 0;
- Int32 Fan = 0;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- Fan = Attacker.getFan(true);
- if (Miss((int)SInfo.Percent)) return 0;
- Defence = Attacked.MonsterInfo.Level * 2;
- Damage = (Int32)Attacker.BaseMagicAttack;
- Damage += (Int32)SInfo.Power;
- #region Breakthrough
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Attacker.BattlePower < Attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)Attacker.Breaktrough / 10f) - (float)(Attacked.Counteraction / 10f)))
- {
- Damage = (Int32)Attacker.BaseMagicAttack;
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- if (Attacker.WearsGoldPrize) Damage += (long)(Damage * goldPrizeMagAttackCoefficient);
- if (Attacked.Hitpoints <= Damage)
- {
- Attacked.Die(Attacker);
- Attacked.IsDropped = true;
- }
- Damage += Fan;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- Damage += Attacker.MagicDamageIncrease;
- if (Attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Damage > 0)
- {
- Damage += (Int32)(Math.Floor((Double)Damage * Attacker.GemBonus(ItemSocket.Phoenix)));
- }
- }
- Damage *= (long)(2.5);
- Damage -= Defence;
- int strike = Math.Max(110, 120);
- if (Attacker.CriticalStrike > 0u)
- {
- if (Base.GetRefinery((uint)Attacker.CriticalStrike / 100, (uint)Attacked.Immunity / 100))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- Damage = Base.MulDiv((int)Damage, strike, 100);
- }
- }
- if (Damage <= 1) Damage = 1;
- return (UInt32)Damage;
- }
- }
- return 0;
- }
- }
- public static uint Magic(Player attacker, Player attacked, ushort spellID, byte spellLevel, ref MsgInteract Packet)
- {
- if (Database.SpellTable.SpellInformations.ContainsKey(spellID))
- {
- Database.SpellInformation spell = Database.SpellTable.SpellInformations[spellID][spellLevel];
- return Magic(attacker, attacked, spell, ref Packet);
- }
- return 0;
- }
- public static uint Magic(Player attacker, MsgNpcInfoEX attacked, Database.SpellInformation spell, ref MsgInteract Packet)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(50))
- {
- GemEffect.Process(attacker);
- }
- }
- if (spell != null)
- if (!Kernel.ChanceSuccess(spell.Percent))
- return 0;
- if (spell != null)
- Durability(attacker, null, spell);
- if (attacker.Transformed)
- return 0;
- long Damage = 0;
- Damage = (long)attacker.MagicAttack;
- if (attacker.Gems[0] != 0)
- {
- Damage += (uint)Math.Floor(Damage * (double)(attacker.Gems[0] * 0.01));
- }
- if (spell != null)
- Damage += spell.Power;
- if (attacker.WearsGoldPrize) Damage += (long)(Damage * goldPrizeMagAttackCoefficient);
- if (Kernel.ChanceSuccess(5))
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.Owner.BlessTime > 0)
- {
- Damage *= 2;
- MsgName str = new MsgName(true);
- str.UID = attacker.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- attacker.Owner.SendScreen(str, true);
- }
- }
- }
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Damage > 0)
- {
- Damage += (Int32)(Math.Floor((Double)Damage * attacker.GemBonus(ItemSocket.Phoenix)));
- }
- }
- if (attacker.Class > 100)
- Damage -= Damage * 7 / 10;
- Damage += attacker.MagicDamageIncrease;
- if (Damage <= 0)
- Damage = 1;
- return (uint)Damage;
- }
- public static uint Ranged(Player attacker, Player attacked, ref MsgInteract Packet)
- {
- if (Packet != null)
- {
- Packet.Effect = MsgInteract.InteractEffects.None;
- }
- #region HideGui
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- MsgAction Data = new MsgAction(true);
- Data.UID = attacker.UID;
- Data.UID = attacked.UID;
- Data.ID = MsgAction.Mode.HideGui;
- attacker.Owner.Send(Data);
- attacked.Owner.Send(Data);
- }
- #endregion
- #region MyClones
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.MyClones.Count > 0)
- {
- foreach (var item in attacked.MyClones.Values)
- {
- MsgAction data = new MsgAction(true);
- data.UID = item.UID;
- data.ID = MsgAction.Mode.RemoveEntity;
- item.MonsterInfo.SendScreen(data);
- attacked.Owner.Map.RemoveEntity(item);
- attacked.Owner.Send(data);
- }
- attacked.MyClones.Clear();
- return 0;
- }
- }
- #endregion
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex)) return 1;
- if (attacker.Transformed) return 0;
- if (attacker == null) return 0;
- if (attacked == null) return 0;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(50))
- {
- GemEffect.Process(attacker);
- }
- }
- Durability(attacker, attacked, null);
- if (attacker.Transformed)
- return 0;
- Double attack = attacker.MinAttack + Kernel.Random.Next((int)attacker.MaxAttack - (int)attacker.MinAttack);
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- {
- attack = (Int32)attacker.MaxAttack;
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- AutoRespone(attacker, attacked, ref attack);
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- attack += MathHelper.MulDiv((int)attack, bonus, 100);
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed)
- attack = (long)(attack * 1.1);
- Double defense = attacked.Defence;
- Double damage = attack - defense;
- var targetLevel = attacked.Level;
- if (targetLevel < 22) damage = MathHelper.MulDiv((int)damage, 35, 100);
- else if (targetLevel < 50) damage = MathHelper.MulDiv((int)damage, 25, 100);
- else if (targetLevel < 90) damage = MathHelper.MulDiv((int)damage, 20, 100);
- else if (targetLevel < 110) damage = MathHelper.MulDiv((int)damage, 15, 100);
- else damage = MathHelper.MulDiv((int)damage, 12, 100);
- int strike = Math.Max(110, 120);
- if (attacker.CriticalStrike > 0u)
- {
- if (Base.GetRefinery((uint)attacker.CriticalStrike / 100, (uint)attacked.Immunity / 100))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- damage = Base.MulDiv((int)damage, strike, 100);
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- if (reduce > 0)
- {
- damage -= (damage / 2) * reduce / 10;
- }
- }
- damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- damage -= damage * (int)reduce / 100;
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage = damage * 3;
- if (attacker.OnIntensify && Time32.Now >= attacker.IntensifyStamp.AddSeconds(4))
- {
- damage *= 2;
- attacker.OnIntensify = false;
- attacker.RemoveFlag((ulong)MsgUpdate.Flags.Intensify);
- }
- #region Block
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.ChanceSuccess((float)attacked.Block / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- damage = (Int32)Math.Floor((float)damage / 2);
- }
- }
- #endregion
- #region Reduction!
- if (attacked.IsDefensiveStance)
- {
- if (attacked.FatigueSecs > 120)
- {
- damage -= attacked.Defence + (Double)(attacked.Defence * 0.40);
- }
- else
- {
- damage -= attacked.Defence + (Double)(attacked.Defence * 0.20);
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (damage > attacked.AzureShieldDefence)
- {
- damage -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- attacked.AzuredShield = true;
- }
- else
- {
- CreateAzureDmg((uint)damage, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)damage;
- attacked.AzureShieldPacket();
- damage = 1;
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (damage > attacked.IronShieldDefence)
- {
- damage -= (int)attacked.IronShieldDefence;
- CreateAzureDmg(attacked.IronShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)damage, attacker, attacked);
- attacked.IronShieldDefence -= (uint)damage;
- attacked.IronShieldPacket();
- damage = 1;
- }
- }
- #endregion
- if (damage < 0)
- damage = 1;
- return Math.Max((uint)1, (uint)damage);
- }
- else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- {
- int Damage = 0;
- Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, MsgInteract.Ranged, ref Packet);
- CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- return (uint)Damage;
- }
- else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (attacker.Transformed)
- return 0;
- if (attacker == null)
- return 0;
- if (attacked == null)
- return 0;
- #region Effect By Maxs
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(50))
- {
- GemEffect.Process(attacker);
- }
- }
- #endregion
- Durability(attacker, attacked, null);
- if (attacker.Transformed)
- return 0;
- Double attack = attacker.MinAttack + Kernel.Random.Next((int)attacker.MaxAttack - (int)attacker.MinAttack);
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- {
- attack = (Int32)attacker.MaxAttack/* + 3000*/;
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- attack += MathHelper.MulDiv((int)attack, bonus, 100);
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed)
- attack = (long)(attack * 1.1);
- Double defense = attacked.Defence;
- Double damage = attack - defense;
- var targetLevel = attacked.Level;
- if (targetLevel < 22) damage = MathHelper.MulDiv((int)damage, 35, 100);
- else if (targetLevel < 50) damage = MathHelper.MulDiv((int)damage, 25, 100);
- else if (targetLevel < 90) damage = MathHelper.MulDiv((int)damage, 20, 100);
- else if (targetLevel < 110) damage = MathHelper.MulDiv((int)damage, 15, 100);
- else damage = MathHelper.MulDiv((int)damage, 12, 100);
- int strike = Math.Max(110, 120);
- if (attacker.CriticalStrike > 0u)
- {
- if (Base.GetRefinery((uint)attacker.CriticalStrike / 100, (uint)attacked.Immunity / 100))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- damage = Base.MulDiv((int)damage, strike, 100);
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- if (reduce > 0)
- {
- damage -= (damage / 2) * reduce / 10;
- }
- }
- damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- damage -= damage * (int)reduce / 100;
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage = damage * 3;
- if (attacker.OnIntensify && Time32.Now >= attacker.IntensifyStamp.AddSeconds(4))
- {
- damage *= 2;
- attacker.OnIntensify = false;
- attacker.RemoveFlag((ulong)MsgUpdate.Flags.Intensify);
- }
- #region Block
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.ChanceSuccess((float)attacked.Block / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- damage = (Int32)Math.Floor((float)damage / 2);
- }
- }
- #endregion
- #region Reduction!
- if (attacked.IsDefensiveStance)
- {
- if (attacked.FatigueSecs > 120)
- {
- damage -= attacked.Defence + (Double)(attacked.Defence * 0.40);
- }
- else
- {
- damage -= attacked.Defence + (Double)(attacked.Defence * 0.20);
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (damage > attacked.AzureShieldDefence)
- {
- damage -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- attacked.AzuredShield = true;
- }
- else
- {
- CreateAzureDmg((uint)damage, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)damage;
- attacked.AzureShieldPacket();
- damage = 1;
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (damage > attacked.IronShieldDefence)
- {
- damage -= (int)attacked.IronShieldDefence;
- CreateAzureDmg(attacked.IronShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)damage, attacker, attacked);
- attacked.IronShieldDefence -= (uint)damage;
- attacked.IronShieldPacket();
- damage = 1;
- }
- }
- #endregion
- if (damage < 0)
- damage = 1;
- return Math.Max((uint)1, (uint)damage);
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex)) return 1;
- if (attacker.Transformed) return 0;
- if (attacker == null) return 0;
- if (attacked == null) return 0;
- #region Effect By Maxs
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(50))
- {
- GemEffect.Process(attacker);
- }
- }
- #endregion
- Durability(attacker, attacked, null);
- if (attacker.Transformed)
- return 0;
- Double attacke = attacker.MinAttack + Kernel.Random.Next((int)attacker.MaxAttack - (int)attacker.MinAttack);
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- {
- attacke = (Int32)attacker.MaxAttack/* + 3000*/;
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- attacke += MathHelper.MulDiv((int)attacke, bonus, 100);
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed)
- attacke = (long)(attacke * 1.1);
- Double defensee = attacked.Defence;
- Double damagee = attacke - defensee;
- var targetLevell = attacked.Level;
- if (targetLevell < 22) damagee = MathHelper.MulDiv((int)damagee, 35, 100);
- else if (targetLevell < 50) damagee = MathHelper.MulDiv((int)damagee, 25, 100);
- else if (targetLevell < 90) damagee = MathHelper.MulDiv((int)damagee, 20, 100);
- else if (targetLevell < 110) damagee = MathHelper.MulDiv((int)damagee, 15, 100);
- else damagee = MathHelper.MulDiv((int)damagee, 12, 100);
- //int strikee = Math.Max(110, 120);
- //if (attacker.CriticalStrike > 0u)
- //{
- // if (Base.GetRefinery((uint)attacker.CriticalStrike / 100, (uint)attacked.Immunity / 100))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // damagee = Base.MulDiv((int)damagee, strikee, 100);
- // }
- //}
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- if (reduce > 0)
- {
- damagee -= (damagee / 2) * reduce / 10;
- }
- }
- damagee = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damagee);
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- damagee -= damagee * (int)reduce / 100;
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damagee = damagee * 3;
- if (attacker.OnIntensify && Time32.Now >= attacker.IntensifyStamp.AddSeconds(4))
- {
- damagee *= 2;
- attacker.OnIntensify = false;
- attacker.RemoveFlag((ulong)MsgUpdate.Flags.Intensify);
- }
- #region Block
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.ChanceSuccess((float)attacked.Block / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- damagee = (Int32)Math.Floor((float)damagee / 2);
- }
- }
- #endregion
- #region Reduction!
- if (attacked.IsDefensiveStance)
- {
- if (attacked.FatigueSecs > 120)
- {
- damagee -= attacked.Defence + (Double)(attacked.Defence * 0.40);
- }
- else
- {
- damagee -= attacked.Defence + (Double)(attacked.Defence * 0.20);
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (damagee > attacked.AzureShieldDefence)
- {
- damagee -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- attacked.AzuredShield = true;
- }
- else
- {
- CreateAzureDmg((uint)damagee, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)damagee;
- attacked.AzureShieldPacket();
- damagee = 1;
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (damagee > attacked.IronShieldDefence)
- {
- damagee -= (int)attacked.IronShieldDefence;
- CreateAzureDmg(attacked.IronShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)damagee, attacker, attacked);
- attacked.IronShieldDefence -= (uint)damagee;
- attacked.IronShieldPacket();
- damagee = 1;
- }
- }
- #endregion
- if (damagee < 0)
- damagee = 1;
- return Math.Max((uint)1, (uint)damagee);
- }
- public static uint Ranged(Player attacker, MsgNpcInfoEX attacked, ref MsgInteract Packet)
- {
- long Damage = 0;
- Durability(attacker, null, null);
- if (attacker.Transformed) return 0;
- Damage = Kernel.Random.Next((int)Math.Min(attacker.MinAttack, attacker.MaxAttack),
- (int)Math.Max(attacker.MinAttack, attacker.MaxAttack) + 1);
- if (attacker.Gems[1] != 0)
- {
- Damage += (uint)Math.Floor(Damage * (double)(attacker.Gems[1] * 0.01));
- }
- if (attacker.WearsGoldPrize) Damage += (long)(Damage * goldPrizePsyAttackCoefficient);
- if (attacker.OnIntensify && Time32.Now >= attacker.IntensifyStamp.AddSeconds(4))
- {
- Damage *= 2;
- attacker.OnIntensify = false;
- attacker.RemoveFlag((ulong)MsgUpdate.Flags.Intensify);
- }
- if (Kernel.ChanceSuccess(5))
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.Owner.BlessTime > 0)
- {
- Damage *= 2;
- MsgName str = new MsgName(true);
- str.UID = attacker.UID;
- str.TextsCount = 1;
- str.Action = MsgName.Effect;
- str.Texts.Add("LuckyGuy");
- attacker.Owner.SendScreen(str, true);
- }
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed)
- Damage = (long)(Damage * 1.1);
- Damage += attacker.PhysicalDamageIncrease;
- Damage += Damage;
- Damage += Damage / 4;
- if (Damage <= 0)
- Damage = 1;
- return (uint)(Damage * reduceValue);
- }
- public static uint Ranged(Player attacker, Player attacked, Database.SpellInformation spell, ref MsgInteract Packet)
- {
- if (Packet != null)
- {
- Packet.Effect = MsgInteract.InteractEffects.None;
- }
- #region HideGui
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- MsgAction Data = new MsgAction(true);
- Data.UID = attacker.UID;
- Data.UID = attacked.UID;
- Data.ID = MsgAction.Mode.HideGui;
- attacker.Owner.Send(Data);
- attacked.Owner.Send(Data);
- }
- #endregion
- #region MyClones
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.MyClones.Count > 0)
- {
- foreach (var clone in attacked.MyClones.Values)
- {
- MsgAction data = new MsgAction(true);
- data.UID = clone.UID;
- data.ID = MsgAction.Mode.RemoveEntity;
- clone.MonsterInfo.SendScreen(data);
- attacked.Owner.Map.RemoveEntity(clone);
- attacked.Owner.Send(data);
- }
- attacked.MyClones.Clear();
- return 0;
- }
- }
- #endregion
- if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
- return 1;
- if (attacked.ContainsFlag((ulong)1UL << 53))
- return 1;
- if (attacker.Transformed)
- return 0;
- if (attacker == null)
- return 0;
- if (attacked == null)
- return 0;
- #region Effect
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(50))
- {
- GemEffect.Process(attacker);
- }
- }
- #endregion
- if (attacker.Transformed)
- return 0;
- Double attack = MyMath.Generate((int)attacker.MinAttack, (int)attacker.MaxAttack);
- //Double attack = attacker.MinAttack + random.Next((int)attacker.MaxAttack - (int)attacker.MinAttack);
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- {
- attack = (Int32)Math.Floor((float)attack * 1.6);
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower >= attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.Breaktrough / 10f) - (float)(attacked.Counteraction / 10f)))
- {
- attack = (Int32)Math.Floor((float)attack * 1.05);
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- #region Spell Bounes
- if (spell != null)
- {
- if (spell.PowerPercent != 0)
- {
- attack = (long)(attack * spell.PowerPercent);
- }
- }
- #endregion
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- attack += MathHelper.MulDiv((int)attack, bonus, 100);
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed)
- attack = (long)(attack * 1.17);
- Double defense = attacked.Defence;
- Double damage = attack - defense;
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- #region BattelPower
- if (Packet.Effect != MsgInteract.InteractEffects.Penetration)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- ushort BattlePower = (ushort)(attacked.BattlePower - attacker.BattlePower);
- if (BattlePower == 1)
- {
- damage = (damage * 70) / 100;
- }
- else if (BattlePower == 2)
- {
- damage = (damage * 60) / 100;
- }
- else if (BattlePower == 3)
- {
- damage = (damage * 50) / 100;
- }
- else if (BattlePower == 4)
- {
- damage = (damage * 40) / 100;
- }
- else if (BattlePower >= 5)
- {
- damage = (damage * 30) / 100;
- }
- }
- }
- #endregion
- }
- var targetLevel = attacked.Level;
- if (targetLevel < 22) damage = MathHelper.MulDiv((int)damage, 35, 100);
- else if (targetLevel < 50) damage = MathHelper.MulDiv((int)damage, 25, 100);
- else if (targetLevel < 90) damage = MathHelper.MulDiv((int)damage, 20, 100);
- else if (targetLevel < 110) damage = MathHelper.MulDiv((int)damage, 15, 100);
- else damage = MathHelper.MulDiv((int)damage, 12, 100);
- #region CriticalStrike
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- damage = (UInt32)Math.Floor((float)damage * 1.0);
- }
- }
- }
- #endregion
- #region CriticalStrike
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower >= attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(((float)attacker.CriticalStrike / 100f) - ((float)attacked.Immunity / 100f)))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- damage = (UInt32)Math.Floor((float)damage * 1.5);
- }
- }
- }
- #endregion
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- if (reduce > 0)
- {
- damage -= (damage / 2) * reduce / 100;
- }
- }
- damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- damage -= damage * (int)reduce / 100;
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage = damage * 3;
- #region Block
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(22))
- {
- if (attacked.Block > 0)
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- damage = (Int32)Math.Floor((float)damage / 2);
- }
- }
- }
- #endregion
- #region Reduction!
- #region Clac Defence
- int nDef, defmain;
- if (!attacker.Transformed)
- nDef = defmain = attacked.Defence;
- else
- nDef = defmain = attacked.TransformationDefence;
- nDef = Handle.ShieldDefence(attacked, nDef);
- if (attacked.IsDefensiveStance)
- nDef *= 3;
- #endregion End Defence
- #endregion
- if (damage < 0)
- damage = 1;
- return Math.Max((uint)1, (uint)damage);
- }
- else if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Monster)
- {
- int Damage = 0;
- Damage = CalculateMonster.GetDamageEntity2Monster(attacker, attacked, spell.ID, spell.Level, ref Packet);
- CalculateMonster.CheckDamage(attacker, attacked, ref Damage, ref Packet, false);
- return (uint)Damage;
- }
- else if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex)) return 1;
- if (attacker.Transformed) return 0;
- if (attacker == null) return 0;
- if (attacked == null) return 0;
- #region GemEffect
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(50))
- {
- GemEffect.Process(attacker);
- }
- }
- #endregion
- Durability(attacker, attacked, null);
- if (attacker.Transformed) return 0;
- Double attack = attacker.MinAttack + Kernel.Random.Next((int)attacker.MaxAttack - (int)attacker.MinAttack);
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(attacker.Breaktrough / 10f - attacked.Counteraction / 10f))
- {
- attack = attacker.MaxAttack;
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- #region Spell Bounes
- if (spell != null)
- {
- if (spell.PowerPercent != 0)
- {
- attack = (long)(attack * spell.PowerPercent);
- }
- }
- #endregion
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- attack += MathHelper.MulDiv((int)attack, bonus, 100);
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed)
- attack = (long)(attack * 1.1);
- Double defense = attacked.Defence;
- Double damage = attack - defense;
- var targetLevel = attacked.Level;
- if (targetLevel < 22) damage = MathHelper.MulDiv((int)damage, 35, 100);
- else if (targetLevel < 50) damage = MathHelper.MulDiv((int)damage, 25, 100);
- else if (targetLevel < 90) damage = MathHelper.MulDiv((int)damage, 20, 100);
- else if (targetLevel < 110) damage = MathHelper.MulDiv((int)damage, 15, 100);
- else damage = MathHelper.MulDiv((int)damage, 12, 100);
- //int strike = Math.Max(110, 120);
- //if (attacker.CriticalStrike > 0u)
- //{
- // if (Base.GetRefinery((uint)attacker.CriticalStrike / 100, (uint)attacked.Immunity / 100))
- // {
- // Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- // damage = Base.MulDiv((int)damage, strike, 100);
- // }
- //}
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- if (reduce > 0)
- {
- damage -= (damage / 2) * reduce / 10;
- }
- }
- damage = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damage);
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- damage -= damage * (int)reduce / 100;
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damage = damage * 3;
- if (attacker.OnIntensify && Time32.Now >= attacker.IntensifyStamp.AddSeconds(4))
- {
- damage *= 2;
- attacker.OnIntensify = false;
- attacker.RemoveFlag((ulong)MsgUpdate.Flags.Intensify);
- }
- #region Block
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.ChanceSuccess((float)attacked.Block / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- damage = (Int32)Math.Floor((float)damage / 2);
- }
- }
- #endregion
- #region Reduction!
- if (attacked.IsDefensiveStance)
- {
- if (attacked.FatigueSecs > 120)
- {
- damage -= attacked.Defence + (Double)(attacked.Defence * 0.40);
- }
- else
- {
- damage -= attacked.Defence + (Double)(attacked.Defence * 0.20);
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (damage > attacked.AzureShieldDefence)
- {
- damage -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- attacked.AzuredShield = true;
- }
- else
- {
- CreateAzureDmg((uint)damage, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)damage;
- attacked.AzureShieldPacket();
- damage = 1;
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (damage > attacked.IronShieldDefence)
- {
- damage -= (int)attacked.IronShieldDefence;
- CreateAzureDmg(attacked.IronShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)damage, attacker, attacked);
- attacked.IronShieldDefence -= (uint)damage;
- attacked.IronShieldPacket();
- damage = 1;
- }
- }
- #endregion
- if (damage < 0)
- damage = 1;
- return Math.Max((uint)1, (uint)damage);
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex)) return 1;
- if (attacker.Transformed) return 0;
- if (attacker == null) return 0;
- if (attacked == null) return 0;
- #region Effect
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.Rate(50))
- {
- GemEffect.Process(attacker);
- }
- }
- #endregion
- Durability(attacker, attacked, null);
- if (attacker.Transformed) return 0;
- double attacke = attacker.MinAttack + Kernel.Random.Next((int)attacker.MaxAttack - (int)attacker.MinAttack);
- #region Breakthrough
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.BattlePower < attacked.BattlePower)
- {
- if (Kernel.ChanceSuccess(attacker.Breaktrough / 10f - attacked.Counteraction / 10f))
- {
- attacke = attacker.MaxAttack;
- Packet.Effect |= MsgInteract.InteractEffects.Penetration;
- }
- }
- }
- #endregion
- #region Spell Bounes
- if (spell != null)
- {
- if (spell.PowerPercent != 0)
- {
- attacke = (long)(attacke * spell.PowerPercent);
- }
- }
- #endregion
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- var bonus = attacker.Gems[1];
- if (bonus > 0)
- {
- attacke += MathHelper.MulDiv((int)attacke, bonus, 100);
- }
- }
- if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Stigma))
- if (!attacker.Transformed)
- attacke = (long)(attacke * 1.1);
- double defensee = attacked.Defence;
- double damagee = attacke - defensee;
- var targetLevell = attacked.Level;
- if (targetLevell < 22) damagee = MathHelper.MulDiv((int)damagee, 35, 100);
- else if (targetLevell < 50) damagee = MathHelper.MulDiv((int)damagee, 25, 100);
- else if (targetLevell < 90) damagee = MathHelper.MulDiv((int)damagee, 20, 100);
- else if (targetLevell < 110) damagee = MathHelper.MulDiv((int)damagee, 15, 100);
- else damagee = MathHelper.MulDiv((int)damagee, 12, 100);
- int strikee = Math.Max(110, 120);
- if (attacker.CriticalStrike > 0u)
- {
- if (Base.GetRefinery((uint)attacker.CriticalStrike / 100, (uint)attacked.Immunity / 100))
- {
- Packet.Effect |= MsgInteract.InteractEffects.CriticalStrike;
- damagee = Base.MulDiv((int)damagee, strikee, 100);
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.Gems[7]));
- if (reduce > 0)
- {
- damagee -= (damagee / 2) * reduce / 10;
- }
- }
- damagee = AdjustRebirthDamage(attacked.Owner, attacker.Owner, (int)damagee);
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- var reduce = Math.Max(0, Math.Min(100, (int)attacked.ItemBless));
- if (reduce > 0)
- {
- damagee -= damagee * reduce / 100;
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Monster)
- damagee = damagee * 3;
- if (attacker.OnIntensify && Time32.Now >= attacker.IntensifyStamp.AddSeconds(4))
- {
- damagee *= 2;
- attacker.OnIntensify = false;
- attacker.RemoveFlag((ulong)MsgUpdate.Flags.Intensify);
- }
- #region Block
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (Kernel.ChanceSuccess(attacked.Block / 100f))
- {
- Packet.Effect |= MsgInteract.InteractEffects.Block;
- damagee = (int)Math.Floor((float)damagee / 2);
- }
- }
- #endregion
- #region Reduction!
- if (attacked.IsDefensiveStance)
- {
- if (attacked.FatigueSecs > 120)
- {
- damagee -= attacked.Defence + attacked.Defence * 0.40;
- }
- else
- {
- damagee -= attacked.Defence + attacked.Defence * 0.20;
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.AzureShield))
- {
- if (damagee > attacked.AzureShieldDefence)
- {
- damagee -= attacked.AzureShieldDefence;
- CreateAzureDmg(attacked.AzureShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.AzureShield);
- attacked.AzuredShield = true;
- }
- else
- {
- CreateAzureDmg((uint)damagee, attacker, attacked);
- attacked.AzureShieldDefence -= (ushort)damagee;
- attacked.AzureShieldPacket();
- damagee = 1;
- }
- }
- if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.IronShield))
- {
- if (damagee > attacked.IronShieldDefence)
- {
- damagee -= (int)attacked.IronShieldDefence;
- CreateAzureDmg(attacked.IronShieldDefence, attacker, attacked);
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.IronShield);
- }
- else
- {
- CreateAzureDmg((uint)damagee, attacker, attacked);
- attacked.IronShieldDefence -= (uint)damagee;
- attacked.IronShieldPacket();
- damagee = 1;
- }
- }
- #endregion
- if (damagee < 0)
- damagee = 1;
- return Math.Max(1, (uint)damagee);
- }
- public static bool Miss(int Percent)
- {
- if (Percent >= 100)
- return false;
- return Kernel.Rate(Percent, 100);
- }
- public static uint Percent(int target, float percent)
- {
- return (uint)(target * percent);
- }
- public static uint Percent(Player attacked, float percent)
- {
- return (uint)(attacked.Hitpoints * percent);
- }
- public static uint Percent(MsgNpcInfoEX attacked, float percent)
- {
- return (uint)(attacked.Hitpoints * percent);
- }
- public static void AutoRespone(Player attacker, Player attacked, ref double Damage)//1
- {
- try
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.Owner.Spells.ContainsKey(11120))
- {
- var s = attacker.Owner.Spells[11120];
- var spell = Database.SpellTable.SpellInformations[s.ID][s.Level];
- if (spell != null)
- {
- if (Kernel.Rate(spell.Percent))
- {
- var ent = attacked as Player;
- if (!ent.IsBlackSpotted)
- {
- ent.IsBlackSpotted = true;
- ent.BlackSpotStamp = Time32.Now;
- ent.BlackSpotStepSecs = spell.Duration;
- Kernel.BlackSpoted.TryAdd(ent.UID, ent);
- BlackSpotPacket bsp = new BlackSpotPacket();
- foreach (var h in Server.Values)
- {
- h.Send(bsp.ToArray(true, ent.UID));
- }
- }
- }
- }
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Owner.Spells.ContainsKey(11130) && attacked.Owner.Player.IsEagleEyeShooted)
- {
- var s = attacked.Owner.Spells[11130];
- var spell = Database.SpellTable.SpellInformations[s.ID][s.Level];
- if (spell != null)
- {
- if (Kernel.Rate(spell.Percent))
- {
- attacked.Owner.Player.IsEagleEyeShooted = false;
- MsgMagicEffect ssuse = new MsgMagicEffect(true);
- ssuse.Attacker = attacked.UID;
- ssuse.SpellID = spell.ID;
- ssuse.SpellLevel = spell.Level;
- ssuse.AddTarget(attacked.Owner.Player.UID, new MsgMagicEffect.DamageClass().Damage = 11030,
- null);
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.SendScreen(ssuse, true);
- }
- }
- }
- }
- if (attacked.CounterKillSwitch && Kernel.Rate(30) && !attacker.ContainsFlag((ulong)MsgUpdate.Flags.Fly) && Time32.Now > attacked.CounterKillStamp.AddSeconds(15))
- {
- var spell = Database.SpellTable.GetSpell(6003, attacker.Owner);
- attacked.CounterKillStamp = Time32.Now;
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- attack.Effect = MsgInteract.InteractEffects.None;
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- uint damage = NewWork(attacked, attacker, ref attack);
- //Physical.OnPlayer(attacked, attacker, spell, out SpellObj, ref attack);
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = Network.GamePackets.MsgInteract.Scapegoat;
- attack.Damage = 0;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(attacker.Hitpoints);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- }
- else
- {
- uint damage = NewWork(attacked, attacker, ref attack);
- //damage = damage * spell.IncreaseDMG;
- //damage = damage / spell.DecreaseDMG;
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = Network.GamePackets.MsgInteract.Scapegoat;
- attack.Damage = 0;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(attacker.Hitpoints);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- }
- Damage = 0;
- }
- else if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.BackFire) && Kernel.Rate(30))
- {
- var spell = Database.SpellTable.GetSpell(12680, attacker.Owner);
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- uint damage = NewWork(attacked, attacker, ref attack);
- //damage = damage * spell.IncreaseDMG;
- //damage = damage / spell.DecreaseDMG;
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = MsgInteract.BackFire;
- attack.Damage = damage;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.BackFire);
- Damage = 0;
- }
- else if (attacked.Owner.Spells.ContainsKey(3060) && Kernel.Rate(30))
- {
- uint damage = (uint)(Damage / 2);
- if (damage <= 0)
- damage = 1;
- if (damage > 10000) damage = 10000;
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = Network.GamePackets.MsgInteract.Reflect;
- attack.Damage = damage;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- Damage = 0;
- }
- }
- }
- catch (Exception e) { Server.SaveException(e); }
- }
- public static void AutoRespone(Player attacker, Player attacked, ref long Damage)//2
- {
- try
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.Owner.Spells.ContainsKey(11120))
- {
- var s = attacker.Owner.Spells[11120];
- var spell = Database.SpellTable.SpellInformations[s.ID][s.Level];
- if (spell != null)
- {
- if (Kernel.Rate(spell.Percent))
- {
- var ent = attacked as Player;
- if (!ent.IsBlackSpotted)
- {
- ent.IsBlackSpotted = true;
- ent.BlackSpotStamp = Time32.Now;
- ent.BlackSpotStepSecs = spell.Duration;
- Kernel.BlackSpoted.TryAdd(ent.UID, ent);
- BlackSpotPacket bsp = new BlackSpotPacket();
- foreach (var h in Server.Values)
- {
- h.Send(bsp.ToArray(true, ent.UID));
- }
- }
- }
- }
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Owner.Spells.ContainsKey(11130) && attacked.Owner.Player.IsEagleEyeShooted)
- {
- var s = attacked.Owner.Spells[11130];
- var spell = Database.SpellTable.SpellInformations[s.ID][s.Level];
- if (spell != null)
- {
- if (Kernel.Rate(spell.Percent))
- {
- attacked.Owner.Player.IsEagleEyeShooted = false;
- MsgMagicEffect ssuse = new MsgMagicEffect(true);
- ssuse.Attacker = attacked.UID;
- ssuse.SpellID = spell.ID;
- ssuse.SpellLevel = spell.Level;
- ssuse.AddTarget(attacked.Owner.Player.UID, new MsgMagicEffect.DamageClass().Damage = 11030,
- null);
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.SendScreen(ssuse, true);
- }
- }
- }
- }
- if (attacked.CounterKillSwitch && Kernel.Rate(30) && !attacker.ContainsFlag((ulong)MsgUpdate.Flags.Fly) && Time32.Now > attacked.CounterKillStamp.AddSeconds(15))
- {
- var spell = Database.SpellTable.GetSpell(6003, attacker.Owner);
- attacked.CounterKillStamp = Time32.Now;
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- attack.Effect = MsgInteract.InteractEffects.None;
- uint damage = NewWork(attacked, attacker, ref attack);
- //damage = damage * spell.IncreaseDMG;
- //damage = damage / spell.DecreaseDMG;
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = Network.GamePackets.MsgInteract.Scapegoat;
- attack.Damage = 0;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(attacker.Hitpoints);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- Damage = 0;
- }
- else if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.BackFire) && Kernel.Rate(30))
- {
- var spell = Database.SpellTable.GetSpell(12680, attacker.Owner);
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- uint damage = Melee(attacked, attacker, ref attack);
- //damage = damage * spell.IncreaseDMG;
- //damage = damage / spell.DecreaseDMG;
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = MsgInteract.BackFire;
- attack.Damage = damage;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.BackFire);
- Damage = 0;
- }
- else if (attacked.Owner.Spells.ContainsKey(3060) && Kernel.Rate(30))
- {
- uint damage = (uint)(Damage / 2);
- if (damage <= 0)
- damage = 1;
- if (damage > 10000) damage = 10000;
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = Network.GamePackets.MsgInteract.Reflect;
- attack.Damage = damage;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- Damage = 0;
- }
- }
- }
- catch (Exception e) { Server.SaveException(e); }
- }
- public static void AutoRespone(Player attacker, Player attacked, ref int Damage)//0
- {
- try
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- if (attacker.Owner.Spells.ContainsKey(11120))
- {
- var s = attacker.Owner.Spells[11120];
- var spell = Database.SpellTable.SpellInformations[s.ID][s.Level];
- if (spell != null)
- {
- if (Kernel.Rate(spell.Percent))
- {
- var ent = attacked as Player;
- if (!ent.IsBlackSpotted)
- {
- ent.IsBlackSpotted = true;
- ent.BlackSpotStamp = Time32.Now;
- ent.BlackSpotStepSecs = spell.Duration;
- Kernel.BlackSpoted.TryAdd(ent.UID, ent);
- BlackSpotPacket bsp = new BlackSpotPacket();
- foreach (var h in Server.Values)
- {
- h.Send(bsp.ToArray(true, ent.UID));
- }
- }
- }
- }
- }
- }
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- if (attacked.Owner.Spells.ContainsKey(11130) && attacked.Owner.Player.IsEagleEyeShooted)
- {
- var s = attacked.Owner.Spells[11130];
- var spell = Database.SpellTable.SpellInformations[s.ID][s.Level];
- if (spell != null)
- {
- if (Kernel.Rate(spell.Percent))
- {
- attacked.Owner.Player.IsEagleEyeShooted = false;
- MsgMagicEffect ssuse = new MsgMagicEffect(true);
- ssuse.Attacker = attacked.UID;
- ssuse.SpellID = spell.ID;
- ssuse.SpellLevel = spell.Level;
- ssuse.AddTarget(attacked.Owner.Player.UID, new MsgMagicEffect.DamageClass().Damage = 11030,
- null);
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.SendScreen(ssuse, true);
- }
- }
- }
- }
- if (attacked.CounterKillSwitch && Kernel.Rate(30) && !attacker.ContainsFlag((ulong)MsgUpdate.Flags.Fly) && Time32.Now > attacked.CounterKillStamp.AddSeconds(15))
- {
- var spell = Database.SpellTable.GetSpell(6003, attacker.Owner);
- attacked.CounterKillStamp = Time32.Now;
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- attack.Effect = MsgInteract.InteractEffects.None;
- uint damage = NewWork(attacked, attacker, ref attack);
- //damage = damage * spell.IncreaseDMG;
- //damage = damage / spell.DecreaseDMG;
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = Network.GamePackets.MsgInteract.Scapegoat;
- attack.Damage = 0;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(attacker.Hitpoints);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- Damage = 0;
- }
- else if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.BackFire) && Kernel.Rate(30))
- {
- var spell = Database.SpellTable.GetSpell(12680, attacker.Owner);
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- uint damage = Melee(attacked, attacker, ref attack);
- //damage = damage * spell.IncreaseDMG;
- //damage = damage / spell.DecreaseDMG;
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = MsgInteract.BackFire;
- attack.Damage = damage;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- attacked.RemoveFlag((ulong)MsgUpdate.Flags.BackFire);
- Damage = 0;
- }
- else if (attacked.Owner.Spells.ContainsKey(14470))
- {
- var spell = Database.SpellTable.GetSpell(14470, attacker.Owner);
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- uint damage = Melee(attacked, attacker, ref attack);
- RunesSystem.HandleRedBlueRunesSkills(attack, attacked, attacker, spell, attacked.X, attacked.Y, damage);
- }
- else if (attacked.Owner.Spells.ContainsKey(3060) && Kernel.Rate(30))
- {
- uint damage = (uint)(Damage);
- if (damage <= 0)
- damage = 0;
- if (damage > 0) damage = 0;
- Network.GamePackets.MsgInteract attack = new COServer.Network.GamePackets.MsgInteract(true);
- attack.Attacked = attacker.UID;
- attack.Attacker = attacked.UID;
- attack.InteractType = Network.GamePackets.MsgInteract.Reflect;
- attack.Damage = damage;
- attack.ResponseDamage = damage;
- attack.X = attacked.X;
- attack.Y = attacked.Y;
- if (attacker.Hitpoints <= damage)
- {
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- attacked.AttackPacket = null;
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- attacker.Die(attacked);
- }
- else
- {
- attacker.Hitpoints -= damage;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- attacked.Owner.UpdateQualifier(damage);
- attacker.Owner.SendScreen(attack, true);
- }
- else
- {
- attacker.MonsterInfo.SendScreen(attack);
- }
- }
- Damage = 0;
- }
- }
- }
- catch (Exception e) { Server.SaveException(e); }
- }
- public static int GetLevelBonus(int l1, int l2)
- {
- int num = l1 - l2;
- int bonus = 0;
- if (num >= 3)
- {
- num -= 3;
- bonus = 1 + (num / 5);
- }
- return bonus;
- }
- private static double AttackMultiplier(Player attacker, Player attacked)
- {
- if (attacked.Level > attacker.Level)
- return 1;
- return ((double)(attacker.Level - attacked.Level)) / 10 + 1;
- }
- public static void CreateAzureDmg(uint dmg, Player attacker, Player attacked)
- {
- MsgInteract Interact = new MsgInteract(true);
- Interact.Attacker = attacker.UID;
- Interact.Attacked = attacked.UID;
- Interact.X = attacked.X;
- Interact.Y = attacked.Y;
- Interact.InteractType = MsgInteract.BlueDamage;
- Interact.Damage = dmg;
- attacked.Owner.SendScreen(Interact, true);
- }
- public static ulong CalculateExpBonus(ushort Level, ushort MonsterLevel, ulong Experience)
- {
- int leveldiff = (2 + Level - MonsterLevel);
- if (leveldiff < -5)
- Experience = (ulong)(Experience * 1.3);
- else if (leveldiff < -1)
- Experience = (ulong)(Experience * 1.2);
- else if (leveldiff == 4)
- Experience = (ulong)(Experience * 0.8);
- else if (leveldiff == 5)
- Experience = (ulong)(Experience * 0.3);
- else if (leveldiff > 5)
- Experience = (ulong)(Experience * 0.1);
- return Experience;
- }
- private static void Durability(Player attacker, Player attacked, Database.SpellInformation spell)
- {
- if (spell != null)
- if (!spell.CanKill) return;
- if (attacker.PlayerFlag == PlayerFlag.Player)
- if (attacker.Owner.Map.ID == 1039) return;
- #region Attack
- if (attacker != null)
- if (attacker.PlayerFlag == PlayerFlag.Player)
- {
- for (byte i = 4; i <= 6; i++)
- {
- if (!attacker.Owner.Equipment.Free(i))
- {
- var item = attacker.Owner.Equipment.TryGetItem(i);
- if (i == 5)
- {
- if (ItemHandler.IsArrow(item.ID))
- {
- continue;
- }
- }
- if (Kernel.Rate(20, 100))
- {
- if (item.Durability != 0)
- {
- if (item.ID == 1050002) return;
- item.Durability--;
- Database.ConquerItemTable.UpdateDurabilityItem2(item, item.ID);
- Database.ConquerItemTable.UpdateDurabilityItem(item);
- item.Mode = Enums.ItemMode.Update;
- item.Send(attacker.Owner);
- item.Mode = Enums.ItemMode.Default;
- }
- else if (item.Durability == 0)
- {
- MsgName str = new MsgName(true)
- {
- UID = attacker.UID,
- Action = MsgName.Effect,
- TextsCount = 1
- };
- str.Texts.Add("EquipBroken");
- attacker.Owner.Send(str.ToArray());
- attacker.Owner.Send(new MsgTalk(Database.ConquerItemInformation.BaseInformations[item.ID].Name + " is totaly damaged!", System.Drawing.Color.Red, 2012));
- }
- }
- }
- if (i == 6) break;
- }
- if (!attacker.Owner.Equipment.Free(10))
- {
- var item = attacker.Owner.Equipment.TryGetItem(10);
- if (Kernel.Rate(20, 100))
- {
- if (item.Durability != 0)
- {
- if (item.ID == 1050002) return;
- item.Durability--;
- if (item.Durability == 0)
- Database.ConquerItemTable.UpdateDurabilityItem2(item, item.ID);
- Database.ConquerItemTable.UpdateDurabilityItem(item);
- item.Mode = Enums.ItemMode.Update;
- item.Send(attacker.Owner);
- item.Mode = Enums.ItemMode.Default;
- }
- else if (item.Durability == 0)
- {
- MsgName str = new MsgName(true)
- {
- UID = attacker.UID,
- Action = MsgName.Effect,
- TextsCount = 1
- };
- str.Texts.Add("EquipBroken");
- attacker.Owner.Send(str.ToArray());
- attacker.Owner.Send(new MsgTalk(Database.ConquerItemInformation.BaseInformations[item.ID].Name + " is totaly damaged!", System.Drawing.Color.Red, 2012));
- }
- }
- }
- }
- #endregion
- #region Defence
- if (attacked != null && !attacker.Name.Contains("Guard1"))
- if (attacked.PlayerFlag == PlayerFlag.Player)
- {
- for (byte i = 1; i <= 8; i++)
- {
- if (i == 4 || i == 6 || i == 7) continue;
- if (!attacked.Owner.Equipment.Free(i))
- {
- var item = attacked.Owner.Equipment.TryGetItem(i);
- if (i == 5)
- {
- if (ItemHandler.ItemPosition(item.ID) != 5 && ItemHandler.IsArrow(item.ID))
- {
- continue;
- }
- }
- if (Kernel.Rate(30, 100))
- {
- if (item.Durability != 0)
- {
- item.Durability--;
- if (item.Durability == 0)
- Database.ConquerItemTable.UpdateDurabilityItem2(item, item.ID);
- Database.ConquerItemTable.UpdateDurabilityItem(item);
- item.Mode = Enums.ItemMode.Update;
- item.Send(attacked.Owner);
- item.Mode = Enums.ItemMode.Default;
- }
- else if (item.Durability == 0)
- {
- MsgName str = new MsgName(true)
- {
- UID = attacked.UID,
- Action = MsgName.Effect,
- TextsCount = 1
- };
- str.Texts.Add("EquipBroken");
- attacked.Owner.Send(str.ToArray());
- attacked.Owner.Send(new MsgTalk(Database.ConquerItemInformation.BaseInformations[item.ID].Name + " is totaly damaged!", System.Drawing.Color.Red, 2012));
- }
- }
- }
- if (i == 8)
- break;
- }
- if (!attacked.Owner.Equipment.Free(11) && Kernel.Rate(30, 100))
- {
- var item = attacked.Owner.Equipment.TryGetItem(11);
- if (Kernel.Rate(30, 100))
- {
- if (item.Durability != 0)
- {
- item.Durability--;
- if (item.Durability == 0)
- Database.ConquerItemTable.UpdateDurabilityItem2(item, item.ID);
- Database.ConquerItemTable.UpdateDurabilityItem(item);
- item.Mode = Enums.ItemMode.Update;
- item.Send(attacked.Owner);
- item.Mode = Enums.ItemMode.Default;
- }
- else if (item.Durability == 0)
- {
- MsgName str = new MsgName(true)
- {
- UID = attacked.UID,
- Action = MsgName.Effect,
- TextsCount = 1
- };
- str.Texts.Add("EquipBroken");
- attacked.Owner.Send(str.ToArray());
- attacked.Owner.Send(new MsgTalk(Database.ConquerItemInformation.BaseInformations[item.ID].Name + " is totaly damaged!", System.Drawing.Color.Red, 2012));
- }
- }
- }
- }
- #endregion
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement