public AddWeaponWindowViewModel(Model.Weapon weapon = null)
        {
            _damageTypeSelectorViewModel1 = new DamageTypeSelectorViewModel();
            _damageTypeSelectorViewModel2 = new DamageTypeSelectorViewModel();
            _damageTypeSelectorViewModel3 = new DamageTypeSelectorViewModel();

            if (weapon != null)
            {
                _name               = weapon.Name;
                _abilityDamage      = weapon.AbilityDamage;
                _abilityDamageValue = weapon.AbilityDamageValue.ToString();
                _selectedAbility    = GetAbilityIndex(weapon.Ability);

                if (weapon.DamageDescriptorSets.Count > 0)
                {
                    _damageTypeSelectorViewModel1.SetFromDamageDescriptorSet(weapon.DamageDescriptorSets[0]);
                }
                if (weapon.DamageDescriptorSets.Count > 1)
                {
                    _damageTypeSelectorViewModel2.SetFromDamageDescriptorSet(weapon.DamageDescriptorSets[1]);
                }
                if (weapon.DamageDescriptorSets.Count > 2)
                {
                    _damageTypeSelectorViewModel3.SetFromDamageDescriptorSet(weapon.DamageDescriptorSets[2]);
                }
            }
            else
            {
                _name          = "";
                _abilityDamage = false;
            }
        }
        public AddImmunityWindowViewModel(Model.DamageDescriptorSet immunity = null)
        {
            _damageTypeSelectorViewModel = new DamageTypeSelectorViewModel();

            if (immunity != null)
            {
                _damageTypeSelectorViewModel.SetFromDamageDescriptorSet(immunity);
            }
        }
Пример #3
0
        public HitPointChangeDialogViewModel(FullyObservableCollection <Model.WeaponSet> weaponList,
                                             string currentActorName, Model.HitPointChange hitPointChange)
        {
            _weaponList       = weaponList;
            _currentActorName = currentActorName;

            _damageTypeSelectorViewModel1 = new DamageTypeSelectorViewModel();
            _damageTypeSelectorViewModel2 = new DamageTypeSelectorViewModel();
            _damageTypeSelectorViewModel3 = new DamageTypeSelectorViewModel();

            if (hitPointChange is Model.Hit)
            {
                Model.Hit hit = hitPointChange as Model.Hit;

                _healing = "";
                _damage1 = "";
                _damage2 = "";
                _damage3 = "";

                _damage1 = hit.DamageSets[0].Amount.ToString();
                if (hit.DamageSets.Count > 1)
                {
                    _damage2 = hit.DamageSets[1].Amount.ToString();
                    if (hit.DamageSets.Count > 2)
                    {
                        _damage3 = hit.DamageSets[2].Amount.ToString();
                    }
                }

                int weaponIndex = GetWeaponIndexInList(hit.Weapon);
                if (weaponIndex >= 0)
                {
                    SelectedWeapon = weaponIndex;
                }
            }
            else if (hitPointChange is Model.Heal)
            {
                Model.Heal heal = hitPointChange as Model.Heal;
                _healing = heal.Amount.ToString();

                _damage1        = "";
                _damage2        = "";
                _damage3        = "";
                _selectedWeapon = 0;
                _abilityDamage  = false;
            }
            else
            {
                _damage1        = "";
                _damage2        = "";
                _damage3        = "";
                _healing        = "";
                _selectedWeapon = 0;
                _abilityDamage  = false;
            }
        }
        public AddDamageReductionWindowViewModel(Model.DamageReduction dr = null)
        {
            _damageTypeSelectorViewModel = new DamageTypeSelectorViewModel();

            if (dr != null)
            {
                _value = dr.Value.ToString();
                _damageTypeSelectorViewModel.SetFromDamageDescriptorSet(dr.DamageTypes);
            }
        }
        public AddDamageWindowViewModel(Model.Damage damage = null)
        {
            _damageTypeSelectorViewModel = new DamageTypeSelectorViewModel();

            if (damage != null)
            {
                _numDice  = damage.NumDice.ToString();
                _die      = GetDieTypeIndex(damage.Die);
                _modifier = damage.Modifier.ToString();
                _damageTypeSelectorViewModel.SetFromDamageDescriptorSet(damage.DamageDescriptorSet);
            }
        }
Пример #6
0
 public HitPointChangeDialogViewModel(FullyObservableCollection <Model.WeaponSet> weaponList,
                                      string currentActorName)
 {
     _weaponList                   = weaponList;
     _currentActorName             = currentActorName;
     _damageTypeSelectorViewModel1 = new DamageTypeSelectorViewModel();
     _damageTypeSelectorViewModel2 = new DamageTypeSelectorViewModel();
     _damageTypeSelectorViewModel3 = new DamageTypeSelectorViewModel();
     _damage1        = "";
     _damage2        = "";
     _damage3        = "";
     _healing        = "";
     _selectedWeapon = 0;
     _abilityDamage  = false;
     _weaponName     = "";
 }
        public Model.Damage GetDamage()
        {
            bool   askForInput = true;
            string feedback    = null;

            Model.Damage damage = null;
            while (askForInput)
            {
                View.AddDamageWindow addDamageWindow = new View.AddDamageWindow(feedback);
                addDamageWindow.DataContext = this;

                if (addDamageWindow.ShowDialog() == true)
                {
                    try
                    {
                        damage = new Model.Damage
                        {
                            NumDice             = Convert.ToInt32(NumDice),
                            Die                 = Methods.GetDieTypeFromString(DieTypes.ElementAt(Die)),
                            Modifier            = Convert.ToInt32(Modifier),
                            DamageDescriptorSet = DamageTypeSelectorViewModel.GetDamageDescriptorSet(),
                        };
                        askForInput = false;
                    }
                    catch (FormatException)
                    {
                        feedback = "Invalid format";
                    }
                }
                else
                {
                    askForInput = false;
                }
            }

            return(damage);
        }