Ejemplo n.º 1
0
        private void btnSimpleAttack_Click(object sender, EventArgs e)
        {
            float prevEnemyHealth = enemy.Health;

            character.SimpleAttack(enemy);
            float enemyDamage = (float)Math.Round(prevEnemyHealth - enemy.Health);

            lblEnemyDamage.Text    = enemyDamage.ToString();
            lblEnemyDamage.Visible = true;
            tmrEnemyDamage.Enabled = true;
            if (enemy.Health <= 0)
            {
                character.GainXP(enemy.XpDropped);
                lblEndFightMessage.Text    = "You Gained " + Math.Round(enemy.XpDropped) + " xp!";
                lblEndFightMessage.Visible = true;
                Refresh();
                Thread.Sleep(1200);
                EndFight();
                if (character.ShouldLevelUp)
                {
                    FrmLevelUp frmLevelUp = new FrmLevelUp();
                    frmLevelUp.Show();
                }
            }
            else
            {
                doEnemyAttack();
            }
        }
Ejemplo n.º 2
0
        private void btnSimpleAttack_Click(object sender, EventArgs e)
        {
            float prevEnemyHealth = enemy.Health;

            character.SimpleAttack(enemy);
            float enemyDamage = (float)Math.Round(prevEnemyHealth - enemy.Health);

            lblEnemyDamage.Text    = enemyDamage.ToString();
            lblEnemyDamage.Visible = true;
            tmrEnemyDamage.Enabled = true;
            if (enemy.Health <= 0)
            {
                character.GainXP(enemy.XpDropped);
                lblEndFightMessage.Text    = "You Gained " + Math.Round(enemy.XpDropped) + " xp!";
                lblEndFightMessage.Visible = true;
                Refresh();
                Thread.Sleep(1200);
                EndFight();
                if (character.ShouldLevelUp)
                {
                    FrmLevelUp frmLevelUp = new FrmLevelUp();
                    frmLevelUp.Show();
                }
            }
            else
            {
                float prevPlayerHealth = character.Health;
                enemy.SimpleAttack(character);
                float playerDamage = (float)Math.Round(prevPlayerHealth - character.Health);
                lblPlayerDamage.Text    = playerDamage.ToString();
                lblPlayerDamage.Visible = true;
                tmrPlayerDamage.Enabled = true;
                if (character.Health <= 0)
                {
                    UpdateStats();
                    game.ChangeState(GameState.DEAD);
                    lblEndFightMessage.Text    = "You Were Defeated!";
                    lblEndFightMessage.Visible = true;
                    Refresh();
                    Thread.Sleep(1200);
                    EndFight();
                    FrmGameOver frmGameOver = new FrmGameOver();
                    frmGameOver.Show();
                }
                else
                {
                    UpdateStats();
                }
            }
        }
 protected virtual void combatStuff()
 {
     if (enemy.Health <= 0)
     {
         character.GainXP(enemy.XpDropped, enemy.Level, character.Level);
         lblEndFightMessage.Text    = "You Gained " + Math.Round(enemy.XpDropped * 2.5F) + " xp!";
         lblEndFightMessage.Visible = true;
         character.regenerateHealth();
         character.regenerateMana();
         Refresh();
         Thread.Sleep(1200);
         EndFight();
         if (character.ShouldLevelUp)
         {
             FrmLevelUp frmLevelUp = new FrmLevelUp();
             frmLevelUp.Show();
         }
     }
     else
     {
         float prevPlayerHealth = character.Health;
         enemy.EnemyAttack(character);
         float playerDamage = (float)Math.Round(prevPlayerHealth - character.Health);
         lblPlayerDamage.Text    = playerDamage.ToString();
         lblPlayerDamage.Visible = true;
         tmrPlayerDamage.Enabled = true;
         if (character.Health <= 0)
         {
             UpdateStats();
             game.ChangeState(GameState.DEAD);
             lblEndFightMessage.Text    = "You Were Defeated!";
             lblEndFightMessage.Visible = true;
             Refresh();
             Thread.Sleep(1200);
             EndFight();
             FrmGameOver frmGameOver = new FrmGameOver();
             frmGameOver.Show();
         }
         else
         {
             UpdateStats();
         }
     }
 }
