-feat: implement boss/ace wave logic

This commit is contained in:
rsxri 2025-04-23 02:59:41 +01:00
parent ce5f0c9241
commit 6cc79a5e3c
2 changed files with 23 additions and 2 deletions

View file

@ -64,7 +64,7 @@ public partial class ai_fighter : ship
return;
}
private void UpdateHealthLabel(int health)
public void UpdateHealthLabel(int health)
{
_healthLabel.Text = health.ToString();
float percentage = (float)Health / MaxHealth;

View file

@ -73,7 +73,28 @@ public partial class wavecontroller : Node2D
else if (CurrWave % 5 == 0) // ace/boss wave
{
return;
// spawn enemies
Random rand = new Random();
var spawn = _enemySpawns[rand.Next(0, 3)];
var enemy = _aiShipScene.Instantiate<ai_fighter>();
enemy.Faction = ship.ShipFaction.ACE;
enemy.Type = (ship.ShipType)rand.Next(0, 3);
enemy.GlobalPosition = spawn.GlobalPosition;
enemy.StatModifier = (_aiStatModifier) * 1.2f; // make aces stronger
enemy.Scale = new Vector2(0.6f, 0.6f);
enemy.HitboxModifier = 1.3f; // make ace hitbox a bit bigger but smaller than regular enemies (balance)
_enemyNode.AddChild(enemy);
enemy.MaxHealth += 400; // make aces health a bit higher
enemy.Health = enemy.MaxHealth;
enemy.UpdateHealthLabel(enemy.Health);
_aiStatModifier += 0.1f; // increase ai stat modifier by 0.1f after an ace wave
if (_aiStatModifier >= 2f) _aiStatModifier = 2f; // cap ai stat modifier at 2f (10 ace waves)
}
}