#base mannworks_spawnfix.pop
#base robot_standard.pop
#base robot_giant.pop
#base valve_extended_templates.pop
WaveSchedule
{   
    Templates{
        T_TFBot_Medic_QuickFix_Boosted // These guys are only used on wave 2 to pocket the scouts
		{
			Class Medic
			Name "Quick-Fix Medic"
			Skill Normal
			Item "The Quick-Fix"
			ItemAttributes
			{
				ItemName "The Quick-Fix"
				"ubercharge rate bonus" 0.1
			}
			CharacterAttributes
			{
				"heal rate bonus" 1.75
			}
		}
    }
    StartingCurrency                      400
    RespawnWaveTime                       7
    CanBotsAttackWhileInSpawnRoom         No
    // Optional KeyValues
    AddSentryBusterWhenKillCountExceeds   15
    AddSentryBusterWhenDamageDealtExceeds 3000
    Advanced                              0 // Only enable for Advanced/Expert missions (for achievements)
    //IsEndless                             0 // Makes the waves spawn in continuously with no time between waves. Might be broken.

    // Wave 1-6 Sentry Busters
    Mission
    {
        Objective           DestroySentries
        Where               spawnbot
        BeginAtWave         1
        RunForThisManyWaves 6
        CooldownTime        70
        DesiredCount        1
        InitialCooldown     30
        TFBot
        {
            Template T_TFBot_SentryBuster
        }
    }
    Mission // Wave 1 spies
	{
		Objective Spy  

		InitialCooldown 25
		Where spawnbot_mission_spy
		BeginAtWave 1
		RunForThisManyWaves 1
		CooldownTime 45
		DesiredCount 2

		TFBot
		{
			Class Spy
			Skill Expert
			Name Spy
		}
	}	
	
    Mission	// Sniper wave 1
	{
		Objective Sniper

		InitialCooldown 30
		Where spawnbot_mission_sniper
		BeginAtWave 1
		RunForThisManyWaves 1
		CooldownTime 60
		DesiredCount 2

		TFBot
		{
			Template T_TFBot_Sniper_Razorback
			Skill hard
		}
	}	
    Mission	// Sniper wave 2
	{
		Objective Sniper

		InitialCooldown 25
		Where spawnbot_mission_sniper
		BeginAtWave 2
		RunForThisManyWaves 1
		CooldownTime 50
		DesiredCount 2

		TFBot
		{
			Template T_TFBot_Sniper_Camper
			Skill hard
		}
	}
    Mission	// Sydneys wave 3
	{
		Objective Sniper

		InitialCooldown 25
		Where spawnbot_mission_sniper
		BeginAtWave 3
		RunForThisManyWaves 1
		CooldownTime 50
		DesiredCount 2

		TFBot
		{
			Template T_TFBot_Sniper_Sydney_Sleeper
			Skill hard
		}
	}	
    Mission // Wave 4 spies
	{
		Objective Spy  

		InitialCooldown 25
		Where spawnbot_mission_spy
		BeginAtWave 4
		RunForThisManyWaves 1
		CooldownTime 45
		DesiredCount 3

		TFBot
		{
			Class Spy
			Skill Expert
			Name Spy
		}
	}	
	

    // Wave 1 - Rewards 900$
    Wave
    {

        StartWaveOutput
		{
			Target bombpath_arrows_clear_relay
			Action Trigger
		}
		
		DoneOutput
		{
			Target bombpath_wavefinished
			Action Trigger
		}
        InitWaveOutput{
            Target "bignet"
            Action "RunScriptCode"
            Param "ClientPrint(null, 3, `\x07ffbf00 Wave 1 Changes since last test:\n- Gave every group of soldiers 1 Medic\n- Every giant soldier has 1 uber medic\n- Added 3 Giant sandman scouts`)"
        }
        WaveSpawn // First Giant Soldier with 4 medics
        {
            Where spawnbot_left
            Name "W1_01"
            TotalCount 2
            MaxActive 2
            SpawnCount 2
            WaitBeforeStarting 0
            WaitBetweenSpawns 0
            TotalCurrency 50
            Squad{
                TFBot{Template T_TFBot_Giant_Soldier_Spammer_Reload}
                TFBot{Template T_TFBot_Medic}
            }

        }
        WaveSpawn // 3rd Giant Soldier
        {
            Where spawnbot_left
            Name "W1_01"
            TotalCount 2
            MaxActive 2
            SpawnCount 2
            WaitBeforeStarting 38
            WaitBetweenSpawns 0
            TotalCurrency 50
            Squad{
                TFBot{Template T_TFBot_Giant_Soldier_Spammer_Reload}
                TFBot{Template T_TFBot_Medic}
            }
        }
        WaveSpawn //  2 Giant Burst-Fire Soldiers from the right side
        {
            Where spawnbot_right
            Name "W1_01"
            TotalCount 4
            MaxActive 4
            SpawnCount 2
            WaitBeforeStarting 15
            WaitBetweenSpawns 38
            TotalCurrency 50
            Squad{
                TFBot{Template T_TFBot_Giant_Soldier_Spammer_Reload}
                TFBot{Template T_TFBot_Medic}
            }
        }
        WaveSpawn // 5x 4 Soldiers (20 total), Spawned in squads so RandomSpawn 1 doesnt split them up
        {
            Where spawnbot 
            Name "W1_A"
            TotalCount 18
            MaxActive 6
            SpawnCount 6
            RandomSpawn 1
            WaitBeforeStarting 2
            WaitBetweenSpawns 10
            TotalCurrency 75
            Squad{
                TFBot{Class Pyro Skill Normal Attributes AlwaysFireWeapon}
                TFBot{Class Pyro Skill Normal Attributes AlwaysFireWeapon}
                TFBot{Class Pyro Skill Normal Attributes AlwaysFireWeapon}
                TFBot{Class Pyro Skill Normal Attributes AlwaysFireWeapon}
                TFBot{Class Pyro Skill Normal Attributes AlwaysFireWeapon}
                TFBot{Class Pyro Skill Normal Attributes AlwaysFireWeapon}
            }
        }
        WaveSpawn // Final giant soldier on the left side, with 2 Uber medics
        {
            Where spawnbot_left
            Name "W1_02"
            WaitForAllSpawned "W1_01"
            TotalCount 2
            MaxActive 2
            SpawnCount 2
            WaitBeforeStarting 48
            WaitBetweenSpawns 38
            TotalCurrency 75
            Squad{
                TFBot{Template T_TFBot_Giant_Soldier_Spammer_Reload}
                TFBot{Template T_TFBot_Medic}
                TFBot{Template T_TFBot_Medic}
            }
        }
        WaveSpawn //  Final giant soldier on the right side, with 2 uber medics
        {
            Where spawnbot_right
            Name "W1_02"
            WaitForAllSpawned "W1_01"
            TotalCount 2
            MaxActive 2
            SpawnCount 2
            WaitBeforeStarting 48
            WaitBetweenSpawns 38
            TotalCurrency 200
            Squad{
                TFBot{Template T_TFBot_Giant_Soldier_Spammer_Reload}
                TFBot{Template T_TFBot_Medic}
            }
        }
        WaveSpawn // 3 Giant Sandman Scouts
        {
            Where spawnbot_right
            Name "W1_02"
            WaitForAllSpawned "W1_01"
            TotalCount 2
            MaxActive 2
            SpawnCount 1
            WaitBeforeStarting 18
            WaitBetweenSpawns 18
            TotalCurrency 75
            TFBot{Template T_TFBot_Giant_Pyro Attributes AlwaysFireWeapon}
        }
        WaveSpawn // 3 Giant Sandman Scouts
        {
            Where spawnbot_left
            Name "W1_02"
            WaitForAllSpawned "W1_01"
            TotalCount 2
            MaxActive 2
            SpawnCount 1
            WaitBeforeStarting 18
            WaitBetweenSpawns 18
            TotalCurrency 75
            TFBot{Template T_TFBot_Giant_Pyro Attributes AlwaysFireWeapon}
        }

        WaveSpawn //  Just like the soldiers these guys are squaded so they dont get split up
        {
            Where spawnbot_lower
            RandomSpawn 1
            Name "W1_B"
            WaitForAllSpawned "W1_A"
            TotalCount 30
            MaxActive 10
            RandomSpawn 1
            SpawnCount 5
            WaitBeforeStarting 6
            WaitBetweenSpawns 6
            TotalCurrency 125
            Squad{
                TFBot{Class Soldier Skill Normal}
                TFBot{Class Soldier Skill Normal}
                TFBot{Class Soldier Skill Normal}
                TFBot{Class Soldier Skill Normal}
                TFBot{Template T_TFBot_Medic_QuickUber}
            }
        }
        WaveSpawn //  30 Bat scouts
        {
            Where spawnbot_lower
            TotalCount 30
            MaxActive 10
            SpawnCount 10
            WaitBeforeStarting 11
            WaitBetweenSpawns 30
            TotalCurrency 100
            TFBot{Class Scout Skill Expert WeaponRestrictions MeleeOnly BehaviorModifiers push}
        }

    }

    // Wave 2 - Rewards 1000$
    Wave
    {
        StartWaveOutput
		{
			Target bombpath_arrows_clear_relay
			Action Trigger
		}
		
		DoneOutput
		{
			Target bombpath_wavefinished
			Action Trigger
		}
        InitWaveOutput{
            Target "bignet"
            Action "RunScriptCode"
            Param "ClientPrint(null, 3, `\x07ffbf00 Wave 2 Changes since last test:\n- Complete rework\n- Payout reduced by 100$`)"
        }
        WaveSpawn // 
        {
            Where spawnbot_right
            Name "W2_01"

            TotalCount 4
            MaxActive 2
            SpawnCount 2
            WaitBeforeStarting 1
            WaitBetweenSpawns 32
            TotalCurrency 100
            TFBot{Template T_TFBot_Giant_Demoman}
        }
        WaveSpawn // 
        {
            Where spawnbot_left
            Name "W2_01"

            TotalCount 2
            MaxActive 2
            SpawnCount 2
            WaitBeforeStarting 16
            WaitBetweenSpawns 16
            TotalCurrency 100
            TFBot{Template T_TFBot_Giant_Demoman}
        }
        WaveSpawn //  Deflector heavy invasion
        {
            Where spawnbot_lower
            RandomSpawn 1
            Name "W2_01"

            TotalCount 16
            MaxActive 8
            SpawnCount 4
            WaitBeforeStarting 1
            WaitBetweenSpawns 10
            TotalCurrency 100
            Squad{
                TFBot{Class Scout Skill Expert}
                TFBot{Template T_TFBot_Medic_QuickFix_Boosted}
            }
        }
        WaveSpawn //  4 DH GSoldiers 
        {
            Where spawnbot
            RandomSpawn 1

            TotalCount 21
            MaxActive 7
            SpawnCount 7
            WaitBeforeStarting 0
            WaitBetweenSpawns 15
            TotalCurrency 100
            TFBot{Class Heavyweapons Skill Easy}
        }
        WaveSpawn //  4 DH GSoldiers 
        {
            Where spawnbot_left
            Name "W2_02"
            WaitForAllSpawned "W2_01"

            TotalCount 4
            MaxActive 2
            SpawnCount 1
            WaitBeforeStarting 21
            WaitBetweenSpawns 17
            TotalCurrency 100
            TFBot{Template T_TFBot_Giant_Soldier_DirectHit}
        }
        WaveSpawn //  4 DH Gsoldiers
        {
            Where spawnbot_right
            Name "W2_02"
            WaitForAllSpawned "W2_01"

            TotalCount 4
            MaxActive 2
            SpawnCount 1
            WaitBeforeStarting 21
            WaitBetweenSpawns 17
            TotalCurrency 100
            TFBot{Template T_TFBot_Giant_Soldier_DirectHit}
        }
        WaveSpawn //  Soldier + QF Medic invasion
        {
            Where spawnbot
            RandomSpawn 1
            Name "W2_02"
            WaitForAllSpawned "W2_01"

            TotalCount 38
            MaxActive 10
            SpawnCount 2
            WaitBeforeStarting 5
            WaitBetweenSpawns 3.5
            TotalCurrency 100
            Squad{
                TFBot{Class Soldier Skill Normal}
                TFBot{Template T_TFBot_Medic_QuickFix}
            }
        }
        WaveSpawn //  
        {
            Where spawnbot_lower
            Name "W2_02"
            WaitForAllSpawned "W2_01"

            TotalCount 26
            MaxActive 4
            SpawnCount 4
            WaitBeforeStarting 5
            WaitBetweenSpawns 3.5
            TotalCurrency 100
            Squad{
                TFBot{Class Soldier Skill Normal}
                TFBot{Template T_TFBot_Medic_QuickFix}
            }
        }
        
    }

    // Wave 3 - 900$
    Wave
    {
        StartWaveOutput
		{
			Target bombpath_arrows_clear_relay
			Action Trigger
		}
		
		DoneOutput
		{
			Target bombpath_wavefinished
			Action Trigger
		}
        InitWaveOutput{
            Target "bignet"
            Action "RunScriptCode"
            Param " ClientPrint(null, 3, `\x07ffbf00 Wave 4 Changes since last test:`)
                    ClientPrint(null, 3, `\x07ffbf00 - Complete rework`)"
        }
        ///////// Supports:
        // Pyros, Active for the whole wave
        // Soldiers, Active for the whole wave
        // Cleaver scout, active for only the end of the wave
        // Boxing heavy, Active for only the start of the wave
        //////// Also pairs of Hard AI Snipers come in throughout the wave
        WaveSpawn //  Support Pyros
        {
            Where spawnbot_lower
            Support 1
            TotalCount 24
            MaxActive 6
            SpawnCount 6
            WaitBeforeStarting 1
            WaitBetweenSpawns 22
            TotalCurrency 50
            TFBot{Template T_TFBot_Pyro_NoAirBlast}
        }
        WaveSpawn //  Support Soldiers
        {
            Where spawnbot
            RandomSpawn 1
            Support 1
            TotalCount 20
            MaxActive 5
            SpawnCount 5
            WaitBeforeStarting 11
            WaitBetweenSpawns 22
            TotalCurrency 50
            Squad{
                TFBot{Class Soldier Skill Normal}
                TFBot{Class Soldier Skill Normal}
                TFBot{Class Soldier Skill Normal}
                TFBot{Class Soldier Skill Hard}
                TFBot{Class Soldier Skill Hard}
            }
        }
        WaveSpawn //  Boxing heavy supports
        {
            Where spawnbot
            RandomSpawn 1
            Support Limited
            TotalCount 20
            MaxActive 10
            SpawnCount 1
            WaitBeforeStarting 4
            WaitBetweenSpawns 0.8
            TotalCurrency 75
            TFBot{Template T_TFBot_Heavyweapons_Heavyweight_Champ BehaviorModifiers push Skill Expert} // These guys will flank + They have expert ai so they can *sometimes* hit someone
        }
        WaveSpawn //  Cleaver Supports
        {
            Where spawnbot_lower
            Support 1
            TotalCount 14
            MaxActive 7
            SpawnCount 7
            WaitForAllDead "W3_01"
            WaitBeforeStarting 5
            WaitBetweenSpawns 0.8
            TotalCurrency 75
            TFBot{Template T_TFBot_Scout_Cleaver}
        }
        // Subwave 4A: 2 Pairs of Giant Heavy + 2 Giant Demomen, Tank + 6 Super Scouts
        WaveSpawn //  
        {
            Where spawnbot_right
            Name "W3_01"

            TotalCount 2
            MaxActive 1
            SpawnCount 1
            WaitBeforeStarting 0
            WaitBetweenSpawns 26
            TotalCurrency 150
            TFBot{Template T_TFBot_Giant_Heavyweapons }
        }
        WaveSpawn //  
        {
            Where spawnbot_left
            Name "W3_01"

            TotalCount 4
            MaxActive 2
            SpawnCount 2
            WaitBeforeStarting 0.1
            WaitBetweenSpawns 26
            TotalCurrency 150
            TFBot{Template T_TFBot_Giant_Demo_RapidFire}
        }
        WaveSpawn //  
        {
            Where spawnbot_left
            Name "W3_01"

            TotalCount 3
            MaxActive 2
            SpawnCount 1
            WaitBeforeStarting 45
            WaitBetweenSpawns 18
            TotalCurrency 150
            TFBot{Template T_TFBot_Giant_Scout_Fast}
        }
        WaveSpawn //  
        {
            Where spawnbot_right
            Name "W3_01"

            TotalCount 3
            MaxActive 2
            SpawnCount 1
            WaitBeforeStarting 45
            WaitBetweenSpawns 18
            TotalCurrency 150
            TFBot{Template T_TFBot_Giant_Scout_Fast}
        }
        WaveSpawn
		{
			TotalCount 1
			WaitBeforeStarting 50
			TotalCurrency 100
			
			Tank
			{
				Health 10000
				Speed 75
				Name "tankboss_left"
				StartingPathTrackNode "boss_path_1"
				
				OnBombDroppedOutput
				{
					Target boss_deploy_relay
					Action Trigger
				}
			}
		}
        WaveSpawn
		{
			TotalCount 1
			WaitBeforeStarting 50
			TotalCurrency 100
			
			Tank
			{
				Health 10000
				Speed 75
				Name "tankboss_right"
				StartingPathTrackNode "boss_path2_1"
				
				OnBombDroppedOutput
				{
					Target boss_deploy_relay
					Action Trigger
				}
			}
		}
        // Subwave 4B: Giant Heavy Pair + 6 Super Scouts
        WaveSpawn //  
        {
            Where spawnbot_right
            Name "W3_02"
            WaitForAllSpawned "W3_01"

            TotalCount 1
            MaxActive 1
            SpawnCount 1
            WaitBeforeStarting 10
            WaitBetweenSpawns 26
            TotalCurrency 150
            TFBot{Template T_TFBot_Giant_Heavyweapons }
        }
        WaveSpawn //  
        {
            Where spawnbot_left
            Name "W3_02"
            WaitForAllSpawned "W3_01"

            TotalCount 1
            MaxActive 1
            SpawnCount 1
            WaitBeforeStarting 10
            WaitBetweenSpawns 26
            TotalCurrency 150
            TFBot{Template T_TFBot_Giant_Heavyweapons }
        }
        WaveSpawn //  
        {
            Where spawnbot_left
            Name "W3_02"
            WaitForAllSpawned "W3_01"

            TotalCount 3
            MaxActive 2
            SpawnCount 1
            WaitBeforeStarting 18
            WaitBetweenSpawns 12
            TotalCurrency 150
            TFBot{Template T_TFBot_Giant_Scout_Fast}
        }
        WaveSpawn //  
        {
            Where spawnbot_right
            Name "W3_02"
            WaitForAllSpawned "W3_01"

            TotalCount 3
            MaxActive 2
            SpawnCount 1
            WaitBeforeStarting 18
            WaitBetweenSpawns 12
            TotalCurrency 150
            TFBot{Template T_TFBot_Giant_Scout_Fast}
        }
        // Subwave 4B: 4 GDemos
        WaveSpawn //  
        {
            Where spawnbot
            RandomSpawn 1
            Name "W3_03"
            WaitForAllSpawned "W3_02"

            TotalCount 3
            MaxActive 3
            SpawnCount 1
            WaitBeforeStarting 5
            WaitBetweenSpawns 7
            TotalCurrency 150
            TFBot{Template T_TFBot_Giant_Demoman}
        }
    }

    // Wave 4 - X Currency
    Wave
    {
        StartWaveOutput{
			Target bombpath_arrows_clear_relay
			Action Trigger}
		DoneOutput{
			Target bombpath_wavefinished
			Action Trigger}
        InitWaveOutput{
            Target "bignet"
            Action "RunScriptCode"
            Param "ClientPrint(null, 3, `\x07ffbf00 Wave 4 Changes since last test:\n- While the wave looks weaker with 4 less Giant heavies everything else was buffed so this was basically a complete rework`)"
        }
        ///////// Supports:
        // Pyros, Active for the whole wave
        // Soldiers, Active for the whole wave
        // Cleaver scout, active for only the end of the wave
        // Boxing heavy, Active for only the start of the wave
        //////// Also pairs of Hard AI Snipers come in throughout the wave
        // Subwave 4A: Pair of Giant Heavy + Giant Spammer, 6 Super scouts
        WaveSpawn // 
        {
            Where spawnbot_left
            Name "W4_01"

            TotalCount 2
            MaxActive 1
            SpawnCount 1
            WaitBeforeStarting 0
            WaitBetweenSpawns 20
            TotalCurrency 100
            TFBot{Template T_TFBot_Soldier_Airstrike}
        }
        
    }

    // Wave 5 - X Currency
    Wave
    {

        StartWaveOutput
        {
            Target wave_start_relay // Replace with "Target wave_start_relay_classic" for Rottenburg
            Action Trigger
        }

        DoneOutput
        {
            Target wave_finished_relay
            Action Trigger
        }

        // Subwave description here
        WaveSpawn
        {
            Name "wave5a"
            Where spawnbot
            TotalCount 12
            MaxActive 6
            SpawnCount 3
            WaitBeforeStarting 0
            WaitBetweenSpawns 10
            TotalCurrency 60
            TFBot
            {
                Class Scout
                Skill Hard
            }
        }
    }

    // Wave 6 - X Currency
    Wave
    {

        StartWaveOutput
        {
            Target wave_start_relay // Replace with "Target wave_start_relay_classic" for Rottenburg
            Action Trigger
        }

        DoneOutput
        {
            Target wave_finished_relay
            Action Trigger
        }

        // Subwave description here
        WaveSpawn
        {
            Name "wave6a"
            Where spawnbot
            TotalCount 12
            MaxActive 6
            SpawnCount 3
            WaitBeforeStarting 0
            WaitBetweenSpawns 10
            TotalCurrency 60
            TFBot
            {
                Class Scout
                Skill Hard
            }
        }
    }
}