//Written by Startacker! https://steamcommunity.com/id/startacker/
// Guardian Map Template Mission
// Ported to mvm_gd_fastener by Pont

#base robot_standard.pop
#base robot_giant.pop

//Boiler plate code to start us off

WaveSchedule
{
	StartingCurrency 800
	CanBotsAttackWhileInSpawnRoom No
	RespawnWaveTime 0
	Advanced 1
	
	Templates
	{
		// Scout train pusher
		FastenerBot_ScoutPushFodder
		{
				Class Scout
				ClassIcon Scout
				Skill Normal
				BehaviorModifiers	Push
				Attributes			IgnoreFlag
				WeaponRestrictions MeleeOnly
				Name "Secondmann"
				Item "Engineer's Cap"
		}
	//WAVESPAWN templates
		// Pusher scout trickle
		FastenerWave_Support_ScoutPushers_Trickle
		{
			Name "support_scoutPushers"
            SpawnCount 1
            MaxActive 3
            WaitBeforeStarting 0
            WaitBetweenSpawns 3
            Where spawnbot
            TotalCurrency 0
			Support 1
		
            TFBot
            {
				Template FastenerBot_ScoutPushFodder
				
				// go to train
				Tag nav_prefer_gate1_flank
				Tag bot_gatebot
            }
		}
		// Pusher scout groups
		FastenerWave_Support_ScoutPushers_Groups
		{
			Name "support_scoutPushers"
            SpawnCount 3
            MaxActive 3
            WaitBeforeStarting 0
            WaitBetweenSpawns 9
            Where spawnbot
            TotalCurrency 0
			Support 1
            TFBot
            {
				Template FastenerBot_ScoutPushFodder
				
				// go to train
				Tag nav_prefer_gate1_flank
				Tag bot_gatebot
            }
		}
	}

    Mission
    {
        Objective Sniper
        Where spawnbot
        BeginAtWave 5
        RunForThisManyWaves 2
        InitialCooldown 25
        CooldownTime 45
        DesiredCount 2

        TFBot
        {
            Template T_TFBot_Sniper
        }
    }

    //Wave 1

    Wave
	{
		StartWaveOutput
		{
			Target	wave_start_relay
			Action	Trigger
		}
		
		DoneOutput
		{
			Target	wave_finished_relay
			Action	Trigger
		}
        InitWaveOutput
		{
			Target wave_reset_relay
			Action Trigger
		}

        WaveSpawn
		{
			Name "wave_1_dynamic_element"
			TotalCount 0
			SpawnCount 0
			WaitBeforeStarting 0
			FirstSpawnOutput
			{
				Target wave_start_events_1
				Action Trigger
			}
        }

		// Pusher scouts
		WaveSpawn
		{
			Template FastenerWave_Support_ScoutPushers_Trickle
		}
        WaveSpawn
        {
            Name "wave01_a"
            TotalCount 40
            SpawnCount 8
            MaxActive 10
            WaitBeforeStarting 5
            WaitBetweenSpawns 5
            Where spawnbot
            TotalCurrency 200

            TFBot
            {
                Template T_TFBot_Heavyweapons_Heavyweight_Champ
                BehaviorModifiers	Push
				Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave01_b"
            TotalCount 28
            SpawnCount 4
            MaxActive 6
            WaitBeforeStarting 0
            WaitBetweenSpawns 4
            Where spawnbot_left
            TotalCurrency 200

            TFBot
            {
                Class Demoman
                Skill Normal
                BehaviorModifiers	Push
				Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave01_c"
            TotalCount 6
            SpawnCount 3
            MaxActive 6
            WaitBeforeStarting 6
            WaitForAllDead "wave01_b"
            WaitBetweenSpawns 20
            Where spawnbot
            TotalCurrency 300

            Squad
            {
                TFBot
                {
                    Template T_TFBot_Giant_Soldier_Crit
                    BehaviorModifiers	Push
				    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
                }
                TFBot
                {
                    Template T_TFBot_Medic_QuickFix
					Tag bot_squad_member
                }
                TFBot
                {
                    Template T_TFBot_Medic_QuickFix
					Tag bot_squad_member
                }
            }
        }
    }
    Wave
	{
		StartWaveOutput
		{
			Target	wave_start_relay
			Action	Trigger
		}
		
		DoneOutput
		{
			Target	wave_finished_relay
			Action	Trigger
		}
        InitWaveOutput
		{
			Target wave_reset_relay
			Action Trigger
		}

        WaveSpawn
		{
			Name "wave_2_dynamic_element"
			TotalCount 0
			SpawnCount 0
			WaitBeforeStarting 0
			FirstSpawnOutput
			{
				Target wave_start_events_2
				Action Trigger
			}
        }
		// Pusher scouts
		WaveSpawn
		{
			Template FastenerWave_Support_ScoutPushers_Groups
		}
        WaveSpawn
        {
            Name "wave02_a"
            TotalCount 8
            SpawnCount 2
            MaxActive 4
            WaitBeforeStarting 0
            WaitBetweenSpawns 15
            Where spawnbot
            TotalCurrency 200

            Squad
            {
                TFBot
                {
                    Template T_TFBot_Giant_Demoman_PrinceTavish
                    BehaviorModifiers	Push
			        Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
                }
                TFBot
                {
                    Template T_TFBot_Medic_QuickFix
                }
            }
        }
        WaveSpawn
        {
            Name "wave02_b"
            TotalCount 14
            SpawnCount 2
            MaxActive 4
            WaitBeforeStarting 18
            WaitForAllSpawned "wave02_a"
            WaitBetweenSpawns 5
            Where spawnbot_left
            TotalCurrency 200

            TFBot
            {
                Class Soldier
                Skill Normal
                Scale 1.3
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
                Attributes HoldFireUntilFullReload
				// go nearby the train
				Tag bot_hoverbot
                ClassIcon soldier_spammer

                ItemAttributes
                {
                    ItemName "TF_WEAPON_ROCKETLAUNCHER"
                    "faster reload rate" 1.3
                    "fire rate bonus" 0.75
                }
            }
        }
        WaveSpawn
        {
            Name "wave02_c"
            TotalCount 50
            SpawnCount 4
            MaxActive 6
            WaitBeforeStarting 6
            WaitForAllSpawned "wave02_b"
            WaitBetweenSpawns 4
            Where spawnbot
            Where spawnbot_right
            TotalCurrency 100
            Support 1

            TFBot
            {
                Class Scout
                Skill Normal
                WeaponRestrictions MeleeOnly
                ClassIcon scout_bat
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave02_d"
            TotalCount 42
            SpawnCount 6
            MaxActive 10
            WaitBeforeStarting 8
            WaitForAllDead "wave02_b"
            WaitBetweenSpawns 5
            Where spawnbot
            Where spawnbot_left
            TotalCurrency 200

            TFBot
            {
                Class Scout
                Skill Easy
                ClassIcon scout
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
    }
    Wave
	{
		StartWaveOutput
		{
			Target	wave_start_relay
			Action	Trigger
		}
		
		DoneOutput
		{
			Target	wave_finished_relay
			Action	Trigger
		}
        InitWaveOutput
		{
			Target wave_reset_relay
			Action Trigger
		}

        WaveSpawn
		{
			Name "wave_3_dynamic_element"
			TotalCount 0
			SpawnCount 0
			WaitBeforeStarting 0
			FirstSpawnOutput
			{
				Target wave_start_events_3
				Action Trigger
			}
        }
		// Pusher scouts
		WaveSpawn
		{
			Template FastenerWave_Support_ScoutPushers_Groups
		}
        WaveSpawn
        {
            Name "wave03_a"
            TotalCount 1
            SpawnCount 1
            MaxActive 1
            Where spawnbot_left
            TotalCurrency 66

            TFBot
            {
                Template T_TFBot_Demoman_Samurai
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave03_a"
            TotalCount 1
            SpawnCount 1
            MaxActive 1
            Where spawnbot
            TotalCurrency 66

            TFBot
            {
                Template T_TFBot_Demoman_Samurai
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave03_a"
            TotalCount 1
            SpawnCount 1
            MaxActive 1
            Where spawnbot_support
            TotalCurrency 68
			WaitBeforeStarting 6

            TFBot
            {
                Template T_TFBot_Demoman_Samurai
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave03_b"
            TotalCount 40
            SpawnCount 2
            MaxActive 10
            WaitBeforeStarting 6
            WaitForAllDead "wave03_a"
            WaitBetweenSpawns 1
            Where spawnbot
            TotalCurrency 200

            Squad
            {
                TFBot
                {
                    Template T_TFBot_Heavyweapons_Shotgun
                    BehaviorModifiers	Push
			        Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
                }
                TFBot
                {
                    Template T_TFBot_Medic_QuickFix
                }
            }
        }
        WaveSpawn
        {
            Name "wave03_c"
            TotalCount 3
            SpawnCount 1
            MaxActive 3
            WaitBeforeStarting 8
            WaitForAllSpawned "wave03_b"
            WaitBetweenSpawns 9
            Where spawnbot
            TotalCurrency 200

            TFBot
            {
                Template T_TFBot_Giant_Demo_RapidFire
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
    }
    Wave
	{
		StartWaveOutput
		{
			Target	wave_start_relay
			Action	Trigger
		}
		
		DoneOutput
		{
			Target	wave_finished_relay
			Action	Trigger
		}
        InitWaveOutput
		{
			Target wave_reset_relay
			Action Trigger
		}

        WaveSpawn
		{
			Name "wave_4_dynamic_element"
			TotalCount 0
			SpawnCount 0
			WaitBeforeStarting 0
			FirstSpawnOutput
			{
				Target wave_start_events_4
				Action Trigger
			}
        }
		// Pusher scouts
		WaveSpawn
		{
			Template FastenerWave_Support_ScoutPushers_Groups
		}
        WaveSpawn
        {
            Name "wave04_a"
            TotalCount 6
            SpawnCount 3
            MaxActive 6
            WaitBetweenSpawns 14
            TotalCurrency 200
            Where spawnbot

            Squad
            {
                TFBot
                {
                    Template T_TFBot_Giant_Soldier_Spammer
                    BehaviorModifiers	Push
			        Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
                }
                TFBot
                {
                    Template T_TFBot_Medic_QuickFix
                }
                TFBot
                {
                    Template T_TFBot_Medic_QuickFix
                }
            }
        }
        WaveSpawn
        {
            Name "wave04_b"
            TotalCount 45
            SpawnCount 1
            MaxActive 10
            WaitBeforeStarting 16
            WaitForAllSpawned "wave04_a"
            WaitBetweenSpawns .75
            Where spawnbot
            Where spawnbot_right
            TotalCurrency 150

            TFBot
            {
                Template T_TFBot_Sniper_Huntsman
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave04_c"
            TotalCount 2
            SpawnCount 1
            MaxActive 2
            WaitBeforeStarting 10
            WaitForAllSpawned "wave04_b"
            WaitBetweenSpawns 8
            Where spawnbot
            TotalCurrency 200

            TFBot
            {
                Template T_TFBot_Giant_Boxing_Heavy
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave04_d"
            TotalCount 50
            SpawnCount 3
            MaxActive 8
            WaitBeforeStarting 8
            WaitForAllDead "wave04_b"
            WaitBetweenSpawns 5
            Where spawnbot_left
            Where spawnbot_right
            TotalCurrency 150
            Support 1

            TFBot
            {
                Class Scout
                Skill Normal
                WeaponRestrictions MeleeOnly
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
    }
    Wave
	{
		StartWaveOutput
		{
			Target	wave_start_relay
			Action	Trigger
		}
		
		DoneOutput
		{
			Target	wave_finished_relay
			Action	Trigger
		}
        InitWaveOutput
		{
			Target wave_reset_relay
			Action Trigger
		}

        WaveSpawn
		{
			Name "wave_5_dynamic_element"
			TotalCount 0
			SpawnCount 0
			WaitBeforeStarting 0
			FirstSpawnOutput
			{
				Target wave_start_events_5
				Action Trigger
			}
        }
		// Pusher scouts
		WaveSpawn
		{
			Template FastenerWave_Support_ScoutPushers_Groups
		}
        WaveSpawn
        {
            Name "wave05_a"
            TotalCount 1
            SpawnCount 1
            Where spawnbot
            TotalCurrency 200

            TFBot
            {
                Template T_TFBot_Giant_Heavyweapons
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
			    Tag nav_prefer_gate1_flank
			    Tag bot_gatebot
            }
        }
        WaveSpawn
        {
            Name "wave05_b"
            TotalCount 30
            SpawnCount 6
            MaxActive 10
            WaitBeforeStarting 8
            WaitForAllDead "wave05_a"
            WaitBetweenSpawns 6
            Where spawnbot
            TotalCurrency 200

            TFBot
            {
                Class Soldier
                Skill Normal
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave05_c"
            TotalCount 3
            SpawnCount 1
            MaxActive 3
            WaitBeforeStarting 6
            WaitForAllDead "wave05_b"
            WaitBetweenSpawns 10
            Where spawnbot
            TotalCurrency 200

            TFBot
            {
                Template T_TFBot_Giant_Scout
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
        WaveSpawn
        {
            Name "wave05_d"
            TotalCount 40
            SpawnCount 4
            MaxActive 8
            WaitBeforeStarting 4
            WaitForAllDead "wave05_b"
            WaitBetweenSpawns 5
            Where spawnbot
            Where spawnbot_left
            Where spawnbot_right
            TotalCurrency 200

            TFBot
            {
                Class Pyro
                Skill Easy
                Attributes AlwaysFireWeapon
                BehaviorModifiers	Push
			    Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
            }
        }
    }
    Wave
	{
		StartWaveOutput
		{
			Target	wave_start_relay
			Action	Trigger
		}
		
		DoneOutput
		{
			Target	wave_finished_relay
			Action	Trigger
		}
        InitWaveOutput
		{
			Target wave_reset_relay
			Action Trigger
		}

        WaveSpawn
		{
			Name "wave_6_dynamic_element"
			TotalCount 0
			SpawnCount 0
			WaitBeforeStarting 0
			FirstSpawnOutput
			{
				Target wave_start_events_6
				Action Trigger
			}
        }
		// Pusher scouts
		WaveSpawn
		{
			Template FastenerWave_Support_ScoutPushers_Groups
		}
        WaveSpawn
        {
            Name "wave06_a"
            TotalCount 11
            SpawnCount 11
            Where spawnbot

            Squad
            {
                TFBot
                {
                    Template T_TFBot_Giant_Heavyweapons_Shotgun
                    BehaviorModifiers	Push
			        Attributes			IgnoreFlag
				// go nearby the train
				Tag bot_hoverbot
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
                TFBot
                {
                    Template T_TFBot_Medic
                }
            }
        }
    }
}