Dec 8, 2011 10:26 PM
(This post was last modified: Dec 8, 2011 11:30 PM by Jozhus.)
I started making a turn based fighting game a few months ago, but stopped because I was running off an old computer. Many commands didn't work for that computer, so the coding was kept simple. Today, while salvaging what was left of that computer, I found it tucked away deep and decided to put all those batch files into one and upload it.
Keep in mind, this was the second batch file I've ever attempted :P
Code
@echo off
echo.
echo 00 00 00
echo 0 0 0 0 0 0
echo 0 00 00 0 0
echo 0 0 0 0
echo 0 0000 00 00 00 0 0
echo 0 0 0 0 0 0 0 0 0 0
echo 0 0000 0 0 0 0000 0 0 000 0 0 0
echo 0 0 0 0 0 0 0 0 0 000 0000 0 0
echo 0 0 0 0 0 0 0 0 0 0 0 0 0
echo 00 00 00 00 00 000 00
echo.
echo.
echo 00 00 00 00 00
echo 0 0 0 0 0 0 0 0 0 0
echo 0 00 00 0 000 0 0 0 00 00
echo 0 0 0 000 0 0 0 0 0
echo 0 0000 00 0 0 0 00 00 00
echo 0 0 0 0 00 0 0 0 0 0
echo 0 0000 0 0 0 0 0 0000 0 0 0
echo 0 0 0 0 00 0 0 0 0 0 0 0
echo 0 0 0 0 0 0 0 0 0 0 0 0
echo 00 00 00 00 00 00
pause
set menuch=0
:MENU
cls
echo.
echo.
echo.
echo.
echo.
echo Play
echo.
echo.
echo.
echo Tutorial
echo.
echo.
set /p menuch=Choice:
if /i %menuch%==play GOTO Difficulty
if /i %menuch%==tutorial GOTO Tutorial
GOTO MENU
:DIFFICULTY
set diff=0
:DIFF
cls
echo.
echo.
echo Choose a difficulty:
echo.
echo Easy
echo.
echo Medium
echo.
echo Hard
echo.
echo.
echo.
set /p diff=Choice:
If /i %diff%==easy GOTO NAME
If /i %diff%==medium GOTO NAME
If /i %diff%==hard GOTO NAME
GOTO DIFF
:NAME
cls
echo.
echo.
echo.
set /p name= Chose your name:
set playerhealth=300
set phealthmax=300
set phealthmin=0
set playermana=200
set pmanamax=200
set pmanamin=0
set whppotions=5
set shppotions=3
set hhppotions=1
set wmppotions=3
set smppotions=1
set hmppotions=1
set fhpotions=1
set healhp=0
set healmp=0
set dattack=0
set stuncount=0
::Difficulty and enemy health here
if /i %diff%==easy GOTO EASY
if /i %diff%==medium GOTO MEDIUM
if /i %diff%==hard GOTO HARD
:EASY
set rnd=%random%
set /a monsterhealth=%rnd%/35
if %monsterhealth% LSS 700 GOTO EASY
if %monsterhealth% GTR 1100 GOTO EASY
GOTO GAME
:MEDIUM
set rnd=%random%
set /a monsterhealth=%rnd%/20
if %monsterhealth% LSS 1200 GOTO MEDIUM
if %monsterhealth% GTR 1900 GOTO MEDIUM
GOTO GAME
:HARD
set rnd=%random%
set /a monsterhealth=%rnd%/15
if %monsterhealth% LSS 2000 GOTO HARD
if %monsterhealth% GTR 2700 GOTO HARD
GOTO GAME
::Main game interface
:GAME
set action=0
cls
echo --
echo Monster
echo HP: %monsterhealth% Mana: N/A
echo --
echo.
echo.
echo.
echo. / \
echo -( o.o)-x x-(._ .)-
echo.
echo.
echo.
echo --
echo %name%
echo HP: %playerhealth% Mana: %playermana%
echo --
echo Actions
echo --
echo Attack (a) Skills (s)
echo.
echo Item (i) Skip (sk)
echo.
echo.
echo.
set /p action=Choice:
if /i %action%==attack GOTO ATTACK
if /i %action%==skip GOTO MONSTERATTACK
if /i %action%==item GOTO ITEMS
if /i %action%==skills GOTO SKILLS
if /i %action%==a GOTO ATTACK
if /i %action%==sk GOTO MONSTERATTACK
if /i %action%==i GOTO ITEMS
if /i %action%==s GOTO SKILLS
GOTO GAME
::Attack screen
:ATTACK
cls
set rnd3=%random%
set rnd4=%random%
set /a rnd4=%rnd4%/500
set /a pdmg=%rnd3%/500
if %dattack% GTR 0 set /a pdmg=%rnd3%/800
set basepdmg=%pdmg%
if %pdmg%==%rnd4% set /a pdmg=%pdmg%*10
set /a monsterhealth=%monsterhealth%-%pdmg%
if %monsterhealth% LSS 0 set monsterhealth=0
echo --
echo Monster
echo HP: %monsterhealth% Mana: N/A
echo --
echo.
echo -%pdmg%
echo.
echo \
echo -( o_o)-+--- x-(x_ x)-
echo.
echo.
echo.
echo --
echo %name%
echo HP: %playerhealth% Mana: %playermana% Crit: %rnd4% Damage: %basepdmg%
echo --
echo.
echo.
echo.
echo.
echo.
echo.
PING 1.1.1.1 -n 1 -w 700 >NUL
if %monsterhealth%==0 GOTO WIN
if %dattack%==1 GOTO DATTACKOFF
if %dattack%==2 GOTO DATTACKBUFF
if %stuncount%==1 GOTO MONSTERSTUN
if %stuncount%==2 GOTO MONSTERSTUN
GOTO MONSTERATTACK
::Monster attack screen
:MONSTERATTACK
cls
set rnd2=%random%
set rnd5=%random%
set /a rnd5=%rnd5%/500
set /a mdmg=%rnd2%/600
set basemdmg=%mdmg%
if %mdmg%==%rnd5% set /a mdmg=%mdmg%*5
set /a playerhealth=%playerhealth%-%mdmg%
if %playerhealth% LSS 1 set playerhealth=0
echo --
echo Monste
echo HP: %monsterhealth% Mana: N/A Crit: %rnd5% Damage: %basemdmg%
echo --
echo.
echo -%mdmg%
echo.
echo. /
echo -( x.x)-x ---+-(._ .)-
echo.
echo.
echo.
echo --
echo %name%
echo HP: %playerhealth% Mana: %playermana%
echo --
echo.
echo.
echo.
echo.
echo.
echo.
PING 1.1.1.1 -n 1 -w 700 >NUL
if %playerhealth% leq %phealthmin% GOTO LOSE
GOTO GAME
::Stunned screen here
:MONSTERSTUN
cls
set /a stuncount=%stuncount%+1
echo --
echo Monster
echo HP: %monsterhealth% Mana: N/A
echo --
echo.
echo *Stunned*
echo.
echo. / \
echo -( o.o)-x x-(._ .)-
echo.
echo.
echo.
echo --
echo %name%
echo HP: %playerhealth% Mana: %playermana%
echo --
echo.
echo.
echo.
echo.
echo.
echo.
PING 1.1.1.1 -n 1 -w 700 >NUL
GOTO GAME
::Item interface
:ITEMS
set use=0
cls
echo --
echo Monster
echo HP: %monsterhealth% Mana: N/A
echo --
echo.
echo.
echo.
echo. / \
echo -( o.o)-x x-(._ .)-
echo.
echo.
echo.
echo --
echo %name%
echo HP: %playerhealth% Mana: %playermana%
echo --
echo ITEMS
echo --
echo WeakHp (wh) x%whppotions% WeakMp (wm) x%wmppotions%
echo StrongHp (sh) x%shppotions% StrongMp (sm) x%smppotions%
echo HyperHp (hh) x%hhppotions% HyperMp (hm) x%hmppotions%
echo FullHeal (fh) x%fhpotions%
echo Cancel
echo.
set /p use=Choice:
if /i %use%==weakhp GOTO WHPPOT
if /i %use%==stronghp GOTO SHPPOT
if /i %use%==hyperhp GOTO HHPPOT
if /i %use%==weakmp GOTO WMPPOT
if /i %use%==strongmp GOTO SMPPOT
if /i %use%==hypermp GOTO HMPPOT
if /i %use%==fullheal GOTO FHPOT
if /i %use%==wh GOTO WHPPOT
if /i %use%==sh GOTO SHPPOT
if /i %use%==hh GOTO HHPPOT
if /i %use%==wm GOTO WMPPOT
if /i %use%==sm GOTO SMPPOT
if /i %use%==hm GOTO HMPPOT
if /i %use%==fh GOTO FHPOT
if /i %use%==cancel GOTO GAME
GOTO ITEMS
::Potions here
:WHPPOT
if %whppotions%==0 GOTO ITEMS
set /a whppotions=%whppotions% -1
set healhp=50
GOTO HEALHP
:SHPPOT
if %shppotions%==0 GOTO ITEMS
set /a shppotions=%shppotions% -1
set healhp=100
GOTO HEALHP
:HHPPOT
if %hhppotions%==0 GOTO ITEMS
set /a hhppotions=%hhppotions% -1
set healhp=250
GOTO HEALHP
:WMPPOT
if %wmppotions%==0 GOTO ITEMS
set /a wmppotions=%wmppotions% -1
set healmp=40
GOTO HEALMP
:SMPPOT
if %smppotions%==0 GOTO ITEMS
set /a smppotions=%smppotions% -1
set healmp=80
GOTO HEALMP
:HMPPOT
if %hmppotions%==0 GOTO ITEMS
set /a hmppotions=%hmppotions% -1
set healmp=100
GOTO HEALMP
:FHPOT
if %fhpotions%==0 GOTO ITEMS
set /a fhpotions=%fhpotions%-1
GOTO FULLHEAL
::Healing hp screen
:HEALHP
cls
set /a playerhealth=%playerhealth%+%healhp%
if %playerhealth% gtr %phealthmax% set playerhealth=%phealthmax%
echo --
echo Monster
echo HP: %monsterhealth% Mana: N/A
echo --
echo.
echo +%healhp% Hp
echo.
echo. / \
echo -( o.o)-x x-(._ .)-
echo.
echo.
echo.
echo --
echo %name%
echo HP: %playerhealth% Mana: %playermana%
echo --
echo.
echo.
echo.
echo.
echo.
echo.
PING 1.1.1.1 -n 1 -w 700 >NUL
if %stuncount%==2 GOTO MONSTERSTUN
GOTO MONSTERATTACK
::Healing mp screen
:HEALMP
cls
set /a playermana=%playermana%+%healmp%
if %playermana% gtr %pmanamax% set playermana=%pmanamax%
echo --
echo Monster
echo HP: %monsterhealth% Mana: N/A
echo --
echo.
echo +%healmp% Mp
echo.
echo. / \
echo -( o.o)-x x-(._ .)-
echo.
echo.
echo.
echo --
echo %name%
echo HP: %playerhealth% Mana: %playermana%
echo --
echo.
echo.
echo.
echo.
echo.
echo.
PING 1.1.1.1 -n 1 -w 700 >NUL
if %stuncount%==2 GOTO MONSTERSTUN
GOTO MONSTERATTACK
:FULLHEAL
cls
set playerhealth=%phealthmax%
set playermana=%pmanamax%
echo --
echo Monster
echo HP: %monsterhealth% Mana: N/A
echo --
echo +MAX Hp
echo +MAX Mp
echo.
echo. / \
echo -( o.o)-x x-(._ .)-
echo.
echo.
echo.
echo --
echo %name%
echo HP: %playerhealth% Mana: %playermana%
echo --
echo.
echo.
echo.
echo.
echo.
echo.
PING 1.1.1.1 -n 1 -w 700 >NUL
if %stuncount%==2 GOTO MONSTERSTUN
GOTO MONSTERATTACK
::Skills interface
:SKILLS
set skill=0
cls
echo --
echo Monster
echo HP: %monsterhealth% Mana: N/A
echo --
echo.
echo.
echo.
echo. / \
echo -( o.o)-x x-(._ .)-
echo.
echo.
echo.
echo --
echo %name%
echo HP: %playerhealth% Mana: %playermana%
echo --
echo Skills Mana Description
echo -- -- --
echo Double (d) 40 Hits twice, but weakly.
echo Stun (s) 80 Stuns enemy for 2 turns.
echo.
echo Cancel
echo.
echo.
set /p skill=Choice:
if /i %skill%==double GOTO DATTACKON
if /i %skill%==stun GOTO STUN
if /i %skill%==s GOTO STUN
if /i %skill%==d GOTO DATTACKON
if /i %skill%==cancel GOTO GAME
GOTO SKILLs
::Skills are here
::Double Attack here
:DATTACKON
if %playermana% LEQ %pmanamin% GOTO SKILLS
if %playermana% LSS 40 GOTO SKILLS
set /a playermana=%playermana%-40
if %playermana% LSS %pmanamin% set playermana=%pmanamin%
set dattack=1
GOTO ATTACK
:DATTACKOFF
set dattack=2
GOTO ATTACK
:DATTACKBUFF
set dattack=0
if %stuncount%==2 GOTO MONSTERSTUN
GOTO MONSTERATTACK
::Stun here
:STUN
if %playermana% LEQ %pmanamin% GOTO SKILLS
if %playermana% LSS 80 GOTO SKILLS
set /a playermana=%playermana%-80
if %playermana% LSS %pmanamin% set playermana=%pmanamin%
set stuncount=1
GOTO ATTACK
:TUTORIAL
cls
echo Tutorial
echo --
echo Type "play" in the menu to play.
echo.
echo The difficulty changes the health of the opponent.
echo.
echo Weak health potions heal 50 health.
echo.
echo Strong health potions heal 100 health.
echo.
echo Super health potions heal 250 health.
echo.
echo Weak mana potions heal 40 mana.
echo.
echo Strong mana potions heals 80 mana.
echo.
echo Super mana potions heals 100 mana.
echo.
echo If your opponent runs out of health, you win!
echo.
echo If YOU run out of health, you lose.
echo.
echo If your base damage is the same as the critical number
echo your damage for that attack will be multiplied by 10.
echo.
echo Your base damage, and critical hit is shown to the right of your name.
echo.
echo Your opponent can hit criticals too.
echo.
echo Double attack hits twice but is weaker each hit.
echo.
echo Stun attack stuns the enemy for 2 turns.
echo.
echo Scroll up for more stuff.
echo.
pause
GOTO MENU
:WIN
cls
echo.
echo.
echo.
echo YOU WIN!
echo.
pause
GOTO Again
:LOSE
cls
echo.
echo.
echo.
echo YOU LOSE!
echo.
pause
GOTO Again
:AGAIN
cls
echo.
echo.
echo.
echo Play again?
echo.
echo Yes / No
echo.
set /p again=Choice:
If /i %again%==yes GOTO Menu
if /i %again%==no EXIT
GOTO AGAIN

