예제 #1
0
        public static List <RuneStat> getCombinedStats(List <Rune> runes)
        {
            int[]           overallStats = new int[12];
            List <RuneStat> result       = new List <RuneStat>();

            foreach (Rune rune in runes)
            {
                RuneStat        primary     = rune.getPrimary();
                RuneStat        inherent    = rune.getInherent();
                List <RuneStat> secondaries = rune.getOverallSecondaries();
                overallStats[(int)primary.property]  += primary.amount;
                overallStats[(int)inherent.property] += inherent.amount;
                foreach (RuneStat stat in secondaries)
                {
                    overallStats[(int)stat.property] += stat.amount;
                }
            }

            for (int i = 1; i < overallStats.Length; i++)
            {
                if (overallStats[i] != 0)
                {
                    result.Add(new RuneStat((RuneStat.Property)i, overallStats[i]));
                }
            }

            return(result);
        }
 private void Upgrade12PropertyCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (Upgrade12PropertyCombo.SelectedItem != null)
     {
         int[] range = Rune.getSecondaryIncrementRange(RuneStat.parseProperty((string)Upgrade12PropertyCombo.SelectedItem), _rune.star);
         Upgrade12AmountCombo.ItemsSource = Enumerable.Range(range[0], range[1] - range[0] + 1);
     }
 }
 private void InnatePropertyCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (InnatePropertyCombo.SelectedItem != null)
     {
         int[] range = Rune.getSecondaryBaseRange(RuneStat.parseProperty((string)InnatePropertyCombo.SelectedItem), _rune.star);
         InnateAmountCombo.ItemsSource = Enumerable.Range(range[0], range[1] - range[0] + 1);
     }
 }
예제 #4
0
        public bool Equals(RuneStat p)
        {
            if ((object)p == null)
            {
                return(false);
            }

            return(this.property == p.property);
        }
예제 #5
0
        public Boolean setUpgrades(List <RuneStat> stats)
        {
            for (int i = 0; i < 4; i++)
            {
                _upgrades[i] = new RuneStat();
            }

            for (int i = 0; i < stats.Count; i++)
            {
                _upgrades[i] = stats[i];
            }
            calculateSecondaries();
            return(true);
        }
예제 #6
0
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            RuneStat p = obj as RuneStat;

            if ((Object)p == null)
            {
                return(false);
            }
            return(this.property == p.property);
        }
예제 #7
0
 public Rune(int slot)
 {
     level             = 0;
     star              = 1;
     this.slot         = slot;
     _inherent         = new RuneStat();
     _upgrades         = new RuneStat[4];
     _secondary        = new RuneStat[4];
     _overallSecondary = new RuneStat[4];
     for (int i = 0; i < 4; i++)
     {
         _upgrades[i]         = new RuneStat();
         _secondary[i]        = new RuneStat();
         _overallSecondary[i] = new RuneStat();
     }
 }
 private Boolean updateSecondary(int i)
 {
     if (secondaryPropertyComboBoxes[i].SelectedItem != null && secondaryAmountComboBoxes[i].SelectedItem != null &&
         secondaryPropertyComboBoxes[i].SelectedIndex != 0 && secondaryAmountComboBoxes[i].SelectedIndex != 0)
     {
         RuneStat stat = new RuneStat();
         stat.setProperty(RuneStat.toProperty((string)secondaryPropertyComboBoxes[i].SelectedItem));
         stat.setAmount((int)secondaryAmountComboBoxes[i].SelectedItem);
         _rune.setSecondary(i, stat);
     }
     else
     {
         _rune.setSecondary(i, new RuneStat());
     }
     displaySecondary();
     return(true);
 }
        private Boolean updatePrimary()
        {
            if (PrimaryPropertyCombo.SelectedItem != null)
            {
                RuneStat.Property runeProperty = RuneStat.toProperty((string)PrimaryPropertyCombo.SelectedItem);
                _rune.setPrimaryProperty(runeProperty);
                RuneStat stat = _rune.getPrimary();
                PrimaryPropertyOverall.Text = stat.property.ToString();
                PrimaryAmountOverall.Text   = _rune.getPrimary().amount.ToString();

                return(true);
            }
            else
            {
                return(false);
            }
        }
        private Boolean updateInherent()
        {
            if (InnatePropertyCombo.SelectedItem != null && InnateAmountCombo.SelectedItem != null)
            {
                RuneStat.Property runeProperty = RuneStat.toProperty((string)InnatePropertyCombo.SelectedItem);
                int runeAmount = (int)InnateAmountCombo.SelectedItem;
                _rune.setInherent(new RuneStat(runeProperty, runeAmount));
                RuneStat stat = _rune.getInherent();
                InnatePropertyOverall.Text = stat.property.ToString();
                InnateAmountOverall.Text   = stat.amount.ToString();

                return(true);
            }
            else
            {
                return(false);
            }
        }
        private Boolean displaySecondary()
        {
            List <RuneStat> stats = _rune.getOverallSecondaries();

            for (int i = 0; i < 4; i++)
            {
                if (i < stats.Count)
                {
                    RuneStat stat = stats[i];
                    secondaryAmountFinal[i].Text   = stat.amount.ToString();
                    secondaryPropertyFinal[i].Text = stat.property.ToString();
                }
                else
                {
                    secondaryAmountFinal[i].Text   = "";
                    secondaryPropertyFinal[i].Text = "";
                }
            }
            return(true);
        }
예제 #12
0
        private void calculateSecondaries()
        {
            List <RuneStat> stats = new List <RuneStat>();

            foreach (RuneStat stat in _secondary)
            {
                if (stat.property != RuneStat.Property.None && stat.amount > 0)
                {
                    stats.Add(stat.copy());
                }
            }
            for (int i = 0; i < 4; i++)
            {
                if (i < stats.Count)
                {
                    _overallSecondary[i] = stats[i];
                }
                else
                {
                    _overallSecondary[i] = new RuneStat();
                }
            }

            foreach (RuneStat upgrade in _upgrades)
            {
                for (int i = 0; i < _overallSecondary.Length; i++)
                {
                    if (_overallSecondary[i].property == upgrade.property)
                    {
                        _overallSecondary[i].setAmount(_overallSecondary[i].amount + upgrade.amount);
                        break;
                    }
                    else if (_overallSecondary[i].property == RuneStat.Property.None)
                    {
                        _overallSecondary[i] = upgrade.copy();
                        break;
                    }
                }
            }
        }
예제 #13
0
 public Boolean setUpgrade(int i, RuneStat stats)
 {
     _upgrades[i] = stats;
     calculateSecondaries();
     return(true);
 }
예제 #14
0
 public Boolean setSecondary(int i, RuneStat stat)
 {
     _secondary[i] = stat;
     calculateSecondaries();
     return(true);
 }
예제 #15
0
 public Boolean setInherent(RuneStat stat)
 {
     _inherent = stat;
     return(true);
 }