#base robot_standard.pop
#base robot_giant.pop

tomboy
{
	StartingCurrency 1984
	CanBotsAttackWhileInSpawnRoom no
	RespawnWaveTime 0

    //Reverse KVs
    ReverseWinConditions 1
    AllowJoinTeamBlueMax 6
    AllowJoinTeamBlue 1
    HumansMustJoinTeam Blue
    SetCreditTeam 3
    SniperAllowHeadshots 1
    SendBotsToSpectatorImmediately 1
    //FlagCarrierMovementPenalty 1
    BluHumanFlagCapture 0			 
    BluHumanFlagPickup 0

    BotsRandomCrit 0

	Templates 
	{
		T_TFBot_Helicopter_Base
		{
			SpawnTemplate Yakuza_Title_Card_HunterChopper

			Name "Hunter-Chopper"
			Class Scout

			Action Mobber
			Skill Expert
			Attributes SuppressFire

			UseCustomModel "models/empty.mdl" 
			Scale 0.3

			AddCond 
			{
				Index 52 
			}

			CustomWeaponModel
			{
				Slot 0
				Model "models/empty.mdl"
			}

			CustomWeaponModel
			{
				Slot 1
				Model "models/empty.mdl"
			}

			CustomWeaponModel
			{
				Slot 2
				Model "models/empty.mdl"
			}
		
			CharacterAttributes
			{
				"not solid to players" 1
				"voice pitch scale" 0
				"move speed bonus" 0.5
				"no_jump" 1
				"damage force reduction" 0.001
				"airblast pushback scale" 0.0001
				"airblast vertical pushback scale" 0.0001
				"dmg from ranged reduced" 0
				"dmg from melee increased" 0
				"cannot be backstabbed" 1
				"cannot pick up intelligence" 1
			}
		}

		T_TFBot_Helicopter_Shoot
		{
			SpawnTemplate Helicopter_Patterns

			Name "Hunter-Chopper"
			Class Soldier

			Action Mobber
			Skill Expert

			Health 1984

			UseCustomModel "models/empty.mdl" 
			Scale 0.1

			AddCond 
			{
				Index 52 
			}

			CustomWeaponModel
			{
				Slot 0
				Model "models/empty.mdl"
			}

			CustomWeaponModel
			{
				Slot 1
				Model "models/empty.mdl"
			}

			CustomWeaponModel
			{
				Slot 2
				Model "models/empty.mdl"
			}

			CharacterAttributes
			{
				"not solid to players" 1
				"move speed bonus" 0.5
				"no_jump" 1
				"dmg from ranged reduced" 0
				"dmg from melee increased" 0
				"cannot be backstabbed" 1
				"cannot pick up intelligence" 1
			}

			EventChangeAttributes
			{
				Default 
				{
					Attributes HoldFireUntilFullReload

					Item TF_WEAPON_ROCKETLAUNCHER

					ItemAttributes
					{
						ItemName TF_WEAPON_ROCKETLAUNCHER
						//"fire full clip at once" 1
                        "is invisible" 1
						"fire rate penalty" 1.3
						"reload time decreased" 0.7
					}
		
								
					ShootTemplate
					{
						Name TridentBurst 
						AttachToProjectile 1
					}
				}

				Pattern2 
				{
					// Item TF_WEAPON_SNIPERRIFLE

					// FireWeapon    
					// {
					// 	Delay 0 
					// 	Cooldown 0.5
					// 	Duration 0.1
					// 	Type "Primary" 
					// }

					// ItemAttributes
					// {
					// 	ItemName TF_WEAPON_SNIPERRIFLE
					// 	"is invisible" 1
					// 	"fire rate bonus" 0.1
					// 	"sniper fires tracer" 1 
					// }

                    Attributes AlwaysFireWeapon
                    
                    Item TF_WEAPON_ROCKETLAUNCHER

                    ItemAttributes
					{
						ItemName TF_WEAPON_ROCKETLAUNCHER
                        "is invisible" 1
						"fire rate bonus" 0.4
                        "Reload time decreased" -1
					}

                    ShootTemplate
					{
						Name RocketMastery
                        AttachToProjectile 1
					}
				}

                Pattern3
				{
                    Attributes AlwaysFireWeapon
                    
                    Item TF_WEAPON_ROCKETLAUNCHER

                    AimOffset "0 0 30"

                    ItemAttributes
					{
						ItemName TF_WEAPON_ROCKETLAUNCHER
                        "is invisible" 1
						"fire rate penalty" 0.5
                        "Projectile speed decreased" 0.3
					}

                    ShootTemplate
					{
						Name RocketSpike
                        AttachToProjectile 1
					}
                }

                Pattern4
				{
                    Attributes AlwaysFireWeapon
                    
                    Item TF_WEAPON_ROCKETLAUNCHER

                    ItemAttributes
					{
						ItemName TF_WEAPON_ROCKETLAUNCHER
                        "is invisible" 1
						"fire rate penalty" 10 //fire once 
                        "Projectile speed decreased" 0.3
                        "always crit" 1
					}

                    ShootTemplate
					{
						Name RocketMasteryConstant 
						AttachToProjectile 1
					}

                }
			}
		}
    }

	PointTemplates
	{
		
		Yakuza_Title_Card_HunterChopper
		{
			OnSpawnOutput
			{
				Target "upper_text"
				Action "Display"
				Delay 3
			}

			OnSpawnOutput
			{
				Target "middle_text"
				Action "Display"
				Delay 3.2
			}

			game_text
			{
				"origin" "1984 1984 99999"
				"targetname" "upper_text"
				"message" "HEAVY WEAPONRY ROTORCRAFT FROM ANOTHER TIME"
				"x" "-1"
				"y" "0.4"
				"spawnflags" "1"
				"effect" "2"
				"channel" "2"
				"color" "255 255 255"
				"fxtime" "0.2"
				"fadeout" "1"
				//"fadein" "0"
				"holdtime" "5"
			}

			game_text
			{
				"origin" "1984 1984 99999"
				"targetname" "middle_text"
				"message" "HUNTER-CHOPPER"
				"x" "-1"
				"y" "0.45"
				"channel" "0"
				"spawnflags" "1"
				"color" "255 255 255"
				"fadein" "0.2"
				"fadeout" "1"
				"holdtime" "4.8"
			}
		}


		TridentBurst 
		{
			OnSpawnOutput 
			{
				Target "firer"
				Action "FireUser1"
				Delay 0
			}

			OnSpawnOutput
			{
				Target "firer"
				Action "$InheritOwner"
				Param "!activator"
				Delay 0
			}


			tf_point_weapon_mimic
			{
				"targetname" "firer"

				"$preventshootparent" "1"

				"spawnflags" "1"
				"angles" "0 0 0"
				"origin" "0 10 -3"
				"teamnum" "2"
				"Crits" "0"
				"Damage" "120"
				"ModelScale" "1"
				"SpeedMax" "1000"
				"SpeedMin" "1000"
				"SplashRadius" "144"
				"SpreadAngle" "0"
				"WeaponType" "0"

				"OnUser1" "!self,FireOnce,,0,-1"
			}

			tf_point_weapon_mimic
			{
				"targetname" "firer"

				"$preventshootparent" "1"

				"spawnflags" "1"
				"angles" "0 0 0"
				"origin" "0 -10 -3"
				"teamnum" "2"
				"Crits" "0"
				"Damage" "75"
				"ModelScale" "1"
				"SpeedMax" "1000"
				"SpeedMin" "1000"
				"SplashRadius" "144"
				"SpreadAngle" "0"
				"WeaponType" "0"

				"OnUser1" "!self,FireOnce,,0,-1"
			}
		}


        RocketMastery
        {
            OnSpawnOutput 
            {
                Target "firer"
                Action "FireUser1"
                Delay 0
            }

            OnSpawnOutput 
            {
                Target "firer"
                Action "SetParent"
                Param ""
                Delay 0
            }

            OnSpawnOutput 
            {
                Target "!activator"
                Action "Kill"
                Delay 0.1
            }

            tf_point_weapon_mimic
            {
                "targetname" "firer"

                "spawnflags" "1"
                "angles" "0 -10 0"
                "origin" "-1 0 -3"
                "teamnum" "2"
                "Crits" "0"
                "Damage" "75"
                "ModelScale" "1"
                "SpeedMax" "700"
                "SpeedMin" "700"
                "SplashRadius" "144"
                "SpreadAngle" "0"
                "WeaponType" "0"

                "OnUser1" "!self,FireOnce,,0,-1"
            }

            tf_point_weapon_mimic
            {
                "targetname" "firer"

                "spawnflags" "1"
                "angles" "0 10 0"
                "origin" "-1 0 -3"
                "teamnum" "2"
                "Crits" "0"
                "Damage" "75"
                "ModelScale" "1"
                "SpeedMax" "500"
                "SpeedMin" "500"
                "SplashRadius" "144"
                "SpreadAngle" "0"
                "WeaponType" "0"

                "OnUser1" "!self,FireOnce,,0,-1"
            }
        }
        
        RocketSpike
        {
            OnSpawnOutput 
            {
                Target "firer"
                Action "FireUser1"
                Delay 0
            }

            tf_point_weapon_mimic
            {
                "targetname" "firer"

                "spawnflags" "1"
                "angles" "90 0 0"
                "origin" "-1 0 -3"
                "teamnum" "2"
                "Crits" "0"
                "Damage" "75"
                "ModelScale" "1"
                "SpeedMax" "700"
                "SpeedMin" "700"
                "SplashRadius" "144"
                "SpreadAngle" "0"
                "WeaponType" "0"

                "OnUser1" "!self,FireOnce,,0,-1"
                "OnUser1" "!self,FireUser1,,0.2,-1"
            }
        }

        RocketMasteryConstant 
        {
            OnSpawnOutput 
            {
                Target "firer"
                Action "FireUser1"
                Delay 0
            }

            tf_point_weapon_mimic
            {
                "targetname" "firer"

                "spawnflags" "1"
                "angles" "0 -10 0"
                "origin" "-1 0 -3"
                "teamnum" "2"
                "Crits" "0"
                "Damage" "75"
                "ModelScale" "1"
                "SpeedMax" "600"
                "SpeedMin" "600"
                "SplashRadius" "144"
                "SpreadAngle" "0"
                "WeaponType" "0"

                "OnUser1" "!self,FireOnce,,0,-1"
                "OnUser1" "!self,FireUser1,,0.4,-1"
            }

            tf_point_weapon_mimic
            {
                "targetname" "firer"

                "spawnflags" "1"
                "angles" "0 10 0"
                "origin" "-1 0 -3"
                "teamnum" "2"
                "Crits" "0"
                "Damage" "75"
                "ModelScale" "1"
                "SpeedMax" "500"
                "SpeedMin" "500"
                "SplashRadius" "144"
                "SpreadAngle" "0"
                "WeaponType" "0"

                "OnUser1" "!self,FireOnce,,0,-1"
                "OnUser1" "!self,FireUser1,,0.4,-1"
            }
        }

		Helicopter_Base_Init
		{
			NoFixup 1

			OnSpawnOutput
			{
				Target "!activator"
				Action "AddOutput"
				Param "targetname helicopter_bot"
				Delay 0
			}

			OnParentKilledOutput
			{
				Target "!activator"
				Action "AddOutput"
				Param "targetname "
				Delay 0
			}

			info_target
			{
				"targetname" "helicopterhitbox_position"
				"origin" "-100 0 450"
			} 


			info_target
			{
				"targetname" "helicoptershooter_position"
				"origin" "0 0 420"
			} 
		}

		Helicopter_Patterns
		{
			NoFixup 1
            
            OnSpawnOutput
			{
				Target "pattern_switch"
				Action "Trigger"
				Delay 0
			}

            logic_relay 
			{
				"targetname" "pattern_switch"
				"spawnflags" "2"

                //pattern 2 after 4 seconds
                "OnTrigger" "player,$DisplayTextChat,pattern 2,4,-1"
				"OnTrigger" "helicopter_bot_shoot,$ChangeAttributes,Pattern2,4,-1"

                //pattern 8 after 9 seconds
                "OnTrigger" "player,$DisplayTextChat,pattern 3,9,-1"
				"OnTrigger" "helicopter_bot_shoot,$ChangeAttributes,Pattern3,9,-1"

                //pattern 4 after 13 seconds
                "OnTrigger" "player,$DisplayTextChat,pattern 4,13,-1"
				"OnTrigger" "helicopter_bot_shoot,$ChangeAttributes,Pattern4,13,-1"

                //default pattern after 15 seconds, loop
                "OnTrigger" "player,$DisplayTextChat,reset,15,-1"
                "OnTrigger" "helicopter_bot_shoot,$ChangeAttributes,Default,15,-1"
                "OnTrigger" "pattern_switch,Trigger,,15.1,-1"
			}
		}

		Helicopter_Shooter_Init
		{
			OnSpawnOutput
			{
				Target "!activator"
				Action "AddOutput"
				Param "targetname helicopter_bot_shoot"
				Delay 0
			}

			OnSpawnOutput
			{
				Target "helicopter_relay"
				Action "FireUser1"
				Delay 0
			}

			OnSpawnOutput 
			{
				Target "stickies"
				Action "FireUser1"
				Delay 5
			}


			OnSpawnOutput 
			{
				Target "stickies"
				Action "SetOwner"
				Param "!activator"
				Delay 0
			}

			logic_relay 
			{
				"targetname" "helicopter_relay"
				"OnUser1" "!activator,$TeleportToEntity,helicoptershooter_position,0,-1"
				"OnUser1" "!self,FireUser1,,0.01,-1"
			}

			tf_point_weapon_mimic
			{
				"targetname" "stickies"

				"$preventshootparent" "1"

				"spawnflags" "1"
				"angles" "0 0 0"
				"origin" "0 0 0"
				"teamnum" "2"
				"Crits" "0"
				"Damage" "100"
				"ModelScale" "1"
				"ModelOverride" "models/weapons/w_models/w_stickybomb.mdl"
				"SpeedMax" "1000"
				"SpeedMin" "100"
				"SplashRadius" "144"
				"SpreadAngle" "30"
				"WeaponType" "3"

				"OnUser1" "!self,FireMultiple,15,0,-1"
				"OnUser1" "!self,DetonateStickies,,3,-1"
				"OnUser1" "!self,FireUser1,,4,-1"
			}


			//model
			prop_dynamic
			{
				"targetname" "helicopter_model"
				"model" "models/combine_helicopter.mdl"
				"origin" "-100 -10 100"
				"angles" "0 0 0"
				"DefaultAnim" "idle"
				"solid" "0"
			}

			//glow, doesn't work
			tf_glow
			{
			"GlowColor" "88 133 162"
			"Mode" "0"
			"target" "helicopter_model"
			}
		}

		Helicopter_Tank_Init
		{
			OnSpawnOutput
			{
				Target "helicopter_relay"
				Action "FireUser1"
				Delay 0
			}

			// OnSpawnOutput
			// {
			// 	Target "helicopter_pattern2_detect"
			// 	Action "Trigger"
			// 	Delay 0
			// }

			OnParentKilledOutput
			{
				Target "helicopter_bot*"
				Action "SetHealth"
				Param "0"
				Delay 0
			}

			OnParentKilledOutput
			{
				Target "helicopter_bot*"
				Action "AddOutput"
				Param "targetname "
				Delay 0.1
			}

			logic_relay 
			{
				"targetname" "helicopter_relay"
				"OnUser1" "!activator,$TeleportToEntity,helicopterhitbox_position,0,-1"
				"OnUser1" "!self,FireUser1,,0.01,-1"
			}

			// logic_relay 
			// {
			// 	"targetname" "helicopter_pattern2_detect"
			// 	"spawnflags" "2"

			// 	"OnTrigger" "!activator,AddOutput,OnHealthBelow90Percent helicopter_pattern2_relay:Trigger:0:-1,0,-1"
			// }
		}
	}

	ExtraSpawnPoint 
	{
		Name "helicopter"   
		TeamNum 3
		X "-3098.7"  
		Y "-1490.0"
		Z "276.6"
	}

	Wave 
	{
		StartWaveOutput
		{
			Target wave_start_relay
			Action Trigger
		}
		DoneOutput
		{
			Target wave_finished_relay
			Action Trigger
		}

		WaveSpawn 
		{
			Where helicopter
			TotalCount 1
			MaxActive 1
			SpawnCount 1
			WaitBetweenSpawns 0
			WaitBeforeStarting 0
			TotalCurrency 0

			Tank
			{
				SpawnTemplate "Helicopter_Tank_Init"

				Health 1000
				Speed 0 
				Scale 1
				DisableSmokestack 1  
				MaxTurnRate 0
				Model "models/empty.mdl" 
				StartSound "misc/null.wav"
				PingSound "misc/null.wav"
				EngineLoopSound "misc/null.wav"
				Gravity 0  
				TeamNum 2
				DisableTracks 1  
				DisableChildModels 1  
				Name "tankboss"
				//StartingPathTrackNode "Helicopter_1"

				OnKilledOutput
				{
					Target boss_dead_relay
					Action Trigger
				}

				OnBombDroppedOutput
				{
					Target boss_deploy_relay
					Action Trigger
				}
			}
		}

		WaveSpawn
		{                                
			Where helicopter
			TotalCount 1
			MaxActive 1
			SpawnCount 1
			WaitBetweenSpawns 0
			WaitBeforeStarting 0
			TotalCurrency 0

			Support Limited

			RandomChoice
			{
				RandomChoice
				{
					TFBot 
					{
						SpawnTemplate "Helicopter_Base_Init"
						Template T_TFBot_Helicopter_Base 
						AddCond { Name "TF_COND_REPROGRAMMED" }
						
						InterruptAction
						{
							Target "-4080.4 -666.5 424.4"
							Delay 0.1
							Repeats 1
						}
						
					}
				}
			}
		}

		WaveSpawn
		{                                
			Where helicopter
			TotalCount 1
			MaxActive 1
			SpawnCount 1
			WaitBetweenSpawns 0
			WaitBeforeStarting 0
			TotalCurrency 0

			Support Limited

			RandomChoice
			{
				RandomChoice
				{
					TFBot 
					{
						SpawnTemplate "Helicopter_Shooter_Init" 
						Template T_TFBot_Helicopter_Shoot
						AddCond { Name "TF_COND_REPROGRAMMED" }
					}
				}
			}
		}
	}
}