protected Enemy(EnemyTypes type, EnemyConstants.EnemyProperties properties, string file, int x, int y, bool isSpawned) : base(file, true) { Initialize(type, properties, file); X = x; Y = y; IsSpawnedEnemy = isSpawned; }
private void Initialize(EnemyTypes type, EnemyConstants.EnemyProperties properties, string file) { Type = type; MaxHealth = Helpers.RandomInRange(properties.MinHealth, properties.MaxHealth) * DifficultyConstants.HealthFactor * (1 + Level.CurrentLevel * GameplayConstants.HealthFactorPerLevel); Health = MaxHealth; MaxMana = Helpers.RandomInRange(properties.MinMana, properties.MaxMana) * DifficultyConstants.ManaFactor; Mana = MaxMana; HealthRegen = properties.HealthRegen * DifficultyConstants.HealthFactor * (1 + Level.CurrentLevel * GameplayConstants.HealthFactorPerLevel); ManaRegen = properties.ManaRegen * DifficultyConstants.ManaFactor; BaseSpeed = Helpers.RandomInRange(properties.MinSpeed, properties.MaxSpeed) * DifficultyConstants.SpeedFactor; CriticalChance = properties.CritChance; }
protected Enemy(EnemyTypes type, EnemyConstants.EnemyProperties properties, string file, MapSection mapSection) : base(file, true) { Initialize(type, properties, file); if (mapSection == null) { // Find a random zerd to spawn near var zerdTarget = Globals.GameState.Zerds.RandomElement(); mapSection = Globals.Map.GetSection(zerdTarget); IsSpawnedEnemy = true; } var spawn = mapSection.GetSpawnSpot(this); X = spawn.X; Y = spawn.Y; }