include("SharedFunctions.lua")
local bVSPowerest = false
function CombainVSPowerest(PlayerID)
if bVSPowerest == true or Game.GetGameTurn()<50 then
print("合纵已经发生过")
	return
end
local eplayer=Players[PlayerID]
if ((EvaluePower(eplayer)) > 0.33) then
print("霸主产生",GetPlayerName(eplayer))

local ieTeamID= eplayer:GetTeam()
	for _, player in pairs(Players) do
		local pTeam=Teams[player:GetTeam()]
		if (player:GetTeam() ~= ieTeamID) and (not player:IsMinorCiv()) and (not player:IsHuman()) and (not pTeam:IsAtWar(ieTeamID)) then
		pTeam:DeclareWar(ieTeamID)
		end
	end
	local strplayerName = GetPlayerName(eplayer)
	local heading = Locale.ConvertTextKey("TXT_KEY_NOTIFICATION_HEZONG_SHORT")
	local text = Locale.ConvertTextKey("TXT_KEY_NOTIFICATION_HEZONG",strplayerName)
	for _, pPlayer in pairs(Players) do
		if pPlayer:IsHuman() then
	pPlayer:AddNotification(NotificationTypes.NOTIFICATION_GENERIC ,text,heading,-1,-1)
		end
	end
	bVSPowerest = true
else
print("没有霸主")
return
end
end
GameEvents.PlayerDoTurn.Add(CombainVSPowerest)