Ejemplo n.º 4
0
        private void btnMagicAttack_Click(object sender, EventArgs e)
        {
            if (character.Mana < 10)
            {
                return;
            }

            if (game.SoundOn)
            {
                magicAttackSound.Play();
            }

            float prevEnemyHealth = enemy.Health;

            character.MagicAttack(enemy, character);
            float enemyDamage = (float)Math.Round(prevEnemyHealth - enemy.Health);

            lblEnemyDamage.Text    = enemyDamage.ToString();
            lblEnemyDamage.Visible = true;
            tmrEnemyDamage.Enabled = true;
            if (enemy.Health <= 0)
            {
                lblEnemyDamage.Visible  = false;
                lblPlayerDamage.Visible = false;
                character.GainXP(enemy.XpDropped);
                lblEndFightMessage.Text    = "You Gained " + Math.Round(enemy.XpDropped) + " xp!";
                lblEndFightMessage.Visible = true;
                Refresh();
                Thread.Sleep(1200);
                EndFight();
                if (character.ShouldLevelUp)
                {
                    FrmLevelUp frmLevelUp = new FrmLevelUp();
                    frmLevelUp.Show();
                }
            }
            else
            {
                doEnemyAttack();
            }
        }
Ejemplo n.º 5
0
 public void LevelUpcheck()
 {
     if (character.ShouldLevelUp)
     {
         FrmLevelUp frmLevelUp = new FrmLevelUp();
         frmLevelUp.Show();
         if (character.Level == 2)
         {
             FrmClass f1 = new FrmClass();
             f1.Show();
         }
     }
     if (roll.ShouldLevelUp)
     {
         FrmLevelUpRoll frmLevelUprl = new FrmLevelUpRoll();
         frmLevelUprl.Show();
     }
     if (rush.ShouldLevelUp)
     {
         FrmLevelUpRush frmLevelUpru = new FrmLevelUpRush();
         frmLevelUpru.Show();
     }
 }
Ejemplo n.º 6
0
        private void btnSimpleAttack_Click(object sender, EventArgs e)
        {
            if (lblEndFightMessage.Visible == true)
            {
                lblEndFightMessage.Visible = false;
            }
            float prevEnemyHealth = boss.Health;

            weapon.SimpleWeaponAttack(boss);
            float enemyDamage = (float)Math.Round(prevEnemyHealth - boss.Health);

            lblEnemyDamage.Text    = enemyDamage.ToString();
            lblEnemyDamage.Visible = true;
            tmrEnemyDamage.Enabled = true;
            //TODO: ZAB
            SoundPlayer sp = new SoundPlayer(@"Resources\bossmusic.wav");

            if (boss.Health <= 0)
            {
                character.GainXP(boss.XpDropped);
                lblEndFightMessage.Text    = "You Gained " + Math.Round(boss.XpDropped) + " xp!";
                lblEndFightMessage.Visible = true;
                SoundPlayer bg = new SoundPlayer(@"Resources\victory.wav");
                bg.Play();
                Refresh();
                Thread.Sleep(1200);
                EndFight();
                if (character.ShouldLevelUp)
                {
                    FrmLevelUp frmLevelUp = new FrmLevelUp();
                    frmLevelUp.Show();
                }
            }
            else
            {
                float prevPlayerHealth = character.Health;
                boss.SimpleAttack(character);
                float playerDamage = (float)Math.Round(prevPlayerHealth - character.Health);
                lblPlayerDamage.Text    = playerDamage.ToString();
                lblPlayerDamage.Visible = true;
                tmrPlayerDamage.Enabled = true;
                //TODO: ZAB
                Thread.Sleep(175);//that is .175 of a second , lets the sound play out completely
                if (character.Health <= 0)
                {
                    UpdateStats();
                    game.ChangeState(GameState.DEAD);
                    sp = new SoundPlayer(@"Resources\game_over.wav");
                    sp.Play();
                    lblEndFightMessage.Text    = "You Were Defeated!";
                    lblEndFightMessage.Visible = true;
                    Refresh();
                    Thread.Sleep(1200);
                    EndFight();
                    FrmGameOver frmGameOver = new FrmGameOver();
                    frmGameOver.Show();
                }
                else
                {
                    UpdateStats();
                }
            }
        }
