Advertisement
CheikoAsami

Village Manager

Nov 23rd, 2023 (edited)
1,340
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 6.66 KB | Gaming | 1 0
  1. @echo off
  2. title Village Manager
  3. :header
  4. cls
  5. echo ------------------------
  6. echo   Head of the Village
  7. echo ------------------------
  8. echo 1- Start Game
  9. echo 2- Exit
  10. echo ------------------------
  11. choice /c 12 /n >nul
  12.  
  13. if %errorlevel% == 1 (
  14.     call :data
  15.     set /p name=Enter name of Village:
  16.     goto game
  17. )
  18. if %errorlevel% == 2 exit
  19. goto header
  20.  
  21. :data
  22. set name=Nameless Village
  23. set gold=100
  24. set pop=0
  25. set villagers=5
  26. set militia=5
  27. set livestock=0
  28. set grain=0
  29. set grainSkill=0
  30. set grainLoss=0
  31. set deathTollVillagers=0
  32. set deathTollMilitia=0
  33.  
  34. set tax=1
  35. set resourceActs=0
  36.  
  37. set fleeChances=0
  38. set fleeChance=15
  39. set raids=0
  40. set raidChance=0
  41. set raidType=0
  42. set raidToggle=0
  43. set daysUntilRaid=0
  44. set days=0
  45. set years=0
  46. set time=0
  47. set timeRate=9999
  48.  
  49. set state=Start
  50. goto:eof
  51.  
  52. :status
  53. set /a pop=%militia%+%villagers%
  54. if %pop% LEQ 0 (
  55.     goto gameover
  56. )
  57. if %resourceActs% EQU 0 set acting=No Actions being Taken, Have the Village do something in Managment!
  58. if %resourceActs% EQU 1 set acting=The Villagers are Growing Grain
  59. if %resourceActs% EQU 2 set acting=The Villagers are Raising Livestock
  60. if %resourceActs% EQU 3 set acting=The Villagers are Expanding Population
  61.  
  62. if %days% GEQ 365 (
  63.     set days=0
  64.     set /a years+=1
  65. )
  66. goto:eof
  67.  
  68. :gameover
  69. cls
  70. echo ------------------------------------------------------------------------
  71. echo     Pity, your village is now desolate! Everyone is dead and rotting.
  72. echo ------------------------------------------------------------------------
  73. echo You lasted %years% Years and %days% Days, surviving %raids% Raids on your village.
  74. echo ------------------------------------------------------------------------
  75. echo Press any Key to Return to Menu...
  76. pause>nul
  77. goto header
  78.  
  79. :game
  80. call :status
  81. cls
  82. echo -----------------------------------------
  83. echo Village Name: %name% /\ Gold: %gold% /\ Population: %pop%
  84. echo -
  85. echo Villagers: %villagers%
  86. echo Militia: %militia%
  87. echo -----------------------------------------
  88. echo Time Since Establishment: Day: %days% Year: %years%
  89. echo -
  90. echo Behavior: %acting%
  91. echo -
  92. echo Grain: %grain%
  93. echo Livestock: %livestock%
  94. if %daysUntilRaid% GTR 0 echo -
  95. if %daysUntilRaid% GTR 0 echo Days Remaining Until Raid:%daysUntilRaid%
  96. echo -
  97. echo Raid Roll: %raidChance%/50
  98. echo -----------------------------------------
  99. echo 1- %state% Time
  100. echo 2- Management
  101. echo 3- Options
  102. echo -----------------------------------------
  103. choice /d 4 /t %timeRate% /c 1234 /n >nul
  104. if %errorlevel% == 1 (
  105.     if %raidToggle% EQU 1 (
  106.         if %daysUntilRaid% EQU 0 (
  107.         goto raidOutcome
  108.         )
  109.     )
  110.     if %time% EQU 1 (
  111.         set time=0
  112.         set timeRate=9999
  113.         set state=Start
  114.     ) else (
  115.     set state=Stop
  116.     set time=1
  117.     set timeRate=2
  118.     )
  119. )
  120. if %errorlevel% == 2 (
  121.     goto management
  122. )
  123. if %errorlevel% == 3 (
  124.     goto options
  125. )
  126. if %errorlevel% == 4 (
  127.     if %time% EQU 1 (
  128.         call :progress
  129.     )
  130. )
  131. goto game
  132.  
  133. :raided
  134. set /a raidType=%random%%%2+1
  135. if %militia% GTR 0 (
  136.     set /a fleeChances=%random%%%100+1
  137.     set /a fleeChance=%militia%*2
  138.     if %fleeChances% GEQ %fleeChance% (
  139.         set /a raidType=3
  140.     )
  141. )
  142. set /a halfGrain=%grain% / 2
  143. set /a halfPop=%villagers% / 2
  144. set /a halfMil=%militia% / 3
  145.  
  146. set /a deathTollVillagers=%random%%%%halfPop%+1
  147. set /a deathTollMilitia=%random%%%%halfMil%+1
  148. set /a grainLoss=%random%%%%halfGrain%+1
  149.  
  150. call :raidTypes
  151.  
  152. set /a raids+=1
  153. set raidToggle=0
  154. goto:eof
  155.  
  156. :raidTypes
  157. if %raidType% EQU 1 (
  158.     set raidedType=They didn't want your goods they wanted death! %deathTollVillagers% Villagers and %deathTollMilitia% Militia lives had been lost in the Raid!
  159.     set /a villagers-=%deathTollVillagers%
  160.     set /a militia-=%deathTollMilitia%
  161. )
  162. if %raidType% EQU 2 (
  163.     set raidedType=To not hurt anyone, the Raiders were quite hungry and stole %grainLoss% grain from the village!
  164.     set /a grain-=%grainLoss%
  165. )
  166. if %raidType% EQU 3 (
  167.     set raidedType=To flee your borders, your militia force diswayed them from attacking! %fleeChances%/%fleeChance%
  168. )
  169. goto:eof
  170.  
  171. :raidOutcome
  172. call :raided
  173. cls
  174. echo -------------------------------------
  175. echo The Village of %name% is being Raided!
  176. echo The Raiders decided, %raidedType%
  177. echo -------------------------------------
  178. echo
  179. pause>nul
  180. goto game
  181.  
  182. :raidTimer
  183. if %raidChance% GTR 50 (
  184.     set raidToggle=1
  185.     set /a daysUntilRaid=%random%%%120+1
  186. )
  187. goto:eof
  188.  
  189. :progress
  190. if %raidToggle% EQU 0 (
  191.     set /a days+=1
  192.     set /a gold+=%pop%+%tax%
  193.     set /a raidChance=%random%%%65+1
  194.     call :raidTimer
  195. )
  196. if %raidToggle% EQU 1 (
  197.     if %daysUntilRaid% EQU 0 (
  198.         set time=0
  199.         set timeRate=9999
  200.         set state=Raid
  201.     )
  202.     if %daysUntilRaid% GTR 0 (
  203.         set /a days+=1
  204.         set /a gold+=%pop%+%tax%
  205.         set /a daysUntilRaid-=1
  206.     )
  207.    
  208. )
  209.  
  210. if %resourceActs% EQU 1 (
  211.     set /a grain+=%pop%+%grainSkill%
  212. )
  213. if %resourceActs% EQU 2 (
  214.     if %grain% GEQ 15 (
  215.         set /a grain-=15
  216.         set /a livestock+=1
  217.     ) else (set resourceActs=1)
  218. )
  219. if %resourceActs% EQU 3 (
  220.     if %grain% GEQ 15 (
  221.         if %livestock% GEQ 1 (
  222.             set /a grain-=15
  223.             set /a livestock-=1
  224.             set /a villagers+=2
  225.         ) else (set resourceActs=1)
  226.     ) else (set resourceActs=1)
  227.    
  228. )
  229. goto:eof
  230.  
  231.  
  232.  
  233. :management
  234. cls
  235. echo ----------------------------------
  236. echo            Management
  237. echo ----------------------------------
  238. echo 1- Actions
  239. echo 2- Stock
  240. echo 3- Return
  241. echo ----------------------------------
  242. choice /c 123 /n >nul
  243. if %errorlevel% == 1 (
  244.     goto villageActions
  245. )
  246. if %errorlevel% == 2 (
  247.     call :stock
  248. )
  249. if %errorlevel% == 3 (
  250.     goto game
  251. )
  252. goto management
  253.  
  254. :villageActions
  255. cls
  256. echo ------------------------------------
  257. echo             Actions
  258. echo ------------------------------------
  259. echo 1- Resource Managment
  260. echo 2- Citizen Management
  261. echo 3- Return
  262. echo ------------------------------------
  263. choice /c 123 /n >nul
  264. if %errorlevel% == 1 (
  265.     cls
  266.     echo ------------------------
  267.     echo Grain: %grain%
  268.     echo Livestock: %livestock%
  269.     echo ------------------------
  270.     echo 0-No Action
  271.     echo 1-Grow Grain
  272.     echo 2-Raise Livestock -Consumes -15 Grain
  273.     echo 3-Grow Population -Consumes -1 Livestock and -15 Grain
  274.     echo ------------------------
  275.     set /p resourceActs=Enter Action to Take:
  276.     call :actionTaken
  277. )
  278. if %errorlevel% == 3 (
  279.     goto management
  280. )
  281. goto villageActions
  282.  
  283. :actionTaken
  284. if %resourceActs% EQU 0 (
  285.     echo The Village will take no action
  286. )
  287. if %resourceActs% EQU 1 (
  288.     echo The Village will now Grow Grain.
  289. )
  290. if %resourceActs% EQU 2 (
  291.     echo The Village will now Raise Livestock.
  292. )
  293. if %resourceActs% EQU 3 (
  294.     echo The Village will now consume to flourish.
  295. )
  296. pause>nul
  297. goto:eof
  298.  
  299. :stock
  300. cls
  301. echo ---------------------------------
  302. echo            Stock
  303. echo ---------------------------------
  304. echo Grain: %grain%
  305. echo Livestock: %livestock%
  306. echo ---------------------------------
  307. pause>nul
  308. goto:eof
  309.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement