批量算术?

Arithmetic in Batch?

我正在制作游戏,我有一个 Health 变量来跟踪玩家在玩游戏时的生命值。有一次,玩家在罐头上咬破了嘴唇(我知道是平安无事),并损失了 2 点 HP。我正在尝试使用算术从 'Health' 变量中减去 2 HP(此时仍为 100),然后显示他们还剩多少生命值,但在我尝试后它仍然显示 100 HP移除 2 HP。我做对了吗?

:Beans
call :colorEcho 7 "You decide you're going to have Canned Beans for     breakfast. Yum. You grab a knife from the kitchen counter and work the top off. You eat the beans straight from the can. Ouch! You cut your lip! It starts to    bleed."
Echo .
set /a "_Health=_Health-2"
Echo.
call :colorEcho C "# ALERT; You have lost 2 Health Points! You are now at %Health% HP!"
Echo.
pause
exit

会发生什么:

好的,感谢@dbenham,我找到了答案。谢谢!

我弄乱了变量,正如 dbenham 指出的那样,当我在 set /a _Health-=2 中使用 _Health 时,我正在扩展 %Health%。我将其更改为 set /a Health-=2,现在一切似乎都正常。