Esempio n. 1
0
        public void VipersFeet_HasExpectedValues()
        {
            // Arrange
            var attributes = new List <ItemStatAttribute>
            {
                new ItemStatAttribute("Power", .3m),
                new ItemStatAttribute("ConditionDamage", .3m),
                new ItemStatAttribute("Precision", .165m),
                new ItemStatAttribute("Expertise", .165m)
            };

            // Act
            var actual = new FeetArmor(attributes);

            // Assert
            const int expectedPower           = 40;
            const int expectedConditionDamage = 40;
            const int expectedPrecision       = 22;
            const int expectedExpertise       = 22;

            Assert.AreEqual(expectedPower, actual.Power);
            Assert.AreEqual(expectedConditionDamage, actual.ConditionDamage);
            Assert.AreEqual(expectedPrecision, actual.Precision);
            Assert.AreEqual(expectedExpertise, actual.Expertise);
        }
Esempio n. 2
0
        public void TakeOn(Fighter fighter, Armor armor)
        {
            try
            {
                Armor   Armor;
                Fighter Fighter = _fight.Fighters.Find(fighter.FighterId);

                switch (armor.type)
                {
                case ("Helmet"):
                    Armor = _fight.Helmets.Find(armor.Id);
                    if (Fighter.HelmetId != null)
                    {
                        Helmet Helmet = _fight.Helmets.Find(Fighter.HelmetId);
                        Helmet.IsWearing = false;
                        Fighter.Armor   -= Helmet.ArmorPoints;
                    }
                    Fighter.HelmetId = Armor.Id;
                    Fighter.Armor   += Armor.ArmorPoints;
                    Armor.IsWearing  = true;
                    break;

                case ("BodyArmor"):
                    Armor = _fight.BodyArmors.Find(armor.Id);
                    if (Fighter.BodyArmorId != null)
                    {
                        BodyArmor bodyArmor = _fight.BodyArmors.Find(Fighter.BodyArmorId);
                        bodyArmor.IsWearing = false;
                        Fighter.Armor      -= bodyArmor.ArmorPoints;
                    }
                    Fighter.BodyArmorId = Armor.Id;
                    Fighter.Armor      += Armor.ArmorPoints;

                    Armor.IsWearing = true;
                    break;

                case ("FeetArmor"):
                    Armor = _fight.FeetArmors.Find(armor.Id);
                    if (Fighter.FeetArmorId != null)
                    {
                        FeetArmor feet = _fight.FeetArmors.Find(Fighter.FeetArmorId);
                        feet.IsWearing = false;
                        Fighter.Armor -= feet.ArmorPoints;
                    }
                    Fighter.FeetArmorId = Armor.Id;
                    Fighter.Armor      += Armor.ArmorPoints;

                    Armor.IsWearing = true;
                    break;

                default: break;
                }
            }
            catch (NullReferenceException)
            {
            }
            _fight.SaveChanges();
        }
Esempio n. 3
0
        public void BerserkersFeet_HasExpectedValues()
        {
            // Arrange
            var attributes = new List <ItemStatAttribute>
            {
                new ItemStatAttribute("Power", .35m),
                new ItemStatAttribute("Precision", .25m),
                new ItemStatAttribute("Ferocity", .25m)
            };

            // Act
            var actual = new FeetArmor(attributes);

            // Assert
            const int expectedPower     = 47;
            const int expectedPrecision = 34;
            const int expectedFerocity  = 34;

            Assert.AreEqual(expectedPower, actual.Power);
            Assert.AreEqual(expectedPrecision, actual.Precision);
            Assert.AreEqual(expectedFerocity, actual.Ferocity);
        }
Esempio n. 4
0
 public void UpdateLists()
 {
     try
     {
         using (UnitOfWork T = new UnitOfWork())
         {
             //T.Weapons.Add(new Bow() { Call = "assd", Username = CurrentUser.Username });
             //T.Weapons.Add(new Bow() { Call = "4len", Username = CurrentUser.Username });
             //T.Weapons.Add(new MiniGun() { Call = "hehe", Username = CurrentUser.Username });
             //T.Weapons.Add(new Bow() { Call = "aga", Username = CurrentUser.Username });
             //T.SaveChanges();
             if (selectedFighter != null)
             {
                 selectedFighter   = T.GetFighters().Find(selectedFighter.FighterId);
                 SelectedWeapon    = (T.GetWeapons().Find(selectedFighter.WeaponId)) ?? (SelectedWeapon = new Bow()
                 {
                     Call = "Без оружия"
                 });
                 SelectedHelmet    = (T.GetHelmets().Find(selectedFighter.HelmetId)) ?? (SelectedHelmet = new Helmet()
                 {
                     Call = "Без шлема"
                 });
                 SelectedBodyArmor = (T.GetBodyArmor().Find(selectedFighter.BodyArmorId)) ?? (SelectedBodyArmor = new BodyArmor()
                 {
                     Call = "Без брони"
                 });
                 SelectedFeetArmor = (T.GetFeetArmor().Find(selectedFighter.FeetArmorId)) ?? (SelectedFeetArmor = new FeetArmor()
                 {
                     Call = "Без ботинок"
                 });
                 HelmetName        = SelectedHelmet.Call;
                 BodyArmorName     = SelectedBodyArmor.Call;
                 FeetArmorName     = SelectedFeetArmor.Call;
                 WeaponName        = SelectedWeapon.Call;
                 OnPropertyChanged("SelectedFighter");
             }
         }
         //T.Helmets.Add(new Helmet() { Call = "sosat", Username = CurrentUser.Username });
         //T.Helmets.Add(new Helmet() { Call = "sosat1", Username = CurrentUser.Username });
         //T.Helmets.Add(new Helmet() { Call = "sosat2", Username = CurrentUser.Username });
         //T.BodyArmors.Add(new BodyArmor() { Call = "Sos", Username = CurrentUser.Username });
         //T.BodyArmors.Add(new BodyArmor() { Call = "Sos1", Username = CurrentUser.Username });
         //T.BodyArmors.Add(new BodyArmor() { Call = "Sos2", Username = CurrentUser.Username });
         //T.FeetArmors.Add(new FeetArmor() { Call = "nog", Username = CurrentUser.Username });
         //T.FeetArmors.Add(new FeetArmor() { Call = "nog1", Username = CurrentUser.Username });
         //T.FeetArmors.Add(new FeetArmor() { Call = "nog2", Username = CurrentUser.Username });
         //T.SaveChanges();
     }
     catch (NullReferenceException)
     {
     }
     catch (Exception Ex)
     {
         MessageBox.Show(Ex.ToString());
     }
 }
Esempio n. 5
0
 public void GetFeetArmor(FeetArmor armor)
 {
     this.FeetArmor = armor;
 }