;------------------------------------------------
;Replace physics level system with perm entities
;------------------------------------------------
add:
{
	"classname" "info_target"
	"targetname" "Stage_CounterInit"
	"spawnflags" "0"
	"OnUser1" "Stage_CounterTemplate,ForceSpawn,,0,1"
	"OnUser1" "Stage_Counter,AddOutput,classname info_target,0.03,1"
	"OnUser1" "!self,Kill,,0.06,1"
}

add:
{
	"classname" "point_template"
	"targetname" "Stage_CounterTemplate"
	"Template01" "Stage_Counter"
	"spawnflags" "2"
}

add:
{
	"classname" "math_counter"
	"targetname" "Stage_Counter"
	"startvalue" "7"
	"StartDisabled" "0"
	"min" "1"
	"max" "7"
	"OnGetValue" "Stage_Case,InValue,,0,-1"
}

add:
{
	"classname" "logic_case"
	"targetname" "Stage_Case"
	"Case01" "1"
	"Case02" "2"
	"Case03" "3"
	"Case04" "4"
	"Case05" "5"
	"Case06" "6"
	"Case07" "7"
	"OnCase01" "Level_1_Start,Trigger,,0.02,-1"
	"OnCase02" "Level_2_Start,Trigger,,0.02,-1"
	"OnCase03" "Level_3_Start,Trigger,,0.02,-1"
	"OnCase04" "Level_4_Start,Trigger,,0.02,-1"
	"OnCase05" "Level_5_Start,Trigger,,0.02,-1"
	"OnCase06" "Map_Beaten_Start,Trigger,,0.02,-1"
	"OnCase07" "Warmup_Start,Trigger,,0.02,-1"
}

modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	insert:
	{
		"OnMapSpawn" "Stage_CounterInit,FireUser1,,0,1"
		"OnMapSpawn" "Stage_Counter,GetValue,,0.02,1"
	}
}

;------------------------------------
;Change stage triggers to new system
;------------------------------------
modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "Button_Level_1"
	}
	delete:
	{
		"OnPressed" "Brush_*,Enable,,0,-1"
		"OnPressed" "Brush_Level_1,Disable,,0.05,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,1,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "Button_Level_2"
	}
	delete:
	{
		"OnPressed" "Brush_Level_2,Disable,,0.05,-1"
		"OnPressed" "Brush_*,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,2,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "Button_Level_3"
	}
	delete:
	{
		"OnPressed" "Brush_Level_3,Disable,,0.05,-1"
		"OnPressed" "Brush_*,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "Button_Level_4"
	}
	delete:
	{
		"OnPressed" "Brush_Level_4,Disable,,0.05,-1"
		"OnPressed" "Brush_*,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,4,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "Button_Level_5"
	}
	delete:
	{
		"OnPressed" "Brush_Level_5,Disable,,0.05,-1"
		"OnPressed" "Brush_*,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,5,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "Button_Zombie_Round"
	}
	delete:
	{
		"OnPressed" "Brush_Map_Beaten,Disable,,0.05,-1"
		"OnPressed" "Brush_*,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,6,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_relay"
		"targetname" "Warmup_Start"
	}
	delete:
	{
		"OnTrigger" "Brush_Warmup,Enable,,30,-1"
		"OnTrigger" "Brush_Level_1,Disable,,30,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,1,30,-1"
	}
}

