
WhatsNext:AddConditionalStatement("Is Player",{
	category = "Unit State",
	test = function(checkTable) 
		return UnitIsPlayer(tostring(checkTable.unit))
	end,
	text = function(checkTable) 
		return GetUnitDisplayText(checkTable.unit) .. " is a player character."
	end,
	arguments = {
		unit = {type = "dropdown", 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 = function(checkTable) 
		return GetUnitDisplayText(checkTable.unit) .. " is at or above level " .. tostring(checkTable.amount) .. "."
	end,
	arguments = {
		unit = {type = "dropdown", 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 = function(checkTable) 
		return GetUnitDisplayText(checkTable.unit1) .. " and " .. GetUnitDisplayText(checkTable.unit2) .. " are enemies."
	end,
	arguments = {
		unit1 = {type = "dropdown", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		unit2 = {type = "dropdown", 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 = function(checkTable) 
		return GetUnitDisplayText(checkTable.unit) .. " is named " .. tostring(checkTable.name) .. "."
	end,
	arguments = {
		unit = {type = "dropdown", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		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 = function(checkTable) 
		return GetUnitDisplayText(checkTable.unit1) .. " can attack " .. GetUnitDisplayText(checkTable.unit2) .. "."
	end,
	arguments = {
		unit1 = {type = "dropdown", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		unit2 = {type = "dropdown", 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 = function(checkTable)
		return GetUnitDisplayText(checkTable.unit1) .. " is the same unit as " .. GetUnitDisplayText(checkTable.unit2) .. "."
	end,
	arguments = {
		unit1 = {type = "dropdown", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		unit2 = {type = "dropdown", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
	},
})

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

WhatsNext:AddConditionalStatement("Unit Tapped By Player",{
	category = "Unit State",
	test = function(checkTable)
		return UnitIsTappedByPlayer(checkTable.unit)
	end,
	text = function(checkTable)
		return GetUnitDisplayText(checkTable.unit) .. " is tapped by player."
	end,
	arguments = {
		unit = {type = "dropdown", 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 = function(checkTable)
		return GetUnitDisplayText(checkTable.unit) .. " is tapped by a different player."
	end,
	arguments = {
		unit = {type = "dropdown", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
	},
})



