;
;
;        Change for ZM Invis item so it's not too op, gives opacity now, change the middle renderamt value (0-255) if still not good enough
;
;
modify:
{
	match:
	{
		"classname" "trigger_multiple"
		"targetname" "zinv_aoe"
	}
	delete:
	{
		"OnStartTouch" "!activator,AddOutput,rendermode 6,0,-1"
	}
	insert:
	{
		"OnStartTouch" "!activator,AddOutput,rendermode 2,0,-1"
		"OnStartTouch" "!activator,AddOutput,renderamt 80,0,-1"
		"OnStartTouch" "!activator,AddOutput,renderamt 255,9.55,-1"
	}
}
;
;
;        Fix megaman being able to die on spawn
;
;
add:
{
	"targetname" "GiveRockmanImmunity"
	"StartDisabled" "0"
	"spawnflags" "1"
	"origin" "1792 5120 -10112"
	"wait" "1"
	"classname" "trigger_multiple"
	"OnUser1" "!self,AddOutput,solid 2,0,1"
	"OnUser1" "!self,AddOutput,mins -64 -64 -64,0.1,1"
	"OnUser1" "!self,AddOutput,maxs 64 64 64,0.1,1"
	"OnStartTouch" "Megaman_HitBox,SetDamageFilter,Immunity,0,1"
}
add:
{
	"targetname" "RemoveRockmanImmunity"
	"StartDisabled" "0"
	"spawnflags" "1"
	"origin" "-13696 1408 2370"
	"wait" "1"
	"classname" "trigger_multiple"
	"OnUser1" "!self,AddOutput,solid 2,0,1"
	"OnUser1" "!self,AddOutput,mins -64 -64 -64,0.1,1"
	"OnUser1" "!self,AddOutput,maxs 64 64 64,0.1,1"
	"OnStartTouch" "Megaman_HitBox,SetDamageFilter,Zombies,0,1"
}
modify:
{
	match:
	{
		"hammerid" "286006"
		"classname" "logic_auto"
	}
	insert:
	{
		"OnMapSpawn" "GiveRockmanImmunity,FireUser1,,0,-1"
		"OnMapSpawn" "RemoveRockmanImmunity,FireUser1,,0,-1"
	}
}

;------------------------
;Stripper Cfg By Saddong
;------------------------
;---------------------------------------
;Immunity Fix
;---------------------------------------
modify:
{
	match:
	{
		"targetname" "Spawn_Humans_Teleport"
	}
	delete:
	{
		"OnStartTouch" "!activator,SetDamageFilter,NoFallDamage,0.3,1"
		"OnEndTouch" "!activator,SetDamageFilter,NoFallDamage,0.3,1"
	}
	insert:
	{
		"OnStartTouch" "!activator,SetDamageFilter,NoFallDamage,0.3,-1"
		"OnEndTouch" "!activator,SetDamageFilter,NoFallDamage,0.3,-1"
	}
}
modify:
{
	match:
	{
		"targetname" "Spawn_Zombies_Teleport_2"
	}
	delete:
	{
		"OnStartTouch" "!activator,SetDamageFilter,NoFallDamage,0.3,1"
	}
	insert:
	{
		"OnStartTouch" "!activator,SetDamageFilter,NoFallDamage,0.3,-1"
	}
}

;---------------------------------------
;Megaman Speed nerf
;---------------------------------------
modify:
{
	match:
	{
		"targetname" "Megaman_Stripper"
	}
	delete:
	{
		"OnStartTouch" "Map_SpeedMod,ModifySpeed,1.1,0,1"
	}
	insert:
	{
		"OnStartTouch" "Map_SpeedMod,ModifySpeed,1.05,0,1"
	}
}