modify:
{
	match:
	{
		"classname" "math_counter"
		"targetname" "lvl1_Win_Counter"
	}
	delete:
	{
		"OnHitMin" "Brush_Level_2,Disable,,0,-1"
		"OnHitMin" "Brush_Level_1,Enable,,0,-1"
		"OnHitMin" "Brush_Warmup,Enable,,0,-1"
	}
	insert:
	{
		"OnHitMin" "Stage_Counter,SetValue,2,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "lvl1_Win_Trigger_CT"
	}
	delete:
	{
		"OnTrigger" "Brush_Warmup,Enable,,0,-1"
		"OnTrigger" "Brush_Level_1,Enable,,0,-1"
		"OnTrigger" "Brush_Level_2,Disable,,0,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,2,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "lvl2_Win_Trigger_CT"
	}
	delete:
	{
		"OnTrigger" "Brush_Warmup,Enable,,0,-1"
		"OnTrigger" "Brush_Level_1,Enable,,0,-1"
		"OnTrigger" "Brush_Level_2,Enable,,0,-1"
		"OnTrigger" "Brush_Level_3,Disable,,0,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "lvl3_Win_Trigger_CT"
	}
	delete:
	{
		"OnTrigger" "Brush_Warmup,Enable,,0,-1"
		"OnTrigger" "Brush_Level_1,Enable,,0,-1"
		"OnTrigger" "Brush_Level_2,Enable,,0,-1"
		"OnTrigger" "Brush_Level_3,Enable,,0,-1"
		"OnTrigger" "Brush_Level_4,Disable,,0,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,4,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "lvl4_Win_Trigger_CT"
	}
	delete:
	{
		"OnTrigger" "Brush_Warmup,Enable,,0,-1"
		"OnTrigger" "Brush_Level_1,Enable,,0,-1"
		"OnTrigger" "Brush_Level_2,Enable,,0,-1"
		"OnTrigger" "Brush_Level_3,Enable,,0,-1"
		"OnTrigger" "Brush_Level_4,Enable,,0,-1"
		"OnTrigger" "Brush_Level_5,Disable,,0,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,5,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_multiple"
		"targetname" "ZMround_Win_Trigger"
	}
	delete:
	{
		"OnTrigger" "Brush*,Enable,,0,1"
		"OnTrigger" "Brush_Level_1,Disable,,0.05,1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,1,0,1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_multiple"
		"targetname" "lvl5_Win_CTs"
	}
	delete:
	{
		"OnTrigger" "Brush*,Enable,,0,1"
		"OnTrigger" "Brush_Map_Beaten,Disable,,0.05,1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,6,0,1"
	}
}

;-------------------------
;Cleanup old level system
;-------------------------
filter:
{
	"classname" "func_brush"
	"targetname" "/Brush_(Warmup|Map_Beaten|Level_[1-5])/"
}

filter:
{
	"classname" "trigger_once"
	"targetname" "/Trigger_(Warmup|Map_Beaten|Level_[1-5])/"
}

filter:
{
	"classname" "func_physbox"
	"targetname" "Phys_Level_Changer"
}

filter:
{
	"classname" "logic_relay"
	"targetname" "Map_Error_Relay"
}

modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	delete:
	{
		"OnNewGame" "Phys_Level_Changer,EnableMotion,,0,-1"
	}
}

;--------------------------------------------------------------------
;STRIPPER CFG BY MOLTARD http://steamcommunity.com/id/0123456789ABC/
;--------------------------------------------------------------------
;FIX POINTS - END OF LEVELS
;---------------------------

modify:
{
	match:
	{
		"targetname" "/lvl[1-5]_Win_Bonus/" ; This match the trigger 1 to 5
		"classname" "trigger_multiple"
	}
	replace:
	{
		"classname" "trigger_once"
	}
}

;Fix teleport glitch stage 4 boss
add:
{
	"model" "*113"
	"classname" "trigger_teleport"
	"origin" "6784 397 4070.5"
	"spawnflags" "1"
	"StartDisabled" "1"
	"target" "lvl4_Cage"
	"targetname" "antiglitch_lvl4"
}

modify:
{
	match:
	{
		"classname" "logic_relay"
		"targetname" "Chuchulainn_Start_Relay"
	}
	insert:
	{
		"OnTrigger" "antiglitch_lvl4,Enable,,13,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_relay"
		"targetname" "Chuchulainn_Killed_Relay"
	}
	insert:
	{
		"OnTrigger" "antiglitch_lvl4,Disable,,0,-1"
	}
}

