; This shit breaks knives
filter:
{
	"classname" "game_weapon_manager"
	"targetname" "Global_Weapon_Clear"
}

; I REALLY don't know why sometimes people start the round without knives, so here's a bandaid fix
add:
{
	"model" "*430"
	"targetname" "Global_Knife_Equip"
	"classname" "game_zone_player"
	"hammerid" "16007489"
	"OnPlayerOutZone" "Knife,Use,,0,-1"
}
modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	insert:
	{
		"OnMapSpawn" "Global_Knife_Equip,CountPlayersInZone,,0.1,-1"
	}
}


; Don't use mp_restartgame because it can be nasty
modify:
{
	match:
	{
		"targetname" "Warmup_Mode"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnUser2" "Server,Command,mp_restartgame 1,60,1"
	}
	insert:
	{
		"OnUser2" "Global_Nuke_Control,Trigger,,60,1"
	}
}


; Kill all weapons whenever the map nukes in an attempt to mitigate crashes
modify:
{
	match:
	{
		"classname" "logic_relay"
		"targetname" "Global_Nuke_Control"
	}
	insert:
	{
		"OnTrigger" "weapon*,Kill,,6,1"
		"OnUser4" "weapon*,Kill,,6,1"
	}
}

; Disable bhop for obvious reasons
modify:
{
	match:
	{
		"classname" "point_servercommand"
		"targetname" "Server"
		"origin" "11432 -2248 13384"
		"hammerid" "4905575"
	}
	insert:
	{
		"OnUser1" "!self,Command,sv_enablebunnyhopping 0,0,1"
	}
}

; Fix the buyzone on stages 2 and 4
modify:
{
	match:
	{
		"classname" "func_buyzone"
		"model" "*200"
		"hammerid" "18853461"
	}
	replace:
	{
		"TeamNum" "3"
	}
}

; Buff King Bomb HP by about 50%
modify:
{
	match:
	{
		"targetname" "KingBomb_Hp_Add_Trigger"
		"classname" "trigger_multiple"
	}
	delete:
	{
		"OnStartTouch" "KingBomb_Hp_Reset,Add,25,0,-1"
	}
	insert:
	{
		"OnStartTouch" "KingBomb_Hp_Reset,Add,40,0,-1"
	}
}

; Target TP_AFK* instead of TP_AFK_* because CS:S's retarded name matching code matches J with *
modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Manager_TP_AFK_Salikawood"
		"origin" "11400 -2312 13384"
		"hammerid" "11180945"
	}
	replace:
	{
		"OnCase01" "TP_AFK*,AddOutput,target TD_AFK_Salikawood_Spawn,0,1"
		"OnCase02" "TP_AFK*,AddOutput,target TD_AFK_Salikawood_1,0,1"
		"OnCase03" "TP_AFK*,AddOutput,target TD_AFK_Salikawood_2,0,1"
		"OnCase04" "TP_AFK*,AddOutput,target TD_AFK_Salikawood_3,0,1"
		"OnCase05" "TP_AFK*,AddOutput,target TD_AFK_Salikawood_4,0,1"
		"OnCase06" "TP_AFK*,AddOutput,target TD_AFK_Salikawood_5,0,1"
		"OnCase07" "TP_AFK*,AddOutput,target TD_AFK_Salikawood_6,0,1"
	}
}
modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Manager_TP_AFK_Nabudis"
		"origin" "11416 -2312 13384"
		"hammerid" "11426088"
	}
	replace:
	{
		"OnCase01" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_Spawn,0,-1"
		"OnCase02" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_1Floor_1,0,-1"
		"OnCase03" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_1Floor_2,0,-1"
		"OnCase04" "TP_AFK*,AddOutput,target TD_AFK_Jail_Spawn,0,-1"
		"OnCase05" "TP_AFK*,AddOutput,target TD_AFK_Jail_1,0,-1"
		"OnCase06" "TP_AFK*,AddOutput,target TD_AFK_Jail_2,0,-1"
		"OnCase07" "TP_AFK*,AddOutput,target TD_AFK_Jail_3,0,-1"
		"OnCase08" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_2Floor_1,0,-1"
		"OnCase09" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_2Floor_2,0,-1"
		"OnCase15" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_Zalera1,0,-1"
		"OnCase16" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_Chaos,0,-1"
		"OnCase13" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_End,0,-1"
		"OnCase14" "TP_AFK*,AddOutput,target TD_AFK_Trial,0,-1"
		"OnCase10" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_2Floor_Device,0,-1"
		"OnCase12" "TP_AFK*,AddOutput,target TD_AFK_Nabudis_1Floor_End,0,-1"
	}
}


