Exemplo n.º 1
0
        public DieRoll SizeDamageDie(MonsterSize size)
        {
            if (DamageDie == null)
            {
                return(null);
            }

            return(DieRoll.StepDie(DamageDie, (size - MonsterSize.Medium)));
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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;
     }
 }
Exemplo n.º 4
0
        public NaturalAttackWindow()
        {
            InitializeComponent();

            weaponView         = new ListCollectionView(new List <Weapon>(Weapon.Weapons.Values));
            weaponView.Filter += new Predicate <object>(NaturalWeaponFilter);
            weaponView.SortDescriptions.Add(
                new SortDescription("Name", ListSortDirection.Ascending));
            weaponView.MoveCurrentToFirst();
            weaponView.CurrentChanged     += new EventHandler(weaponView_CurrentChanged);
            NaturalAttackListBox.GotFocus += new RoutedEventHandler(NaturalAttackListBox_GotFocus);

            NaturalAttackListBox.DataContext = weaponView;

            DieRoll step = new DieRoll(0, 1, 0);

            for (int i = 0; i < 12; i++)
            {
                ComboBoxItem item = new ComboBoxItem();

                item.DataContext = step.Step;
                item.Content     = step.Text;
                AttackDamage.Items.Add(item);
                step = DieRoll.StepDie(step, 1);
            }

            for (int i = 1; i < 12; i++)
            {
                ComboBoxItem item = new ComboBoxItem();

                item.DataContext = i;
                item.Content     = i.ToString();
                AttackCountComboBox.Items.Add(item);
            }

            EnableOK();
        }
Exemplo n.º 5
0
        //create a blank weapon from an attack
        public Weapon(Attack attack, bool ranged, MonsterSize size)
        {
            _Name = attack.Name;

            DieRoll medRoll = DieRoll.StepDie(attack.Damage, ((int)MonsterSize.Medium) - (int)size);
            DieRoll smRoll  = DieRoll.StepDie(attack.Damage, -1);

            _DmgM = new DieStep(medRoll).ToString();
            _DmgS = new DieStep(smRoll).ToString();

            _CritRange      = attack.CritRange;
            _CritMultiplier = attack.CritMultiplier;

            if (attack.Bonus.Count > 1)
            {
                _Class = "Martial";
            }
            else
            {
                _Class = "Natural";
            }

            if (ranged)
            {
                _Hands = "Ranged";
            }
            else
            {
                _Hands = "One-Handed";
            }

            _RangedTouch    = attack.RangedTouch;
            _AltDamage      = attack.AltDamage;
            _AltDamageStat  = attack.AltDamageStat;
            _AltDamageDrain = attack.AltDamageDrain;
        }
Exemplo 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();
        }