Exemplo n.º 1
0
 public void PlayerAttack(TypeOfWeapons currentWeapon, Quality weaponQuality)
 {
     while (EntityState != State.Dead)
     {
         if (CurrentWeapon.WeaponDamage(currentWeapon, weaponQuality) < GetDamageHp())
         {
             GetDamageHp();
         }
     }
     if (Hp <= 0)
     {
         EntityState = State.Dead;
         entity.Dead();
     }
 }
Exemplo n.º 2
0
        public int WeaponDamage(TypeOfWeapons currentWeapon, Quality weaponQuality)
        {
            TypeOfWeapons[] weaponArr  = new TypeOfWeapons[] { TypeOfWeapons.Sword, TypeOfWeapons.Spear, TypeOfWeapons.Axe };
            Quality[]       qualityArr = new Quality[] { Quality.Wooden, Quality.Silver, Quality.Gold };
            // Wooden Quality
            if (weaponQuality == qualityArr[0])
            {
                // Sword can make damage from 5-15
                if (currentWeapon == weaponArr[0])
                {
                    Damage = randomNum.Next(0, 10);
                    return(Damage);
                }

                // Spear can make damage from 1-30

                if (currentWeapon == weaponArr[1])
                {
                    Damage = randomNum.Next(0, 15);
                    return(Damage);
                }
                // Axe can make damage from 1-30

                if (currentWeapon == weaponArr[2])
                {
                    Damage = randomNum.Next(0, 18);
                    return(Damage);
                }
            }
            // Silver Quality
            if (weaponQuality == qualityArr[1])
            {
                // Sword can make damage from 5-15
                if (currentWeapon == weaponArr[0])
                {
                    Damage = randomNum.Next(0, 15);
                    return(Damage);
                }

                // Spear can make damage from 1-30

                if (currentWeapon == weaponArr[1])
                {
                    Damage = randomNum.Next(0, 18);
                    return(Damage);
                }
                // Axe can make damage from 1-30

                if (currentWeapon == weaponArr[2])
                {
                    Damage = randomNum.Next(0, 22);
                    return(Damage);
                }
            }
            // Golden Quality
            if (weaponQuality == qualityArr[2])
            {
                // Sword can make damage from 5-15
                if (currentWeapon == weaponArr[0])
                {
                    Damage = randomNum.Next(9, 18);
                    return(Damage);
                }

                // Spear can make damage from 1-30

                if (currentWeapon == weaponArr[1])
                {
                    Damage = randomNum.Next(12, 20);
                    return(Damage);
                }
                // Axe can make damage from 1-30

                if (currentWeapon == weaponArr[2])
                {
                    Damage = randomNum.Next(14, 25);
                    return(Damage);
                }
            }

            return(Damage);
        }
        public static AttackWeapon MakeAttackWeapon(int damage, int defend, bool isUsed, int inventorySlot, TypeOfWeapons weapon)
        {
            AttackWeapon attack = new AttackWeapon(damage, defend, isUsed, inventorySlot);

            return(attack);
        }