Ejemplo n.º 1
0
        public static Int32 GetDamagePlayer2Monster(Player Attacker, Monster Target, UInt16 MagicType, Byte MagicLevel)
        {
            Magic.Info Info = new Magic.Info();
            Database.AllMagics.TryGetValue((MagicType * 10) + MagicLevel, out Info);

            Double Damage = 0;

            if (Info.Type == 1115 || (Info.WeaponSubtype != 0 && Info.WeaponSubtype != 500))
            {
                Damage = MyMath.Generate(Attacker.MinAtk, Attacker.MaxAtk);
                if (Info.Power > 30000)
                {
                    Damage *= (Double)(Info.Power - 30000) / 100;
                }
                else
                {
                    Damage += Info.Power;
                }
                Damage = AdjustDamagePlayer2Monster(Damage, Attacker, Target);

                Damage -= Target.Defence;
            }
            else if (Info.WeaponSubtype == 500)
            {
                Damage = MyMath.Generate(Attacker.MinAtk, Attacker.MaxAtk);
                if (Info.Power > 30000)
                {
                    Damage *= (Double)(Info.Power - 30000) / 100;
                }
                else
                {
                    Damage += Info.Power;
                }
                Damage = AdjustDamagePlayer2Monster(Damage, Attacker, Target);
            }
            else
            {
                Damage = Attacker.MagicAtk;
                if (Info.Power > 30000)
                {
                    Damage *= (Double)(Info.Power - 30000) / 100;
                }
                else
                {
                    Damage += Info.Power;
                }
                Damage = AdjustDamagePlayer2Monster(Damage, Attacker, Target);

                Damage *= ((Double)(100 - Target.MagicDef) / 100);
                Damage -= Target.MagicBlock;
                Damage *= 0.75;
            }

            if (Damage < 1)
            {
                Damage = 1;
            }

            Damage = AdjustMinDamagePlayer2Monster(Damage, Attacker, Target);

            if (Attacker.LuckyTime > 0 && MyMath.Success(10))
            {
                Damage *= 2;
                World.BroadcastRoomMsg(Attacker, new MsgName(Attacker.UniqId, "LuckyGuy", Network.MsgName.NameAct.RoleEffect), true);
            }
            return((Int32)Math.Round(Damage, 0));
        }