;---------------------------------------
;Breakable Traps
;---------------------------------------
add:
{
	"model" "*140"
	"classname" "func_physbox_multiplayer"
	"targetname" "Missle_HitBox"
	"spawnobject" "0"
	"spawnflags" "16384"
	"rendermode" "10"
	"renderfx" "0"
	"rendercolor" "255 255 255"
	"renderamt" "255"
	"propdata" "0"
	"pressuredelay" "0"
	"preferredcarryangles" "0 0 0"
	"PerformanceMode" "0"
	"notsolid" "0"
	"nodamageforces" "0"
	"material" "1"
	"massScale" "0"
	"health" "300"
	"gibdir" "0 0 0"
	"disableshadows" "0"
	"disablereceiveshadows" "0"
	"Damagetype" "0"
	"damagetoenablemotion" "0"
	"origin" "2785 4446.5 -13658.5"
}
add:
{
	"model" "*26"
	"origin" "2712 5400 -13468.1"
	"classname" "func_physbox_multiplayer"
	"targetname" "KnightCage_HitBox"
	"spawnobject" "0"
	"spawnflags" "16384"
	"rendermode" "10"
	"renderfx" "0"
	"rendercolor" "255 255 255"
	"renderamt" "255"
	"propdata" "0"
	"pressuredelay" "0"
	"preferredcarryangles" "0 0 0"
	"PerformanceMode" "0"
	"notsolid" "0"
	"nodamageforces" "0"
	"material" "2"
	"massScale" "0"
	"health" "300"
	"gibdir" "0 0 0"
	"forcetoenablemotion" "0"
	"explosion" "0"
	"ExplodeRadius" "0"
	"explodemagnitude" "0"
	"ExplodeDamage" "0"
	"disableshadows" "0"
	"disablereceiveshadows" "0"
	"Damagetype" "0"
	"damagetoenablemotion" "0"
	"origin" "2712 5400 -13456"
}
modify:
{
	match:
	{
		"targetname" "Missle_Template"
	}
	insert:
	{
		"Template09" "Missle_HitBox"
	}
}
modify:
{
	match:
	{
		"targetname" "Missle_HitBox"
	}
	insert:
	{
		"OnBreak" "Missle_Door,Kill,,0,1"
		"OnBreak" "Missle_Hurt,Kill,,0,1"
		"OnBreak" "Missle_Particle,Kill,,0,1"
		"OnBreak" "Missle_Sprite,Kill,,0,1"
		"OnBreak" "Missle_Trap,Break,,0,1"
		"OnBreak" "Missle_Explode_Effect,Kill,,0,1"
		"OnBreak" "Missle_Lazy_Hurt_fix,Kill,,0,1"
		"OnBreak" "Missle_Sound,Kill,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "KnightCage_Template"
	}
	insert:
	{
		"Template06" "KnightCage_HitBox"
	}
}
modify:
{
	match:
	{
		"targetname" "KnightCage_HitBox"
	}
	insert:
	{
		"OnBreak" "KnightCage_Door,Kill,,0,1"
		"OnBreak" "KnightCage_Model,Kill,,0,1"
		"OnBreak" "KnightCage_Particle,Kill,,0,1"
		"OnBreak" "KnightCage_Sound,Kill,,0,1"
		"OnBreak" "KnightCage_Trigger,Kill,,0,1"
	}
}

;---------------------------------------
;Broken Tp Fix
;---------------------------------------
modify:
{
	match:
	{
		"targetname" "Event_Stage_Case"
	}
	insert:
	{
		"OnUser2" "Spawn_Zombies_Teleport,AddOutput,target Tele_Des_01,20,1"
	}
}

;---------------------------------------
;Misc
;---------------------------------------
modify:
{
	match:
	{
		"targetname" "LifeSystem_Counter"
	}
	delete:
	{
		"OnHitMax" "Map_Command,Command,say >>>1 Lifes Remaining<<<,5.3,-1"
	}
}

;Extend roundtime
modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	delete:
	{
		"OnMultiNewMap" "Map_Command,Command,mp_roundtime 15,0,1"
	}
	insert:
	{
		"OnMultiNewMap" "Map_Command,Command,mp_roundtime 25,0,1"
	}
}

;; _

;; fix castle elevator

modify:
{
	match:
	{
		"targetname" "Knight_Tele_Libary"
		"classname" "trigger_teleport"
	}
	delete:
	{
		"OnStartTouch" "Knight_Elavater_2,Kill,,0,1"
		"OnStartTouch" "Knight_Elavater_3,Open,,0.1,1"
	}
	insert:
	{
		"OnStartTouch" "Knight_Elavater_2,Kill,,1,1"
		"OnStartTouch" "Knight_Elavater_3,Open,,1.5,1"
	}
}

