我正在尝试使用批量制作一个简单的RPG游戏,以及用于消除敌人健康和“SP”的“攻击”。这是我目前的代码。
@echo off
set /a HP=10
set /a SP=10
echo hp = %HP%
echo SP = %SP%
pause nul
set /p DC= 10 max
set /a NHP=%HP% - %DC%
set /a HP=%NHP%
echo %HP%
pause nul
set /a DCE=10
echo you have %HP% hp
Echo You can 1. Hit (-1 hp to enemy) 2. Kick (-1 hp to enemy) 3 special hit (-2 hp to enemy and -5 SP to you)
请注意,HP =健康点和SP =您用于特殊攻击的特殊点或点
而且,开始代码只是为了测试系统带走点。所以如果你有一个更好的系统。这会很有帮助
答案 0 :(得分:0)
set /a EHP = 10
set /a BaseDamage = 1
set /a SpecialDamage = 2
set /a SpecialCost = 5
set /p input = .
if %input% == 1 or %input% == hit (
echo you hit the enemy
set /a EHP = %EHP% - %BaseDamage%
)
if %input% == 2 or %input% == kick (
echo you kick the enemy
set /a EHP = %EHP% - %BaseDamage%
)
if %input% == 3 or %input% == special hit (
echo [insert dialoge here]
set /a EHP = %EHP% - %SpecialDamage%
set /a SP = %SP% - %SpecialCost%
)
goto a
顺便说一下你应该添加:a before echo你可以1.Hit 2.Kick 3.special hit