Ejemplo n.º 1
0
        private WeaponItem ShowMeleeWeaponDialog(IEnumerable <WeaponItem> items, bool melee, bool ranged, bool natural)
        {
            WeaponSelectWindow wind = new WeaponSelectWindow();

            wind.Owner   = this;
            wind.Melee   = melee;
            wind.Ranged  = ranged;
            wind.Natural = natural;
            wind.Hands   = characterAttacks.Hands - CountHands(items);
            wind.Size    = SizeMods.GetSize(_Monster.Size);

            wind.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            WeaponItem item = null;

            if (wind.ShowDialog() == true)
            {
                if (wind.Weapon != null)
                {
                    item = new WeaponItem(wind.Weapon);
                }
            }

            return(item);
        }
Ejemplo n.º 2
0
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType != typeof(string))
            {
                return(DependencyProperty.UnsetValue);
            }

            return(SizeMods.GetSizeText((MonsterSize)value));
        }
Ejemplo n.º 3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType != typeof(int))
            {
                return(DependencyProperty.UnsetValue);
            }


            return((int)SizeMods.GetSize((string)value));
        }
Ejemplo n.º 4
0
        private void CreateWeaponItem(Weapon weapon)
        {
            WeaponItem item = new WeaponItem(weapon);

            DieRoll roll = DieRoll.FromString(item.Weapon.DmgM);

            roll      = DieRoll.StepDie(roll, ((int)SizeMods.GetSize(monster.Size)) - (int)MonsterSize.Medium);
            item.Step = roll.Step;

            WeaponItem = item;
        }
Ejemplo n.º 5
0
 private void UpdateWeaponItemFields()
 {
     if (weaponItem != null && this.IsLoaded)
     {
         if (weaponItem.Step == null)
         {
             DieRoll roll = DieRoll.FromString(weaponItem.Weapon.DmgM);
             roll            = DieRoll.StepDie(roll, ((int)SizeMods.GetSize(monster.Size)) - (int)MonsterSize.Medium);
             weaponItem.Step = roll.Step;
         }
         AttackDamage.Text        = weaponItem.Step.Text;
         AttackName.Text          = weaponItem.Name;
         AttackType.Text          = weaponItem.Weapon.Light ? "Secondary" : "Primary";
         AttackCountComboBox.Text = weaponItem.Count.ToString();
         PlusTextBox.Text         = weaponItem.Plus;
     }
 }
Ejemplo n.º 6
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (weaponItem == null)
            {
                weaponItem = new WeaponItem();
            }
            Weapon weapon  = null;
            string atkname = AttackName.Text.Trim();

            if (Weapon.Weapons.ContainsKey(atkname))
            {
                weapon = Weapon.Weapons[atkname];
            }

            if (weapon == null)
            {
                weapon       = new Weapon();
                weapon.Name  = atkname;
                weapon.Hands = "One-Handed";
                weapon.Class = "Natural";
                DieRoll roll = DieRoll.FromString(AttackDamage.Text);
                roll              = DieRoll.StepDie(roll, ((int)SizeMods.GetSize(monster.Size)) - (int)MonsterSize.Medium);
                weapon.DmgM       = roll.Text;
                weapon.DmgS       = DieRoll.StepDie(roll, -1).Text;
                weaponItem.Weapon = weapon;
            }


            weaponItem.Weapon = weapon;
            weaponItem.Count  = AttackCountComboBox.SelectedIndex + 1;
            weaponItem.Plus   = PlusTextBox.Text;
            weaponItem.Step   = DieRoll.FromString(AttackDamage.Text).Step;

            DialogResult = true;
            Close();
        }