; Don't instantly kill the king bomb so it can do its explosion thingy when it dies
modify:
{
	match:
	{
		"classname" "func_physbox"
		"targetname" "KingBomb_Move_Physbox"
		"origin" "-7104 -5120 -336"
		"model" "*372"
		"hammerid" "13482041"
	}
	delete:
	{
		"OnUser4" "KingBomb_Model,Kill,,0,1"
		"OnUser4" "KingBomb_Maker_Esper,ClearParent,,0,-1"
	}
	insert:
	{
		"OnUser4" "KingBomb_Model,ClearParent,,0,1"
		"OnUser4" "KingBomb_Maker_Esper,ClearParent,,0,1"
	}
}


; Buff vortex a bit
modify:
{
	match:
	{
		"classname" "trigger_push"
		"targetname" "Magick_Vortex_Push"
		"speed" "125"
	}
	replace:
	{
		"speed" "200"
	}
}


; Make blizzard actually freeze zms
modify:
{
	match:
	{
		"classname" "trigger_hurt"
		"targetname" "Magick_Blizzard_Hurt"
	}
	delete:
	{
		"OnStartTouch" "!activator,AddOutput,movetype 0,0,-1"
		"OnStartTouch" "!activator,AddOutput,movetype 2,7,-1"
		"OnEndTouch" "!activator,AddOutput,movetype 2,0,-1"
	}
	insert:
	{
		"OnStartTouch" "Speed,ModifySpeed,0,0,-1"
		"OnStartTouch" "Speed,ModifySpeed,1,7,-1"
		"OnEndTouch" "Speed,ModifySpeed,1,0,-1"
	}
} 

; Hide the weapon of the ghost zm
modify:
{
	match:
	{
		"classname" "game_ui"
		"targetname" "Item_Ghost_Ui"
	}
	replace:
	{
		"spawnflags" "64"
	}
}

; Add proper split teleport for the zombie cages on zalera and chaos bosses
add:
{
	"model" "*39"
	"wait" "1"
	"targetname" "Zalera_Trigger_ZM"
	"StartDisabled" "0"
	"spawnflags" "1"
	"origin" "-10032 13232 -1112"
	"classname" "trigger_multiple"
	"OnStartTouch" "TD_AFK_Nabudis_Zalera,PickRandomShuffle,,0,-1"
}
modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "TD_AFK_Nabudis_Zalera"
		"origin" "-10048 13212 -1464"
		"hammerid" "19689067"
	}
	replace:
	{
		"origin" "-10032 13228 -1112"
	}
}
add:
{
	"origin" "-9696 12896 2944"
	"targetname" "TD_AFK_Nabudis_Chaos"
	"classname" "logic_case"
	"OnCase01" "TD_AFK_Nabudis_Chaos1,Teleport,,0,-1"
	"OnCase02" "TD_AFK_Nabudis_Chaos2,Teleport,,0,-1"
	"OnCase03" "TD_AFK_Nabudis_Chaos3,Teleport,,0,-1"
	"OnCase04" "TD_AFK_Nabudis_Chaos4,Teleport,,0,-1"
}
add:
{
	"model" "*39"
	"wait" "1"
	"targetname" "Chaos_Trigger_ZM"
	"StartDisabled" "0"
	"spawnflags" "1"
	"origin" "-9696 12896 2944"
	"classname" "trigger_multiple"
	"OnStartTouch" "TD_AFK_Nabudis_Chaos,PickRandomShuffle,,0,-1"
}
modify:
{
	match:
	{
		"classname" "info_teleport_destination"
		"targetname" "TD_AFK_Nabudis_Chaos"
		"origin" "-9696 12896 2704"
		"hammerid" "14102247"
	}
	replace:
	{
		"targetname" "TD_AFK_Nabudis_Chaos1"
		"classname" "point_teleport"
	}
	insert:
	{
		"target" "!activator"
		"spawnflags" "0"
	}
}
modify:
{
	match:
	{
		"classname" "info_teleport_destination"
		"targetname" "TD_AFK_Nabudis_Chaos"
		"origin" "-9696 15520 2704"
		"hammerid" "14102962"
	}
	replace:
	{
		"targetname" "TD_AFK_Nabudis_Chaos2"
		"angles" "0 235 0"
		"classname" "point_teleport"
	}
	insert:
	{
		"target" "!activator"
		"spawnflags" "0"
	}
}
modify:
{
	match:
	{
		"classname" "info_teleport_destination"
		"targetname" "TD_AFK_Nabudis_Chaos"
		"origin" "-12320 15520 2704"
		"hammerid" "14102964"
	}
	replace:
	{
		"targetname" "TD_AFK_Nabudis_Chaos3"
		"angles" "0 305 0"
		"classname" "point_teleport"
	}
	insert:
	{
		"target" "!activator"
		"spawnflags" "0"
	}
}
modify:
{
	match:
	{
		"classname" "info_teleport_destination"
		"targetname" "TD_AFK_Nabudis_Chaos"
		"origin" "-12320 12896 2704"
		"hammerid" "14102952"
	}
	replace:
	{
		"targetname" "TD_AFK_Nabudis_Chaos4"
		"classname" "point_teleport"
	}
	insert:
	{
		"target" "!activator"
		"spawnflags" "0"
	}
}


