Ejemplo n.º 1
0
        private void BtnAttack_Click(object sender, RoutedEventArgs e)
        {
            bool added = (Game.Map.Adventurer + Game.Map.CurrentLocation.Monster);

            pbHeroHealth.Value    -= (double)(Game.Map.Adventurer.CurrentHitPoints / Game.Map.Adventurer.MaximumHitPoints) * 100.0;
            pbMonsterHealth.Value -= (double)(Game.Map.CurrentLocation.Monster.CurrentHitPoints / Game.Map.CurrentLocation.Monster.MaximumHitPoints) * 100.0;
            Window wnd = null;

            if (Game.Map.Adventurer.IsAlive == false)
            {
                Game.GameStates = Game.GameState.Lost;
                wnd             = new frmGameOver();
                wnd.Show();
                this.Close();
            }
            else if (Game.Map.CurrentLocation.Monster.IsAlive == false)
            {
                Game.Map.Cells[Game.Map.Adventurer.PositionY, Game.Map.Adventurer.PositionX].Monster = null;
                this.Close();
            }
            else
            {
                ChangingData();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// attacking the hero
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void btnAttack_Click(object sender, RoutedEventArgs e)
        {
            bool   action = (Game.Map.Adventurer + Game.Map.CurrentLocation.Monster);
            Window wnd    = null;

            if (Game.Map.Adventurer.isAlive() == false)
            {
                Game.State = Game.GameState.Lost;
                wnd        = new frmGameOver();
                wnd.Show();

                this.Close();
            }
            else if (Game.Map.CurrentLocation.Monster.isAlive() == false)
            {
                Game.Map.Cells[Game.Map.Adventurer.PositionY, Game.Map.Adventurer.PositionX].Monster = null;
                this.Close();
            }
            else
            {
                displayInfo();
            }
        }