;--------------------------------------------
; Fixes targetname issue for multiple rounds
;--------------------------------------------
modify:
{
	match:
	{
		"classname" "logic_auto"
		"origin" "856 8176 -10168"
	}
	delete:
	{
		"OnMapSpawn" "Player,AddOutput,targetname Player_None,2,1"
		"OnMapSpawn" "User_*,AddOutput,classname player,1,1"
	}
	insert:
	{
		"OnMapSpawn" "player,AddOutput,targetname Player_None,5,1"
	}
}

;--------------------------------------------
; Delay megaman strip
;--------------------------------------------
modify:
{
	match:
	{
		"classname" "logic_auto"
		"origin" "856 8176 -10168"
	}
	delete:
	{
		"OnMapSpawn" "Megaman_Stripper,Enable,,15,-1"
	}
	insert:
	{
		"OnMapSpawn" "Megaman_Stripper,Enable,,23,-1"
	}
}

;-----------------------------
; Fix ct getting stuck in elevator
;-----------------------------
add:
{
	"model" "*195"
	"classname" "trigger_teleport"
	"targetname" "fix_elevator_stuck_tp"
	"parentname" "Knight_Elavater_3"
	"target" "fix_elevator_stuck_dest"
	"spawnflags" "1"
	"origin" "15616 13824 6156"
	"StartDisabled" "1"
}
add:
{
	"classname" "info_teleport_destination"
	"targetname" "fix_elevator_stuck_dest"
	"origin" "15632.5 13816 6755.61"
	"angles" "0 180 0"
}
modify:
{
	match:
	{
		"origin" "15616 13824 6160"
		"classname" "func_door"
		"targetname" "Knight_Elevater_3"
	}
	insert:
	{
		"OnFullyOpen" "fix_elevator_stuck_tp,Enable,,0.01,-1"
		"OnFullyOpen" "fix_elevator_stuck_tp,Disable,,3.01,-1"
	}
}
modify:
{
	match:
	{
		"origin" "14016 6624 6976"
		"classname" "trigger_teleport"
		"targetname" "Knight_Tele_Libary"
	}
	insert:
	{
		"OnStartTouch" "fix_elevator_stuck_tp,Enable,,0.01,-1"
		"OnStartTouch" "fix_elevator_stuck_tp,Disable,,6.01,-1"
	}
}

;---------------------
; Boss Balance Changes
;---------------------
modify:
{
	match:
	{
		"targetname" "MainBoss_Hurt"
		"origin" "1020 6142 -13241.7"
		"classname" "trigger_hurt"
	}
	replace:
	{
		"damage" "15"
	}
}
modify:
{
	match:
	{
		"targetname" "GlobalBoss_HpCase"
		"origin" "1096 6176 -13296"
		"classname" "logic_case"
	}
	delete:
	{
		"OnCase02" "MapBoss_HpScale,AddOutput,OnStartTouch BossCounter2:Add:10:0.04:-1,2.2,1"
		"OnCase02" "MapBoss_HpScale,AddOutput,OnStartTouch BossCounter1:Add:10:0.04:-1,2.15,1"
	}
	insert:
	{
		"OnCase02" "MapBoss_HpScale,AddOutput,OnStartTouch BossCounter2:Add:25:0.04:-1,2.2,1"
		"OnCase02" "MapBoss_HpScale,AddOutput,OnStartTouch BossCounter1:Add:25:0.04:-1,2.15,1"
	}
}

;-------------------------------------------------------------------------------------------------------------------------------------
; Boss Balance Changes --- Adds trigger push on floor connecting the arena, this will then be disabled when the blade attack is picked
;-------------------------------------------------------------------------------------------------------------------------------------
add:
{
	"model" "*151"
	"classname" "trigger_push"
	"targetname" "attack_push"
	"spawnflags" "1"
	"origin" "8928 13824 7936"
	"StartDisabled" "1"
	"speed" "400"
	"filtername" "Humans"
	"pushdir" "0 180 0"
}
modify:
{
	match:
	{
		"targetname" "Event_Stage_Case"
		"origin" "776 8144 -10168"
		"classname" "logic_case"
	}
	insert:
	{
		"OnCase02" "attack_push,Enable,,30.01,-1"
	}
}
modify:
{
	match:
	{
		"targetname" "MainBoss_KnightCase"
		"origin" "1096 6216 -13296"
		"classname" "logic_case"
	}
	insert:
	{
		"OnCase05" "attack_push,Disable,,0.01,-1"
		"OnCase05" "attack_push,Enable,,10.01,-1"
	}
}
modify:
{
	match:
	{
		"targetname" "BossEnds_Case"
		"origin" "1112 6160 -13296.6"
		"classname" "logic_case"
	}
	insert:
	{
		"OnCase02" "attack_push,Kill,,0.01,-1"
		"OnCase02" "tp_jailor_free,Enable,,0.01,-1"
	}
}

