Пример #1
0
        void UpdateDataFromControls()
        {
            Data.Spells.Clear();

            Data.Unit = PickedUnit;

            Hero hero = GetSelectedHero();

            if (hero != null)
            {
                HeroStats stats = Data.HeroStats;

                stats.Hero    = hero;
                stats.Attack  = (int)HeroAttackUpDn.Value;
                stats.Defense = (int)HeroDefenseUpDn.Value;

                if (Mode != ApplicationMode.Simple)
                {
                    stats.Level = (int)HeroLevelUpDn.Value;

                    stats.SetLevelForSecondarySkillType(typeof(Offense), (SecondarySkillLevel)HeroOffenseComboBox.SelectedValue);
                    stats.SetLevelForSecondarySkillType(typeof(Archery), (SecondarySkillLevel)HeroArcheryComboBox.SelectedValue);
                    stats.SetLevelForSecondarySkillType(typeof(Armorer), (SecondarySkillLevel)HeroArmorerComboBox.SelectedValue);

                    if (Mode == ApplicationMode.Scientific)
                    {
                        stats.SetLevelForSecondarySkillType(typeof(AirMagic), (SecondarySkillLevel)HeroAirComboBox.SelectedValue);
                        stats.SetLevelForSecondarySkillType(typeof(FireMagic), (SecondarySkillLevel)HeroFireComboBox.SelectedValue);
                        stats.SetLevelForSecondarySkillType(typeof(EarthMagic), (SecondarySkillLevel)HeroEarthComboBox.SelectedValue);
                        stats.SetLevelForSecondarySkillType(typeof(WaterMagic), (SecondarySkillLevel)HeroWaterComboBox.SelectedValue);

                        CheckSpellCheckbox(BlessChbx, typeof(Bless), Data.Spells, stats);
                        CheckSpellCheckbox(BloodlustChbx, typeof(Bloodlust), Data.Spells, stats);
                        CheckSpellCheckbox(FrenzyChbx, typeof(Frenzy), Data.Spells, stats);
                        CheckSpellCheckbox(PrayerChbx, typeof(Prayer), Data.Spells, stats);
                        CheckSpellCheckbox(PrecisionChbx, typeof(Precision), Data.Spells, stats);
                        CheckSpellCheckbox(SlayerChbx, typeof(Slayer), Data.Spells, stats);

                        CheckSpellCheckbox(ShieldChbx, typeof(Shield), Data.Spells, stats);
                        CheckSpellCheckbox(StoneSkinChbx, typeof(StoneSkin), Data.Spells, stats);
                        CheckSpellCheckbox(AirShieldChbx, typeof(AirShield), Data.Spells, stats);
                    }
                }
            }
            else
            {
                data.HeroStats = null;
            }

            if (OpponentHeroStats != null)
            {
                CheckSpellCheckbox(DisruptingRayChbx, typeof(DisruptingRay), Data.Spells, OpponentHeroStats);
                CheckSpellCheckbox(CurseChbx, typeof(Curse), Data.Spells, OpponentHeroStats);
                CheckSpellCheckbox(WeaknessChbx, typeof(Weakness), Data.Spells, OpponentHeroStats);
            }
        }