不思議なダンジョンソース


不思議なダンジョンソース

makeimg(M,122,58)
@(m,"戦う","防御","魔法","アイテム")
@(E,"(`・ω・´)","シャキーン",10,16,12,8,7,14,5,"Γ(◎±◎∂","タルー",12,5,5,16,16,9,14,"ミ゚Д゚彡","フサギコ",15,8,16,7,14,7,5,"∠@∀@▽","チャメコ",12,9,9,11,16,12,13,"○£○ヶ","プリマ",20,20,0,20,0,10,20,"( ゚Д ゚","ソリタリー")
w=132
h=144
@(H,-1,1,1,-1,62,25,15,11,8)
@(IM,"ポーション","万能薬","破砕グラブ","鉄壁","水晶玉","マモノ餌","TNT爆弾","見透しの巻物","透明マント","幸せの風")
@(IP,1,3,4,4,6,6,10,10,10,200)
N="北東南西"
frect(C(),0,2*w2=width/2,2*h2=height/2)
labelー
origin(w2,h2)
if(!load()){
    @(D,5,5,5,5,5,5,1,300,0,1,0,0,16,8,7,7,7,5,5,5,5,1,0,0)
    V()
}
k=load()
for(i=0,j=-1;i<24;D[i++]=substr(k,++j,-j+j=index(k,",",j))){}
get=tick/1000-D[11]
V=-1
D[9]--
LV=D[6]
HP=LV*LV+237*LV+362>>1
label 0'次の階に行く処理'
gc()
if(m=++D[9]%10==0&&V>=0){
    gosub 9
}
EN=100
for(P[V=1]=P[0]=B=i=0;i<105;M[1][i%15][i/15]=M[0][i/15][i++%15]=1){}
for(i=1;104>i=i+1+R(40);M[1][i%15][i/15]=3+(rand&1)){}
for(i=1;i<15;i=i+2){
    for(j=1;j<7;M[1][i][j]=M[0][j][i]=0,j=j+2){
        while(!M[1][i+x=rand%2][j+y=x?0:(rand&1)*2-1;]){}
        M[1][i+x][j+y]=M[0][j+y][i+x]=0
    }
}
trgt(M)
lock()
clear(0,0,122,58)
C()
rect(0,0,121,57)
for(i=0;i<120;i=i+8){
    for(j=0;j<56;j=j+8){
        switch(M[1][i>>3][j>>3]){
            case 0:
                frect(i+1,j+1,8,8)
            break;
            case 3:
                frect(i+3,j+3,4,4)
                frect(i+4,j+2,2,6)
                clear(i+4,j+3,1,3)
        }
    }
}
unlock(1)
trgt(off)
M[1][14][6]=2
origin(w2,h2)
soft1("EXIT")
soft2("MENU")
label 1
if(1<<18&A){
    gosub"図"
}
lock()
if(CL()+C()+1<<17&A){
    end
}
B=0
if(1&A=A>>12){
    if(M[j=V&1][P[j]+H[V]][P[1-j]]){
        P[j]=P[j]+H[V]
        B=1
    }
}elsif(A&14){
    V=1+V+A+A/8&3
}
text("方位:".strat(N,V).";座標(".P[1].",".P[0].")",-66,-72,0)
line(-62,-62,62,62)
line(-62,62,62,-62)
for(i=0;i<5;++i){
    if(j=H[4+i],M[K=V&1][P[K]+i*H[V]][P[!K]]){
        for(k=i>>2<<1;k<2;++k){
            if(M[K][P[K]+i*H[V]][P[!K]+H[k]*(1-(V>>1<<1))]){
                rect(-H[4+i+k],-l=H[5+i],l+j,l+l)
            }
        }
        rect(-j,-j,j+j,j+j)
    }else{
        frect(-j,-j,j+j+1,j+j)
        break;
    }
}
farc(-10,40,20,5)
col(0x80FE)
frect(-8,12,16,30)
unlock(1)
if(I=M[1][P[1]][P[0]],B&&I==1){
    if(R(2000)<EN){
        gosub"戦"
    }elsif(D[22]&2){
        D[7]=D[7]-HP/100
    }
    if(D[7]<1){
        goto"死"
    }
}
I<3&&A=input();
goto I
label 2
if(!B){
    goto 1
}
clear(-27,-15,54,30)
C()
rect(-28,-16,55,31)
text("1.おりる",-24,0,32)
text("2.やめる",-24,1,0)
unlock(1)
B=0
while(!A=input()&6){}
goto A>>2
label図
lock()
drawimg(M,-61,-71,CL(C()))
for(i=0;i<6;++i){
    text(substr("Lv HP EXPFLRGLDTIM",i*3,3).":".D[i+6],0,i*12-12,0)
    text(strat("強耐魔精早運",i).":".D[i],-64,i*12-12,0)
}
text("ST",-64,60,0)
for(i=0;i<4;++i){
    if(D[22]&1<<i){
        text(strat("闇毒混沈",i),i*12-52,60,0)
    }
}
text("MaxHP:".HP,0,60,0)
soft1("SAVE")
soft2("ITEM")
C()
while(64!=(j=input(100)>>12)&&(j&32&&j=V(D[11]=k),1)){
    lock()
    clear(P[1]*8-60,P[0]*8-70,8,8)
    clear(24,48,42,12)
    col(-1)
    rect(-65,-13+12*a=D[23],12,12)
    C()
    rect(-65,-13+12*D[23]=a+(j&8&&5>a)-(j&1&&a>0),12,12)
    text((k=tick/1000-get)/3600.":".k/60%60.":".k%60,24,48,0)
    farc(P[1]*8-60,P[0]*8-70,8*i=!i,8)
    unlock(1)
}
m=0
label 9
soft1(m?"買う":"使う";)
soft2("戻る")
lock()
CL()
C()
for(i=1;i<11;++i){
    text(IM[i-1],-52,i*12-72,0)
}
text(m?"SHOP":"ITEM";,0,-72,1)
line(-66,-60,66,-60)
text(D[10],66,60,8*m)
k=UC=0
while(!(J&32&&BT&&UC)&&64!=J=input(0)>>12){
    lock()
    clear(-66,-59,12,131)
    text("*",-65,-60+12*k=k+(J&8&&9>k)-(J&1&&k>0),0)
    if(J&32){
        if(m&&0<=j=D[10]-IP[k]*50){
            D[k+12]++
            clear(0,60,66,12)
            text(D[10]=j,66,60,8)
        }elsif(D[k+12]*!m){
            UC=1
            D[k+12]--
            i=1
            switch(k){
                case 1:
                    D[22]=0
                break;
                case 4:
                    M[3]=M[3]*3/2
                case 2:
                case 3:
                    M[j=k-2]=M[j]*3/2
                    PD=PD|k==3
                break;
                case 6:
                    K=V&1
                    if(!BT&&M[1][x=P[1]+K*H[V]][y=P[0]+!K*H[V]]>2){IT(x,y)}
                    D[31]=0
                break;
                case 0:'ポーション'
                    if((D[7]=D[7]+(M[3]+M[2])*18)>HP){D[7]=HP}
                break;
                case 7:'トラップ表示'
                    trgt(M)
                    C()
                    for(j=1+200*STA=BT;j<104;++j){
                        if(M[1][a=j%15][b=j/15]==4){
                            farc(a*8+1,b*8+4,8,4)
                        }
                    }
                    trgt(off)
                    origin(w2,h2)
                break;
                case 8:
                    if(BT){
                        S[l=0]="逃げ出した!"
                    }
                    EN=EN>>!BT
                break;
                case 5:
                    EN=EN<<!BT
                    D[29]=Mh
                break;
                case 9:
                    for(D[22]=j=0;j<6;++D[j++]){}
                    D[7]=HP
            }
        }
    }
    if(i){
        clear(30,-59,36,119)
        for(j=-5;j<5;++j){
            text(m?IP[j+5]*50:D[j+17];,66,j*12,8)
        }
    }
    i=0
    unlock(1)
}
soft1("EXIT")
soft2("MENU")
}
func CL(){
    clear(-66,-72,w,h)
}
func C(){
    col(0x400040)
}
label 3
for(i=0;i<10&&10-i<R(15);++i){}
D[j=10*!i+!!i*11+i]=D[j]+(i?1:j=R(501);)
IT(P[1],P[0],1)
text((i?IM[i-1]:j."GLD";)."を手に入れた!",0,-6,1)
input()
goto 1
label 4
switch(2+j=rand%3){
    case 0:
    case 4:
        MS=(j-2?(j=5,"金"):"HP";)."半減!"
        D[j+5]=D[j+5]>>1
    break;
    case 3:
    case 1:
        if((D[9]=D[9]+j*(1+R(10)))<1){D[9]=0}
        MS=D[9]+1."階へワープ!"
    break;
    case 2:
        MS="ステータス異常!"
        D[22]=15
}
IT(P[1],P[0],1)
text(MS,0,-6,1)
sleep(1500)
goto!(abs(j)==1)
func V(){
    for(_="",j=0;j<24;_=_.D[j++].","){}
    save(_)
}
label戦
BT=1
S=CL()
C()
clearkey()
soft1("")
soft2("")
for(ExP=D[31]=Mh=((237+i=D[9])*i+362+rand%i>>1)*E[2+ET=R(17)/4*9]/10,D[46]=j=STA=0;j<6;ExP=ExP+D[24+j]=(4+i)*E[ET+3+j]/10+rand%i/2,++j){}
copy(D,d[0]=d[24]=PD=0,M,0,28)
clip(TY=MX=-TX=66,-72,w,h)
MY=30
AT=(D[28]<D[4])*24
BG=0xECD6B4
while(BT){
    lock()
    line(CL()-66,36,w,36)
    col(BG)
    text(E[ET],TX,TY,0)
    text(D[31]."/".Mh.":".D[46],60,-54,8)
    col(BG>>1)
    text(E[45],MX,MY,32)
    text(D[7]."/".HP.":".D[22],-60,6,0)
    switch(A=input(40+C()),S){
        case 0:
            if(!TX=TX-6){
                S=2
                S[j=0]=E[ET+l=k=1]."が現れた!"
            }
        break;
        case 1:
            if(AT){
                if(ET){
                    if(ET-9){
                        if(ET-18){
                            if(ET-27){
                                Z=2*(D[31]<Mh/2)+R(2)
                            }else{
                                if(D[31]<Mh){
                                    Z=3
                                }else{
                                    Z=R(2)
                                }
                            }
                        }else{
                            if(!Z=!!R(5)){if(!Z=!R(2)*3){Z=R(2)}}
                        }
                    }else{
                        if((!Z=!!R(10)*2)&&Z=R(3)){++Z}
                    }
                }else{
                    if(Z=!R(10)){Z=1+R(3)}
                }
                S=2
                S[j=0]=E[ET+k=1]."のターン!!"
                l=3+Z
            }else{
                rect(-66,25,48,48)
                clear(-66,26,48,48)
                for(a=0;a<4;++a){
                    text(m[a],-48,26+a*12,0)
                }
                if(16&a=A>>12){
                    S=2
                    k=1
                    l=Z+3
                    S[j=0]=E[46]."のターン!!"
                }
                text("*",-60,26+12*Z=Z+(a&8&&Z<3)-(a&1&&Z),0)
                if((D[7]=D[7]+d[0]*HP/10)>HP){D[7]=HP}
            }
            d[AT]=0
        break;
        case 2:
            if((3>k-j=j+(1<<16==A))&&j){
                Z=0
                if(1==S=l){
                    if(D[22+AT]&2&&!t2){
                        D[a=7+AT]=D[a]-D[33-a]*6
                        S=t2=2
                        S[j=!k=1]="毒のダメージ!"
                    }else{
                        e=24-AT=24-AT+t2=0
                    }
                }
                if(BT=D[7]>0&&l>0,2<S){
                    if(4&i=D[22+AT]){
                        S=3
                        e=R(2)*24
                    }
                    if(i&8&&S==5){
                        S=2
                        k=l=1
                        S[j=0]="魔法失敗…"
                    }
                }
                if(BT&&D[31]<1){
                    S=2
                    l=j=0
                    k=3
                    TX=99
                    @(S,E[ET+1]."を倒した!",D[29]*10."GLD入手!",ExP/10."の経験値を得た","レベルアップ!")
                    D[10]=D[10]+D[29]*10
                    D[8]=D[8]+ExP/10
                    while(HP<=D[8]){
                        a=++D[6]
                        D[8]=D[8]-HP
                        D[7]=HP=a*a+237*a+362>>1
                        for(i=!D[D[23]]++;i<6;D[i++]++){}
                        D[22]=0
                        k=4
                    }
                }
            }else{
                for(i=0;i<3&&i<k;++i){
                    text(S[i+j],-66,36+i*12,0)
                }
            }
        break;
        case 3:
            if(D[AT+22]&1&&(D[4]<D[28]||rand%9)){
                k=1
                S[0]="攻撃失敗…"
            }else{
                if((i=rand%D[9]+(14+M[AT]/8)*M[AT]-(6+M[e+1]/12)*M[e+1]>>d[e])<0){i=0}
                if((D[k=7+e]=D[k]-i)<0){D[k]=0}
                @(S,E[e?ET+1:46;]."に".i,"のダメージ")
                D[k=22+e]=D[k]&~4
                k=2
            }
            S=2
            l=1
            j=0
        break;
        case 4:
            d[AT]=l=k=1
            S[j=0]=E[AT?ET+1:46;]."は身を固めた"
            S=2
        break;
        case 5:
            if((i=rand%D[9]+(14+M[AT+2]/8)*M[AT+2]-(6+M[e+3]/12)*M[e+3]>>d[e])<0){i=0}
                if((D[k=7+e]=D[k]-i)<0){D[k]=0}
            @(S,E[e?ET+1:46;]."に".i,"のダメージ")
            `=0
            if((!PD||--PD||e)&&!d[e]&&i&&R(i)>D[e+5]-D[AT+5]){
                D[22+e]=D[22+e]|`=R(16)&R(16)
            }
            gosub 20
            l=1S=k=2
            j=0
        break;
        case 6:
            if(AT){
                D[31]=(i=D[31]+D[27]*14)>Mh?Mh:i;
                D[46]=D[46]&~R(16)
                S[0]=E[ET+1]."はHP・ST回復!"
                k=l=1
                S=2
            }else{
                gosub 9
                k-8?(S[l=1]="を使った",S[0]=IM[k],k=2):k=1;
                S=UC+1
            }
            j=0
            soft1("")
            soft2("")
    }
    unlock(1)
}
soft1("EXIT")
soft2("MENU")
}
func IT(X1,Y1,W1){
    C()
    frect(-67,-10,2+w,20*W1)
    clear(-66,-9,w,18*W1)
    trgt(M)
    clear(X1*8+1,Y1*8+M[1][X1][Y1]=1,8,8)
    trgt(off)
    origin(w2,h2)
}
label死
C()
frect(-66,-72,w,h)
col(-1)
text("You are deleted",0,-12,1)
text("from this world...",0,0,1)
save(0)
sleep(2000)
goto"ー"
func R(。){
    return abs(rand)%。
}
label 20
gc()
for(A=!Z=R(8)+1;++A<23;){
    lock()
    clear(-66,-72,132,108)
    if(`&1){
        for(i=5;i>=0&&0<j=(i*3+9-A)*A>>1;--i){
            col(i*0x321F32)
            foval(-j,-j,j<<1,j<<1,0,180)
            col(i*0x220022)
            farc(-j,-j/2,j<<1,j)
        }
    }
    C()
    text(E[e?ET:45;],rand%6,rand%6-6,1)
    col(rand)
    text("◆",rand%16,rand%16-6,1)
    if(`&2){
        col(0xA000)
        for(j=(22-A)*A,i=A*2;360>i;i=i+45){
            farc(cos(i*Z)*j/z=320-sin(i)>>1,cos(i+j)*j/z>>1,1000/z,1000/z)
        }
    }
    if(`&4){
        col(0xFFFF00)
        for(i=0;i<3;++i){
            text("★",cos(j=i*120+A*9)/5,sin(j)/10-20,3)
        }
    }
    if(`&8){
        col(0xFF0000)
        for(i=k=0,l=A*2-44;i<720&&A>i/48;i=i+144){
            line(k,l,k=sin(i+144)*(j=22-A<<1)/100,l=-cos(i+144)*j/100)
        }
    }
    unlock(1)
    sleep(80)
}}