;---------------------
; MegaMan CHANGES
; Buster Shot now interacts with the environment! (Can shoot traps and boss)
;---------------------
add:
{
	"classname" "filter_activator_team"
	"targetname" "MapFilterCT_NO"
	"origin" "1660 4496 -10088"
	"filterteam" "3"
	"Negated" "1"
}
modify:
{
	match:
	{
		"targetname" "BusterShot_Hurt"
		"origin" "1624 4496 -10088"
		"classname" "trigger_hurt"
	}
	replace:
	{
		"spawnflags" "1097"
		"filtername" "mapfilterct_no"
	}
}
add:
{
	"classname" "logic_relay"
	"targetname" "buster_damage_boss_relay"
	"origin" "1644 4496 -10088"
	"spawnflags" "0"
	"StartDisabled" "1"
	"OnTrigger" "BossCounter1,Subtract,30,-1"
}
modify:
{
	match:
	{
		"targetname" "MainBoss_HitBox"
		"origin" "1024 6144 -13241.7"
		"classname" "func_physbox_multiplayer"
	}
	insert:
	{
		"OnUser4" "buster_damage_boss_relay,Trigger,,0.01,-1"
	}
}
modify:
{
	match:
	{
		"targetname" "BusterShot_Hurt"
		"origin" "1624 4496 -10088"
		"classname" "trigger_hurt"
	}
	insert:
	{
		"OnHurt" "!activator,FireUser4,,0.01,-1"
	}
}
modify:
{
	match:
	{
		"targetname" "Event_Stage_Case"
		"origin" "776 8144 -10168"
		"classname" "logic_case"
	}
	insert:
	{
		"OnCase02" "buster_damage_boss_relay,Enable,,31.01,-1"
	}
}

