Exemple #1
0
        private void UpgradeStat(UIMouseEvent evt, UIElement listeningElement, Stat stat, int amount)
        {
            if (!visible)
            {
                return;
            }
            Main.PlaySound(SoundID.MenuOpen);
            if (Main.keyState.PressingShift())
            {
                if ((Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl)))
                {
                    while (Char.FreePtns > 0)
                    {
                        Char.SpendPoints(stat, Char.GetStatXPMax(stat) - Char.GetStatXP(stat));
                    }
                    return;
                }

                for (int i = 0; i < amount; i++)
                {
                    Char.SpendPoints(stat, Char.GetStatXPMax(stat) - Char.GetStatXP(stat));
                }
                return;
            }
            Char.SpendPoints(stat, amount);
        }