local count,type,rmBlood,rmFrost,rmUnholy

WhatsNext:AddConditionalStatement("Rune Ready Count",{
	category = "Death Knight",
	test = function(checkTable) 
		count = 0
		for i = 1,6 do
			if select(3,GetRuneCooldown(i)) then
				count = count + 1
			end
		end
		return  count >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return "player has at least ".. tostring(checkTable.amount) .. " runes off cooldown."
	end,
	arguments = {
		amount = {type = "integer", default = 0},
	}
})

WhatsNext:AddConditionalStatement("Blood Rune Ready Count",{
	category = "Death Knight",
	test = function(checkTable) 
		count = 0
		for i = 1,6 do
			type = GetRuneType(i)
			if select(3,GetRuneCooldown(i)) and (type == 1 or type == 4) then
				count = count + 1
			end
		end
		return  count >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return "player has at least ".. tostring(checkTable.amount) .. " blood/death runes off cooldown."
	end,
	arguments = {
		amount = {type = "integer", default = 0},
	}
})

WhatsNext:AddConditionalStatement("Frost Rune Ready Count",{
	category = "Death Knight",
	test = function(checkTable) 
		count = 0
		for i = 1,6 do
			type = GetRuneType(i)
			if select(3,GetRuneCooldown(i)) and (type == 3 or type == 4) then
				count = count + 1
			end
		end
		return  count >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return "player has at least ".. tostring(checkTable.amount) .. " frost/death runes off cooldown."
	end,
	arguments = {
		amount = {type = "integer", default = 0},
	}
})

WhatsNext:AddConditionalStatement("Unholy Rune Ready Count",{
	category = "Death Knight",
	test = function(checkTable) 
		count = 0
		for i = 1,6 do
			type = GetRuneType(i)
			if select(3,GetRuneCooldown(i)) and (type == 2 or type == 4) then
				count = count + 1
			end
		end
		return  count >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return "player has at least ".. tostring(checkTable.amount) .. " unholy/death runes off cooldown."
	end,
	arguments = {
		amount = {type = "integer", default = 0},
	}
})

WhatsNext:AddConditionalStatement("Blood Rune Simple Ready Count",{
	category = "Death Knight",
	test = function(checkTable) 
		count = 0
		for i = 1,6 do
			type = GetRuneType(i)
			if select(3,GetRuneCooldown(i)) and type == 1 then
				count = count + 1
			end
		end
		return  count >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return "player has at least ".. tostring(checkTable.amount) .. " blood runes off cooldown."
	end,
	arguments = {
		amount = {type = "integer", default = 0},
	}
})

WhatsNext:AddConditionalStatement("Frost Rune Simple Ready Count",{
	category = "Death Knight",
	test = function(checkTable) 
		count = 0
		for i = 1,6 do
			type = GetRuneType(i)
			if select(3,GetRuneCooldown(i)) and type == 3 then
				count = count + 1
			end
		end
		return  count >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return "player has at least ".. tostring(checkTable.amount) .. " frost runes off cooldown."
	end,
	arguments = {
		amount = {type = "integer", default = 0},
	}
})

WhatsNext:AddConditionalStatement("Unholy Rune Simple Ready Count",{
	category = "Death Knight",
	test = function(checkTable) 
		count = 0
		for i = 1,6 do
			type = GetRuneType(i)
			if select(3,GetRuneCooldown(i)) and type == 2 then
				count = count + 1
			end
		end
		return  count >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return "player has at least ".. tostring(checkTable.amount) .. " unholy runes off cooldown."
	end,
	arguments = {
		amount = {type = "integer", default = 0},
	}
})

WhatsNext:AddConditionalStatement("Death Rune Ready Count",{
	category = "Death Knight",
	test = function(checkTable) 
		count = 0
		for i = 1,6 do
			type = GetRuneType(i)
			if select(3,GetRuneCooldown(i)) and type == 4 then
				count = count + 1
			end
		end
		return  count >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return "player has at least ".. tostring(checkTable.amount) .. " death runes off cooldown."
	end,
	arguments = {
		amount = {type = "integer", default = 0},
	}
})

WhatsNext:AddConditionalStatement("Rune Type Ready Count",{
	category = "Death Knight",
	test = function(checkTable) 
		rmBlood = tonumber(checkTable.bloodAmount)
		rmFrost = tonumber(checkTable.frostAmount)
		rmUnholy = tonumber(checkTable.unholyAmount)
		count = 0
		for i = 1,6 do
			type = GetRuneType(i)
			if select(3,GetRuneCooldown(i)) then
				if type == 1 then
					rmBlood = math.max(0,rmBlood - 1)
				elseif type == 2 then
					rmUnholy = math.max(0,rmUnholy - 1)
				elseif type == 2 then
					rmFrost = math.max(0,rmFrost - 1)
				else
					count = count + 1
				end
			end
		end
		return  rmBlood + rmFrost + rmUnholy <= count
	end,
	text = function(checkTable) 
		return "player has at least ".. tostring(checkTable.bloodAmount) .. " blood " .. tostring(checkTable.frostAmount) .. " frost and " .. tostring(checkTable.unholyAmount) .. " unholy rune(s) off cooldown."
	end,
	arguments = {
		unholyAmount = {type = "integer", default = 0},
		bloodAmount = {type = "integer", default = 0},
		frostAmount = {type = "integer", default = 0},
	}
})