// Common rules for death and ctf_death.txt

if startup1 then triggerdelay 1000 MarkAllTroopersStrategic  // show all enemy targets
variable killedUnitScore 0

// @1 = color killed, @2 = Capitalized color (e.g. "Green"), @3 = color of killer
macro killed_trooper 3
{
	if killed @1  by @3 testvar isAlly @3 @1 = 0 then
		showmessage "@2 unit killed by @3",
		trigger @3KilledEnemyUnit
}

// @1 = color, @2 = Capitalized color (e.g. "Green"), @3-5 are other colors
macro death_rules 5
{
	// in deathmatch the enemy sarge should be shown on the stratmap
//	if startup1 testvar iscoloringame @1 > 0 then
//		setitemflag @1sarge1 strategic 1

	// check for the sarge being killed and who killed them
	expand killed_trooper ( @1 @2 @3 )
	expand killed_trooper ( @1 @2 @4 )
	expand killed_trooper ( @1 @2 @5 )

	// deathmatch specific scoring events

	if @1KilledEnemyUnit then
		setvar killedUnitScore getplasticvalue me,
		addvar @1score killedUnitScore,
		playsound "mp_death.wav" (0,0) 1 2,
		trigger check@1wins
}

expand death_rules ( green Green tan blue grey )
expand death_rules ( tan Tan green blue grey )
expand death_rules ( blue Blue green tan grey )
expand death_rules ( grey Grey green tan blue )
