WhatsNext:AddConditionalStatement("Is Player",{
	category = "Unit State",
	test = function(checkTable) 
		return UnitIsPlayer(tostring(checkTable.unit))
	end,
	text = "{unit} is a player character.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	}
})

local lvl
WhatsNext:AddConditionalStatement("Level",{
	category = "Unit State",
	test = function(checkTable) 
		lvl = UnitLevel(tostring(checkTable.unit))
		return (lvl ~= -1 and lvl or UnitLevel("player")+3) >= tonumber(checkTable.amount)
	end,
	text = "{unit} is at or above level {amount}.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		amount = {type = "integer", default = "90"},
	}
})

WhatsNext:AddConditionalStatement("Are Enemies",{
	category = "Unit State",
	test = function(checkTable) 
		return UnitIsEnemy(tostring(checkTable.unit1),tostring(checkTable.unit2))
	end,
	text = "{unit1} and {unit2} are enemies.",
	arguments = {
		unit1 = {label = "Unit 1", type = "unit", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		unit2 = {label = "Unit 2", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	}
})

WhatsNext:AddConditionalStatement("Is Named",{
	category = "Unit State",
	test = function(checkTable) 
		return UnitName(tostring(checkTable.unit)) == tostring(checkTable.name)
	end,
	text = "{unit} is named {name}.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		name = {label = "Name", type = "text", default = ""}
	}
})

WhatsNext:AddConditionalStatement("Attackable Target",{
	category = "Unit State",
	test = function(checkTable) 
		return UnitName(tostring(checkTable.unit2)) and UnitCanAttack(tostring(checkTable.unit1),tostring(checkTable.unit2))
	end,
	text = "{unit1} can attack {unit2}.",
	arguments = {
		unit1 = {label = "Unit 1", type = "unit", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		unit2 = {label = "Unit 2", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	}
})

WhatsNext:AddConditionalStatement("Unit Is Unit",{
	category = "Unit State",
	test = function(checkTable)
		return UnitExists(checkTable.unit1) and UnitExists(checkTable.unit2) and UnitIsUnit(checkTable.unit1,checkTable.unit2)
	end,
	text = "{unit1} is the same unit as {unit2}.",
	arguments = {
		unit1 = {label = "Unit 1", type = "unit", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		unit2 = {label = "Unit 2", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})

WhatsNext:AddConditionalStatement("Unit Exists",{
	category = "Unit State",
	test = function(checkTable)
		return UnitExists(checkTable.unit)
	end,
	text = "{unit} exists.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})
WhatsNext:AddConditionalStatement("Unit Dead",{
	category = "Unit State",
	test = function(checkTable)
		return UnitIsDead(checkTable.unit)
	end,
	text = "{unit} is dead.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})
WhatsNext:AddConditionalStatement("Unit Ghost",{
	category = "Unit State",
	test = function(checkTable)
		return UnitIsGhost(checkTable.unit)
	end,
	text = "{unit} is a ghost.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})
WhatsNext:AddConditionalStatement("Unit Dead or Ghost",{
	category = "Unit State",
	test = function(checkTable)
		return UnitIsDeadOrGhost(checkTable.unit)
	end,
	text = "{unit} is dead or a ghost.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})
WhatsNext:AddConditionalStatement("Unit Possessed",{
	category = "Unit State",
	test = function(checkTable)
		return UnitIsPossessed(checkTable.unit)
	end,
	text = "{unit} is possessed.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})
WhatsNext:AddConditionalStatement("Unit Charmed",{
	category = "Unit State",
	test = function(checkTable)
		return UnitIsCharmed(checkTable.unit)
	end,
	text = "{unit} is charmed.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})
WhatsNext:AddConditionalStatement("Unit Visible",{
	category = "Unit State",
	test = function(checkTable)
		return UnitIsVisible(checkTable.unit)
	end,
	text = "{unit} is visible.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})

WhatsNext:AddConditionalStatement("Unit Tapped By Player",{
	category = "Unit State",
	test = function(checkTable)
		return UnitIsTappedByPlayer(checkTable.unit)
	end,
	text = "{unit} is tapped by player.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})

WhatsNext:AddConditionalStatement("Unit Tapped",{
	category = "Unit State",
	test = function(checkTable)
		return UnitIsTapped(checkTable.unit) and not UnitIsTappedByPlayer(checkTable.unit)
	end,
	text = "{unit} is tapped by a different player.",
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})