Example #1
0
 public BossSprite(Texture2D textureImage, Vector2 position,
    Point frameSize, int collisionOffset, Point currentFrame, Point sheetSize,
    Vector2 speed, Game1 game, Enemy boss)
     : base(textureImage, position, frameSize, collisionOffset, currentFrame, sheetSize, speed, game)
 {
     this.game = game;
     this.zIndex = .2f;
     passable = false;
     this.isInteractable = true;
     this.interactOnTouch = true;
     this.Boss = boss;
 }
Example #2
0
        private void EnemyDeath(Enemy e)
        {
            Player.exp += e.EXPGiven;
            enemyDrops.AddRange(e.Drops);

            ControlManager.Remove(SecondEnemyBackground);
            ControlManager.Remove(SecondEnemyHealth);
            ControlManager.Remove(SecondEnemyHealthLabel);
            ControlManager.Remove(SecondEnemyName);
            ControlManager.Remove(SecondEnemyLevel);
            ControlManager.Remove(SecondEnemyLevelLabel);

            Player.AddItems(enemyDrops);
            Player.Money += totalGold;
            foreach (Item item in enemyDrops)
            {
                sb.Append(item.ToString() + "\n");
            }
            sb.Append("\nGold: " + totalGold);

            if (Enemies.Count == 1)
            {
                bool isLeveled = false;
                while (Player.exp >= Player.EXPToNext)
                {
                    Player.levelUp();
                    isLeveled = true;
                }
                EndCombat(isLeveled);
            }

            if (Enemies.Count > 1 && e == Enemies[0])
            {
                Enemies[0] = Enemies[1];
            }
            if (Enemies.Count != 1)
            {
                Enemies.Remove(Enemies[1]);
            }
        }
Example #3
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";
        }
Example #4
0
        private void DamageEnemy(Enemy e)
        {
            int damage = 1;
            if (isSpecialAttack)
            {
                Ability randomAblilty = Player.GetAbility();
                damage = (int)(randomAblilty.Effect(Player) - (e.SpecDefense * e.SP_DEF_MOD));
                Player.CurrentMana -= randomAblilty.getCost(Player);
            }
            else
            {
                if (((Player.Atk + 1) - e.Defense) > 0)
                {
                    damage = (int)((Player.getDamage()) - (e.Defense * e.DEF_MOD));
                }
            }

            e.CurrentHP -= damage;
            if (e.CurrentHP <= 0)
            {
                EnemyDeath(e);
            }
        }