It's a little bit failing fight simulator.
Posted: 12 Jan 2012 13:12
Ok, I have made a some-kind-of fight simulator. But when going from attack phase or defend phase, it says something about an - that shouldn't be there. But the thing is, I don't have any - on any place where it shouldn't be. If someone could see what the problem is, please tell me! And this is just a little bit modified part of the whole file.
Code: Select all
@echo off
set def=4
set atk=5
set lol=0
set max=12
set min=6
set name=Mattis95
set mon=monster
set monhp=30
set manhp=40
set maxman=40
set maxmon=30
set potn=3
set atk=5
set def=4
goto batmen
:batmen
cls
title ::::::::BATTLE MENU::::::::
echo ::::::::BATTLE MENU::::::::
echo.
echo Your hp: %manhp%/%maxman%
echo The %mon%'s hp: %monhp%/%maxmon%
echo You have %potn% pot(s).
echo 1) Attack the %mon%
echo 2) Just defend (nearly the same as skip)
echo 3) Drink a potion
set /p bch=
if %bch% == 1 goto attack
if %bch% == 2 goto defend
if %bch% == 3 goto potion
:attack
title ::::ATTACK::::
set /a mandmg=%random% %% (max - min + 1)+min
echo You attack the %mon% and deal %mandmg%+%atk% hp.
set /a monhp=%monhp% - %mandmg% - %atk%
if %monhp% leq 0 goto yay
set /a mondmg=%random% %% (max - min + 1)+ min
echo The %mon% attacks you and deals %mondmg%-%def%!
set manhp=%manhp% - 10 + %def%
set /a lol=%lol% + 1
pause
if %manhp% leq 0 goto no
goto batmen
:defend
title ::::DEFEND::::
echo You defend.
pause
set /a mondmg=%random% %% (max - min + 1)+ min
echo The %mon% attack you and deals %mondmg%-%def%.
set manhp=%manhp% - %mondmg% + %def%
pause
if %manhp% leq 0 goto no
goto batmen
:potion
title ::::POTION::::
echo You have %potn% potions. Do you really want to use one?
set /p yn=(yes/no)
if %yn% == no goto batmen
echo Ok, you drink one and refill your hp by 10.
pause
echo If it goes over %maxman%, it will stop at %maxman%.
set /a manhp=%manhp% + 10
if %manhp% gtr %maxman% set manhp=%maxman%
pause
goto batmen
:no
cls
title lose...
echo Sorry, really sorry.
pause
echo You... Lost!
pause
echo.
echo Do you want to play again?
set /p yn=(yes/no)
if %yn% == yes goto top
if %yn% == no exit