; Don't give players a chance to make it behind gabranth before he starts running (though with bhop disabled this is pretty much impossible)
modify:
{
	match:
	{
		"classname" "trigger_hurt"
		"targetname" "Gabranth_Hurt"
		"origin" "2800 11392 128"
		"model" "*182"
		"hammerid" "15149456"
	}
	replace:
	{
		"StartDisabled" "0"
	}
}


; Obliterate those who block the puzzle doors
modify:
{
	match:
	{
		"classname" "func_door"
	}
	replace:
	{
		"forceclosed" "1"
	}
}
modify:
{
	match:
	{
		"classname" "func_rotating"
		"targetname" "Nabudis_Entrance_Puzzle_Rotate"
		"origin" "-8704 9664 256"
		"model" "*489"
		"hammerid" "11256390"
	}
	replace:
	{
		"dmg" "99999"
	}
}
modify:
{
	match:
	{
		"classname" "func_door"
		"targetname" "Nabudis_Entrance_Puzzle_Move_3"
		"origin" "-8704 9704 448"
		"model" "*490"
		"hammerid" "11256396"
	}
	replace:
	{
		"dmg" "99999"
	}
}
modify:
{
	match:
	{
		"classname" "func_door"
		"targetname" "Nabudis_Entrance_Puzzle_Move_4"
		"origin" "-8896 9704 256"
		"model" "*491"
		"hammerid" "11256406"
	}
	replace:
	{
		"dmg" "99999"
	}
}
modify:
{
	match:
	{
		"classname" "func_door"
		"targetname" "Nabudis_Entrance_Puzzle_Move_2"
		"origin" "-8512 9704 256"
		"model" "*492"
		"hammerid" "11256416"
	}
	replace:
	{
		"dmg" "99999"
	}
}
modify:
{
	match:
	{
		"classname" "func_door"
		"targetname" "Nabudis_Entrance_Puzzle_Move_1"
		"origin" "-8704 9704 64"
		"model" "*493"
		"hammerid" "11256426"
	}
	replace:
	{
		"dmg" "99999"
	}
}
modify:
{
	match:
	{
		"classname" "func_door"
		"targetname" "Nabudis_Entrance_Puzzle_Move_Main"
		"origin" "-8704 9672 256"
		"model" "*494"
		"hammerid" "11256442"
	}
	replace:
	{
		"spawnflags" "12"
	}
}

; Nerf the chaos attack timer
modify:
{
	match:
	{
		"classname" "logic_timer"
		"targetname" "Chaos_Timer_Attack"
	}
	replace:
	{
		"refiretime" "14"
	}
}
modify:
{
	match:
	{
		"classname" "logic_relay"
		"targetname" "Chaos_Status_Ancient"
	}
	delete:
	{
		"OnTrigger" "Chaos_Timer_Attack,RefireTime,7,0,1"
	}
	insert:
	{
		"OnUser4" "Chaos_Timer_Attack,RefireTime,10,0,1"
	}
}
modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "Mote_Ultra_Cleanse_Button"
	}
	delete:
	{
		"OnUser4" "Chaos_Timer_Attack,RefireTime,9,0,1"
	}
	insert:
	{
		"OnUser4" "Chaos_Timer_Attack,RefireTime,15,0,1"
	}
}

; 1 less edict, because why not
modify:
{
	match:
	{
		"classname" "info_target"
		"targetname" "Client_All"
		"origin" "11432 -2280 13384"
		"hammerid" "19659244"
	}
	replace:
	{
		"classname" "logic_relay"
	}
}


; Move the initial credits message just a little bit up
modify:
{
	match:
	{
		"classname" "game_text"
		"targetname" "Global_Hudhint_All"
	}
	replace:
	{
		"y" "0.45"
	}
}


; Add a hud message when a human is inflicted with doom
modify:
{
	match:
	{
		"classname" "game_text"
		"targetname" "Global_Hudhint_Single"
	}
	insert:
	{
		"OnUser3" "!self,AddOutput,message You have been doomed! You will die in 10 seconds unless cure or cleanse is used!,0,-1"
		"OnUser3" "!self,AddOutput,color 192 64 64,0,-1"
		"OnUser3" "!self,AddOutput,x -1,0,-1"
		"OnUser3" "!self,AddOutput,y 0.5,0,-1"
		"OnUser3" "!self,Display,,0.02,-1"
	}
}
modify:
{
	match:
	{
		"classname" "trigger_multiple"
		"targetname" "Zmagick_Doom_Trigger"
	}
	insert:
	{
		"OnStartTouch" "Global_Hudhint_Single,FireUser3,,0,-1"
	}
}