Ejemplo n.º 7
0
        private void btnMagicAttack_Click(object sender, EventArgs e)
        {
            float prevEnemyHealth = boss.Health;

            weapon.ManaWeaponAttack(boss);
            float enemyDamage = (float)Math.Round(prevEnemyHealth - boss.Health);

            lblEnemyDamage.Text    = enemyDamage.ToString();
            lblEnemyDamage.Visible = true;
            tmrEnemyDamage.Enabled = true;
            if (character.Mana != 0)
            {
                weapon.ManaWeaponAttack(boss);
                character.Mana -= 10;
                if (boss.Health <= 0)
                {
                    character.GainXP(boss.XpDropped);
                    lblEndFightMessage.Text    = "You Gained " + Math.Round(boss.XpDropped) + " xp!";
                    character.Mana             = 40;
                    lblEndFightMessage.Visible = true;
                    Refresh();
                    Thread.Sleep(1200);
                    EndFight();
                    if (character.ShouldLevelUp)
                    {
                        FrmLevelUp frmLevelUp = new FrmLevelUp();
                        frmLevelUp.Show();
                    }
                }
                else
                {
                    float prevPlayerHealth = character.Health;
                    boss.SimpleAttack(character);
                    float playerDamage = (float)Math.Round(prevPlayerHealth - character.Health);
                    lblPlayerDamage.Text    = playerDamage.ToString();
                    lblPlayerDamage.Visible = true;
                    tmrPlayerDamage.Enabled = true;

                    if (character.Health <= 0)
                    {
                        UpdateStats();
                        game.ChangeState(GameState.DEAD);
                        lblEndFightMessage.Text    = "You Were Defeated!";
                        lblEndFightMessage.Visible = true;
                        Refresh();
                        Thread.Sleep(1200);
                        EndFight();
                        FrmGameOver frmGameOver = new FrmGameOver();
                        frmGameOver.Show();
                    }
                    else
                    {
                        UpdateStats();
                    }
                }
            }
            else
            {
                lblEndFightMessage.Text    = "You have no more mana";
                lblEndFightMessage.Visible = true;
                lblEnemyDamage.Visible     = false;
            };
        }
Ejemplo n.º 8
0
        private void btnSimpleAttack_Click(object sender, EventArgs e)
        {
            float prevEnemyHealth = enemy.Health;

            character.SimpleAttack(enemy);
            float enemyDamage = (float)Math.Round(prevEnemyHealth - enemy.Health);

            lblEnemyDamage.Text    = enemyDamage.ToString();
            lblEnemyDamage.Visible = true;
            tmrEnemyDamage.Enabled = true;
            if (enemy.Health <= 0)
            {
                //Generate a number 0-9 then if that number is > 4 give the player a potion
                int potion = rand.Next(10);
                if (potion > 4)
                {
                    //Set the potioncount higher in the inventory
                    inventory.getPotion();
                    label10.Text    = "You got a potion!!!";
                    label10.Visible = true;
                }

                character.GainXP(enemy.XpDropped);
                lblEndFightMessage.Text    = "You Gained " + Math.Round(enemy.XpDropped) + " xp!";
                lblEndFightMessage.Visible = true;
                Refresh();
                Thread.Sleep(1200);
                EndFight();
                //Once the fight ends (but before levelling up) reset the characters strength and def stats (in case postions were used.)
                character.ResetStrDef();
                if (character.ShouldLevelUp)
                {
                    FrmLevelUp frmLevelUp = new FrmLevelUp();
                    frmLevelUp.Show();
                }
            }
            else
            {
                float prevPlayerHealth = character.Health;
                enemy.SimpleAttack(character);
                float playerDamage = (float)Math.Round(prevPlayerHealth - character.Health);
                lblPlayerDamage.Text    = playerDamage.ToString();
                lblPlayerDamage.Visible = true;
                tmrPlayerDamage.Enabled = true;
                if (character.Health <= 0)
                {
                    UpdateStats();
                    character.ResetStrDef();
                    game.ChangeState(GameState.DEAD);
                    lblEndFightMessage.Text    = "You Were Defeated!";
                    lblEndFightMessage.Visible = true;
                    Refresh();
                    Thread.Sleep(1200);
                    EndFight();
                    FrmGameOver frmGameOver = new FrmGameOver();
                    frmGameOver.Show();
                }
                else
                {
                    UpdateStats();
                }
            }
        }
