0
だから、私はいくつかの問題を抱えています。バッチRPG:ファイトループが壊れた
- TutorialFightが実行されるとき、ヒーローが決してヒットしないことを除いて、ほとんど私が望むように動作します。
- MagicまたはRunを選択すると、ifステートメントはエコーを表示せず、TutorialErrorに移動します。
注:%stat%はヒーローのstatですが、%estat%は敵のstatです。
:TutorialIntro
title Tutorial^^!
cls
set /a ehealth=15
set /a emana=15
set /a ebstat=5
set /a eostat=5
set /a ecstat=5
set /a elevel=1
set /a health=15
set /a mana=15
set /a bstat=5
set /a ostat=5
set /a cstat=5
set /a level=1
echo You have run into a
echo Level %elevel% Sock Puppet.
echo -I made this from a combination of a sock, glue, and some paper.
echo If you lose to this thing, I'm not looking you in the eye again.
echo You know, if I could actually look at you in the first place.
echo.
echo Level %level% Hero
echo %health% HP
echo %mana% MP
echo %bstat% Brawn
echo %ostat% Obscurity
echo %cstat% Cowardice
pause
goto Tutorial
:Tutorial
title Fight^^!
cls
if %ehealth% leq 0 goto TutorialWin
if %health% leq 0 goto TutorialLoss
echo Level %elevel% Sock Puppet.
echo (%ehealth% HP)
echo.
echo V.S.
echo.
echo Level %level% Hero
echo %health% HP
echo %mana% MP
echo %bstat% Brawn
echo %ostat% Obscurity
echo %cstat% Cowardice
echo.
set /p answer= Fight(1), Magic(2), Run(3)
if %answer%==1 goto TutorialFight
if %answer%==2 echo Sorry. You don't know magic yet.
if %answer%==3 echo No. You are not going to run from a sock.
goto TutorialError
:TutorialFight
set /a loss=0
set /a eloss=0
set /a num=%random% * ((%cstat%-%ecstat%) - 1 + 1)/32768 + 1
if %num% lss (%ecstat%/2) set /a loss=%random% * (%ebstat% - (%ebstat%/2) + 1)/32768 + (%ebstat%)/2)
if %num% geq (%ecstat%/2) set /a eloss=%random% * (%bstat% - (%bstat%/2) + 1)/32768 + (%bstat%)/2)
set /a health=(%health% - %loss%)
set /a ehealth=(%ehealth% - %eloss%)
goto Tutorial
:TutorialError
title Huh?
cls
echo Try that again. I believe in you.
pause
goto Tutorial
:TutorialWin
title Victory
cls
echo Yay^^!
echo Now I think you are ready for the big pond^^!
pause
goto Intro
:TutorialLoss
title ...
cls
echo ...
echo.
echo Let's forget that ever happened.
pause
goto Menu
これは動作しません: '%num%lss(%ecstat%/ 2)...'。 'set/A num2 = ecstat/2'と' if%num%lss%num2%... 'のように、最初の2番目の数値を計算してifで使う必要があります。 – Aacini