Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 批量RPG:战斗循环中断_Batch File_Variables - Fatal编程技术网

Batch file 批量RPG:战斗循环中断

Batch file 批量RPG:战斗循环中断,batch-file,variables,Batch File,Variables,所以,我有几个问题 当“教程之夜”运行时,它几乎按照我的要求运行,只是英雄从未被击中 选择Magic或Run时,if语句不显示回显,而是转到教程错误 注意:%stat%是英雄的属性,而%estat%是敌人的属性 :TutorialIntro title Tutorial^^! cls set /a ehealth=15 set /a emana=15 set /a ebstat=5 set /a eostat=5 set /a ec

所以,我有几个问题

  • 当“教程之夜”运行时,它几乎按照我的要求运行,只是英雄从未被击中
  • 选择Magic或Run时,if语句不显示回显,而是转到教程错误
  • 注意:%stat%是英雄的属性,而%estat%是敌人的属性

        :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
    

    使用附加计算:

    Set/A half摇头丸=摇头丸/2
    
    然后将行更改为:

    如果%num%lss(%t%/2)
    
    致:

    如果%num%Lss%t%
    

    我还注意到,后面的计算有不平衡的括号,因此您可能还需要仔细查看。

    这不起作用:
    如果%num%lss(%摇头丸%/2)…
    。您必须先计算第二个数字,然后在if:
    set/A num2=negat/2
    &
    if%num%lss%num2%…