不太懂ㄟ
我有一個人家寫好iphone4用的lua
-- 适用屏幕参数
SCREEN_RESOLUTION="640x1136";
SCREEN_COLOR_BITS=32;
count=1;
round=0
defPrevRound=0;
bloodRound=65
hardRound=100
function main()
while count<6000 do
fightEvil();
mSleep(300);
end
end
function fightEvil()
count=count+1;
--notifyMessagew(round);
--判斷跳過動畫
x, y =findColorInRegion(0x1f907d,35,569,35,569);
click(x,y,20,20)
touchDown(0, 600, 570)
touchUp(0);
mSleep(300);
x, y =findColorInRegion(0x1f907d,35,569,35,569);
click(x,y,20,20)
--touchDown(0, 600, 570)
--touchUp(0);
--打完繼續
x1, y1 =findColorInRegion(0x21937d,29,675,29,675);
click(x1,y1,0,0)
--領獎勵
x2, y2 =findColorInRegion(0x1f937a,95,570,95,570);
click(x2,y2,0,0)
if round<=bloodRound then
--血戰
x3, y3 =findColorInRegion(0xdd4d31,135,348,135,348);
clickRound(x3,y3,0,0)
elseif round<= hardRound then
--力戰
x4, y4 =findColorInRegion(0xd64831,134,564,134,564);
clickRound(x4,y4,0,0)
else
--奮戰
x5, y5 =findColorInRegion(0xdf5433,136,782,136,782);
clickRound(x5,y5,0,0)
end
--點加成
--30%氣血
x6, y6 =findColorInRegion(0xdc5ea1,347,751,347,751);
--30%武力
x7, y7 =findColorInRegion(0xd65b35,351,747,351,747);
--30%防禦
x8, y8 =findColorInRegion(0xfbd55c,351,750,351,750);
--15%氣血
x9, y9 =findColorInRegion(0xdb519c,343,569,343,569);
--15%武力
x10, y10 =findColorInRegion(0xd65631,346,568,346,568);
--15%防禦
x11, y11 =findColorInRegion(0xfbd662,349,569,349,569);
--以上都沒有,則點任何30%
if x6 ~= -1 then
--notifyMessage("氣血");
click(x6,y6,0,0)
elseif x7 ~= -1 then
--notifyMessage("武力");
click(x7,y7,0,0)
elseif x8 ~= -1 then
--notifyMessage("防禦");
clickDef(x8,y8,0,0)
elseif x9 ~= -1 then
--notifyMessage("氣血");
click(x9,y9,0,0)
elseif x10 ~= -1 then
--notifyMessage("武力");
click(x10,y10,0,0)
elseif x11 ~= -1 then
--notifyMessage("防禦");
clickDef(x11,y11,0,0)
elseif x6 == -1 and x7 == -1 and x8 == -1 and x9 == -1 and x10 == -1 and x11 == -1 then
--notifyMessage("30%");
click30Percent();
end
end
function clickRound(x,y,dx,dy)
if x ~= -1 and y ~= -1 then
round=round+1;
touchDown(0, (x+dx), (y+dy)) ;
touchUp(0);
end
end
function clickDef(x,y,dx,dy)
diffRound=round-defPrevRound;
if defPrevRound == 0 then
click(x,y,dx,dy);
defPrevRound=round;
elseif diffRound >18 then
click(x,y,dx,dy);
defPrevRound=round;
else
click30Percent();
end
end
function click30Percent()
x, y =findColorInRegion(0x939393,346,751,346,751);
if x ~= -1 and y ~= -1 then
click(350,385,0,0)
else
click(347,751,0,0);
end
end
function click(x,y,dx,dy)
if x ~= -1 and y ~= -1 then
touchDown(0, (x+dx), (y+dy)) ;
touchUp(0);
--mSleep(500);
--notifyMessage(x);
--notifyMessage(y);
else
-- notifyMessage("no");
end
end
請大大教我該怎麼樣轉換這些數值 我螢幕大小為720*1280 |