예제 #1
0
 public static uint MagicPlayerVsPlayer(Entities.Character Attacker, Entities.Character Attacked, Skills.Skill Skill)
 {
     uint Damage = 0;
     switch (Skill.SkillInfo.DamageType)
     {
         #region Magic
         case Enums.DamageType.Magic:
             {
                 Damage = Skill.SkillInfo.Damage;
                 Damage = (uint)((double)(Damage + Attacker.MagicAttack) * (1 + ((double)Attacker.PhoenixGemBonus / 100)));
                 Damage = (uint)((double)Damage * (1 - ((double)Attacked.MDefenseByPct / 100)));
                 if (Attacked.MDefenseByVal >= Damage)
                     Damage = 1;
                 else
                     Damage -= Attacked.MDefenseByVal;
                 Damage = (uint)((double)(Damage * Skill.SkillInfo.EffectValue));
                 break;
             }
         #endregion
         #region Ranged
         case Enums.DamageType.Ranged:
             {
                 Damage = (uint)Program.Random.Next(Attacker.MinAttack, Attacker.MaxAttack);
                 Damage = (uint)((double)Damage * (1 + (Attacker.DragonGemBonus / 100)));
                 Damage = (uint)((double)Damage * Skill.SkillInfo.EffectValue);
                 Damage = (uint)((double)Damage * ((double)(210 - Attacked.Dodge) / 100));
                 Damage = (uint)(Math.Min(1, Damage * (Attacked.Dodge * .01)));
                 Damage = (uint)((double)Damage * .15);
                 break;
             }
         #endregion
         #region Melee
         case Enums.DamageType.Melee:
             {
                 Damage = (uint)Program.Random.Next(Attacker.MinAttack, Attacker.MaxAttack);
                 Damage = (uint)((double)Damage * (1 + (Attacker.DragonGemBonus / 100)));
                 Damage = (uint)((double)Damage * Skill.SkillInfo.EffectValue);
                 if (Attacked.PDefense >= Damage)
                     Damage = 1;
                 else
                     Damage -= Attacked.PDefense;
                 break;
             }
         #endregion
         #region HealHP
         case Enums.DamageType.HealHP: return Skill.SkillInfo.Damage;
         #endregion
         #region HealMP
         case Enums.DamageType.HealMP: return Skill.SkillInfo.Damage;
         #endregion
         default: break;
     }
     return Math.Max(1, Damage);
 }
예제 #2
0
        //obiekt przechowujący obiekty ubiegające się o dostęp do wątku
        //private Object Sync;
        public MainForm()
        {
            InitializeComponent();

            //Sync = new Object();

            //domyślnie serwer jest wyłączony
            isRunning = false;
            timer = new System.Windows.Forms.Timer();
            timer.Interval = 1000;
            timer.Tick += new EventHandler(DisplayServerTime);
            timer.Start();

            //utworzenie gniazda serwera
            try
            {
                server = new TcpListener(IPAddress.Any, 8001);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Nie udało się utworzyć gniazda serwera. Dalsze korzystanie z aplikacji może generować błędy! Uruchom aplikację jeszcze raz.\nDebuger message:\n" + ex.ToString(), "Błąd tworzenia gniazda serwera!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            dataBase = new GlobalMySql();

            try
            {
                dataBase.Connection.Open();
            }
            catch
            {
                AddLog("Nie udało się nawiązać połączenia z bazą danych. Aplikacja nie będzie działać poprawanie.");
            }

            //stworzenie obiektu z danymi mapy
            map = new Map(dataBase);

            skills = new Skills(dataBase);
        }
예제 #3
0
 public static uint MagicPlayerVsMonster(Entities.Character Attacker, Entities.Monster Attacked, Skills.Skill Skill)
 {
     uint Damage = 0;
     switch(Skill.SkillInfo.DamageType)
     {
         #region Magic
         case Enums.DamageType.Magic:
             {
                 Damage = Skill.SkillInfo.Damage;
                 Damage = (uint)((double)(Damage + Attacker.MagicAttack) * (1 + ((double)Attacker.PhoenixGemBonus / 100)));
                 if (Attacked.Info.MagicDefense >= Damage)
                     Damage = 1;
                 else
                     Damage -= Attacked.Info.MagicDefense;
                 Damage = (uint)((double)(Damage * Skill.SkillInfo.EffectValue));
                 break;
             }
         #endregion
         #region Ranged
         case Enums.DamageType.Ranged:
             {
                 Damage = (uint)Program.Random.Next(Attacker.MinAttack, Attacker.MaxAttack);
                 Damage = (uint)((double)Damage * (1 + (Attacker.DragonGemBonus / 100)));
                 Damage = (uint)((double)Damage * ((double)(210 - Attacked.Info.Dodge) / 100));
                 Damage = (uint)((double)Damage * Skill.SkillInfo.EffectValue);
                 Damage = (uint)(Math.Min(1, Damage * (Attacked.Info.Dodge * .01)));
                 break;
             }
         #endregion
         #region Melee
         case Enums.DamageType.Melee:
             {
                 Damage = (uint)Program.Random.Next(Attacker.MinAttack, Attacker.MaxAttack);
                 Damage = (uint)((double)Damage * (1 + (Attacker.DragonGemBonus / 100)));
                 if (Attacked.Info.Defense >= Damage)
                     Damage = 1;
                 else
                     Damage -= Attacked.Info.Defense;
                 Damage = (uint)((double)Damage * Skill.SkillInfo.EffectValue);
                 break;
             }
         #endregion
         #region HealHP
         case Enums.DamageType.HealHP: return Skill.SkillInfo.Damage;
         #endregion
         #region HealMP
         case Enums.DamageType.HealMP: return Skill.SkillInfo.Damage;
         #endregion
         default: break;
     }
     if (Attacker.Level > Attacked.Info.Level)
     {
         int dLvl = Attacker.Level - Attacked.Info.Level;
         if (dLvl >= 3 && dLvl <= 5)
             Damage = (uint)(Damage * 1.5);
         else if (dLvl > 5 && dLvl <= 10)
             Damage *= 2;
         else if (dLvl > 10 && dLvl <= 20)
             Damage *= 3;
         else if (dLvl > 20)
             Damage = (uint)(Damage * (1 + (.3 * dLvl / 5)));
     }
     return Math.Max(1, Damage);
 }