Exemplo n.º 1
0
        private void LevelUp_Click(object sender, EventArgs e)
        {
            LevelUp levelUp = new LevelUp(player, player.storedLevelUps);

            levelUp.ShowDialog();

            player.level         += player.storedLevelUps;
            player.storedLevelUps = 0;

            levelUpButton.Enabled = false;
            levelUpButton.Text    = "Already leveled up";
        }
Exemplo n.º 2
0
        public bool add_Exp(int pom)
        {
            int temp = 0;

            if (extra_exp)
            {
                pom *= 10;         // za testiranje
            }
            if (level == 50)
            {
                return(false);
            }

            level_Progress += pom;
            //MessageBox.Show("First");
            if (level_Progress >= level_up_exp)
            {
                //  MessageBox.Show("Second");
                //MessageBox.Show(level_Progress.ToString());
                while (level_Progress >= level_up_exp)
                {
                    temp++;
                    level_Progress -= level_up_exp;
                    level_up_exp    = stepen(level + temp) * 100;
                }
                level += temp;
            }
            else
            {
                //   MessageBox.Show("Third");
                return(false);
            }
            if (temp > 0)
            {
                System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"Sounds\level up.wav");
                //player.Play();
                player.Play();
                if (level > 20)
                {
                    this.upgrade_items = true;
                }
                else
                if (level > 11)
                {
                    //MessageBox.Show("GUESS WHAT?");
                    this.upgrade_items = true;
                }

                this.level_up_exp = 100 * stepen(level);
                this.heal(100, true);
                this.unused_Stats += temp * 3;
                LevelUp up = new LevelUp();
                if (up.ShowDialog() == DialogResult.OK)
                {
                    this.stats            = up.stats;
                    this.unused_Stats     = up.unused;
                    should_Invalidate_All = true;
                }
                // System.Windows.Forms.MessageBox.Show("You leveled up, your level_progress: " + level_Progress);
                return(true);
            }
            return(false);
        }