;------------------------
;DYNAMIC ENTWATCH CONFIG
;------------------------
modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Darkaga_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1841846 Dark.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1841846 Dark.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1841846 Dark.Lv3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Wind_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1841928 Wind.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1841928 Wind.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1841928 Wind.Lv3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Heal_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1841349 Heal.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1841349 Heal.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1841349 Heal.Lv3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Blizzard_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1841762 Ice.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1841762 Ice.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1841762 Ice.Lv3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_fire_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1841431 Fire.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1841431 Fire.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1841431 Fire.Lv3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Electro_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1841678 Electro.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1841678 Electro.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1841678 Electro.Lv3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Z_Heal_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1869948 ZM Heal.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1869948 ZM Heal.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1869948 ZM Heal.Lv3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Z_Fire_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1870326 ZM Fire.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1870326 ZM Fire.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1870326 ZM Fire.Lv3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Z_Darkaga_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1871410 ZM Dark.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1871410 ZM Dark.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1871410 ZM Dark.Lv3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Z_Warp_Level_Case"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 1871651 ZM Warp.Lv1,0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 1871651 ZM Warp.Lv2,0,-1"
		"OnCase03" "cmd,Command,sm_ewsetshortname 1871651 ZM Warp.Lv3,0,-1"
	}
}

;add dynamic item name to berserk
modify:
{
	match:
	{
		"classname" "logic_case"
		"targetname" "Item_Berserk_Case"
		"hammerid" "3764118"
	}
	insert:
	{
		"OnCase01" "cmd,Command,sm_ewsetshortname 3764112 Berserk (Ammo),0,-1"
		"OnCase02" "cmd,Command,sm_ewsetshortname 3764112 Berserk (Speed),0,-1"
	}
}

;------------------------------------------------------------------------------------
; Fixes stage 3 ending for the ball which HP can be increased infinitely
;------------------------------------------------------------------------------------
modify:
{
	match:
	{
		"targetname" "lvl3_Boss_Killed"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "fix_issue_for_ball_hp_push,Enable,,0,-1"
	}
}

add:
{
	"model" "*104"
	"targetname" "fix_issue_for_ball_hp_push"
	"StartDisabled" "1"
	"speed" "500"
	"spawnflags" "1"
	"pushdir" "0 270 0"
	"origin" "10641 6425 2673"
	"filtername" "Humans_Filter"
	"alternateticksfix" "0"
	"classname" "trigger_push"
}

add:
{
	"model" "*104"
	"targetname" "fix_issue_for_ball_hp_push"
	"StartDisabled" "1"
	"speed" "500"
	"spawnflags" "1"
	"pushdir" "0 270 0"
	"origin" "10641 6393 2673"
	"filtername" "Humans_Filter"
	"alternateticksfix" "0"
	"classname" "trigger_push"
}

add:
{
	"model" "*104"
	"targetname" "fix_issue_for_ball_hp_push"
	"StartDisabled" "1"
	"speed" "500"
	"spawnflags" "1"
	"pushdir" "0 270 0"
	"origin" "10641 6377 2673"
	"filtername" "Humans_Filter"
	"alternateticksfix" "0"
	"classname" "trigger_push"
}

add:
{
	"model" "*104"
	"targetname" "fix_issue_for_ball_hp_push"
	"StartDisabled" "1"
	"speed" "500"
	"spawnflags" "1"
	"pushdir" "0 270 0"
	"origin" "10641 6409 2673"
	"filtername" "Humans_Filter"
	"alternateticksfix" "0"
	"classname" "trigger_push"
}

add:
{
	"model" "*104"
	"targetname" "fix_issue_for_ball_hp_push"
	"StartDisabled" "1"
	"speed" "500"
	"spawnflags" "1"
	"pushdir" "0 270 0"
	"origin" "10964 6377 2673"
	"filtername" "Humans_Filter"
	"alternateticksfix" "0"
	"classname" "trigger_push"
}

add:
{
	"model" "*104"
	"targetname" "fix_issue_for_ball_hp_push"
	"StartDisabled" "1"
	"speed" "500"
	"spawnflags" "1"
	"pushdir" "0 270 0"
	"origin" "10431 6377 2673"
	"filtername" "Humans_Filter"
	"alternateticksfix" "0"
	"classname" "trigger_push"
}

