diff --git a/src/stribun.c b/src/stribun.c index ebf6133..7e67e77 100644 --- a/src/stribun.c +++ b/src/stribun.c @@ -647,6 +647,8 @@ void bossMarineShoot(float speedMultiplier, } } +static bool bossMarineAttacks[BOSS_MARINE_NOT_SHOOTING] = {0}; + void bossMarineAttack(void) { bossMarine.attackTimer -= GetFrameTime(); bossMarine.fireCooldown -= GetFrameTime(); @@ -655,9 +657,26 @@ void bossMarineAttack(void) { bossMarine.isWalking = (bool)GetRandomValue(0, 1); if (bossMarine.currentAttack == BOSS_MARINE_NOT_SHOOTING) { - bossMarine.currentAttack += GetRandomValue(BOSS_MARINE_SINUS_SHOOTING, - BOSS_MARINE_BOUNCING_WAVES); - bossMarine.currentAttack = bossMarine.currentAttack % BOSS_MARINE_NOT_SHOOTING; + int c = 0; + for (int i = 0; i < BOSS_MARINE_NOT_SHOOTING; i++) { + if (bossMarineAttacks[i]) { + c++; + } + } + + if (c == BOSS_MARINE_NOT_SHOOTING) { + memset(bossMarineAttacks, 0, sizeof(bossMarineAttacks)); + } + + BossMarineAttack a = 0; + do { + a = GetRandomValue(BOSS_MARINE_SINUS_SHOOTING, + BOSS_MARINE_BOUNCING_WAVES); + } while (bossMarineAttacks[a]); + bossMarineAttacks[a] = true; + + bossMarine.currentAttack = a; + bossMarine.attackTimer = (float)GetRandomValue(3, 7); } else { bossMarine.currentAttack = BOSS_MARINE_NOT_SHOOTING; @@ -692,7 +711,7 @@ void bossMarineAttack(void) { (void) i; float spread = (float)GetRandomValue(-15, 15); - float speed = (float)GetRandomValue(1, 10) / 10.0f * 0.6f; + float speed = (float)GetRandomValue(1, 10) / 10.0f * 0.8f; bossMarineShoot(speed, 0, @@ -2039,6 +2058,7 @@ void initBackgroundAsteroid(void) { void initBossMarine(void) { memset(&bossMarine, 0, sizeof(bossMarine)); + memset(bossMarineAttacks, 0, sizeof(bossMarineAttacks)); bossMarine = (BossMarine) { .position = {