0,]']±>Sï}WÿÍu§ðp8·d%qy0•4;]ÉA¦ösï÷ôôô”¥Âml†3p.root.dur then p.root.a=false end if p.mov==nil then return end local t1=p.mov.t local direction=directions[p.mov.dir+1] p.x=p.x+direction.x p.y=p.y+direction.y p.s.cur=p.mov.s+t1%12//6 if math.abs(p.x-p.mov.x)>7 or math.abs(p.y-p.mov.y)>7 then p.mov=nil end end function mov(p,dir) if p.mov==nil then if canMove(p,dir) then p.mov={dir=dir,x=p.x,y=p.y,t=t,s=p.s.cur} end setSprFlip(p,dir) end end function drawGUI(x,y,h,w) rect(x,y,w*8,h*8,0) spr(112,x,y,11,1,0,0,1,1)--tl corner spr(112,x+w*8,y,11,1,0,1,1,1)--tr corner spr(112,x,y+h*8,11,1,0,3,1,1)--bl corner spr(112,x+w*8,y+h*8,11,1,0,2,1,1) --br corner for i=1,w-1,1 do spr(113,x+i*8,y,11,1,0,1,1,1) spr(113,x+i*8,y+h*8,11,1,0,1,1,1) end for i=1,h-1,1 do spr(113,x,y+i*8,11,1,0,0,1,1) spr(113,x+w*8,y+i*8,11,1,0,0,1,1) end for i=1,w-1,1 do spr(113,x+i*8,y+8*2,11,1,0,1,1,1) spr(113,x+i*8,y+8*9,11,1,0,1) end local divL=((w-2)*8)/2 spr(113,x+divL+8,y+8,11,1,0,2,1,1) spr(69,x+8+divL/3,y+8,11) spr(68,x+16+divL*4/3,y+8,11) local ystat=y+8*10+2 smallPr("HP "..p.hp.."/"..p.hpmax,x+10,ystat) ystat=ystat+6 line(x+10,ystat,x+10+50-50*(p.hpmax-p.hp)*1/p.hpmax,ystat,2) ystat=ystat+2 smallPr("MP "..p.mp.."/"..p.mpmax,x+10,ystat) ystat=ystat+6 line(x+10,ystat,x+10+50-50*(p.mpmax-p.mp)*1/p.mpmax,ystat,9) ystat=ystat+2 smallPr("Sta "..p.sta.."/"..100,x+10,ystat) ystat=ystat+6 line(x+10,ystat,x+10+50-50*(100-p.sta)*1/100,ystat,4) ystat=ystat+2 smallPr("Ham "..p.ham.."/"..100,x+10,ystat) ystat=ystat+6 line(x+10,ystat,x+10+50-50*(100-p.ham)*1/100,ystat,6) ystat=ystat+2 smallPr("Sed "..p.sed.."/"..100,x+10,ystat) ystat=ystat+6 line(x+10,ystat,x+10+50-50*(100-p.sed)*1/100,ystat,10) if inv then drawInv() else drawSpell() end end function drawInv() local sel for i=0,3,1 do for j=0,2,1 do local x=169+i*13+2 local y=25+j*13+2 local idx=i+j*4 local item=p.inv[idx] spr(item.s,x+2,y+2,11) if item.selected then sel=item end rectb(x,y,12,12,item.selected and 4 or 15) end end smallPr(sel.name.." n: "..sel.a,169,66) end function drawSpell() local sel local selI=0 for i=0,4,1 do local x=169 local y=25+i*7 local s=spells[i] if s.selected then sel=s;selI=i end rectb(x,y,50,8,15) smallPr(s.name,x+3,y+1,s.selected and 4 or 15) end -- selected yellow border rectb(169,25+selI*7,50,8,4) spr(96,182,63,11,1,0,0,5,1) spr(128,222,30,11) spr(128,222,41,11,1,2) end function smallPr(str,x,y,c) c=c or 15 print(str,x,y,c,false,1,true) end mPress=false unpress=true itemPress=nil function checkM() local x,y,left = mouse() if left then if mPress then mPress=false end if unpress then mPress=true unpress=false end else unpress=true mPress=false end if mPress then -- check inv click if x>168 and x<195 and y>8 and y<15 then inv=true end if x>204 and x<231 and y>8 and y<15 then inv=false end -- check spell hit -- IMPORTANT CHECK BEFORE LANZAR if castReady then for i,c in pairs(allChars) do local eX,eY=absToRel(c) if x+3>=eX and x+3=eY and y+3iX and xiY and yiX and xiY and y223 and x<228 then if y>33 and y<39 then moveSpell(true)end if y>41 and y<47 then moveSpell(false)end end end end --check spell click if not inv and left then for i=0,4,1 do local sY=25+i*7 if x>169 and x<169+50 and y>sY and y0 then i.a=i.a-1 i.callback(p,i) end end function hpPot(p,i) p.hp=p.hp+rand(1,10) if p.hp>p.hpmax then p.hp=p.hpmax end end function mpPot(p,i) p.mp=p.mp+rand(20,50) if p.mp>p.mpmax then p.mp=p.mpmax end end function curItem() for i=0,11,1 do if p.inv[i].selected then return p.inv[i] end end end function selectItem(idx) for i=0,11,1 do p.inv[i].selected=false end p.inv[idx].selected=true end function selectSpell(idx) for i=0,4,1 do spells[i].selected=false end spells[idx].selected=true end function selectedSpell() for i=0,4,1 do if spells[i].selected then return spells[i],i end end end function moveSpell(up) local cur,idx=selectedSpell() if up then if idx>0 then local temp=spells[idx] spells[idx]=spells[idx-1] spells[idx-1]=temp end else if idx<4 then local temp=spells[idx] spells[idx]=spells[idx+1] spells[idx+1]=temp end end end --Real to map coordinates function toMap(x,y) return x//8,y//8 end function setSprFlip(dir) if dir==0 then sprite=41 flip=0 end if dir==1 then sprite=41 flip=2 end if dir==2 then sprite=25 flip=1 end if dir==3 then sprite=25 flip=0 end end function setSprFlip(p,dir) if dir==0 then p.s.cur=p.s.ver p.s.flip=0 end if dir==1 then p.s.cur=p.s.ver p.s.flip=2 end if dir==2 then p.s.cur=p.s.hor p.s.flip=1 end if dir==3 then p.s.cur=p.s.hor p.s.flip=0 end if p.mov~=nil then p.mov.s=p.s.cur end end function applyDmg(spell,from,to) if from==to then return false end if from.mpabs(dY) then dir=dX>0 and 2 or 3 else dir=dY>0 and 0 or 1 end else dir=rand(0,3)end mov(e,dir) end if t%e.dif.mFreq==0 and isInScreen(e) then if rand()>(p.mov==nil and e.dif.standHit or e.dif.movHit) then if e.root.a then castSpell(remo,e,e)end if not p.root.a and rand()>0.9 then castSpell(inmo,e,p) else for i=3,1,-1 do if castSpell(dmgSpells[i],e,p) then break end end end end end if t%e.dif.pFreq==0 then if e.hpp.x-8*10 and e.xp.y-8*11 and e.y