;---------------------
; Prevent people from picking up items on checkpoint
; (This is a shitty way of doing it but I couldn't get the item system to work without breaking shit so this will do for now LOL)
;---------------------
add:
{
	"model" "*151"
	"classname" "trigger_push"
	"targetname" "checkpoint_push"
	"spawnflags" "1"
	"origin" "9824 9536 3072"
	"StartDisabled" "0"
	"speed" "600"
	"filtername" "Humans"
	"pushdir" "0 270 0"
}
add:
{
	"model" "*151"
	"classname" "trigger_push"
	"targetname" "checkpoint_push"
	"spawnflags" "1"
	"origin" "8864 9536 3072"
	"StartDisabled" "0"
	"speed" "600"
	"filtername" "Humans"
	"pushdir" "0 270 0"
}
modify:
{
	match:
	{
		"classname" "logic_auto"
		"origin" "856 8176 -10168"
	}
	insert:
	{
		"OnMapSpawn" "checkpoint_push,Kill,,19,-1"
	}
}

;---------------------
; Brute force fix to tp humans out of jailor attack
;---------------------
add:
{
	"model" "*82"
	"classname" "trigger_teleport"
	"targetname" "tp_jailor_free"
	"target" "fix_jailor_dest"
	"spawnflags" "1"
	"origin" "10496 11520 7424"
	"StartDisabled" "1"
}
add:
{
	"classname" "info_teleport_destination"
	"targetname" "fix_jailor_dest"
	"origin" "7679.55 13823.6 8101"
	"angles" "0 0 0"
}
modify:
{
	match:
	{
		"targetname" "Prison_Lever"
		"classname" "func_button"
		"origin" "7680 15167.5 7872"
	}
	insert:
	{
		"OnPressed" "tp_jailor_free,Enable,,0.01,-1"
		"OnPressed" "tp_jailor_free,Disable,,3.01,-1"
	}
}

;---------------------
; Stop humans from getting items at spawn before infection
;---------------------
add:
{
	"model" "*151"
	"classname" "trigger_push"
	"targetname" "parta_stop_going_for_the_gravity_push"
	"spawnflags" "1"
	"origin" "416 9216 -10048"
	"StartDisabled" "0"
	"speed" "600"
	"filtername" "Humans"
	"pushdir" "0 270 0"
}
modify:
{
	match:
	{
		"classname" "logic_auto"
		"origin" "856 8176 -10168"
	}
	insert:
	{
		"OnMapSpawn" "parta_stop_going_for_the_gravity_push,Kill,,25,-1"
	}
}

;---------------------
; Stop multiple lightning and gravity spawns hopefully
;---------------------
modify:
{
	match:
	{
		"targetname" "Z_Items_Case"
		"classname" "logic_case"
		"origin" "728 8128 -10168"
	}
	delete:
	{
		"OnCase04" "Item_Maker,ForceSpawn,,0.15,1"
		"OnCase04" "Global_Item_origin,PickRandomShuffle,,0.1,1"
		"OnCase04" "Item_Maker,AddOutput,EntityTemplate Lighting_Template,0.05,1"
		"OnCase03" "Item_Maker,ForceSpawn,,0.15,1"
		"OnCase03" "Global_Item_origin,PickRandomShuffle,,0.1,1"
		"OnCase03" "Item_Maker,AddOutput,EntityTemplate Lighting_Template,0.05,1"
		"OnCase02" "Global_Item_origin,PickRandomShuffle,,1.1,1"
		"OnCase02" "Item_Maker,AddOutput,EntityTemplate Gravity_Template,0.5,1"
		"OnCase02" "Item_Maker,ForceSpawn,,1.15,1"
		"OnCase03" "Item_Maker,ForceSpawn,,0.45,1"
		"OnCase03" "Global_Item_origin,PickRandomShuffle,,0.25,1"
		"OnCase03" "Item_Maker,AddOutput,EntityTemplate Gravity_Template,0.2,1"
		"OnCase04" "Item_Maker,ForceSpawn,,0.3,1"
		"OnCase04" "Global_Item_origin,PickRandomShuffle,,0.25,1"
		"OnCase04" "Item_Maker,AddOutput,EntityTemplate Gravity_Template,0.2,1"
	}
}

;---------------------
; Spawn gravity at checkpoint
;---------------------
modify:
{
	match:
	{
		"classname" "logic_case"
		"origin" "944 7856 -10164"
		"targetname" "LifeSystem_Case"
	}
	insert:
	{
		"OnCase07" "Gravity_Template,AddOutput,origin 9668 9984 3009,0.52,-1"
		"OnCase07" "Gravity_Template,ForceSpawn,,20.48,-1"
	}
}

;---------------------
; Buff heal
;---------------------
modify:
{
	match:
	{
		"classname" "trigger_hurt"
		"origin" "-392 7808 -13580"
		"targetname" "SubTank_Heal"
	}
	insert:
	{
		"OnStartTouch" "!activator,AddOutput,max_health 130,0.02,-1"
	}
}

;----------------------------------------------
; Convert trigger_brush to logic_eventlistener
;----------------------------------------------
filter:
{
	"targetname" "game_playerdie"
	"classname" "trigger_brush"
}
add:
{
	"targetname" "game_playerdie"
	"IsEnabled" "1"
	"EventName" "player_death"
	"classname" "logic_eventlistener"
	"OnEventFired" "!activator,AddOutput,classname player,0,-1"
	"OnEventFired" "Map_clientcommand,Command,r_screenoverlay overlays/Clean_Overlay.vmt,0.06,-1"
	"OnEventFired" "!activator,AddOutput,targetname Player_None,0.02,-1"
	"OnEventFired" "!activator,SetDamageFilter,NoFallDamage,0.04,-1"
	"OnEventFired" "!activator,AddOutput,rendermode 0,0.08,-1"
}
filter:
{
	"targetname" "game_playerjoin"
	"classname" "trigger_brush"
}
add:
{
	"targetname" "game_playerjoin"
	"IsEnabled" "1"
	"EventName" "player_connect"
	"classname" "logic_eventlistener"
	"OnEventFired" "!activator,AddOutput,targetname Player_None,0,-1"
}

;--------------------------------
; Fix incorrect targetname usage
;--------------------------------
modify:
{
	match:
	{
		"targetname" "MainNpc_TargetTrigger"
		"classname" "trigger_multiple"
	}
	delete:
	{
		"OnTrigger" "!activator,AddOutput,targetname player,5,-1"
	}
	insert:
	{
		"OnTrigger" "!activator,AddOutput,targetname Player_None,5,-1"
	}
}