0,q 4, p8dU)6o;]AsVl30 then pcol=3 elseif priceb[i]<0 then pcol=9 end if sellb[i] >0 then scol=9 elseif sellb[i] <0 then scol=3 end if psrate[i]>psrateb[i] then pscol=9 elseif psrate[i]=price[i] and pflag~=0 then PLANT(i) money=money-price[i] else info="you don't have enough money or space!" infodur=60*3 sfx(1,40,4) end end if keyp(27+i+4) or sellkey==i then if have[i]~=0 then have[i]=have[i]-1 money=money+sell[i] sfx(1,"A-4",4) else info="you don't have any crops!" infodur=60*3 sfx(1,"A-3",4) end end end for q=1,6 do rect(16*(1+q)-1,8*5-1,8,16,1) print(placename[q],16*(1+q),8*5) print(place[q],16*(1+q),8*6) end if key(50) or key(48) then mode=2 sfx(1,57,4) end end function INCDAY() if idur==0 then local modulecng=0 local seasoncng=0 mode=1 idur=idurdef do --week matagu shori info="" infodur=0 if week~=5 then week=week+1 else week=1;module=module+1;modulecng=1 end if module==4 then module=1;season=season+1;seasoncng=1 end if season==3 then mode=3 end --gameover for tb=1,6 do local tbrand=math.random(6) if placecrop[tb]==4 and tbrand==1 then info="The plant(s) have died!" infodur=60*5 place[tb]=0 placename[tb]="" placecrop[tb]=0 sc_dead=sc_dead+1 sfx(1,"A-3",30) end end if seasoncng==1 then for si=1,6 do place[si]=0 placecrop[si]=0 placename[si]="" if si<=4 then have[si]=0 end end price={40,80,150,160} sell={80,160,500,400} info="All the spring crops are dead!" infodur=60*5 sfx(1,"E-5",8) end local decng=0 local iscng=0 if modulecng==1 and seasoncng==0 then modulecng=0 local mrnd=16 --math.random(100) local mgb=math.random(2)-1 local mflag=0 local mpl=99 if mrnd<=20 then if mrnd<=5 then --insects info="Oh, the crop were eaten by insects!" infodur=60*5 for mi=1,6 do if mpl>place[mi] then mpl=place[mi] end end for mi=1,6 do if place[mi]==mpl then place[mi]=0 placename[mi]="" end end elseif mrnd<=10 then --thief info="Oh, thieves have stolen my crops!" infodur=60*5 for mi=1,4 do if mpl>have[mi] and have[mi]~=0 then mpl=have[mi] end end for mi=1,4 do if have[mi]==mpl and mflag==0 then have[mi]=0 mflag=1 end end elseif mrnd<=15 then --demand if mgb==0 then infodur=60*5 mi=3 --math.random(1,4) info="Alas, "..crop[season][mi].." demand is skyrocketing!" iscng=mi decng=1 else mi=3 --math.random(1,4) info="Oh my gosh, "..crop[season][mi].." demand is so low!" infodur=60*5 iscng=mi decng=2 end else --climate info="Harvest time shifted!" infodur=60*5 for mi=1,6 do if place[mi]~=0 then place[mi]=place[mi]+mgb*2-1 if place[mi]==0 then --harvest have[placecrop[mi]]=have[placecrop[mi]]+1 place[mi]=0 placename[mi]="" end end end end sfx(1,"A-3",30) end end seasoncng=0 for q=1,6 do if place[q]~=0 then place[q]=place[q]-1 if place[q]==0 then --harvest have[placecrop[q]]=have[placecrop[q]]+1 place[q]=0 placename[q]="" sc_harv=sc_harv+1 end end end for val=1,4 do local prand=1+(math.random(5)-3)/10 local srand=1+(math.random(7)-4)/10 priceb[val]=price[val] sellb[val]=sell[val] psrateb[val]=psrate[val] if iscng~=val then price[val]=math.floor(price[val]*prand) sell[val]=math.floor(sell[val]*srand) elseif decng==1 then --skyrocket price[mi]=math.floor(price[mi]*(math.random()+3)) sell[val]=math.floor(sell[mi]*(math.random()+5)) elseif decng==2 then --so low price[val]=math.floor(price[val]*0.2) sell[val]=math.floor(sell[mi]*0.2) end if price[val]>sell[val] then sell[val]=price[val]*4 end psrate[val]=math.floor((sell[val]/price[val])*10)/10 priceb[val]=price[val]-priceb[val] sellb[val]=sell[val]-sellb[val] end end else idur=idur-1 end cls(13) print("sleeping...",8,8,12) end function OVER() cls(6) print("GAME OVER!",8,8,12) sc=(sc_harv-sc_dead)*(money-100) local message="" if money<=100 then message="Don't give up!" elseif money<=1000 then message="Good!" elseif money<=5000 then message="Great!" elseif money<=10000 then message="Awesome!" elseif money<=50000 then message="Marvelous!!" else message="INCREDIBLE!!" end print("YOU EARNED $"..money..". ",16,32,12) print(message,120,32,4) print("SCORE : "..sc,16,32+8,12) print("-- PRESS ENTER --",8,60,2) if ovtime==0 then ovtime=60*20 sfx(1,"A-5",4) else ovtime=ovtime-1 end if key(50) then ovtime=1 end if ovtime==1 then sfx(1,"A-6",2) mode=4 end end function INIT() money=100 season=1 module=1 week=1 ovtime=0 info="" infodur=0 place={0,0,0,0,0,0} placecrop={0,0,0,0,0,0} placename={"","","","","",""} price={25,50,100,80} sell={50,100,300,250} psrate={0,0,0,0} priceb={0,0,0,0} sellb={0,0,0,0} psrateb={0,0,0,0} have={0,0,0,0} sc_harv=0 sc_dead=0 mode=0 end ----------------------------------- function PLANT(num) local pdone=0 for i=1,6 do if place[i]==0 and pdone==0 then place[i]=numday[num] placename[i]=cropi[season][num] placecrop[i]=num pdone=1 sfx(1,50,2) end end end function INFO() if infodur~=0 or key(3) then print(info,8*2,8*2,3) if infodur~=0 then infodur=infodur-1 end end end