@echo off
set wood=0
set efficiency=1
:game
cls
echo 按下1再按回车伐木,按下2再按回车进入商店。
echo 你的木头:%wood% 你的效率:%efficiency%
set /p select="请输入:"
if "%select%"=="1" (set /a wood=%wood%+%efficiency%)
if "%select%"=="2" (goto shop)
pause
goto game
:shop
set /a price=%efficiency%*10
cls
echo 伙计:瞧瞧,你一定是伐木工,我这总有比你好的斧子。我知道你没钱,那就用你的木头换吧。
echo 价格:%price%
set /p select_shop="按1再按回车离开,按2购买:"
if "%select_shop%"=="1" (goto game)
if "%select_shop%"=="2" (goto buy)
:buy
if "%wood%" LSS "%price%" (echo 木头不够! && pause && goto game)
set /a wood=%wood%-%price%
set /a efficiency=%efficiency%*2
goto game
set wood=0
set efficiency=1
:game
cls
echo 按下1再按回车伐木,按下2再按回车进入商店。
echo 你的木头:%wood% 你的效率:%efficiency%
set /p select="请输入:"
if "%select%"=="1" (set /a wood=%wood%+%efficiency%)
if "%select%"=="2" (goto shop)
pause
goto game
:shop
set /a price=%efficiency%*10
cls
echo 伙计:瞧瞧,你一定是伐木工,我这总有比你好的斧子。我知道你没钱,那就用你的木头换吧。
echo 价格:%price%
set /p select_shop="按1再按回车离开,按2购买:"
if "%select_shop%"=="1" (goto game)
if "%select_shop%"=="2" (goto buy)
:buy
if "%wood%" LSS "%price%" (echo 木头不够! && pause && goto game)
set /a wood=%wood%-%price%
set /a efficiency=%efficiency%*2
goto game