let shopY=0;let shopX=0;function shop(){if(dungeon_count<DUNGEON_MAX){drawImg(Graphs.BG_TOWN,0,0)}else{drawImg(Graphs.BG_TOWN2,0,0)} setAlp(50);drawImgS(Graphs.W_BG,0,0,DISPLAY_SIZE_X,DISPLAY_SIZE_Y);setAlp(100);fText("【武器屋】",500,45,25,colorRGB(255,255,255));textX=["【武器】","【防具】","【道具】"];shopX=selectMenuX(shopX,3);if(shopX<2){shopY=selectMenuY(shopY,12)}else{shopY=selectMenuY(shopY,4)} shopX=selectMenuX(shopX,3);fText(textX[shopX],300,50,25,colorRGB(255,255,255));let y=0,n=0;let y_max=12*shopX;if(shopX===2){n=4}else{n=12} let color=0;for(y=y_max;y<y_max+n;y++){if(shopX===2&&shopY>3){shopY=3} if(shopY===(y-y_max)){if(items[y].kind===SWORDSMAN_W||items[y].kind===SWORDSMAN_A){drawImgS(Graphs.PLAYER1,0,0,PLAYER_X_SIZE_B,PLAYER_Y_SIZE_B)}else if(items[y].kind===STRIKER_W||items[y].kind===STRIKER_A){drawImgS(Graphs.PLAYER2,0,0,PLAYER_X_SIZE_B,PLAYER_Y_SIZE_B)}else if(items[y].kind===MAGICIAN_W||items[y].kind===MAGICIAN_A){drawImgS(Graphs.PLAYER3,0,0,PLAYER_X_SIZE_B,PLAYER_Y_SIZE_B)} color=colorRGB(255,64,64);fText(items[y].text,300,400,20,colorRGB(255,255,255));if(shopX===0){if(items[y].kind===SWORDSMAN_W){fText("【武器Lv："+items[y].lv+"】"+"【KP："+items[y].kp+"】"+items[y].gold+"G",310,425,20,colorRGB(255,255,255))}else{fText("【武器Lv："+items[y].lv+"】"+items[y].gold+"G",310,425,20,colorRGB(255,255,255))}}else if(shopX===1){fText("【防具Lv："+items[y].lv+"】"+items[y].gold+"G",310,425,20,colorRGB(255,255,255))}else{fText(items[y].gold+"G",300,425,20,colorRGB(255,255,255))} if(key[32]===1||key[13]===1){key[32]=2;key[13]=2;if(items[y].num_>=items[y].num_max){playSE(Sounds.SE_ESC)}else{if(gold>=items[y].gold){gold-=items[y].gold;playSE(Sounds.SE_SHOP);items[y].num_++;if(items[y].kind===SWORDSMAN_W){if(items[y].gold>items[equimentListNum[0][0]].gold){equimentListY[0][0]++}}else if(items[y].kind===STRIKER_W){if(items[y].gold>items[equimentListNum[1][0]].gold){equimentListY[1][0]++}}else if(items[y].kind===MAGICIAN_W){if(items[y].gold>items[equimentListNum[2][0]].gold){equimentListY[2][0]++}}else if(items[y].kind===SWORDSMAN_A){if(items[y].gold>items[equimentListNum[0][1]].gold){equimentListY[0][1]++}}else if(items[y].kind===STRIKER_A){if(items[y].gold>items[equimentListNum[1][1]].gold){equimentListY[1][1]++}}else if(items[y].kind===MAGICIAN_A){if(items[y].gold>items[equimentListNum[2][1]].gold){equimentListY[2][1]++}}}else{playSE(Sounds.SE_ESC)}}}}else{if(items[y].num_>=items[y].num_max){color=colorRGB(128,128,128)}else{color=colorRGB(255,255,255)}} if(items[y].num<24){fText(items[y].name,300,80+25*(y-y_max),20,color)}else{fText(items[y].name+"("+items[y].num_+")",300,80+25*(y-y_max),20,color)}} fText("GOLD:"+gold+"G",520,450,30,colorRGB(255,255,150));fText("<<",200,220,25,colorRGB(255,255,255));fText(">>",400,220,25,colorRGB(255,255,255));drawImg(Graphs.KEY_ESC,0,0);fText("タイトルに戻る",105,14,16,colorRGB(64,255,64));drawImg(Graphs.KEY_I,480,220);drawImg(Graphs.KEY_J,450,250);drawImg(Graphs.KEY_K,480,250);drawImg(Graphs.KEY_L,510,250);fText("十字キー",595,250,16,colorRGB(64,255,64));drawImg(Graphs.KEY_SPACE,450,280);fText("購入",595,290,16,colorRGB(64,255,64));drawImg(Graphs.KEY_F,450,320);fText("街へ戻る",595,330,16,colorRGB(64,255,64));if(key[70]===1){key[70]=2;shopY=0;shopX=0;gameScene=SCENE_TOWN;playSE(Sounds.SE_ESC)} if(key[27]===1){key[27]=2;shopY=0;shopX=0;playSE(Sounds.SE_ESC);stopBgm();bgmSwitch=BGM_OFF;gameScene=SCENE_TITLE;backScene=BS_TITLE}}