コード例 #1
0
        /// <summary>
        /// Initializes a new Ultimate Bravery Form
        /// </summary>
        public UltimateBraveryForm()
        {
            InitializeComponent();

            // Init the items and champions
            Item.InitItemList();
            Champion.InitChampionList();
            Summoner.InitSummonerSpellList();
            Runes.InitRunes();

            // Clear the champion combo box
            championComboBox.Items.Clear();
            championComboBox.Items.Add("Any");

            // Get the list of every champion's name and put them in the combo box
            championComboBox.Items.AddRange(Champion.championList.Values.ToList().ConvertAll(champ => champ.name).ToArray());
            championComboBox.SelectedIndex = 0;
        }
コード例 #2
0
        public static void InitSummonerSpellList()
        {
            Summoner Heal = new Summoner("Heal", Resources.Heal);

            Heal.Register();

            Summoner Ghost = new Summoner("Ghost", Resources.Ghost);

            Ghost.Register();

            Summoner Barrier = new Summoner("Barrier", Resources.Barrier);

            Barrier.Register();

            Summoner Exhaust = new Summoner("Exhaust", Resources.Exhaust);

            Exhaust.Register();

            Summoner Clarity = new Summoner("Clarity", Resources.Clarity);

            Clarity.Register();

            Summoner Flash = new Summoner("Flash", Resources.Flash);

            Flash.Register();

            Summoner Teleport = new Summoner("Teleport", Resources.Teleport);

            Teleport.Register();

            Summoner Smite = new Summoner("Smite", Resources.Smite);

            Smite.Register();

            Summoner Cleanse = new Summoner("Cleanse", Resources.Cleanse);

            Cleanse.Register();

            Summoner Ignite = new Summoner("Ignite", Resources.Ignite);

            Ignite.Register();
        }
コード例 #3
0
        private void RollSummonerSpells(Random rand, bool guaranteeFlash)
        {
            if (guaranteeFlash)
            {
                rolledSummoners[0] = Summoner.GetSummoner("Flash");
            }

            int currentSummonerIndex = guaranteeFlash ? 1 : 0;

            while (currentSummonerIndex < 2)
            {
                Summoner summoner = Summoner.summonerSpellList.Values.ToList()[rand.Next(0, Summoner.summonerSpellList.Values.Count)];

                if (currentSummonerIndex == 1 && summoner.Equals(rolledSummoners[0]))
                {
                    continue;
                }

                rolledSummoners[currentSummonerIndex] = summoner;

                currentSummonerIndex++;
            }
        }
