Exemple #1
0
        private void btnAttack_Click(object sender, RoutedEventArgs e)
        {
            Game.Map.Adventurer.IsRunningAway = false;
            if (Game.Map.Adventurer.isAlive())
            {
                bool n = Game.Map.Adventurer + Game.Map.LocationOfAdventurer.Monster;
                if (Game.Map.Adventurer.Weapon != null)
                {
                    Game.Map.Adventurer.Weapon.Durability--;

                    if (Game.Map.Adventurer.Weapon.Durability == 0)
                    {
                        frmInformUser inform = new frmInformUser();
                        inform.ShowDialog();
                        Game.Map.Adventurer.Weapon = null;
                    }
                }
            }
            UpdateLabels();

            //For testing
            //if (Game.Map.Adventurer.isAlive() && !Game.Map.LocationOfAdventurer.Monster.isAlive()) {
            //    //MessageBox.Show(Game.Map.LocationOfAdventurer.Monster.AttackValue.ToString());
            //    //MessageBox.Show(Game.Map.Adventurer.Weapon.AffectValue.ToString());
            //    //MessageBox.Show(Game.Map.Adventurer.ExperiancePoints.ToString());
            //}
            CheckIfMonsterAndHeroIsAlive();
        }
Exemple #2
0
 private void CheckIfMonsterAndHeroIsAlive()
 {
     if (!Game.Map.LocationOfAdventurer.Monster.isAlive())
     {
         this.Close();
         frmInformUser monsterDied = new frmInformUser();
         monsterDied.ShowDialog();
     }
     else if (!Game.Map.Adventurer.isAlive())
     {
         Game.GameState = Game.State.Lost;
         this.Close();
         frmInformUser monsterDied = new frmInformUser();
         monsterDied.ShowDialog();
     }
 }
Exemple #3
0
 private void btnRun_Click(object sender, RoutedEventArgs e)
 {
     Game.Map.Adventurer.IsRunningAway = true;
     if (Game.Map.Adventurer.AmountOfTimesAHeroCanRunAway <= 0)
     {
         bool          n   = Game.Map.Adventurer + Game.Map.LocationOfAdventurer.Monster;
         frmInformUser inf = new frmInformUser();
         inf.ShowDialog();
         Game.Map.Adventurer.IsRunningAway = false;
     }
     else if (Game.Map.Adventurer.AmountOfTimesAHeroCanRunAway > 0)
     {
         bool n = Game.Map.Adventurer + Game.Map.LocationOfAdventurer.Monster;
         this.Close();
     }
     //MessageBox.Show(Game.Map.LocationOfAdventurer.Monster.AttackValue.ToString());
 }