Exemple #1
0
 public cEnemyAI(Drawable pc, cStats pcStats, Point startingPosition, string enemyName, int health, int attack, int range, int detectRange, double attackRange, double lootChance)
 {
     player                = pc;
     playerStats           = pcStats;
     this.StartingPosition = startingPosition;
     this.enemyName        = enemyName;
     this.health           = health;
     this.maxHealth        = health;
     this.range            = range;
     this.detectRange      = detectRange * detectRange;
     this.attackRange      = attackRange * attackRange;
     damage                = attack;
     this.lootChance       = lootChance;
     xpAmount              = (health + attack + ((int)attackRange * 3)) / 5;
 }
Exemple #2
0
        private int Damage(int amount, Drawable d, cStats playerStats)
        {
            if (health - amount <= 0)
            {
                if (Game.g.rng.NextDouble() < lootChance)
                {
                    Game.g.pcInv.SpawnLoot(d.pos.xPos, d.pos.yPos);
                }

                d.SetPos(-1, -1);
                d.active = false;
                playerStats.GainXP(xpAmount);
            }
            else
            {
                health -= amount;
            }

            return(amount);
        }