Ejemplo n.º 1
0
        private void EnemyAttack(Enemy e)
        {
            bool   isSpecial;
            int    damage    = e.GetAttack(out isSpecial);
            Status s         = null;
            bool   gotStatus = e.GetStatus(out s);

            if (gotStatus)
            {
                s.player             = Player;
                Player.CurrentStatus = s;
            }
            int damageTaken = Player.getAttacked(damage);

            if (Player.CurrentHP <= 0)
            {
                GameRef.GameOver();
            }

            EnemyMoves += e.name + " attacked you for " + damageTaken.ToString() + " damage.\n";
        }
Ejemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            if (Player.CurrentHP <= 0)
            {
                GameRef.GameOver();
            }
            if (!textBox)
            {
                if (Enemies.Count == 2)
                {
                    SecondEnemyHealth.Text = Enemies[1].CurrentHP.ToString();
                }
                if (InputHandler.KeyPressed(Keys.Escape))
                {
                    RemoveCombatMenu();
                    AddCombatMenu();
                }
                ControlManager.Update(gameTime, playerIndexInControl);
                base.Update(gameTime);
            }
            if (textBox)
            {
                if (InputHandler.KeyPressed(Keys.X))
                {
                    EnemyMoves = "";
                    textBox    = false;
                    RemoveCombatMenu();
                    AddCombatMenu();
                }
            }

            PlayerMana.Text       = Player.CurrentMana.ToString();
            PlayerHealth.Text     = Player.CurrentHP.ToString();
            EnemyHealth.Text      = Enemies[0].CurrentHP.ToString();
            EnemyName.Text        = Enemies[0].name;
            EnemyLevel.Text       = Enemies[0].Level.ToString();
            enemyBackground.Image = Enemies[0].image;
        }