コード例 #4
0
        /// <summary>
        /// Shows the current bravery roll to the user
        /// </summary>
        /// <param name="sender">The sender of the Event</param>
        /// <param name="e">The PaintEventArgs of the Event</param>
        private void RollPanel_Paint(object sender, PaintEventArgs e)
        {
            // If there is no bravery roll, there is nothing to show
            if (braveryRoll == null)
            {
                return;
            }

            // The variables we use to draw the champion name and sprite
            Font  championFont           = new Font((sender as Panel).Font.FontFamily, 15);
            Point championNameLocation   = new Point(10, 10);
            Point championSpriteLocation = new Point(10, 40);
            Size  championSpriteSize     = new Size(90, 90);

            // Draw the name with the image next to it
            e.Graphics.DrawString(braveryRoll.rolledChampion.name, championFont, Brushes.White, championNameLocation);
            e.Graphics.DrawImage(braveryRoll.rolledChampion.sprite, new Rectangle(championSpriteLocation, championSpriteSize));

            // The variables we use to draw the item name and size
            Point itemLocation     = new Point(10, 150);
            Size  itemSpriteSize   = new Size(40, 40);
            Point itemNameOffset   = new Point(0, 50);
            Font  itemFont         = new Font(championFont.FontFamily, 10);
            int   itemNameMaxWidth = 105;

            // Draw every item
            for (int i = 0; i < 6; i++)
            {
                // Get the rolled item for the nth index
                Item rolledItem = braveryRoll.GetRolledItems()[i];
                // Draw the image
                // Some magic happens here, but it is quite simple
                // We calculate the x-pos by taking the item x-pos.
                // We then calculate an offset by taking the difference between the max item name width and the item sprite width, subtracting a small bit to align it better with shorter names
                // And then half it as it needs to offset on both sides
                e.Graphics.DrawImage(rolledItem.sprite, new Rectangle(new Point(itemLocation.X + ((itemNameMaxWidth - itemSpriteSize.Width - 35) / 2), itemLocation.Y), itemSpriteSize));
                // The Rectangle in which we draw the item name. It auto-fits the string to this rectangle, making sure it doesn't go past it
                // We use a large value for the height of it so we always have space for the item name
                Rectangle layoutRectangle = new Rectangle(new Point(itemLocation.X + itemNameOffset.X, itemLocation.Y + itemNameOffset.Y), new Size(itemNameMaxWidth, 100));
                e.Graphics.DrawString(rolledItem.name, itemFont, Brushes.White, layoutRectangle);

                // Update the item location to align the items next to each other
                itemLocation = new Point(itemLocation.X + itemNameMaxWidth, itemLocation.Y);
            }

            // The variables we use to draw the skills
            Point skillLocation = new Point(120, 10);
            Size  skillSize     = new Size(20, 20);

            // Draw the skills in max order
            for (int i = 0; i < 4; i++)
            {
                char skill = braveryRoll.GetSkillOrder()[i];

                e.Graphics.DrawRectangle(Pens.White, new Rectangle(skillLocation, skillSize));

                SizeF charSize = e.Graphics.MeasureString(skill.ToString(), itemFont);

                Point charLocationOffset = new Point((int)(skillSize.Width - charSize.Width) / 2, (int)(skillSize.Height - charSize.Height) / 2);

                e.Graphics.DrawString(skill.ToString(), itemFont, Brushes.White, new Point(skillLocation.X + charLocationOffset.X, skillLocation.Y + charLocationOffset.Y));

                skillLocation = new Point(skillLocation.X, skillLocation.Y + (int)(skillSize.Height * 1.25));
            }

            Point summonerLocation = new Point(150, 10);
            Size  summonerSize     = new Size(45, 45);

            for (int i = 0; i < 2; i++)
            {
                Summoner summoner = braveryRoll.GetRolledSummoners()[i];

                e.Graphics.DrawImage(summoner.sprite, new Rectangle(summonerLocation, summonerSize));

                summonerLocation = new Point(summonerLocation.X, summonerLocation.Y + summonerSize.Height + 5);
            }

            Point runeLocation = new Point(210, 10);
            Size  runeSize     = new Size(45, 45);

            for (int i = 0; i < 4; i++)
            {
                Rune rune = braveryRoll.GetFirstTree()[i];

                e.Graphics.DrawImage(rune.sprite, new Rectangle(runeLocation, runeSize));

                runeLocation = new Point(runeLocation.X + (int)(runeSize.Width * 1.25), runeLocation.Y);
            }

            runeLocation = new Point(210, 70);

            for (int i = 0; i < 2; i++)
            {
                Rune rune = braveryRoll.GetSecondTree()[i];

                e.Graphics.DrawImage(rune.sprite, new Rectangle(runeLocation, new Size((int)(runeSize.Width * 0.8), (int)(runeSize.Height * 0.8))));

                runeLocation = new Point(runeLocation.X + (int)(runeSize.Width), runeLocation.Y);
            }

            for (int i = 0; i < 3; i++)
            {
                Shard shard = braveryRoll.GetShards()[i];

                e.Graphics.DrawImage(shard.sprite, new Rectangle(runeLocation, new Size((int)(runeSize.Width * 0.6), (int)(runeSize.Height * 0.6))));

                runeLocation = new Point(runeLocation.X + (int)(runeSize.Width * 0.8), runeLocation.Y);
            }

            // The variables we use to draw the gold amount
            Point goldSpriteLocation = new Point(120, 115);
            Point goldAmountLocation = new Point(140, 115);

            // Draw the gold icon and the total gold cost of the build
            e.Graphics.DrawImage(Resources.Gold, goldSpriteLocation);
            e.Graphics.DrawString(braveryRoll.totalGoldCost.ToString(), itemFont, Brushes.Gold, goldAmountLocation);
        }