ÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÀ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌÀ¬ÀÀÀ¬ÀÀÀ¬ÀÀÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÌ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌ̬ÀÀÀ¬ÀÀÀ¬ÀÀ¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî >@=ÐÐMÐÔðÑäOÓÿ A4ò.ðÐM.ÞÔñà/àïàÝíà!àîîîîðÞíàÝÒàÔÝÝMÝÝM 3ãîî> ÓÝÝÝÝíÞÝÔÝDßÝíþðàÔ"#3"3C#Ý Ô3ÝÓÓÔMð@$"334"323#$ðî#C04B34C#Ò-.îàïîñþ"îîîàC#2233#2ÔîðÿÿðþîïáàîïþþïîïÞÝàÝÝîîÐ=33344BDC3ôñðN4B>CCD4342CðMDMDDDD4þA4DDÔ4ä C#2D3D43$1ÔÑDD4CNDDD$ßÓDDMÔDMDÝ=3D4D 4CCCDD4DÓà$1D33ÓÝC4DD34C3C34CD04#333#$M"C3CDDD#33B 3C3$ 3CC23C3333B M#2#C33ôÐ$D4D2DD3C3 !ñð$323ÔC434ÓN3343C33äß=343C43äà$"234.""BD33A33M3CA33DDDDCÐ43343D3 4#B3D4/3ÞîïÞ=íð-D3Cà3C3C@3C?34DN33Dãï>Cäà$322ò1434ä03C D33Ð4C"â>C04D4þ>3Ð$Ð44D îÞÝÝáîñ424D4C4DBCCM4DBC4ãÓà4C4äNC3$?C3ð43ÓÐ3Cà 0D4/ä@Ð43ÓÿÞðCC3C4C4CBDCC3DA4C4C4BC3ôA4CD3ÔÐDC 44ãþ0442à3C3CC34DOCC043#A33A333äC23äà44ð4C3ÐCC/ 43CÔÐ4"4ïð433C4C#ãC"Bä>C33äDBCB3#2ô>2#4033ô4"ÓB33DÓM333CÔþ@$CÔð$23C 4##22"3D433##"2>3#ä13"ó0#"CÓ133333 ð>3#34ãÿ124C ð#""B"2C03#2"##?#2@##"ã22" ""äð3"3?#3"#2!3#23B?433ð#""2ð33"21"2#2#3?221#"22!"2"#2"0"2!23"B@4#2ÿÿ#""10$"#2O"21"20""à #""#Bä2!"O#"ó#!"0#2 3303#B#""10$""31"2 #"30""3âC $"3?#Ò2$"0""3 #!""2Ð""2?"2ðþÿ#!"2ÔðC"#2"!1"!10ò!23"2ã#!"1#?2""0""""C!"2"!"þÿÿ.B3# #"2A!2/á !ÑÔ3Mä""ò2!""0"3#.""##!"ò>33#"!2 "!""!!#2!3233"ã2##C""1A#1ïàð2">3#!"1"!#1/"""""2/ó""""""" "!##/""1#""#""""B""1ðà ðã""!à$#""#"3/""""""/#!B/"""20""""""1##!""2!"àï $ñ"!!3!""ÿ!"""""""á2#òÿ!ñð"!!""""""21ñð1#"!"2óÿñ"""2 31ÿð122"#ò0!ôñþÿ"!BCþí """"" """"!"""" ""!"""!"!"!""2!#î 3ò " " "  "" "! " !"" "23!áàMã"""!"  ! "!  """"! ""2Þ4 àÝþ""""""  "! """ """""   """îÝáà!" "  "  !" "!""""" !"  ñð ! ! """"!!""!"ÿðð!!" "!! ""!ðððð!ðÿ!""" ó!"#""!!"!!!"#""""""!""""1ð"!"!"""""!""!"""""""!"""!"""!"""""ððÿ ""!""""ðþðÿð_ """!"à_ðÿðÿð"""""" !"ðÿåÿÿðÿ^"""""!"!"ÿïUóÿðàå^ï !""""! "!""!""!""_UïUïðÿÿððàUþïU !"""! " """""""î_5åUÿÿðU_UU !"!" """" """ñQ^õõððÿð_^å !"""""""!""""ðàþðÿðÿððÿÿ"!!"""""""""""ÿÿÿÿÿð""!" """""""""ððÿ!""""""""!ð ÿðð"""""""""â"ÿðððÿ""!"" """"" / ððÿ"" "" """"! ! #ðð"  """ð 2ðð """ðñðÿ" "!"ðâð"áðð"ñðî ð"ñÑðñÿðð"ÑÞÞáÿ ñòÝðñ ï ð ""ðÿñßÿ"Ò/"ð!ð #B1" îð2Ò ".âð""ñÿÿðñðñ #!òÓ1""!ÿ"ðñàþÒ!ò #ð"2#ÿ ñðð!" "ÝÒ0"""ððÿÿ#!/"ð"Ð!ä""ðÿð"ÿ!à!"ÿ0/!!"/ "!""# !!3ð/ "!"!ð ðÒ ñ ÿ!ÿ! "áBà!  ÿ""ñ!21#! !ðà!"ÿ!2ðáð #"ðð"ò!ððñ!"òÿ"ð"!!1"ðÿ.ð/ "ññÿÿð  "ñ#!!"ðñ òÿñ! " 0ðò! "ð " !ðBñ  ñÿñðð! # #!" 23ððð/""ð"2ð""# ! "!2"òÑñÿðñ "#!"" "ÿ  "2# "ñ!àÿð â3ð ð"ñ"!3ßñð3ÿÒððññ"/"1""ñBðñ1 ! Ð ð ""0 #"!/!!"ð !" ""2"" !ð"2!" """"!#îñ ""#!2"" "!þð" #" "!#"ñ!ñ3ÿ1" " 1!"/ ""ðð /""!ÿ " "!"ÿ!!"!"!#òð" ! "ò 2à"òðñÿÿ""ÿ! "!ÿ/ðÿ!""!!3ÿð!áÿÿÿÿ """!"" ð """ðñ!!!"!" """àðÿ"" "" !""ðð!!Óð!" "" ! !#"!"" ""!2!13ð"!! !!B!"!11ð! ""  !00 "  ""ð!"ð " !ðððÿñÿ"" "ð2"""" ðñðñ""!2"! " ""ð!ððñ"""!3"  /á-ñð "!" "àáñð"!ñÿ ððñðððÿñð"/!ÿÿð?"#!0#C2ô40#ô21ððÿA"#1?#3"30# ñð!ðÿðððððÿ" ððð!!!ððððð!"""  ""   "!" ""!" !" " !!" ""  ñ!"  !""  "" """  ! !oÜ-- title: ORC QUEST: THE LONG WAR -- author: ohwhatta -- desc: A brutal fantasy auto-run brawler. Smash, juggle, rage and survive the Long War. -- version: 1.0 -- script: lua -- input: gamepad -- ORC QUEST v0.17.2 CORPSE CLEANUP -- Z SMASH / X UPPERCUT / A RAGE G=104 GR=.32 state="title" p={}es={}ps={}ts={}waves={}spells={} ogre=nil boss=nil chief=nil seer=nil ogreOn=false bossOn=false chiefOn=false seerOn=false ogreDead=false bossDead=false chiefDead=false seerDead=false score=0 combo=0 ct=0 best=0 wx=0 time=0 dist=0 spawn=70 dead=false stop=0 shake=0 sx=0 sy=0 flash=0 rage=0 rt=0 area=1 banner=0 loop=1 win=0 title=0 upgrade=false reward=nil opts={}pending=1 upulse=0 bossesKilled=0 armorcd=0 blood=0 ups={fist=0,hide=0,upper=0,fury=0,chain=0,blood=0} rare={tyrant=false,volcano=false,bloodstorm=false,catapult=false,bombeater=false} syn={eruption=false,bloodarmor=false,powder=false,meteor=false} SPR=0x8000 ready=false audio=false OID=0 ORUN1=4 ORUN2=8 OSMASH1=12 OSMASH2=48 OUP1=52 OUP2=56 GOB=96 SPEAR=98 BOMB=100 BOAR=102 BOAR2=105 BOARH=108 OGRE=128 WAR=132 WAR2=137 GUARD=192 GOR=196 GOR2=201 function cl(v,a,b)if vb then return b end return v end function hit(a,b,c,d,e,f,g,h)return ashake then shake=n end end function txt(s,x,y,c)table.insert(ts,{s=s,x=x,y=y,t=35,c=c})end function mult()return rt>0 and 2 or 1 end function addR(n)if rt==0 then rage=math.min(100,rage+math.floor(n*(1+ups.fury*.3)))end end function cnt(t)local n=0 for _,v in pairs(t)do if v then n=n+1 end end return n end function canv(w,h)local a={}for i=1,w*h do a[i]=0 end return{w=w,h=h,a=a}end function cp(c,x,y,k)x=math.floor(x)y=math.floor(y)if x>=0 and y>=0 and x=dy then e=e+dy x1=x1+sx end if q<=dx then e=e+dx y1=y1+sy end end end function wb(id,c,w,h) for ty=0,h-1 do for tx=0,w-1 do local sid=id+ty*16+tx for y=0,7 do for x=0,7 do poke4(SPR+sid*64+y*8+x,c.a[(ty*8+y)*c.w+tx*8+x+1]or 0)end end end end end function orc(m) local c=canv(32,24)local l,r,by,hy=0,0,0,0 if m=="r1"then l=-2 r=2 by=1 elseif m=="r2"then l=2 r=-2 elseif m=="s1"then by=1 hy=1 elseif m=="u1"then by=3 hy=2 end cr(c,4,19+l,8,4,2)cr(c,14,19+r,8,4,2) cr(c,6,15+by,5,6+l,4)cr(c,15,15+by,5,6+r,4) cr(c,4,7+by,17,11,5)cr(c,7,8+by,10,9,4) ce(c,5,9+by,5,5,13)ce(c,20,9+by,5,5,13) cr(c,3,7+by,4,2,12)cr(c,18,7+by,4,2,12) cr(c,4,15+by,17,3,2)cr(c,10,15+by,5,3,10) ln(c,7,8+by,17,16+by,2) cr(c,8,hy,13,11,5)cr(c,12,7+hy,12,6,5)cr(c,7,hy,11,3,2) ln(c,14,3+hy,19,2+hy,2) cr(c,18,4+hy,2,2,10)cr(c,21,5+hy,3,3,4) cp(c,18,10+hy,12)cp(c,22,10+hy,12) ln(c,12,12+hy,10,16+hy,13)ln(c,22,12+hy,25,16+hy,13) if m=="i"or m=="r1"or m=="r2"then local y=9+by cr(c,19,y,8,5,5)cr(c,24,y,6,7,13)cr(c,27,y+2,4,4,12) elseif m=="s1"then cr(c,18,7,7,6,5)cr(c,22,4,7,9,13)cr(c,25,3,6,6,12) elseif m=="s2"then cr(c,18,8,11,6,5)cr(c,25,6,7,10,13)cr(c,28,8,4,6,12) elseif m=="u1"then cr(c,19,9,8,5,5)cr(c,23,8,6,7,13)cr(c,25,10,5,5,12) else cr(c,17,2,6,13,5)cr(c,16,0,10,7,13)cr(c,19,0,7,5,12)end return c end function gob(k) local c=canv(16,16) cr(c,2,13,5,3,2)cr(c,10,13,5,3,2)cr(c,4,9,3,5,4)cr(c,10,9,3,5,4) cr(c,3,5,11,7,6)cr(c,3,5,3,6,8)cr(c,3,10,11,2,2) cr(c,5,0,9,7,6)cr(c,12,3,4,3,6)ln(c,5,2,0,0,6)ln(c,0,0,4,5,6) cr(c,5,0,8,2,2)cp(c,11,2,10)cp(c,12,6,12) if k==1 then ln(c,2,11,15,3,12)ln(c,0,12,15,3,4) elseif k==2 then ce(c,3,11,3,3,2)ln(c,2,8,0,5,4)cp(c,0,4,10)end return c end function boar(f,h) local c=canv(24,16) if h then cr(c,4,7,4,5,2)cr(c,15,5,4,5,2) elseif f==1 then cr(c,3,10,5,5,2)cr(c,16,9,4,6,2) else cr(c,5,9,4,6,2)cr(c,14,11,5,4,2)end ce(c,10,8,10,6,14)cr(c,5,1,10,4,4)cr(c,15,3,7,9,14)cr(c,19,7,5,5,4) ln(c,16,3,18,0,4)ln(c,18,0,20,3,4) cp(c,18,5,8)cp(c,22,11,12)cp(c,23,10,12) return c end function ogArt() local c=canv(32,32) cr(c,3,27,10,5,2)cr(c,19,27,10,5,2)cr(c,6,20,7,9,4)cr(c,19,20,7,9,4) ce(c,16,16,13,11,6)cr(c,8,14,16,9,13)cr(c,6,21,20,3,2) cr(c,10,2,13,10,6)cr(c,8,9,17,7,6)cp(c,13,6,10)cp(c,20,6,10) ce(c,5,14,5,6,13)cr(c,23,10,7,7,6)ln(c,26,12,30,2,4)cr(c,26,0,6,6,2) return c end function warArt(f) local c=canv(40,32)local b=f and 8 or 14 cr(c,9,21,8,10,2)cr(c,27,21,8,10,2)cr(c,7,28,11,4,1)cr(c,26,28,11,4,1) ce(c,23,16,16,12,b)cr(c,15,23,17,4,4)cr(c,14,4,18,8,4) ce(c,8,18,9,10,b)cr(c,0,18,11,8,4)cr(c,8,12,4,3,f and 10 or 8) ln(c,3,24,0,28,12)ln(c,8,25,3,31,12) if not f then cr(c,15,5,20,9,13)cr(c,16,6,18,2,12) else ln(c,18,7,21,0,2)ln(c,29,8,32,1,2)ln(c,15,14,20,18,10)end return c end function guardArt() local c=canv(16,16) cr(c,3,12,4,4,2)cr(c,10,12,4,4,2)cr(c,4,6,9,7,5)cr(c,5,2,8,6,5) cr(c,4,1,9,2,2)cp(c,11,4,10)cr(c,0,4,7,11,13)cr(c,1,5,5,9,2) ln(c,13,7,15,12,12)return c end function gorArt(f) local c=canv(40,32)local s=f and 8 or 5 cr(c,7,25,9,7,2)cr(c,25,25,9,7,2)cr(c,9,18,7,10,4)cr(c,25,18,7,10,4) ce(c,20,17,15,13,s)cr(c,8,17,24,4,2)cr(c,16,20,8,4,10) cr(c,12,3,16,11,s)cr(c,10,10,20,8,s)cr(c,11,2,17,3,2) cp(c,16,7,10)cp(c,24,7,10)cp(c,12,15,12)cp(c,28,15,12) if not f then ce(c,5,13,6,8,13)cr(c,0,9,7,13,13)cr(c,1,10,5,11,2) ce(c,34,12,6,8,13)ln(c,33,12,39,3,4)cr(c,35,0,5,6,2) else ln(c,4,7,1,0,2)ln(c,36,7,39,0,2)cr(c,30,8,6,13,8) ln(c,34,9,39,0,4)cr(c,36,0,4,7,2)ln(c,13,16,18,20,10) end return c end function initSprites() wb(OID,orc("i"),4,3)wb(ORUN1,orc("r1"),4,3)wb(ORUN2,orc("r2"),4,3) wb(OSMASH1,orc("s1"),4,3)wb(OSMASH2,orc("s2"),4,3) wb(OUP1,orc("u1"),4,3)wb(OUP2,orc("u2"),4,3) wb(GOB,gob(0),2,2)wb(SPEAR,gob(1),2,2)wb(BOMB,gob(2),2,2) wb(BOAR,boar(1,false),3,2)wb(BOAR2,boar(2,false),3,2)wb(BOARH,boar(1,true),3,2) wb(OGRE,ogArt(),4,4)wb(WAR,warArt(false),5,4)wb(WAR2,warArt(true),5,4) wb(GUARD,guardArt(),2,2)wb(GOR,gorArt(false),5,4)wb(GOR2,gorArt(true),5,4) ready=true end SB=0xFF9C mt=0 tone=nil noise=nil function sa(c)return SB+18*c end function fv(c,f,v) f=cl(math.floor(f or 0),0,4095)v=cl(math.floor(v or 0),0,15)local a=sa(c) poke(a,f%256)poke(a+1,math.floor(f/256)+v*16) end function sw(c,i,v)poke(sa(c)+2+i,v)end function mute(c)fv(c,0,0)end function initAudio() for i=0,15 do sw(0,i,i<8 and 255 or 0)sw(1,i,i<4 and 255 or 0)sw(2,i,i<6 and 255 or 0)sw(3,i,0x88)end for c=0,3 do mute(c)end audio=true end E2=82 F2=87 G2=98 A2=110 B2=123 C3=131 D3=147 E3=165 F3=175 G3=196 A3=220 B3=247 mus={ {E3,G3,A3,G3,E3,D3,E3,G3},{E3,E3,G3,A3,G3,E3,D3,E3}, {D3,F3,G3,D3,F3,A3,G3,F3},{E3,F3,E3,D3,E3,G3,F3,D3}, {D3,F3,A3,F3,D3,C3,D3,A2},{C3,D3,F3,E3,C3,A2,D3,B2} } bas={ {E2,E2,C3,D3,E2,E2,D3,B2},{E2,E2,G2,A2,G2,E2,D3,E2}, {D3,D3,F2,C3,D3,D3,C3,D3},{E2,E2,D3,C3,E2,D3,C3,B2}, {D3,D3,F2,D3,C3,C3,D3,A2},{C3,C3,D3,C3,F2,D3,C3,B2} } function toneS(f,d,v,s)tone={f=f,t=d,m=d,v=v,s=s or 0}end function noiseS(f,d,v,s)noise={f=f,t=d,m=d,v=v,s=s or 0}for i=0,15 do sw(3,i,math.random(2)==1 and 255 or 0)end end function sHit()toneS(95,5,12,-8)noiseS(520,5,12,-60)end function sBoom()toneS(90,13,12,-5)noiseS(950,15,15,-75)end function sHurt()toneS(80,12,10,-5)noiseS(300,8,10,-25)end function sParry()toneS(420,11,15,-28)noiseS(900,10,15,-90)end function sMagic()toneS(360,18,10,-10)noiseS(240,7,5,18)end function updMusic() if state=="title"then if title%18<8 then fv(0,E3,3)else mute(0)end if title%36<5 then fv(1,E2,2)else mute(1)end return end if dead then mute(0)mute(1)return end if upgrade then if time%28<6 then fv(0,E3,2)else mute(0)end mute(1)return end local a=area local sp=({12,10,11,9,8,7})[a] if ogreOn then sp=8 elseif bossOn then sp=boss.phase==2 and 7 or 10 elseif chiefOn then sp=7 elseif seerOn then sp=seer.phase==2 and 6 or 8 end mt=mt+1 local i=math.floor(mt/sp)%8+1 local m=mus[a]or mus[6]local b=bas[a]or bas[6] if mt%sp0 and ups.hide>0 end if k=="volcano"then return ups.upper>=2 end if k=="bloodstorm"then return ups.fury>=2 end if k=="catapult"then return ups.chain>=2 end return ups.blood>0 and ups.chain>0 end function choice() local a={}for i=1,#rd do if rareReady(i)then table.insert(a,i)end end if #a>0 and math.random(100)<=32 then return{t=1,id=a[math.random(#a)]}end return{t=0,id=math.random(#ud)} end function same(a,b)return a.t==b.t and a.id==b.id end function checkSyn() local made=false if not syn.eruption and rare.volcano and rare.catapult then syn.eruption=true txt("ERUPTION CHAIN!",55,43,10)made=true end if not syn.bloodarmor and rare.tyrant and rare.bloodstorm then syn.bloodarmor=true txt("BLOOD ARMOR!",70,43,8)made=true end if not syn.powder and rare.bombeater and rare.catapult then syn.powder=true txt("POWDER KEG!",74,43,10)made=true end if not syn.meteor and ups.fist>=2 and ups.upper>=2 then syn.meteor=true txt("ORC METEOR!",72,43,12)made=true end if made then fire(p.x+10,p.y+8,25)sParry()sh(9)flash=3 end end function beginUp(a) upgrade=true reward=nil pending=a es={}waves={}spells={} local x=choice()local y=choice()local n=0 while same(x,y)and n<20 do y=choice()n=n+1 end opts={x,y}upulse=0 end function beginReward(k,a) upgrade=true reward=k pending=a es={}waves={}spells={} local x=math.random(#br)local y=math.random(#br) while y==x do y=math.random(#br)end opts={{t=2,id=x},{t=2,id=y}}upulse=0 end function takeUp(i) local o=opts[i]local d if o.t==2 then d=br[o.id] if d.k=="fang"then ups.fist=ups.fist+1 rage=math.min(100,rage+30) elseif d.k=="heart"then p.max=p.max+1 p.hp=math.min(p.max,p.hp+3) elseif d.k=="drum"then ups.fury=ups.fury+1 rage=math.min(100,rage+40) else ups.upper=ups.upper+1 ups.chain=ups.chain+1 end elseif o.t==1 then d=rd[o.id]rare[d.k]=true if d.k=="tyrant"then p.max=p.max+2 p.hp=math.min(p.max,p.hp+2)end else d=ud[o.id]ups[d.k]=ups[d.k]+1 if d.k=="hide"then p.max=p.max+1 p.hp=math.min(p.max,p.hp+2)end end txt(d.n.."!",75,48,10)fire(p.x+10,p.y+8,16)checkSyn() local r=reward reward=nil upgrade=false if r=="BONESEER"then win=220 else area=pending banner=120 spawn=75 end end function updUp() upulse=upulse+1 updParts() if btnp(4)then takeUp(1)elseif btnp(5)then takeUp(2)end end function reset() p={x=45,y=G-24,vy=0,hp=5,max=5,a=0,at=0,hurt=0,run=0,airUpper=false,meteor=0,meteorHit=false} es={}ps={}ts={}waves={}spells={} score=0 combo=0 ct=0 best=0 wx=0 time=0 dist=0 spawn=70 dead=false stop=0 shake=0 flash=0 rage=0 rt=0 area=1 banner=120 loop=1 win=0 ogre=nil boss=nil chief=nil seer=nil ogreOn=false bossOn=false chiefOn=false seerOn=false ogreDead=false bossDead=false chiefDead=false seerDead=false upgrade=false reward=nil opts={}pending=1 bossesKilled=0 armorcd=0 blood=0 ups={fist=0,hide=0,upper=0,fury=0,chain=0,blood=0} rare={tyrant=false,volcano=false,bloodstorm=false,catapult=false,bombeater=false} syn={eruption=false,bloodarmor=false,powder=false,meteor=false} end function start()reset()state="play"toneS(E3,10,10,15)end function areaName() return({"ASHWOOD TRAIL","RAZORTUSK CAMP","SKULLBRIDGE","WARBOAR DEN","BLACKFANG KEEP","THE BURNING PLAIN"})[area] end function updateArea() local n=dist<1200 and 1 or dist<2400 and 2 or dist<3600 and 3 or dist<4800 and 4 or dist<6000 and 5 or 6 if n~=area and not upgrade and not ogreOn and not bossOn and not chiefOn and not seerOn then beginUp(n)end end function speed()return 1.5+(loop-1)*.25+math.min(time/4500,.8)end function addE(t,off) local e={type=t,x=250+(off or 0),y=G-15,vy=0,hit=false,danger=true,cd=0,anim=math.random(20),vx=-speed()} if t=="rider"then e.vx=e.vx-.2 elseif t=="spear"then e.vx=-speed()*.82 e.ai="run"e.ait=0 elseif t=="armor"then e.vx=-speed()*.88 e.armor=1 e.rec=0 elseif t=="bomb"then e.vx=-speed()*.9 e.fuse=170+math.random(35) elseif t=="guard"then e.vx=-speed()*.65 e.ai="march"e.ait=0 e.shield=1 elseif t=="shaman"then e.vx=-speed()*.55 e.ai="walk"e.ait=0 end if loop>=2 and math.random(100)<=18+math.min(loop*3,18)then e.elite=true e.vx=e.vx*1.22 end table.insert(es,e) end function addGob(x,y,vx,vy)table.insert(es,{type="gob",x=x,y=y,vx=vx,vy=vy,hit=false,danger=false,cd=0,anim=0})end function spawnOne(off) local r=math.random(100) if area==1 then if r<42 then addE("boar",off)elseif r<63 then addE("rider",off)elseif r<83 then addE("spear",off)else addE("armor",off)end elseif area==2 then if r<20 then addE("boar",off)elseif r<45 then addE("rider",off)elseif r<66 then addE("spear",off)elseif r<84 then addE("armor",off)else addE("bomb",off)end elseif area==3 then if r<16 then addE("boar",off)elseif r<34 then addE("rider",off)elseif r<55 then addE("spear",off)elseif r<76 then addE("armor",off)else addE("bomb",off)end elseif area==4 then if r<30 then addE("boar",off)elseif r<56 then addE("armor",off)elseif r<79 then addE("bomb",off)else addE("rider",off)end elseif area==5 then if r<34 then addE("guard",off)elseif r<53 then addE("armor",off)elseif r<73 then addE("spear",off)elseif r<89 then addE("bomb",off)else addE("rider",off)end else if r<29 then addE("shaman",off)elseif r<49 then addE("guard",off)elseif r<68 then addE("spear",off)elseif r<85 then addE("bomb",off)else addE("armor",off)end end end function spawnPack() local n if area==1 then local r=math.random(100)n=r<18 and 1 or r<80 and 2 or 3 elseif area==2 then n=math.random(100)<30 and 3 or 2 else n=math.random(100)<60 and 3 or 2 end if loop>=2 and math.random(100)<30 then n=3 end for i=1,n do spawnOne((i-1)*26+math.random(0,8))end if n>=3 then txt("WAR PACK!",177,70,area>=5 and 8 or 13)end end function addCombo(v,x,y) combo=combo+1 best=math.max(best,combo)ct=110 local n=(v+math.min(combo*10,250))*mult()score=score+n txt("+"..n,x,y,10)addR(6) if ups.blood>0 then blood=blood+1 if blood>=math.max(3,7-ups.blood)then blood=0 if p.hp0 and 8 or 9)and p.at>=3 end if p.a==2 then return p.at<=(rt>0 and 9 or 11)and p.at>=3 end return false end function launch(e) local q=rt>0 and 1.55 or 1 if p.a==2 then q=q*(1+ups.upper*.2)*(rare.volcano and 1.25 or 1)end if p.meteorHit then q=q*1.28 end local light=e.type=="gob"or e.type=="spear"or e.type=="bomb"or e.type=="guard"or e.type=="shaman" if p.a==1 then e.vx=(light and 6.5 or 5.3)*q e.vy=(light and -3.2 or -2.6)*q else e.vx=(light and 3.2 or 2.7)*q e.vy=(light and -8 or -6.5)*q end end function normalSmack(e) e.hit=true e.danger=false e.deadT=180 if e.type=="rider"then addGob(e.x+7,e.y-13,2.5,-5.5)e.type="boar" txt("DISMOUNT!",e.x-10,e.y-18,9)addCombo(150,e.x,e.y-10) elseif e.type=="gob"or e.type=="spear"or e.type=="bomb"or e.type=="guard"or e.type=="shaman"then addCombo(175+(e.elite and 100 or 0),e.x,e.y-10) else addCombo(100+(e.elite and 100 or 0),e.x,e.y-10)end launch(e) if e.type=="bomb"and rare.bombeater then e.friendly=true txt("ARMED!",e.x,e.y-22,10)end burst(e.x+8,e.y+6,e.elite and 20 or 14,12)lines(e.x+15,e.y+8,4) if p.a==2 and rare.volcano then fire(e.x+8,e.y+8,16)txt("ERUPT!",e.x,e.y-22,8)end if p.meteorHit then fire(e.x+5,G-2,16)txt("METEOR!",e.x-2,e.y-22,10)sh(9)end sHit()stop=4 flash=2 sh(rt>0 and 7 or 4) end function smack(e) if e.hit then return end if e.type=="guard"and e.shield==1 and p.a==1 and e.ai~="swing"then e.vx=1.8 e.ait=0 txt("BLOCK!",e.x-3,e.y-18,13)burst(e.x+2,e.y+7,10,13) toneS(180,5,8,-20)stop=3 sh(3)return end if e.type=="guard"and e.shield==1 and p.a==2 then e.shield=0 txt("SHIELD BREAK!",e.x-12,e.y-20,10)burst(e.x+4,e.y+8,18,13)lines(e.x+5,e.y+7,5) end if e.type=="armor"and e.armor==1 then if rare.tyrant then e.armor=0 txt("TYRANT CRUSH!",e.x-12,e.y-18,10)burst(e.x+8,e.y+6,22,13) normalSmack(e)stop=6 flash=3 sh(9)return end e.armor=0 e.hit=true e.danger=false e.rec=22 e.vx=2.2 e.vy=-1.5 txt("ARMOR CRACK!",e.x-10,e.y-18,10)burst(e.x+8,e.y+6,18,12)lines(e.x+18,e.y+8,5) addCombo(75,e.x,e.y-10)sBoom()stop=5 flash=2 sh(6)return end normalSmack(e) end function tryE(e) if e.hit or not active()then return end local x,y,w,h if p.a==1 then x=p.x+15 y=p.y+5 w=31+ups.fist*4+(p.meteorHit and 8 or 0)h=16 else x=p.x+10 y=p.y-8 w=23 h=32 end if hit(x,y,w,h,e.x,e.y,22,16)then smack(e)end end function hurt(s) if p.hurt>0 then return end if syn.bloodarmor and rt>0 and armorcd<=0 then armorcd=120 txt("BLOOD ARMOR!",p.x-8,p.y-20,10)fire(p.x+10,p.y+10,18)sParry()sh(8)stop=5 return end p.hp=p.hp-1 p.hurt=75 combo=0 ct=0 txt(s,p.x-4,p.y-14,8)burst(p.x+10,p.y+10,16,8)addR(20)sHurt()sh(8)stop=6 flash=3 if p.hp<=0 then dead=true end end function updPlayer() p.run=p.run+1 if armorcd>0 then armorcd=armorcd-1 end if p.meteor>0 then p.meteor=p.meteor-1 end if p.hurt>0 then p.hurt=p.hurt-1 end if p.at>0 then p.at=p.at-1 if p.at<=0 then p.a=0 p.meteorHit=false end end if rage>=100 and rt==0 and btnp(6)then rage=0 rt=300 if rare.bloodstorm and p.hp0 and 9 or 13 p.meteorHit=syn.meteor and p.meteor>0 if p.meteorHit then p.meteor=0 burst(p.x+24,G-3,18,10)noiseS(750,8,12,-60)sh(7)end toneS(150,5,10,-14) end if btnp(5)and p.a==0 then p.a=2 p.at=rt>0 and 11 or 16 p.airUpper=true if p.y>=G-24 then p.vy=(rt>0 and -4.1 or -3.2)-(rare.volcano and .7 or 0)dust(p.x+10)if rare.volcano then fire(p.x+10,G-3,9)end end toneS(190,7,9,35) end p.vy=p.vy+GR p.y=p.y+p.vy if p.y>G-24 then if p.vy>2 then dust(p.x+10)end if p.airUpper and syn.meteor then p.meteor=55 txt("METEOR READY",p.x-9,p.y-13,12)end p.airUpper=false p.y=G-24 p.vy=0 end end function explode(e) local safe=rare.bombeater and e.friendly local rad=safe and(syn.powder and 72 or 54)or 38 burst(e.x+8,e.y+6,safe and 42 or 30,8)lines(e.x+8,e.y+8,safe and 11 or 7) txt(safe and(syn.powder and"POWDER KEG!"or"MEGA BOOM!")or"BOOM!",e.x-5,e.y-20,10) sBoom()sh(safe and 13 or 10)flash=3 stop=5 if not safe and math.abs(p.x-e.x)<34 and math.abs(p.y-e.y)<28 then hurt("BLASTED!")end for _,b in ipairs(es)do if b~=e and not b.hit and math.abs(b.x-e.x)42 then e.ai="walk"e.ait=0 e.vx=-speed()*.55 end end function spearAI(e) if e.hit then return end e.ait=e.ait+1 if e.ai=="run"and e.x<138 then e.ai="wind"e.ait=0 e.vx=0 txt("THRUST!",e.x-8,e.y-15,9) elseif e.ai=="wind"and e.ait>18 then e.ai="lunge"e.ait=0 e.vx=-5.2-loop*.15 toneS(300,5,8,-30) elseif e.ai=="lunge"and e.ait>14 then e.ai="recover"e.ait=0 e.vx=0 elseif e.ai=="recover"and e.ait>18 then e.ai="run"e.ait=0 e.vx=-speed()*.82 end end function guardAI(e) if e.hit then return end e.ait=e.ait+1 if e.ai=="march"and e.x<142 then e.ai="wind"e.ait=0 e.vx=0 txt("AXE!",e.x,e.y-17,8) elseif e.ai=="wind"and e.ait>20 then e.ai="swing"e.ait=0 e.vx=-4.5 elseif e.ai=="swing"and e.ait>10 then e.ai="recover"e.ait=0 e.vx=0 elseif e.ai=="recover"and e.ait>18 then e.ai="march"e.ait=0 e.vx=-speed()*.65 end end function chains() for i=1,#es do local a=es[i] if a.hit and math.abs(a.vx)>2 and a.cd<=0 then for j=1,#es do local b=es[j] if i~=j and not b.hit and hit(a.x,a.y,22,16,b.x,b.y,22,16)then local q=(1+ups.chain*.18)*(rare.catapult and 1.3 or 1)*(syn.eruption and 1.18 or 1) b.hit=true b.danger=false b.deadT=180 b.vx=(a.vx*.8+1)*q b.vy=(-3.5-math.random()*2)*q-(syn.eruption and 2.4 or 0) a.vx=a.vx*.65 a.vy=-2 a.cd=8 if b.type=="rider"then addGob(b.x+7,b.y-12,3.5*q,-6*q)b.type="boar"end burst(b.x+8,b.y+6,rare.catapult and 25 or 14,12)lines(b.x+10,b.y+6,rare.catapult and 10 or 6) if rare.catapult then fire(b.x+8,b.y+7,syn.eruption and 18 or 8)txt(syn.eruption and"ERUPTION!"or"MEAT BOMB!",b.x-7,b.y-23,10)end addCombo(150+ups.chain*50+(rare.catapult and 150 or 0)+(syn.eruption and 100 or 0),b.x,b.y-10) txt("CHAIN!",b.x-4,b.y-18,8)sh(5+ups.chain+(rare.catapult and 4 or 0))break end end end end end function updEnemies() for i=#es,1,-1 do local e=es[i]local rem=false e.anim=e.anim+1 if e.cd>0 then e.cd=e.cd-1 end if e.type=="spear"then spearAI(e)elseif e.type=="guard"then guardAI(e)elseif e.type=="shaman"then shamanAI(e)end if e.type=="bomb"then e.fuse=e.fuse-1 if e.fuse==45 and not e.hit then txt("TICK!",e.x,e.y-15,8)end if e.fuse<=0 then explode(e)table.remove(es,i)rem=true end end if not rem then if e.type=="armor"and e.rec and e.rec>0 then e.rec=e.rec-1 if e.rec<=0 then e.hit=false e.danger=true e.vx=-speed()*.9 end end e.vy=e.vy+.25 e.x=e.x+e.vx e.y=e.y+e.vy if e.y>G-15 then e.y=G-15 if e.hit then e.vy=-e.vy*.25 e.vx=e.vx*.94 else e.vy=0 end end if p.a>0 then tryE(e)end if e.danger and p.hurt==0 and hit(p.x+4,p.y+4,18,20,e.x+2,e.y+2,19,14)then hurt(e.type=="guard"and"CLEAVED!"or e.elite and"ELITE HIT!"or"OUCH!") e.hit=true e.danger=false e.deadT=150 e.vx=3.5 e.vy=-3.5 end if e.deadT then e.deadT=e.deadT-1 end if(e.deadT and e.deadT<=0)or e.x<-50 or e.x>340 or e.y<-80 then table.remove(es,i) end end end chains() end function spellHit(s) if not active()or p.a~=1 then return false end return hit(p.x+15,p.y+5,31+ups.fist*4+(p.meteorHit and 8 or 0),16,s.x-6,s.y-6,12,12) end function updSpells() for i=#spells,1,-1 do local s=spells[i]local rem=false if s.type=="skull"then s.x=s.x+s.vx s.t=s.t-1 if spellHit(s)then txt("DISPEL!",s.x-7,s.y-12,10)burst(s.x,s.y,12,12)lines(s.x,s.y,5)toneS(450,5,10,-40)rem=true elseif p.hurt==0 and hit(p.x,p.y,22,22,s.x-4,s.y-4,8,8)then hurt("HEXED!")rem=true elseif s.x<-20 or s.t<=0 then rem=true end elseif s.type=="curse"then if s.t>0 then s.t=s.t-1 if s.t==0 then s.b=12 burst(s.x,G-2,12,13)noiseS(500,8,9,-30)end else s.b=s.b-1 if s.b==10 and p.hurt==0 and p.y>G-34 and math.abs(p.x+10-s.x)<13 then hurt("BONE CURSE!")end if s.b<=0 then rem=true end end else s.x=s.x+s.vx s.t=s.t-1 if spellHit(s)then txt("SPIRIT BREAK!",s.x-10,s.y-14,10)fire(s.x,s.y+10,20)sParry()sh(9)rem=true elseif p.hurt==0 and hit(p.x,p.y,22,22,s.x,s.y,32,23)then hurt("MAULED!")rem=true elseif s.x<-40 or s.t<=0 then rem=true end end if rem then table.remove(spells,i)end end end function spawnOgre() ogreOn=true ogre={x=255,y=G-31,vx=-1.1,vy=0,hp=8+(loop-1)*2,max=8+(loop-1)*2,s="enter",t=0,hit=0} es={}waves={}spells={}txt("OGRE GATEBREAKER!",65,45,8)toneS(70,28,11,-1)sh(6) end function dmgOgre() if not ogreOn or ogre.hit>0 or not active()then return false end local x,y,w,h if p.a==1 then x=p.x+15 y=p.y+4 w=32+ups.fist*4+(p.meteorHit and 8 or 0)h=18 else x=p.x+9 y=p.y-8 w=25 h=33 end if not hit(x,y,w,h,ogre.x,ogre.y,32,32)then return false end local d=1+(p.a==1 and math.floor(ups.fist/2)or 0)+(rt>0 and 1 or 0)+(rare.tyrant and p.a==1 and 1 or 0)+(rare.volcano and p.a==2 and 1 or 0)+(p.meteorHit and 1 or 0) ogre.hp=ogre.hp-d ogre.hit=14 ogre.x=math.min(ogre.x+2,82) burst(ogre.x+4,ogre.y+14,16,12)lines(ogre.x+10,ogre.y+14,6) if rare.volcano and p.a==2 then fire(ogre.x+8,ogre.y+12,15)end if p.meteorHit then fire(ogre.x+8,G-2,18)end addCombo(225,ogre.x,ogre.y-8)txt("WHAM!",ogre.x,ogre.y-18,10)sHit()stop=5 flash=2 sh(7) if ogre.hp<=0 then ogre.hp=0 ogre.s="die"ogre.t=0 ogre.vx=2 ogre.vy=-5 score=score+1200*loop txt("GATEBREAKER DOWN!",62,48,10)sBoom()sh(12)stop=10 flash=4 end return true end function makeWave(x,v)table.insert(waves,{x=x,y=G-7,vx=v,l=60})end function updWaves() for i=#waves,1,-1 do local w=waves[i]w.x=w.x+w.vx w.l=w.l-1 if p.hurt==0 and p.y>G-32 and hit(p.x+4,p.y+15,18,9,w.x,w.y,13,7)then hurt("SHOCKED!")w.l=0 end if w.l<=0 or w.x<-20 then table.remove(waves,i)end end end function updOgre() if ogre.hit>0 then ogre.hit=ogre.hit-1 end ogre.t=ogre.t+1 if ogre.s=="die"then ogre.vy=ogre.vy+.25 ogre.x=ogre.x+ogre.vx ogre.y=ogre.y+ogre.vy if ogre.y>G-31 then ogre.y=G-31 ogre.vy=-math.abs(ogre.vy)*.35 end if ogre.t>70 then ogreOn=false ogreDead=true bossesKilled=bossesKilled+1 ogre=nil waves={} p.hp=math.min(p.max,p.hp+1)rage=math.min(100,rage+25)txt("BRIDGE CLEARED!",73,50,10) end return end dmgOgre() if ogre.s=="enter"then ogre.x=ogre.x+ogre.vx if ogre.x<=78 then ogre.x=78 ogre.vx=0 ogre.s="wait"ogre.t=0 end elseif ogre.s=="wait"then if ogre.x>78 then ogre.x=math.max(78,ogre.x-.5)end if ogre.t>50 then ogre.s="wind"ogre.t=0 txt("CLUB UP!",ogre.x-3,ogre.y-18,9)end elseif ogre.s=="wind"and ogre.t>30 then ogre.s="slam"ogre.t=0 elseif ogre.s=="slam"then if ogre.t==3 then makeWave(ogre.x,-5.2-loop*.15)dust(ogre.x+5)dust(ogre.x+22)noiseS(700,12,13,-50)sh(10)flash=2 end if ogre.t>16 then ogre.s="open"ogre.t=0 txt("OPEN!",ogre.x+1,ogre.y-18,10)end elseif ogre.s=="open"and ogre.t>42 then ogre.x=78 ogre.s="wait"ogre.t=0 end end function spawnBoss() bossOn=true boss={x=260,y=G-31,vx=-.7,vy=0,hp=16+(loop-1)*4,max=16+(loop-1)*4,phase=1,s="enter",t=0,hit=0,atk=false,dead=0} es={}spells={}txt("WARBOAR!",100,45,8)toneS(85,30,10,-1) end function dmgBoss() if not bossOn or boss.hit>0 or not active()or boss.s=="die"or boss.s=="break"or boss.s=="recoil"or boss.s=="back"then return false end local x,y,w,h if p.a==1 then x=p.x+15 y=p.y+4 w=32+ups.fist*4+(p.meteorHit and 8 or 0)h=18 else x=p.x+9 y=p.y-8 w=25 h=33 end if not hit(x,y,w,h,boss.x,boss.y,40,32)then return false end local d=1+(p.a==1 and ups.fist or 0)+(rt>0 and 1 or 0)+(rare.tyrant and p.a==1 and 1 or 0)+(rare.volcano and p.a==2 and 1 or 0)+(p.meteorHit and 1 or 0) boss.hp=boss.hp-d boss.hit=16 addCombo(250,boss.x,boss.y-10)burst(boss.x+5,boss.y+12,16,12)lines(boss.x+8,boss.y+12,7) if rare.volcano and p.a==2 then fire(boss.x+5,boss.y+12,16)end if p.meteorHit then fire(boss.x+8,G-3,20)end if boss.s=="charge"then boss.s="recoil"boss.t=0 boss.vx=3.4 boss.vy=-2 boss.atk=true txt("PARRY!",boss.x-4,boss.y-25,10) sParry()stop=10 flash=4 sh(12) else boss.x=math.min(boss.x+3,200) if p.a==2 then boss.vy=-2.5*(1+ups.upper*.12+(rare.volcano and .25 or 0))end txt("CRUNCH!",boss.x-2,boss.y-18,10)sHit()stop=6 flash=3 sh(8) end if boss.hp>0 and boss.phase==1 and boss.hp<=boss.max/2 then boss.phase=2 boss.s="break"boss.t=0 boss.hit=50 boss.vy=-2.8 burst(boss.x+16,boss.y+8,35,13) txt("ARMOR BREAK!",boss.x-20,boss.y-24,10)txt("BLOOD FURY!",boss.x-8,boss.y-35,8)sBoom()stop=12 flash=5 sh(12) end if boss.hp<=0 then boss.hp=0 boss.s="die"boss.dead=0 boss.vx=1.5 boss.vy=-5 score=score+2500*loop txt("WARBOAR FALLS!",76,45,10)sBoom()stop=15 flash=6 sh(14) end return true end function updBoss() if boss.s=="die"then boss.dead=boss.dead+1 boss.vy=boss.vy+.2 boss.x=boss.x+boss.vx boss.y=boss.y+boss.vy if boss.y>G-31 then boss.y=G-31 boss.vy=-math.abs(boss.vy)*.45 end if boss.dead>95 then bossOn=false bossDead=true bossesKilled=bossesKilled+1 boss=nil dist=4800 beginReward("WARBOAR",5)end return end if boss.hit>0 then boss.hit=boss.hit-1 end boss.t=boss.t+1 boss.vy=boss.vy+.25 boss.y=boss.y+boss.vy if boss.y>G-31 then boss.y=G-31 boss.vy=0 end if boss.s=="enter"then boss.x=boss.x+boss.vx if boss.x<=180 then boss.x=180 boss.vx=0 boss.s="wait"boss.t=0 end elseif boss.s=="wait"then dmgBoss() if boss.phase==1 then if boss.t==30 then txt("SNORT!",boss.x,boss.y-10,12)noiseS(120,12,11,15)end if boss.t>75 then boss.s="charge"boss.t=0 boss.vx=-4.2-loop*.2 boss.atk=false end else if boss.t==14 then txt("SNORT!",boss.x,boss.y-12,8)end if boss.t==28 then if math.random(100)<=35 then boss.s="fake"boss.t=0 txt("...?",boss.x+5,boss.y-16,12) else boss.s="charge"boss.t=0 boss.vx=-5.7-loop*.25 boss.atk=false end end end elseif boss.s=="fake"then dmgBoss()if boss.t==18 then txt("NOW!",boss.x,boss.y-16,8)end if boss.t>27 then boss.s="charge"boss.t=0 boss.vx=-5.7-loop*.25 boss.atk=false end elseif boss.s=="charge"then boss.x=boss.x+boss.vx local par=dmgBoss() if not par and boss.s=="charge"and not boss.atk and hit(p.x+3,p.y+3,19,21,boss.x,boss.y,40,31)then boss.atk=true hurt("SMASHED!")end if boss.s=="charge"and boss.x<-42 then boss.x=-42 boss.s="return"boss.t=0 boss.vx=boss.phase==1 and 3.3 or 4.4 end elseif boss.s=="recoil"then boss.x=boss.x+boss.vx boss.vx=boss.vx*.82 if boss.x>=84 or boss.t>12 then boss.x=cl(boss.x,78,84)boss.s="stun"boss.t=0 boss.vx=0 txt("STUNNED!",boss.x-5,boss.y-16,9)end elseif boss.s=="return"then boss.x=boss.x+boss.vx if boss.x>=175 then boss.x=175 boss.vx=0 boss.s="wait"boss.t=0 end elseif boss.s=="stun"then dmgBoss() if boss.t>(boss.phase==1 and 65 or 38)then boss.s="back"boss.t=0 boss.vx=boss.phase==1 and 3 or 3.8 end elseif boss.s=="back"then boss.x=boss.x+boss.vx if boss.x>=175 then boss.x=175 boss.vx=0 boss.s="wait"boss.t=0 end elseif boss.s=="break"then boss.x=math.min(175,boss.x+2.5) if boss.t==20 then burst(boss.x+15,boss.y+8,25,13)end if boss.t>70 then boss.x=175 boss.s="wait"boss.t=0 boss.hit=0 end end end function spawnChief() chiefOn=true chief={x=260,y=G-31,vx=-.9,vy=0,hp=24+(loop-1)*5,max=24+(loop-1)*5,phase=1,s="enter",t=0,hit=0,atk=false,dead=0} es={}waves={}spells={}txt("GORVAK THE IRONJAW",60,44,8)toneS(60,35,13,2)noiseS(130,20,10,7)sh(10) end function dmgChief() if not chiefOn or chief.hit>0 or not active()or chief.s=="die"or chief.s=="break"or chief.s=="rush"or chief.s=="slam"then return false end local x,y,w,h if p.a==1 then x=p.x+15 y=p.y+4 w=32+ups.fist*4+(p.meteorHit and 8 or 0)h=18 else x=p.x+9 y=p.y-8 w=25 h=33 end if not hit(x,y,w,h,chief.x,chief.y,40,32)then return false end if chief.phase==1 and chief.s~="open"and p.a==1 then txt("IRON GUARD!",chief.x-12,chief.y-20,13)burst(chief.x+4,chief.y+12,10,13)toneS(170,5,8,-10)stop=3 sh(3)return false end local d=1+(p.a==1 and math.floor(ups.fist/2)or 0)+(p.a==2 and math.floor(ups.upper/2)or 0)+(rt>0 and 1 or 0)+(rare.tyrant and p.a==1 and 1 or 0)+(rare.volcano and p.a==2 and 1 or 0)+(p.meteorHit and 1 or 0) chief.hp=chief.hp-d chief.hit=14 chief.x=math.min(chief.x+2,82) addCombo(300,chief.x,chief.y-10)burst(chief.x+8,chief.y+12,18,12)lines(chief.x+8,chief.y+12,7) if rare.volcano and p.a==2 then fire(chief.x+8,chief.y+12,16)end if p.meteorHit then fire(chief.x+10,G-3,22)end sHit()stop=5 flash=2 sh(8) if chief.hp>0 and chief.phase==1 and chief.hp<=chief.max/2 then chief.phase=2 chief.s="break"chief.t=0 chief.hit=60 txt("IRONJAW BREAKS!",chief.x-18,chief.y-25,10) fire(chief.x+15,chief.y+10,22)sBoom()sh(13)flash=5 end if chief.hp<=0 then chief.hp=0 chief.s="die"chief.dead=0 chief.vx=2.2 chief.vy=-5 score=score+5000*loop txt("IRONJAW FALLS!",70,45,10)sBoom()sh(15)stop=12 flash=6 end return true end function chiefAttack() local r=math.random(100) if chief.phase==1 then chief.s=r<45 and"cleave"or r<75 and"rush"or"slam" else chief.s=r<35 and"cleave"or r<65 and"rush"or"slam"end chief.t=0 chief.atk=false if chief.s=="cleave"then txt("CLEAVER!",chief.x-4,chief.y-18,8) elseif chief.s=="rush"then txt("IRON RUSH!",chief.x-8,chief.y-18,9)chief.vx=chief.phase==1 and -4.8 or -6 else txt("EXECUTION!",chief.x-10,chief.y-20,8)end end function updChief() if chief.hit>0 then chief.hit=chief.hit-1 end chief.t=chief.t+1 if chief.s=="die"then chief.vy=chief.vy+.25 chief.x=chief.x+chief.vx chief.y=chief.y+chief.vy if chief.y>G-31 then chief.y=G-31 chief.vy=-math.abs(chief.vy)*.3 end if chief.dead%10==0 then burst(chief.x+18,chief.y+12,14,8)end chief.dead=chief.dead+1 if chief.dead>100 then chiefOn=false chiefDead=true bossesKilled=bossesKilled+1 chief=nil dist=6000 beginReward("GORVAK",6)end return end chief.vy=chief.vy+.25 chief.y=chief.y+chief.vy if chief.y>G-31 then chief.y=G-31 chief.vy=0 end dmgChief() if chief.s=="enter"then chief.x=chief.x+chief.vx if chief.x<=78 then chief.x=78 chief.vx=0 chief.s="wait"chief.t=0 end elseif chief.s=="wait"then if chief.x>78 then chief.x=math.max(78,chief.x-.7)end if chief.t>45 then chiefAttack()end elseif chief.s=="cleave"then if chief.t==18 then if p.hurt==0 and p.y>G-36 and hit(p.x+4,p.y+5,19,20,chief.x-12,chief.y+6,30,18)then hurt("CLEAVED!")end noiseS(500,5,10,-40)sh(7) end if chief.t>28 then chief.s="open"chief.t=0 end elseif chief.s=="rush"then chief.x=chief.x+chief.vx if not chief.atk and hit(p.x+3,p.y+3,19,21,chief.x,chief.y,40,31)then local par=active()and p.a==1 if par then chief.atk=true chief.vx=4 chief.s="open"chief.t=0 chief.x=80 txt("GUARD BREAK!",chief.x-8,chief.y-22,10)sParry()sh(12)stop=8 else chief.atk=true hurt("RAMMED!")end end if chief.x<-45 then chief.x=-45 chief.s="return"chief.vx=4.5 chief.t=0 end elseif chief.s=="return"then chief.x=chief.x+chief.vx if chief.x>=170 then chief.x=170 chief.s="wait"chief.vx=0 chief.t=0 end elseif chief.s=="slam"then if chief.t==24 then makeWave(chief.x,-6.2)if chief.phase==2 then makeWave(chief.x+8,-4.2)end dust(chief.x+8)noiseS(800,12,14,-55)sh(12)flash=3 end if chief.t>38 then chief.s="open"chief.t=0 end elseif chief.s=="open"then dmgChief()if chief.t>38 then chief.s="wait"chief.t=0 end elseif chief.s=="break"then if chief.t==20 then burst(chief.x+15,chief.y+8,30,13)end if chief.t>60 then chief.s="wait"chief.t=0 chief.hit=0 chief.x=78 end end end function spawnSeer() seerOn=true seer={x=245,y=G-30,hp=30+(loop-1)*6,max=30+(loop-1)*6,phase=1,s="enter",t=0,hit=0,dead=0} es={}waves={}spells={}txt("MORVAK THE BONESEER",56,43,10)txt("THE DEAD ANSWER...",69,54,13)sMagic()noiseS(160,22,9,8)sh(10) end function seerAttack() local r=math.random(100) if seer.phase==1 then seer.s=r<45 and"skull"or r<78 and"curse"or"vanish" else seer.s=r<34 and"beast"or r<67 and"skull"or"curse"end seer.t=0 if seer.s=="skull"then txt("DEATH ORBS!",seer.x-7,seer.y-20,10)sMagic() elseif seer.s=="curse"then txt("BONE CURSE!",seer.x-7,seer.y-20,8)sMagic() elseif seer.s=="vanish"then txt("WHERE AM I?",seer.x-6,seer.y-20,13)toneS(520,10,8,-35) else txt("ANCESTOR, HUNT!",seer.x-15,seer.y-20,8)noiseS(180,14,10,10)end end function dmgSeer() if not seerOn or seer.hit>0 or not active()or seer.s~="open"then return false end local x,y,w,h if p.a==1 then x=p.x+15 y=p.y+4 w=32+ups.fist*4+(p.meteorHit and 8 or 0)h=18 else x=p.x+9 y=p.y-8 w=25 h=33 end if not hit(x,y,w,h,seer.x,seer.y,34,30)then return false end local d=1+(p.a==1 and math.floor(ups.fist/2)or 0)+(p.a==2 and math.floor(ups.upper/2)or 0)+(rt>0 and 1 or 0)+(rare.tyrant and p.a==1 and 1 or 0)+(rare.volcano and p.a==2 and 1 or 0)+(p.meteorHit and 1 or 0) seer.hp=seer.hp-d seer.hit=14 seer.x=math.min(seer.x+2,82) addCombo(350,seer.x,seer.y-10)burst(seer.x+10,seer.y+10,20,12)lines(seer.x+12,seer.y+10,7) if rare.volcano and p.a==2 then fire(seer.x+10,seer.y+10,18)end if p.meteorHit then fire(seer.x+12,G-3,24)end txt("BREAK HEX!",seer.x-8,seer.y-20,10)sHit()stop=5 flash=2 sh(8) if seer.hp>0 and seer.phase==1 and seer.hp<=seer.max/2 then seer.phase=2 seer.s="break"seer.t=0 seer.hit=65 txt("THE VEIL TEARS!",61,44,10)txt("SPECTRAL FURY!",70,55,8) fire(seer.x+15,seer.y+12,35)sBoom()sh(14)flash=5 spells={} end if seer.hp<=0 then seer.hp=0 seer.s="die"seer.dead=0 score=score+7000*loop txt("BONESEER SILENCED!",61,44,10) fire(seer.x+12,seer.y+12,40)sBoom()sh(16)stop=15 flash=6 spells={} end return true end function updSeer() if seer.hit>0 then seer.hit=seer.hit-1 end seer.t=seer.t+1 if seer.s=="die"then seer.dead=seer.dead+1 if seer.dead%8==0 then burst(seer.x+math.random(0,28),seer.y+math.random(0,25),10,13)end if seer.dead>100 then seerOn=false seerDead=true bossesKilled=bossesKilled+1 seer=nil beginReward("BONESEER",0)end return end if seer.s=="enter"then seer.x=seer.x-1.3 if seer.x<=150 then seer.x=150 seer.s="wait"seer.t=0 end elseif seer.s=="wait"and seer.t>42 then seerAttack() elseif seer.s=="skull"then if seer.t==16 then spawnSkull(seer.x-4,seer.y+8,-4.2-loop*.1)end if seer.phase==2 and seer.t==29 then spawnSkull(seer.x-4,seer.y-2,-5-loop*.1)end if seer.t>44 then seer.x=78 seer.s="open"seer.t=0 txt("MATERIALIZED!",74,55,10)end elseif seer.s=="curse"then if seer.t==10 then addCurse(p.x+10)end if seer.phase==2 and seer.t==22 then addCurse(p.x+32)end if seer.t>43 then seer.x=78 seer.s="open"seer.t=0 txt("STRIKE NOW!",78,55,10)end elseif seer.s=="vanish"then if seer.t==28 then seer.x=78 burst(seer.x+12,seer.y+10,14,13)end if seer.t>36 then seer.s="open"seer.t=0 txt("FOUND YOU!",82,55,10)end elseif seer.s=="beast"then if seer.t==17 then addBeast()sMagic()end if seer.t>42 then seer.x=78 seer.s="open"seer.t=0 txt("THE SPIRIT FADES!",64,55,10)end elseif seer.s=="open"then dmgSeer()if seer.t>(seer.phase==1 and 42 or 30)then seer.x=150 seer.s="wait"seer.t=0 end elseif seer.s=="break"then if seer.t==18 then addBeast()burst(seer.x+12,seer.y+10,30,8)end if seer.t>65 then seer.x=150 seer.s="wait"seer.t=0 seer.hit=0 end end end function nextLoop() loop=loop+1 dist=0 area=1 ogre=nil boss=nil chief=nil seer=nil ogreOn=false bossOn=false chiefOn=false seerOn=false ogreDead=false bossDead=false chiefDead=false seerDead=false es={}waves={}spells={}spawn=65 banner=150 p.hp=math.min(p.max,p.hp+2)rage=math.min(100,rage+40)txt("WARPATH "..loop,85,50,10) end function updateGame() if dead then if btnp(6)then reset()end return end if stop>0 then stop=stop-1 return end if win>0 then win=win-1 updParts()if win<=0 then nextLoop()end return end time=time+1 if upgrade then updUp()return end wx=wx+1.35+(loop-1)*.08 if not ogreOn and not bossOn and not chiefOn and not seerOn then dist=dist+.55 end updateArea() if upgrade then return end if area==3 and not ogreOn and not ogreDead and dist>=3400 then spawnOgre()end if area==4 and not bossOn and not bossDead and dist>=4600 then spawnBoss()end if area==5 and not chiefOn and not chiefDead and dist>=5800 then spawnChief()end if area==6 and not seerOn and not seerDead and dist>=7050 then spawnSeer()end updPlayer() if ogreOn then updOgre() elseif bossOn then updBoss() elseif chiefOn then updChief() elseif seerOn then updSeer() else spawn=spawn-1 if spawn<=0 then spawnPack() spawn=math.max(48,88-area*4-loop*3)+math.random(28) end updEnemies() end updWaves()updSpells()updParts() if ct>0 then ct=ct-1 if ct<=0 then combo=0 end end if rt>0 then rt=rt-1 if rt<=0 then rt=0 txt("RAGE FADES",p.x-10,p.y-15,6)end end if banner>0 then banner=banner-1 end if shake>0 then shake=math.max(0,shake-.7)end if flash>0 then flash=flash-1 end end function mountain(sp,c) for i=0,5 do local x=((i*58-wx*sp)%350)-60 tri(x,72,x+27,35,x+55,72,c)end end function bg() if area==1 then cls(1)mountain(.06,2)rect(0,70,240,34,3) for i=0,8 do local x=((i*40-wx*.28)%320)-30 rect(x,48,6,40,2)circ(x+3,43,13,3)circ(x-7,51,9,3)circ(x+12,51,10,3) end elseif area==2 then cls(1)mountain(.05,2)rect(0,71,240,33,3) for i=0,4 do local x=((i*65-wx*.45)%330)-40 tri(x,83,x+19,56,x+38,83,2)tri(x+8,83,x+19,67,x+30,83,1) line(x+19,58,x+19,39,2)tri(x+19,40,x+35,45,x+19,51,8) end elseif area==3 then cls(1)mountain(.04,2)rect(0,75,240,61,0)line(0,88,240,88,4)line(0,95,240,95,4) for i=0,15 do local x=((i*17-wx)%275)-20 rectb(x,G,15,18,3)end elseif area==4 then cls(0)rect(0,40,240,64,1) for i=0,8 do local x=((i*32-wx*.07)%300)-20 tri(x,0,x+8,20+(i%3)*6,x+17,0,2)end for i=0,4 do local x=((i*62-wx*.15)%350)-40 rect(x,32,8,72,2)rect(x-3,29,14,5,2) if math.floor(time/6+i)%2==0 then circ(x+4,59,3,8)end end elseif area==5 then cls(0)rect(0,34,240,70,1) for i=0,6 do local x=((i*48-wx*.08)%330)-30 rect(x,38,18,66,2)rectb(x+3,43,12,17,4)tri(x-4,38,x+9,20,x+22,38,2) end for i=0,4 do local x=((i*65-wx*.35)%340)-30 rect(x,70,5,34,4)tri(x-3,72,x+2,62,x+7,72,8) end else cls(0)mountain(.025,1)rect(0,66,240,38,2) for i=0,10 do local x=((i*29-wx*.16)%300)-20 tri(x,75,x+5,57-(i%3)*4,x+11,75,8)tri(x+3,75,x+7,64,x+10,75,10) end for i=0,3 do local x=((i*82-wx*.18)%360)-50 rect(x,35,22,69,2)rectb(x+4,42,14,22,4)line(x,35,x+22,27,4)line(x+22,35,x,27,4) circ(x+3,99,7,1)circ(x+19,99,7,1) end for i=0,4 do local x=(time*3+i*57)%300-30 line(x,20+i*5,x+9,24+i*5,13)end end if area~=3 then rect(0,G,240,32,area>=5 and 1 or 2)rect(0,G,240,4,4)end end function drawOrc() local x=p.x+sx local y=p.y+sy if p.hurt>0 and math.floor(p.hurt/4)%2==0 then return end elli(x+12,G+sy+2,12,2,0) local id=OID local yo=0 if p.a==1 then if p.at>9 then id=OSMASH1 elseif p.at>=4 then id=OSMASH2 else id=OSMASH1 x=x-1 end elseif p.a==2 then id=p.at>11 and OUP1 or OUP2 else local f=math.floor(p.run/5)%4 if f==0 then id=ORUN1 yo=1 elseif f==1 then id=ORUN2 elseif f==2 then id=ORUN1 else id=ORUN2 yo=1 end end spr(id,x,y+yo,0,1,0,0,4,3) if ups.hide>0 then rect(x+5,y+8+yo,3,5,13)pix(x+6,y+8+yo,12)end if rare.tyrant then rect(x+1,y+5+yo,5,6,2)rect(x+19,y+4+yo,6,6,2) line(x+2,y+4+yo,x,y+1+yo,12)line(x+23,y+4+yo,x+26,y+1+yo,12) end if p.a==1 and ups.fist>0 and p.at<=9 then local z=math.min(ups.fist*2,8)+(rare.tyrant and 3 or 0)+(p.meteorHit and 4 or 0) rect(x+29,y+7,4+z,8,13)rect(x+31,y+9,3+z,4,12) end if p.a==2 and p.at<=11 then local n=2+math.min(ups.upper,4)+(rare.volcano and 2 or 0) for i=1,n do line(x+17+i*2,y+12,x+17+i*2,y-3-i*2,rare.volcano and(i%2==0 and 8 or 10)or(i%2==0 and 10 or 12))end end if p.meteor>0 and math.floor(time/4)%2==0 then line(x+5,G-1,x+2,G-7,12)line(x+20,G-1,x+24,G-8,10)end if rt>0 and math.floor(time/3)%2==0 then rectb(x-3,y-4,35,31,rare.bloodstorm and 10 or 8) if syn.bloodarmor and armorcd<=0 then rectb(x-5,y-6,39,35,10)end end end function drawE(e) if e.deadT and e.deadT<45 and math.floor(e.deadT/4)%2==0 then return end local x=e.x+sx local y=e.y+sy if e.type=="guard"then elli(x+8,G+sy+2,8,2,0)local bob=e.ai=="wind"and 2 or 0 spr(GUARD,x,y-1+bob,0,1,1,0,2,2) if e.shield==1 then rectb(x-2,y+2,8,13,13)line(x,y+4,x+4,y+12,12)line(x+4,y+4,x,y+12,12)end if e.ai=="wind"then line(x-6,y+4,x+2,y+4,8)elseif e.ai=="swing"then line(x-11,y+9,x+1,y+7,12)end if e.elite then rectb(x-2,y-3,20,21,8)end return end if e.type=="shaman"then elli(x+8,G+sy+2,8,2,0)local bob=math.floor(e.anim/6)%2 spr(GOB,x,y-1+bob,0,1,1,0,2,2)line(x+1,y+2,x-4,y+17,13)circ(x-4,y+2,3,12)pix(x-4,y+2,0) if e.ai=="cast"then local r=2+math.floor(e.ait/5)%2 circ(x-8,y+5,r,10)line(x-8,y+5,x-13,y+2,8)end if e.elite then rectb(x-4,y-4,22,22,8)end return end if e.type=="gob"or e.type=="spear"or e.type=="bomb"then elli(x+8,G+sy+2,8,2,0) local id=e.type=="gob"and GOB or e.type=="spear"and SPEAR or BOMB local bob=not e.hit and math.floor(e.anim/5)%2 or math.floor(e.anim/2)%3-1 local flip=e.hit and math.floor(e.anim/4)%2 or 1 local yy=y-1+bob if e.type=="spear"and e.ai=="wind"then yy=yy+2 line(x-9,y+9,x+5,y+9,10)line(x-10,y+8,x+3,y+8,12) elseif e.type=="spear"and e.ai=="lunge"then yy=yy+1 line(x-12,y+6,x+1,y+6,12)end spr(id,x,yy,0,1,flip,0,2,2) if e.type=="bomb"then if e.friendly then rectb(x-2,y-3,20,21,10)end if e.fuse<80 and math.floor(e.fuse/3)%2==0 then line(x+4,y-3,x+2,y-6,10)line(x+11,y-3,x+13,y-6,10)end if e.fuse<50 and math.floor(e.fuse/4)%2==0 then circ(x+15,y+2,2,e.friendly and 12 or 10)pix(x+15,y-1,12)end end if e.elite then rectb(x-2,y-3,20,21,8)end return end elli(x+11,G+sy+2,11,2,0) local id=e.hit and BOARH or math.floor(e.anim/5)%2==1 and BOAR2 or BOAR local by=y+(not e.hit and math.floor(e.anim/5)%2 or 0) spr(id,x,by,0,1,1,0,3,2) if e.hit then if math.floor(e.anim/3)%2==0 then line(x+6,y-2,x+1,y-5,12)else line(x+16,y-2,x+21,y-5,12)end end if e.type=="armor"and e.armor==1 then rect(x+7,by+3,11,7,13)rectb(x+7,by+3,11,7,12)end if e.type=="rider"then spr(GOB,x+4,by-14-math.floor(e.anim/5)%2,0,1,1,0,2,2)end if e.elite then rectb(x-2,by-2,28,20,8)end end function drawOgre() if not ogreOn then return end local x=ogre.x+sx local y=ogre.y+sy if ogre.hit>0 and math.floor(ogre.hit/3)%2==0 then return end local yo=0 local xo=0 if ogre.s=="wait"then yo=math.floor(ogre.t/14)%2 elseif ogre.s=="wind"then yo=-2 xo=1 elseif ogre.s=="slam"then if ogre.t<5 then yo=3 xo=-2 else yo=1 end elseif ogre.s=="open"then yo=2 xo=2 end elli(x+16,G+sy+3,17,4,0)spr(OGRE,x+xo,y+yo,0,1,1,0,4,4) if ogre.s=="wind"then line(x+5,y-8,x+27,y-8,8)line(x+9,y-11,x+23,y-11,10) elseif ogre.s=="slam"and ogre.t<8 then line(x-5,G,x+6,G-5,12)line(x+26,G,x+37,G-5,12) elseif ogre.s=="open"then circ(x+5,y-4,2,10)circ(x+20,y-7,2,10)end end function drawBoss() if not bossOn then return end local x=boss.x+sx local y=boss.y+sy if boss.hit>0 and boss.s~="break"and math.floor(boss.hit/3)%2==0 then return end local xo=0 local yo=0 if boss.s=="wait"then yo=math.floor(boss.t/12)%2 elseif boss.s=="charge"then xo=-4 yo=2 elseif boss.s=="recoil"then xo=3 yo=-2 elseif boss.s=="stun"then yo=2 elseif boss.s=="break"then xo=math.floor(boss.t/2)%2==0 and -2 or 2 end if boss.phase==2 then xo=xo+(math.floor(time/3)%2==0 and -1 or 1)end elli(x+20,G+sy+3,22,4,0)spr(boss.phase==2 and WAR2 or WAR,x+xo,y+yo,0,1,0,0,5,4) if boss.s=="charge"then line(x+40,y+9,x+49,y+5,8)line(x+40,y+15,x+52,y+15,10)line(x+37,y+22,x+49,y+25,12) elseif boss.s=="recoil"then line(x-3,y+2,x-11,y-4,10)line(x,y+22,x-12,y+26,12) elseif boss.s=="stun"then circ(x+7,y-5,2,10)circ(x+20,y-9,2,10)circ(x+33,y-4,2,10)end if boss.phase==2 and math.floor(time/5)%2==0 then line(x+18,y-3,x+16,y-8,8)line(x+29,y-2,x+32,y-8,10)end end function drawChief() if not chiefOn then return end local x=chief.x+sx local y=chief.y+sy if chief.hit>0 and math.floor(chief.hit/3)%2==0 then return end local xo=0 local yo=0 if chief.s=="cleave"then xo=-2 elseif chief.s=="rush"then xo=-4 yo=1 elseif chief.s=="slam"then yo=chief.t<24 and -2 or 3 elseif chief.s=="open"then yo=2 elseif chief.s=="break"then xo=math.floor(chief.t/2)%2==0 and -2 or 2 end elli(x+20,G+sy+3,22,4,0)spr(chief.phase==2 and GOR2 or GOR,x+xo,y+yo,0,1,1,0,5,4) if chief.s=="cleave"then line(x-14,y+5,x+2,y+9,12)line(x-12,y+2,x+1,y+8,8) elseif chief.s=="rush"then line(x+38,y+8,x+51,y+5,8)line(x+38,y+15,x+54,y+15,10) elseif chief.s=="slam"and chief.t<24 then line(x+30,y-3,x+38,y-12,12)line(x+33,y-4,x+42,y-9,8) elseif chief.s=="open"then circ(x+8,y-5,2,10)circ(x+26,y-7,2,10)end if chief.phase==2 and math.floor(time/5)%2==0 then line(x+15,y-2,x+12,y-8,8)line(x+28,y,x+32,y-7,10)end end function drawSeer() if not seerOn then return end if seer.s=="vanish"and seer.t>8 and seer.t<28 then return end local x=seer.x+sx local y=seer.y+sy if seer.hit>0 and seer.s~="break"and math.floor(seer.hit/3)%2==0 then return end local yo=seer.s=="open"and 2 or 0 if seer.s=="break"then x=x+(math.floor(seer.t/2)%2==0 and -2 or 2)end elli(x+15,G+sy+3,17,3,0) if seer.phase==2 then circ(x+28,y+7,8,2)rect(x+22,y+8,13,12,2) tri(x+24,y+4,x+27,y-4,x+30,y+5,8)tri(x+32,y+5,x+36,y-3,x+36,y+8,8) end tri(x+7,y+14+yo,x+25,y+14+yo,x+28,y+30+yo,2) tri(x+7,y+14+yo,x+28,y+30+yo,x+3,y+30+yo,2) rect(x+9,y+11+yo,14,12,5) line(x+8,y+12+yo,x+1,y+7+yo,13)line(x+22,y+12+yo,x+29,y+7+yo,13) circ(x+16,y+7+yo,8,5) rect(x+10,y+1+yo,12,4,13)rect(x+13,y+5+yo,8,7,12) pix(x+15,y+7+yo,0)pix(x+19,y+7+yo,0) line(x+13,y+11+yo,x+11,y+15+yo,13)line(x+21,y+11+yo,x+23,y+15+yo,13) line(x+25,y+4+yo,x+31,y+30+yo,4)circ(x+24,y+2+yo,5,13)circ(x+24,y+2+yo,2,0) if seer.s=="skull"or seer.s=="curse"or seer.s=="beast"then circ(x+24,y+2+yo,2+math.floor(seer.t/5)%2,10)line(x+24,y+2+yo,x+34,y-2+yo,8) end if seer.s=="open"then circ(x+7,y-4,2,10)circ(x+22,y-7,2,10)end end function drawSpells() for _,s in ipairs(spells)do local x=s.x+sx local y=(s.y or G)+sy if s.type=="skull"then circ(x,y,5,12)pix(x-2,y-1,0)pix(x+2,y-1,0)rect(x-2,y+2,5,2,13) line(x+6,y,x+12,y-2,10)line(x+6,y+3,x+11,y+5,8) elseif s.type=="curse"then if s.t>0 then local r=5+math.floor((34-s.t)/5)circ(x,G+sy-1,r,8)circ(x,G+sy-1,math.max(1,r-2),0) else for j=0,2 do tri(x-8+j*7,G+sy,x-4+j*7,G+sy-20-j*4,x+j*7,G+sy,13)end end else elli(x+13,G+sy+2,16,3,0)circ(x+9,y+10,10,2)rect(x+8,y+8,20,12,2)circ(x+27,y+10,7,2) tri(x+23,y+5,x+25,y-4,x+29,y+5,8)tri(x+29,y+5,x+33,y-3,x+34,y+6,8)pix(x+29,y+9,10) line(x+4,y+7,x-5,y+2,8)line(x+4,y+14,x-7,y+15,10) end end end function drawStuff() for _,w in ipairs(waves)do local x=w.x+sx local y=w.y+sy line(x,y+5,x+12,y+5,12)tri(x+2,y+5,x+5,y,x+8,y+5,12)tri(x+7,y+5,x+10,y+1,x+13,y+5,10) end for _,q in ipairs(ps)do circ(q.x+sx,q.y+sy,1,q.c)end for _,t in ipairs(ts)do print(t.s,t.x+sx,t.y+sy,t.c)end end function bossHud(n,h,m,c) rect(32,34,176,16,0)rectb(32,34,176,16,c) print(n,120-print(n,-100,-100)/2,36,12) rect(37,45,math.max(0,math.floor(166*h/m)),3,c) end function hud() rect(0,0,240,32,0)rect(0,115,240,21,0)rectb(0,0,240,32,2) print("GLORY",4,3,13)print(score,4,10,12)print("LIFE",50,3,13) for i=1,math.min(p.max,7)do local x=51+(i-1)*7 if i<=p.hp then tri(x,12,x+5,12,x+2,18,8)else rectb(x,12,5,5,2)end end print("RAGE",100,3,13)rect(100,12,58,7,1)rectb(99,11,60,9,4) rect(101,13,math.floor(56*(rt>0 and rt/300 or rage/100)),5,8) if rage>=100 and rt==0 then print("A!",164,12,10)end if combo>1 then print("x"..combo,205,5,10,false,2)end if not ogreOn and not bossOn and not chiefOn and not seerOn then print(math.floor(dist).."m",194,22,13) rectb(170,27,66,3,4)rect(171,28,math.floor(64*math.min(1,dist/7200)),1,8) end if ogreOn then bossHud("OGRE GATEBREAKER",ogre.hp,ogre.max,10) elseif bossOn then bossHud(boss.phase==2 and"WARBOAR - BLOOD FURY"or"WARBOAR",boss.hp,boss.max,8) elseif chiefOn then bossHud(chief.phase==2 and"GORVAK - BERSERKER"or"GORVAK THE IRONJAW",chief.hp,chief.max,8) elseif seerOn then bossHud(seer.phase==2 and"MORVAK - SPECTRAL FURY"or"MORVAK THE BONESEER",seer.hp,seer.max,10)end if banner>30 then rect(0,48,240,30,0)rectb(0,48,240,30,2) local n=areaName() print(area==6 and"THE SIEGE"or"THE LONG WAR",area==6 and 95 or 87,53,8) print(n,120-print(n,-100,-100)/2,64,12) end print("F"..ups.fist.." H"..ups.hide.." U"..ups.upper.." R"..ups.fury.." C"..ups.chain.." B"..ups.blood,4,117,13) local st="" if syn.eruption then st=st.." E"end if syn.bloodarmor then st=st.." A"end if syn.powder then st=st.." P"end if syn.meteor then st=st.." M"end print("SYN"..st,171,117,10) print("Z SMASH X UPPERCUT",51,128,13) end function drawUp() rect(8,36,224,83,0)rectb(8,36,224,83,reward and 10 or 8) print(reward and"SPOILS OF "..reward or"THE WARPATH HARDENS",reward and 63 or 61,40,10) print("CHOOSE ONE",88,49,12) for i=1,2 do local o=opts[i]local d=o.t==2 and br[o.id]or o.t==1 and rd[o.id]or ud[o.id] local x=i==1 and 14 or 125 rect(x,58,101,56,0)rectb(x,58,101,56,o.t==2 and 10 or o.t==1 and 8 or 4) if o.t==2 then rect(x+3,61,95,8,4)print("BOSS SPOIL",x+23,62,12) elseif o.t==1 then rect(x+3,61,95,8,2)print("RARE MUTATION",x+16,62,8)end local yy=o.t>0 and 72 or 64 print(d.n,x+50-print(d.n,-100,-100)/2,yy,o.t>0 and 10 or 12) print(d.d,x+50-print(d.d,-100,-100)/2,yy+14,13) print(i==1 and"Z CHOOSE"or"X CHOOSE",x+28,104,8) end end function drawTitle() title=title+1 cls(0)circ(194,29,19,2)circ(201,25,17,1) for i=0,5 do local x=i*48-15 tri(x,102,x+26,50+(i%2)*13,x+54,102,2) end rect(0,102,240,34,1) for i=0,4 do local x=i*55+5 rect(x,70,5,34,2)tri(x-5,72,x+2,57,x+9,72,8) end rect(38,18,164,64,0)rectb(38,18,164,64,4) print("ORC",80,27,5,false,4) print("QUEST",66,50,8,false,4) print("THE LONG WAR",79,75,12) spr(math.floor(title/20)%2==0 and ORUN1 or ORUN2,104,83,0,1,0,0,4,3) if math.floor(title/30)%2==0 then print("PRESS Z TO RAID",77,114,10)end print("Z SMASH X UPPERCUT A RAGE",35,128,13) end function drawGame() sx=0 sy=0 if shake>0 then local a=math.ceil(shake) sx=math.random(-a,a)sy=math.random(-a,a) end bg() for _,e in ipairs(es)do drawE(e)end drawSpells()drawOgre()drawBoss()drawChief()drawSeer()drawOrc()drawStuff() if flash>0 then rect(0,0,240,136,12)end hud() if upgrade then drawUp()end if win>0 then rect(17,26,206,84,0)rectb(17,26,206,84,10) print("THE LONG WAR IS WON",31,34,10,false,2) print("MORVAK THE BONESEER FALLS",39,59,12) print("CAMPAIGN CLEARED",74,72,13) print("GLORY "..score,81,83,12) print("BEST COMBO x"..best,68,93,10) print("WARPATH "..loop,91,102,8) end if dead then rect(27,27,186,84,0)rectb(27,27,186,84,8) print("ORC DOWN",62,33,8,false,3) print("GLORY "..score,72,59,12) print("WARPATH "..loop.." AREA "..area,61,69,13) print("BEST COMBO x"..best,66,78,10) print("BOSSES "..bossesKilled.." RARES "..cnt(rare),57,87,13) print("SYNERGIES "..cnt(syn),75,96,10) print("PRESS A TO RAID AGAIN",58,105,13) end end function TIC() if not ready then initSprites()end if not audio then initAudio()end if state=="title"then drawTitle()updAudio() if btnp(4)then start()end return end updateGame() updAudio() drawGame() end initSprites() initAudio() reset()