output("--------------------")
output("2 3 2")
output("3 2 2 0")
output("1 2 2 3")
output("2 2 1 1")
output("2 1 1")
output("1 1")
output("0 0 2")


--
local v = {}

--ѭ
function Main(g_player)
	if nofight() and nobuff("ľ") then
		cast("ľ", true)
	end

	--
	if tbuffstate("ɴ") then
		cast("ָ")
	end

	--ȷĿ
	v["Ŀ"] = id()
	v["Ѫٶ"] = party("û״̬:", "Լ", "<20", "߿ɴ", "ûؾ", "Ѫ")
	if v["Ѫٶ"] ~= 0 and xlife(v["Ѫٶ"]) < life() then
		v["Ŀ"] = v["Ѫٶ"]
	end

	v["ĿѪ"] = xlife(v["Ŀ"])
	v["ĿT"] = xmount("ϴ辭|||", v["Ŀ"])

	--
	if fight() and v["Ŀ"] ~= id() then		--սУԼ
		if v["ĿѪ"] < 0.3 and life() > 0.9 then
			xcast("紵ѩ", v["Ŀ"])
		end
	end

	--
	if v["ĿѪ"] < 0.4 or (v["ĿT"] and v["ĿѪ"] < 0.6) then
		if buff("Ѫ|ˮ޼") then
			xcast("", v["Ŀ"])
		else
			if cdtime("") <= 0 then
				if cast("ˮ޼", true) then
					xcast("", v["Ŀ"])
				end
			end
		end
	end

	--
	if fight() and v["ĿT"] and v["ĿѪ"] < 0.5 and xbuffstate("Ч", v["Ŀ"]) < 40 then		--TѪ50%ûˣǰ泤ûϣϴ
		xcast("໤", v["Ŀ"])
	end

	--ɢ
	xcast("紹¶", party("û״̬:", "<20", "߿ɴ", "buffʱ:ԲЧ|ԪԲЧ|ԲЧ|ѨЧ|ԲЧ>1"))

	--
	_, v["10ڲѪ"] = party("û״̬:", "<10", "߿ɴ", "Ѫ<0.7")
	if v["10ڲѪ"] > 3 then
		cast("")
	end

	--
	if v["ĿѪ"] < 0.8 or (v["ĿT"] and v["ĿѪ"] < 0.9) then
		xcast("", v["Ŀ"])
	end
	
	if fight() then
		if buffsn("") < 4 or bufftime("") < 5 or bufftime("Ѫ") < 5 then
			local tank = party("û״̬:", "<20", "ڹ:ϴ辭|||", "߿ɴ")
			if tank ~= 0 then
				xcast("", tank)
			else
				cast("", true)
			end
		end
	end

	--
	if v["ĿѪ"] < 0.9 and xbufftime("", v["Ŀ"]) < -1 then		--Ѫϸ
		xcast("", v["Ŀ"])
	end
	xcast("", party("û״̬:", "<20", "ڹ:ϴ辭|||", "߿ɴ", "buffʱ:<-1"))		--T


	--
	if nobuff("ˮ") and life() > 0.9 and mana() < 0.7 then
		cast("")
	end

	if mana() < 0.4 then
		cast("ˮ", true)
	end

	--ŵ, ƶзŲܣԼѪ
	if life() < 0.7 then
		cast("", true)
	end
end
