舰_1-5A+远征[0728]

--这个是舰娘的脚本 1-5A全面升级为1-5+远征
--这个是测试版本,有问题请到群133282323反馈!
--[2015.07.28] 修正 远征开关某些条件无效的问题
--[2016.01.15] 优化 check_time无效的问题
--[2016.01.15] 优化 启动脚本时会先进行一次远征

---------------------------------------------------------------------
--这里是设置区域!请仔细阅读!!!!! 然后再修改 
--如果设置区域读不懂 请按Alt+F4提高智商后再来

battle_count_max = 100
--设置最大战斗次数,就是出击多少次

battle_point_count = 1
--设置战斗进行的点数,如果是1,就只打A点,打全图的话就写4了。

conquest_open = false
--远征的整体开关,如果是false就不进行远征,true远征,
--false的情况下无需设置下面的时间及远征出击图,当然设置了也没用。

k2_conquest = {5,5}
k3_conquest = {5,6}
k4_conquest = {1,6}
--设置2、3、4舰队的远征图,5,5 = 第五页 第五个 = 东急
--可自行新建一个远征脚本复制出这几行数据

check_time = {5,10}
--设置5,10分钟检测收回并放出一次远征

Base.SetConfig("Sleep+?",100) --所有延时随机增加1-100
---------------------------------------------------------------------
m_lv = {SS=0,S=0,A=0,B=0,C=0,D=0,ALL=0,ERROR=0}

function YuanZhengCore() 
	ret = Kan.ConquestGet()
	Base.Sleep(2000)
	a,b,c,d = Kan.SupplyAll() --执行1234舰队的补给
	Win.Print("补给完毕 尝试远征")
	
	if b ~= -3 and b ~= -1 and k2_conquest ~= nil then --判断第二战队不在远征状态
		Kan.Conquest(2,k2_conquest[1],k2_conquest[2])
	end
	if c ~= -3 and c ~= -1 and k3_conquest ~= nil then
		Kan.Conquest(3,k3_conquest[1],k3_conquest[2])
	end
	if d ~= -3 and d ~= -1 and k4_conquest ~= nil then
		Kan.Conquest(4,k4_conquest[1],k4_conquest[2])
	end
end

function YuanZheng() --这个函数不要修改了!
--远征函数 如果时间大于 5分钟 就检查一次脚本 放出一次
	s2 = os.time()
	s = os.difftime(s2, s1)
	math.randomseed(os.time())
	min = math.random(check_time[1],check_time[2]) --取随机分钟数3-5
	if s > 60*min then
		s1 = os.time()
		Win.Print('时间符合 进行一次远征尝试')
		YuanZhengCore()
	else
		Win.Print('时间不符合 不远征')
	end
end

function CheckLv() --统计等级

	count = Base.GetValueInt("LastBattleCount")
	Base.Print("LastBattleCount:"..count)
	if count > 0 then
		m_lv.ALL = m_lv.ALL+count
		for n=1,count do
			ret = Base.GetValueInt("Battle_Lv_"..n)
			if ret == C.WIN_SS then
				m_lv.SS = m_lv.SS+1
			elseif  ret == C.WIN_S then
				m_lv.S = m_lv.S+1
			elseif  ret == C.WIN_A then
				m_lv.A = m_lv.A+1
			elseif  ret == C.WIN_B then
				m_lv.B = m_lv.B+1
			elseif  ret == C.WIN_C then
				m_lv.C = m_lv.C+1
			elseif  ret == C.WIN_D then
				m_lv.D = m_lv.D+1
			elseif  ret == C.WIN_ERROR then
				m_lv.ERROR = m_lv.ERROR+1
			end
			
		end
	end

	Win.SetState("累计战斗:"..m_lv.ALL.." SS:"..m_lv.SS.."  S:"..m_lv.S.."  A:"..m_lv.A.."  B:"..m_lv.B.."  C:"..m_lv.C.."  D:"..m_lv.D)
end

s1 = os.time() 

battle_count = 0; run_count = 0;
--用于计数的变量,不要改

if conquest_open == true then
	YuanZhengCore()
end

while true do --无限循环
	math.randomseed(os.time()) --设置随机数种子
	min = math.random(check_time[1],check_time[2]) --取随机分钟数3-5
	
	run_count = run_count+1
	a = "开始第:%d次"
	Win.Print(a:format(run_count))

	ret = Kan.Supply() --执行补给 只补给舰队1

	if ret > 0 then
		
		if conquest_open == true then
			Base.Print("舰船大破")
			Base.Print("等待"..min.."分后执行远征...")
			Base.Sleep(1000 * 60 * min)
			goto yc
		else
			Base.Print('舰船大破 脚本停止!')
			break
		end

	elseif ret == -1 then
		if conquest_open == true then
			Base.Print("补给不足")
			Base.Print("等待"..min.."分后执行远征...")
			Base.Sleep(1000 * 60 * min)
			goto yc
		else
			Base.Print('补给不足 脚本停止!')
			break
		end
	elseif ret == -2 then
		if conquest_open == true then
			Base.Print("等待"..min.."分后执行远征...")
			Base.Sleep(1000 * 60 * min)
			goto yc
		else
			Base.Print('远征中 脚本停止!')
			break
		end	
	end
		
	Kan.Sally(1, 5) --进行出击1-5

	--第一舰队/出击一次(A点)/不夜战/阵型单横
	if Kan.Battle(1, battle_point_count, false, 5) == false then
		CheckLv()
		Base.Print('战斗异常') --无法出击或者道中大破
		if conquest_open == true then
			Base.Print("等待"..min.."分后执行远征...")
			Base.Sleep(1000 * 60 * min)
			goto yc
		else
			break
		end
	else
		CheckLv()
	end	



	battle_count = battle_count + 1
	
	if battle_count > battle_count_max then
		
		
		
		if conquest_open == true then
			Base.Print("等待"..min.."分后执行远征...")
			Base.Sleep(1000 * 60 * min)
			goto yc
		else
			--Win.Pop('达到最大战斗次数,脚本停止',true)
			break
		end
	end
	Kan.WaitHome(1500)
	Base.Sleep(2000)
	
	if conquest_open == true then
		goto yc
	end
	
	
	::yc:: do
		if conquest_open == true then
			YuanZheng()
		end
	end



end



Win.Pop('脚本执行完毕!',true)

Last updated