;----------------------------------------------
; Remove level change after winning last stage.
;----------------------------------------------
filter:
{
	"classname" "logic_relay"
	"targetname" "vote_relay"
}

modify:
{
	match:
	{
		"classname" "math_counter"
		"targetname" "LevelLogCounter"
	}
	replace:
	{
		"max" "5"
	}
}
;-----------------
;Fix Dragonpriest
;-----------------
modify:
{
	match:
	{
		"origin" "-8704 -4544 -5184"
		"targetname" "knife_dr"
		"classname" "weapon_knife"
	}
	insert:
	{
		"OnPlayerPickup" "dr_phbox,FireUser1,,0,1"
	}
}
modify:
{
	match:
	{
		"origin" "-8700 -4544 -5172.5"
		"targetname" "dr_phbox"
		"classname" "func_physbox_multiplayer"
	}
	insert:
	{
		"OnUser1" "!activator,AddOutput,health 25000,0,-1"
		"OnUser1" "!self,FireUser1,,1,-1"
	}
}
modify:
{
	match:
	{
		"origin" "-8696 -4544 -5182"
		"targetname" "dragon_dead"
		"classname" "trigger_hurt"
	}
	replace:
	{
		"damage" "999999"
	}
}
modify:
{
	match:
	{
		"origin" "-8704 -4544 -5163.5"
		"targetname" "dr_nuke2"
		"classname" "trigger_multiple"
	}
	insert:
	{
		"OnStartTouch" "speedmod,ModifySpeed,1,6,-1"
	}
}

;----------------------------
;Fix the infamous Dragon bug
;----------------------------
;Stage 1
modify:
{
	match:
	{
		"targetname" "boss_1break"
		"classname" "func_breakable"
	}
	insert:
	{
		"filter" "filter_ct_no"
	}
}
modify:
{
	match:
	{
		"targetname" "helgen_boss"
		"classname" "trigger_multiple"
	}
	insert:
	{
		"OnStartTouch" "boss_1break,SetDamageFilter,,7,1"
	}
}

;Stage 2
modify:
{
	match:
	{
		"targetname" "boss_2_break"
		"classname" "func_physbox"
	}
	insert:
	{
		"filter" "filter_ct_no"
	}
}
modify:
{
	match:
	{
		"targetname" "wr_once7"
		"classname" "trigger_once"
	}
	insert:
	{
		"OnStartTouch" "boss_2_break,SetDamageFilter,,5,1"
	}
}

;Stage 5
modify:
{
	match:
	{
		"targetname" "sovng_boss_break"
		"classname" "func_physbox"
	}
	insert:
	{
		"filter" "filter_ct_no"
	}
}
modify:
{
	match:
	{
		"origin" "8372 13456 0"
		"targetname" "boss_3_path_3"
		"classname" "path_track"
	}
	insert:
	{
		"OnPass" "sovng_boss_break,SetDamageFilter,,0,-1"
	}
}

;----------------------
;Buff Centurion Boss
;----------------------
modify:
{
	match:
	{
		"targetname" "dw_hp"
		"classname" "math_counter"
	}
	replace:
	{
		"startvalue" "105"
	}
}
modify:
{
	match:
	{
		"targetname" "dw_hp_backup"
		"classname" "math_counter"
	}
	replace:
	{
		"startvalue" "105"
	}
}
modify:
{
	match:
	{
		"targetname" "stage_4_bosshp"
		"classname" "trigger_multiple"
	}
	delete:
	{
		"OnStartTouch" "dw_hp,Add,42,0,-1"
		"OnStartTouch" "dw_hp_backup,Add,42,0,-1"
	}
	insert:
	{
		"OnStartTouch" "dw_hp,Add,53,0,-1"
		"OnStartTouch" "dw_hp_backup,Add,53,0,-1"
	}
}
modify:
{
	match:
	{
		"targetname" "dw_naderelay"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "dw_hp,Subtract,140,0,-1"
	}
	insert:
	{
		"OnTrigger" "dw_hp,Subtract,110,0,-1"
	}
}

;--------------------------------------------
;Fix final dragon using an attack after death
;--------------------------------------------
modify:
{
	match:
	{
		"targetname" "BossHpIterations"
		"classname" "math_counter"
	}
	delete:
	{
		"OnHitMin" "boss_3_ulti_hrt,Disable,,0,-1"
		"OnHitMin" "freeze,Disable,,0,-1"
		"OnHitMin" "hamm_hurt_3,Disable,,0,-1"
		"OnHitMin" "push_boss,Disable,,0,-1"
		"OnHitMin" "fire_1,Disable,,0,-1"
		"OnHitMin" "eat_hurt2,Disable,,0,-1"
	}
	insert:
	{
		"OnHitMin" "boss_3_ulti_hrt,Kill,,0,-1"
		"OnHitMin" "freeze,Kill,,0,-1"
		"OnHitMin" "hamm_hurt_3,Kill,,0,-1"
		"OnHitMin" "push_boss,Kill,,0,-1"
		"OnHitMin" "fire_1,Kill,,0,-1"
		"OnHitMin" "eat_hurt2,Kill,,0,-1"
		"OnHitMin" "alduin_3_hamm,Kill,,0,-1"
		"OnHitMin" "boss_3_freeze,Kill,,0,-1"
		"OnHitMin" "boss_3_push,Kill,,0,-1"
		"OnHitMin" "boss_3_fire,Kill,,0,-1"
		"OnHitMin" "fire,Kill,,0,-1"
		"OnHitMin" "ice,Kill,,0,-1"
		"OnHitMin" "hurt,Kill,,0,-1"
		"OnHitMin" "wind,Kill,,0,-1"
		"OnHitMin" "push_relay,Disable,,0,-1"
		"OnHitMin" "hamm_relay,Disable,,0,-1"
		"OnHitMin" "fire_1_relay,Disable,,0,-1"
		"OnHitMin" "freeze_relay,Disable,,0,-1"
		"OnHitMin" "freeze_relay,CancelPending,,0,-1"
		"OnHitMin" "fire_1_relay,CancelPending,,0,-1"
		"OnHitMin" "hamm_relay,CancelPending,,0,-1"
		"OnHitMin" "push_relay,CancelPending,,0,-1"
	}
}