Ejemplo n.º 9
0
        private void btnSimpleAttack_Click(object sender, EventArgs e)
        {
            // make swing noise
            sp.Play();

            float prevEnemyHealth = boss.Health;

            character.SimpleAttack(boss);
            float enemyDamage = (float)Math.Round(prevEnemyHealth - boss.Health);

            lblEnemyDamage.Text    = enemyDamage.ToString();
            lblEnemyDamage.Visible = true;
            tmrEnemyDamage.Enabled = true;
            if (boss.Health <= 0)
            {
                character.GainXP(boss.XpDropped);
                lblEndFightMessage.Text    = "You Gained " + Math.Round(boss.XpDropped) + " xp!";
                lblEndFightMessage.Visible = true;
                Refresh();
                Thread.Sleep(1200);
                EndFight();
                if (character.ShouldLevelUp)
                {
                    FrmLevelUp frmLevelUp = new FrmLevelUp();
                    frmLevelUp.Show();
                }
                Refresh();
                Thread.Sleep(1200);
                DialogResult result = MessageBox.Show("Congratulations on beating the boss!\n You are about to enter a 'coin frenzy' period.\n" +
                                                      "You will have 60 seconds to collect as many coins as possible . . . in the DARK! Good LUCK!", "Announcement", MessageBoxButtons.OK);

                if (result == DialogResult.OK)
                {
                    FrmCoinFrenzy frmCF = new FrmCoinFrenzy();
                    frmCF.Show();
                }
            }
            else
            {
                float prevPlayerHealth = character.Health;
                boss.SimpleAttack(character);
                float playerDamage = (float)Math.Round(prevPlayerHealth - character.Health);
                lblPlayerDamage.Text    = playerDamage.ToString();
                lblPlayerDamage.Visible = true;
                tmrPlayerDamage.Enabled = true;
                if (character.Health <= 0)
                {
                    UpdateStats();
                    game.ChangeState(GameState.DEAD);
                    lblEndFightMessage.Text    = "You Were Defeated!";
                    lblEndFightMessage.Visible = true;
                    Refresh();
                    Thread.Sleep(1200);
                    EndFight();
                    FrmGameOver frmGameOver = new FrmGameOver();
                    frmGameOver.Show();
                }
                else
                {
                    UpdateStats();
                }
            }
        }
Ejemplo n.º 10
0
        private void btnSimpleAttack_Click(object sender, EventArgs e)
        {
            // make swing noise
            sp.Play();

            float prevEnemyHealth = enemy.Health;

            character.SimpleAttack(enemy);
            float enemyDamage = (float)Math.Round(prevEnemyHealth - enemy.Health);

            lblEnemyDamage.Text    = enemyDamage.ToString();
            lblEnemyDamage.Visible = true;
            tmrEnemyDamage.Enabled = true;
            if (enemy.Health <= 0)
            {
                character.GainXP(enemy.XpDropped);
                lblEndFightMessage.Text    = "You Gained " + Math.Round(enemy.XpDropped) + " xp!";
                lblEndFightMessage.Visible = true;

                Refresh();
                Thread.Sleep(1200);
                EndFight();
                if (character.ShouldLevelUp)
                {
                    FrmLevelUp frmLevelUp = new FrmLevelUp();
                    frmLevelUp.Show();
                }
                if (character.DidDrop() == true & character.HasWeapon == false)
                {
                    FrmDrop frmDrop = new FrmDrop();
                    frmDrop.Show();
                    frmDrop.Refresh();
                    Thread.Sleep(3000);
                    frmDrop.sp.Stop();
                    frmDrop.Hide();
                    character.HasWeapon = true;
                }

                if (enemy.CoinDropped > 0)
                {
                    FrmReward frmReward = new FrmReward();
                    frmReward.Amt = enemy.CoinDropped;
                    character.GetMoney(enemy.CoinDropped);
                    frmReward.Show();
                }
            }
            else
            {
                float prevPlayerHealth = character.Health;
                enemy.SimpleAttack(character);
                float playerDamage = (float)Math.Round(prevPlayerHealth - character.Health);
                lblPlayerDamage.Text    = playerDamage.ToString();
                lblPlayerDamage.Visible = true;
                tmrPlayerDamage.Enabled = true;
                if (character.Health <= 0)
                {
                    UpdateStats();
                    game.ChangeState(GameState.DEAD);
                    lblEndFightMessage.Text    = "You Were Defeated!";
                    lblEndFightMessage.Visible = true;
                    character.HasWeapon        = false;
                    Refresh();
                    Thread.Sleep(1200);
                    EndFight();
                    FrmGameOver frmGameOver = new FrmGameOver();
                    frmGameOver.Show();
                }
                else
                {
                    UpdateStats();
                }
            }
        }