; Fix not adjustable music volume
modify:
{
	match:
	{
		"message" "feywood/masaharu iwata - the feywood.mp3"
	}
	replace:
	{
		"message" "#feywood/masaharu iwata - the feywood.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/esper battle.mp3"
	}
	replace:
	{
		"message" "#feywood/esper battle.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/audiomachine  - age of rebellion.mp3"
	}
	replace:
	{
		"message" "#feywood/audiomachine  - age of rebellion.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hitoshi sakimoto - victory fanfare.mp3"
	}
	replace:
	{
		"message" "#feywood/hitoshi sakimoto - victory fanfare.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hayato matsuo - the forgotten capital.mp3"
	}
	replace:
	{
		"message" "#feywood/hayato matsuo - the forgotten capital.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hitoshi sakimoto - a moments rest.mp3"
	}
	replace:
	{
		"message" "#feywood/hitoshi sakimoto - a moments rest.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/mikolai stroinski - sir alonne.mp3"
	}
	replace:
	{
		"message" "#feywood/mikolai stroinski - sir alonne.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hayato matsuo - rebellion.mp3"
	}
	replace:
	{
		"message" "#feywood/hayato matsuo - rebellion.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hitoshi_sakimoto_-_to_the_place_of_the_gods.mp3"
	}
	replace:
	{
		"message" "#feywood/hitoshi_sakimoto_-_to_the_place_of_the_gods.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hitoshi sakimoto - the golmore jungle.mp3"
	}
	replace:
	{
		"message" "#feywood/hitoshi sakimoto - the golmore jungle.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/momofallthebattles.mp3"
	}
	replace:
	{
		"message" "#feywood/momofallthebattles.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hitoshi sakimoto - the salikawood.mp3"
	}
	replace:
	{
		"message" "#feywood/hitoshi sakimoto - the salikawood.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hitoshi-sakimoto - undercity.mp3"
	}
	replace:
	{
		"message" "#feywood/hitoshi-sakimoto - undercity.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/immediate music - shield of faith.mp3"
	}
	replace:
	{
		"message" "#feywood/immediate music - shield of faith.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hitoshi sakimoto - boss battle.mp3"
	}
	replace:
	{
		"message" "#feywood/hitoshi sakimoto - boss battle.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/pendulum - under the waves.mp3"
	}
	replace:
	{
		"message" "#feywood/pendulum - under the waves.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hitoshi sakimoto - a speechless battle.mp3"
	}
	replace:
	{
		"message" "#feywood/hitoshi sakimoto - a speechless battle.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/2sfh_to_glory.mp3"
	}
	replace:
	{
		"message" "#feywood/2sfh_to_glory.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/hitoshi sakimoto - esper.mp3"
	}
	replace:
	{
		"message" "#feywood/hitoshi sakimoto - esper.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/god_is_an_austronaut.mp3"
	}
	replace:
	{
		"message" "#feywood/god_is_an_austronaut.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/there for tomorrow - sore winner.mp3"
	}
	replace:
	{
		"message" "#feywood/there for tomorrow - sore winner.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/ffxii - chocobo race.mp3"
	}
	replace:
	{
		"message" "#feywood/ffxii - chocobo race.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/the_skycity.mp3"
	}
	replace:
	{
		"message" "#feywood/the_skycity.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/the_sky_fortess_bahamut.mp3"
	}
	replace:
	{
		"message" "#feywood/the_sky_fortess_bahamut.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/march_of_a_wise_man.mp3"
	}
	replace:
	{
		"message" "#feywood/march_of_a_wise_man.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/the_mosphoran_highwaste.mp3"
	}
	replace:
	{
		"message" "#feywood/the_mosphoran_highwaste.mp3"
	}
}
modify:
{
	match:
	{
		"message" "feywood/two steps from hell - freefall.mp3"
	}
	replace:
	{
		"message" "#feywood/two steps from hell - freefall.mp3"
	}
}




;; _

;; restart round on warmup

modify:
{
	match:
	{
		"targetname" "Warmup_Start"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "Map_All_Hurt,Enable,,65,-1"
	}
	insert:
	{
		"OnTrigger" "cmd,Command,mp_restartgame 1,65,-1"
	}
}