Advertisement
CheikoAsami

Village Manager

Sep 15th, 2024
454
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 13.82 KB | Gaming | 0 0
  1. @echo off
  2. title Village Manager
  3. setlocal enabledelayedexpansion
  4. color 0e
  5.  
  6. :header
  7. cls
  8. echo ------------------------
  9. echo   Head of the Village
  10. echo ------------------------
  11. echo 1- Start Game
  12. echo 2- Exit
  13. echo ------------------------
  14. choice /c 12 /n >nul
  15.  
  16. if %errorlevel% == 1 (
  17.     call :data
  18.     goto game
  19. )
  20. if %errorlevel% == 2 exit
  21. goto header
  22.  
  23. :data
  24. set name=Nameless Village
  25. set gold=100
  26. set pop=0
  27. set villagers=5
  28. set militia=5
  29. set livestock=0
  30. set grain=0
  31. set grainSkill=0
  32. set grainLoss=0
  33. set deathTollVillagers=0
  34. set deathTollMilitia=0
  35.  
  36. set tax=1
  37. set resourceActs=0
  38.  
  39. set fleeChances=0
  40. set fleeChance=15
  41. set raids=0
  42. set raidChance=0
  43. set raidType=0
  44. set raidToggle=0
  45. set daysUntilRaid=0
  46. set days=0
  47. set years=0
  48. set time=0
  49. set timeRate=9999
  50.  
  51. rem Caravan variables
  52. set caravanActive=0
  53. set caravanTimer=0
  54. set caravanGold=0
  55. set caravanGrain=0
  56. set caravanType=0
  57.  
  58. set friendlyCaravanActive=0
  59. set /a daysUntilFriendlyCaravan=%random% %% 30 + 10
  60.  
  61. set confirm=
  62. set state=Start
  63. goto:eof
  64.  
  65. :status
  66. set /a pop=%militia%+%villagers%
  67. if %pop% LEQ 0 (
  68.     goto gameover
  69. )
  70. if %resourceActs% EQU 0 set acting=No Actions being Taken, Have the Village do something in Management!
  71. if %resourceActs% EQU 1 set acting=The Villagers are Growing Grain
  72. if %resourceActs% EQU 2 set acting=The Villagers are Raising Livestock
  73. if %resourceActs% EQU 3 set acting=The Villagers are Expanding Population
  74.  
  75. if %days% GEQ 365 (
  76.     set days=0
  77.     set /a years+=1
  78. )
  79. goto:eof
  80.  
  81. :gameover
  82. cls
  83. echo ------------------------------------------------------------------------
  84. echo     Pity, your village is now desolate! Everyone is dead and rotting.
  85. echo ------------------------------------------------------------------------
  86. echo You lasted %years% Years and %days% Days, surviving %raids% Raids on your village.
  87. echo ------------------------------------------------------------------------
  88. echo Press any Key to Return to Menu...
  89. pause>nul
  90. goto header
  91.  
  92. :game
  93. call :status
  94. cls
  95. echo -----------------------------------------
  96. echo Village Name: %name% /\ Gold: %gold% /\ Population: %pop%
  97. echo -
  98. echo Villagers: %villagers%
  99. echo Militia: %militia%
  100. echo -----------------------------------------
  101. echo Time Since Establishment: Day: %days% Year: %years%
  102. echo -
  103. echo Behavior: %acting%
  104. echo -
  105. echo Grain: %grain%
  106. echo Livestock: %livestock%
  107. if %daysUntilRaid% GTR 0 echo -
  108. if %daysUntilRaid% GTR 0 echo Days Remaining Until Raid: %daysUntilRaid%
  109. if %friendlyCaravanActive% EQU 0 (
  110.     echo Days until next friendly caravan: %daysUntilFriendlyCaravan%
  111. )
  112. echo -
  113. echo Raid Roll: %raidChance%/50
  114. echo -----------------------------------------
  115. echo 1- %state% Time
  116. echo 2- Management
  117. echo 3- Options
  118. echo -----------------------------------------
  119. if %caravanTimer% GTR 0 (
  120.     echo Caravan Timer: %caravanTimer% days remaining
  121. )
  122. choice /d 4 /t %timeRate% /c 1234 /n >nul
  123. if %errorlevel% == 1 (
  124.     if %raidToggle% EQU 1 (
  125.         if %daysUntilRaid% EQU 0 (
  126.         goto raidOutcome
  127.         )
  128.     )
  129.     if %time% EQU 1 (
  130.         set time=0
  131.         set timeRate=9999
  132.         set state=Start
  133.     ) else (
  134.         set state=Stop
  135.         set time=1
  136.         set timeRate=2
  137.     )
  138. )
  139. if %errorlevel% == 2 goto management
  140. if %errorlevel% == 3 goto options
  141. if %errorlevel% == 4 (
  142.     if %time% EQU 1 call :progress
  143. )
  144. goto game
  145.  
  146. :friendlyCaravanArrives
  147. echo A friendly caravan has arrived at the village!
  148. set /a goldBonus=%random% %% 50 + 50
  149. set /a grainBonus=%random% %% 200 + 100
  150. set /a gold+=%goldBonus%
  151. set /a grain+=%grainBonus%
  152. echo +%goldBonus% gold and +%grainBonus% grain have been added to your stocks!
  153. set /a daysUntilFriendlyCaravan=%random% %% 30 + 10
  154. set friendlyCaravanActive=0
  155. pause
  156. goto :eof
  157.  
  158. :raided
  159. set /a raidType=%random%%%2+1
  160. if %militia% GTR 0 (
  161.     set /a fleeChances=%random% %% 100 + 1
  162.     set /a fleeChance=%militia% * 2
  163.     if %fleeChance% GTR 70 set fleeChance=70
  164.     if %fleeChances% LEQ %fleeChance% (
  165.         set /a raidType=3
  166.     )
  167. )
  168. set /a halfGrain=%grain% / 2
  169. set /a halfPop=%villagers% / 2
  170. set /a halfMil=%militia% / 3
  171.  
  172. set /a deathTollVillagers=%random%%%%halfPop%+1
  173. set /a deathTollMilitia=%random%%%%halfMil%+1
  174. set /a grainLoss=%random%%%%halfGrain%+1
  175.  
  176. call :raidTypes
  177.  
  178. set /a raids+=1
  179. set raidToggle=0
  180. goto:eof
  181.  
  182. :raidTypes
  183. if %raidType% EQU 1 (
  184.     set raidedType=They didn't want your goods they wanted death! %deathTollVillagers% Villagers and %deathTollMilitia% Militia lives had been lost in the Raid!
  185.     set /a villagers-=%deathTollVillagers%
  186.     set /a militia-=%deathTollMilitia%
  187. )
  188. if %raidType% EQU 2 (
  189.     set raidedType=To not hurt anyone, the Raiders were quite hungry and stole %grainLoss% grain from the village!
  190.     set /a grain-=%grainLoss%
  191. )
  192. if %raidType% EQU 3 (
  193.     set raidedType=To flee your borders, your militia force dissuaded them from attacking! %fleeChances%/%fleeChance%
  194. )
  195. goto:eof
  196.  
  197. :raidOutcome
  198. call :raided
  199. cls
  200. echo -------------------------------------
  201. echo The Village of %name% is being Raided!
  202. echo The Raiders decided, %raidedType%
  203. echo -------------------------------------
  204. echo
  205. pause>nul
  206. goto game
  207.  
  208. :raidTimer
  209. if %raidChance% GTR 50 (
  210.     set raidToggle=1
  211.     set /a daysUntilRaid=%random%%%120+1
  212. )
  213. goto:eof
  214.  
  215. :caravanState
  216.  if %caravanType% EQU 1 (
  217.             echo Caravan has been raided! All resources lost.
  218.             set caravanGold=0
  219.             set caravanGrain=0
  220.         ) else (
  221.             echo Caravan returned safely with %caravanGold% Gold and %caravanGrain% Grain.
  222.         )
  223.         echo Press any key to continue...
  224.         pause>nul
  225.         set caravanActive=0
  226. goto:eof
  227.  
  228. :progress
  229. if %raidToggle% EQU 0 (
  230.     set /a days+=1
  231.     set /a gold+=%pop%+%tax%
  232.     set /a raidChance=%random%%%65+1
  233.     call :raidTimer
  234. )
  235. if %friendlyCaravanActive% EQU 0 (
  236.     set /a daysUntilFriendlyCaravan-=1
  237.     if %daysUntilFriendlyCaravan% LEQ 0 (
  238.         set friendlyCaravanActive=1
  239.         call :friendlyCaravanArrives
  240.     )
  241. )
  242.  
  243. rem Caravan operations progress
  244. if %caravanTimer% GTR 0 (
  245.     set /a caravanTimer-=1
  246.     if %caravanTimer% EQU 0 (
  247.         set /a caravanType=%random%%%2+1
  248.             call :caravanState
  249.     )
  250. ) else (
  251.     set /a caravanGold+=3
  252.     set /a caravanGrain+=3
  253. )
  254.  
  255. ::echo Raid Toggle 1 If Remaining Days until Raid is 0 pause time and set the village state to raid haulting everything
  256. ::pause>nul
  257. if %raidToggle% EQU 1 (
  258.     if %daysUntilRaid% EQU 0 (
  259.         set time=0
  260.         set timeRate=9999
  261.         set state=Raid
  262.     )
  263.     if %daysUntilRaid% GTR 0 (
  264.         set /a days+=1
  265.         set /a gold+=%pop%+%tax%
  266.         set /a daysUntilRaid-=1
  267.     )
  268. )
  269. ::echo Raid Toggle 2
  270. ::pause>nul
  271. if %resourceActs% EQU 1 (
  272.     set /a grain+=%pop%+%grainSkill%
  273. )
  274. if %resourceActs% EQU 2 (
  275.     if %grain% GEQ 15 (
  276.         set /a grain-=15
  277.         set /a livestock+=1
  278.     ) else (
  279.         set resourceActs=1
  280.     )
  281. )
  282. ::echo Resource Act 1 and 2
  283. ::pause>nul
  284. if %resourceActs% EQU 3 (
  285.     if %grain% GEQ 15 (
  286.         if %livestock% GEQ 1 (
  287.             set /a grain-=15
  288.             set /a livestock-=1
  289.             set /a villagers+=2
  290.         ) else (
  291.             set resourceActs=1
  292.         )
  293.     ) else (
  294.         set resourceActs=1
  295.     )
  296. )
  297. ::echo Resource Act 3
  298. ::pause>nul
  299.  
  300.  
  301. goto:eof
  302.  
  303. :management
  304. cls
  305. echo ----------------------------------
  306. echo            Management
  307. echo ----------------------------------
  308. echo 1- Actions
  309. echo 2- Stock
  310. echo 3- Citizen Management
  311. echo 4- Return
  312. echo ----------------------------------
  313. choice /c 1234 /n >nul
  314. if %errorlevel% == 1 goto villageActions
  315. if %errorlevel% == 2 call :stock
  316. if %errorlevel% == 3 goto citizenManagement
  317. if %errorlevel% == 4 goto game
  318. goto management
  319.  
  320. :villageActions
  321. cls
  322. echo ------------------------------------
  323. echo             Actions
  324. echo ------------------------------------
  325. echo 1- Resource Management
  326. echo 2- Caravan Operations
  327. echo 3- Return
  328. echo ------------------------------------
  329. choice /c 123 /n >nul
  330. if %errorlevel% == 1 goto resourceManagement
  331. if %errorlevel% == 2 goto caravanOperations
  332. if %errorlevel% == 3 goto game
  333. goto villageActions
  334.  
  335. :resourceManagement
  336. cls
  337. echo ------------------------------------
  338. echo          Resource Management
  339. echo ------------------------------------
  340. echo 1- Grow Grain
  341. echo 2- Raise Livestock -15 Grain
  342. echo 3- Grow Population -1 Livestock, -15 Grain
  343. echo 4- Return
  344. echo ------------------------------------
  345. choice /c 1234 /n >nul
  346. if %errorlevel% == 1 (
  347.     set /a resourceActs=1
  348. )
  349. if %errorlevel% == 2 (
  350.     set /a resourceActs=2
  351. )
  352. if %errorlevel% == 3 (
  353.     set /a resourceActs=3
  354. )
  355. if %errorlevel% == 4 goto villageActions
  356. call :actionTaken
  357. goto resourceManagement
  358.  
  359. :actionTaken
  360. if %resourceActs% EQU 1 echo The Village will now Grow Grain.
  361. if %resourceActs% EQU 2 echo The Village will now Raise Livestock.
  362. if %resourceActs% EQU 3 echo The Village will now Expand Population.
  363. echo.
  364. pause
  365. goto:eof
  366.  
  367. :caravanOperations
  368. cls
  369. echo ------------------------------------
  370. echo             Caravan Operations
  371. echo ------------------------------------
  372. echo 1- Send Out Caravan
  373. echo 2- Recall Caravan
  374. echo 3- Check Caravan Status
  375. echo 4- Return to Actions Menu
  376. echo ------------------------------------
  377. choice /c 1234 /n >nul
  378.  
  379. if %errorlevel% == 1 (
  380.     if %caravanActive% EQU 1 (
  381.         echo A caravan is already out.
  382.         pause
  383.     ) else (
  384.        rem Check if enough resources to send caravan
  385.         if %gold% GEQ 20 if %grain% GEQ 10 (
  386.             echo Confirm sending a caravan, it will cost 20 gold and 10 grain. [1/2]
  387.             set /p confirm=1 Yes or 2 No:
  388.             if /I "!confirm!"=="1" (
  389.                 call :sendCaravan
  390.             )
  391.         ) else (
  392.             echo Not enough resources to send a caravan! Need at least 20 gold and 10 grain.
  393.             pause
  394.         )
  395.     )
  396. )
  397.  
  398. if %errorlevel% == 2 (
  399.     if %caravanActive% EQU 1 (
  400.         echo Confirm you want to recall the caravan? [1/2]
  401.         set /p confirm=1 Yes or 2 No:
  402.         if /I "!confirm!"=="1" (
  403.             call :recallCaravan
  404.         )
  405.     ) else (
  406.         echo No caravan is currently out.
  407.         pause
  408.     )
  409. )
  410.  
  411. if %errorlevel% == 3 (
  412.     if %caravanActive% EQU 1 (
  413.         echo Caravan currently out: %caravanGold% gold and %caravanGrain% grain collected so far.
  414.         echo Days remaining until return: %caravanTimer%
  415.     ) else (
  416.         echo No caravan is currently out.
  417.     )
  418.     pause
  419. )
  420.  
  421. if %errorlevel% == 4 goto villageActions
  422.  
  423. goto caravanOperations
  424.  
  425. :sendCaravan
  426. cls
  427. echo Sending out a caravan...
  428. set /a gold-=20
  429. set /a grain-=10
  430. set /a caravanTimer=%random% %% 20 + 10
  431. set /a caravanGold=0
  432. set /a caravanGrain=0
  433. set caravanActive=1
  434. echo Caravan has been dispatched and will return in %caravanTimer% days.
  435. pause
  436. goto caravanOperations
  437.  
  438. :recallCaravan
  439. cls
  440. echo Recalling the caravan...
  441. set /a gold+=%caravanGold%
  442. set /a grain+=%caravanGrain%
  443. echo Caravan has returned safely with %caravanGold% Gold and %caravanGrain% Grain.
  444. set caravanTimer=0
  445. set caravanActive=0
  446. pause
  447. goto caravanOperations
  448.  
  449. :actionTaken
  450. if %resourceActs% EQU 0 echo The Village will take no action
  451. if %resourceActs% EQU 1 echo The Village will now Grow Grain.
  452. if %resourceActs% EQU 2 echo The Village will now Raise Livestock.
  453. if %resourceActs% EQU 3 echo The Village will now consume to flourish.
  454. pause>nul
  455. goto:eof
  456.  
  457. :stock
  458. cls
  459. echo ---------------------------------
  460. echo            Stock
  461. echo ---------------------------------
  462. echo Grain: %grain%
  463. echo Livestock: %livestock%
  464. echo ---------------------------------
  465. pause>nul
  466. goto management
  467.  
  468. :citizenManagement
  469. cls
  470. echo ------------------------------------
  471. echo         Citizen Management
  472. echo ------------------------------------
  473. echo 1- Food Production Upgrade - Cost: 50 Gold
  474. echo 2- Gold Production Upgrade - Cost: 50 Gold
  475. echo 3- Increase Tax Rate
  476. echo 4- Decrease Tax Rate
  477. echo 5- Return
  478. echo ------------------------------------
  479. choice /c 12345 /n >nul
  480. if %errorlevel% == 1 call :foodProductionUpgrade
  481. if %errorlevel% == 2 call :goldProductionUpgrade
  482. if %errorlevel% == 3 call :increaseTaxRate
  483. if %errorlevel% == 4 call :decreaseTaxRate
  484. if %errorlevel% == 5 goto management
  485. goto citizenManagement
  486.  
  487. :foodProductionUpgrade
  488. if %gold% GEQ 50 (
  489.     set /a grainSkill+=1
  490.     set /a gold-=50
  491.     echo Food Production has been upgraded. Grain skill is now %grainSkill%.
  492. ) else (
  493.     echo Not enough gold to upgrade food production.
  494. )
  495. pause>nul
  496. goto citizenManagement
  497.  
  498. :goldProductionUpgrade
  499. if %gold% GEQ 50 (
  500.     set /a tax+=1
  501.     set /a gold-=50
  502.     echo Gold Production has been upgraded. Tax rate is now %tax%.
  503. ) else (
  504.     echo Not enough gold to upgrade gold production.
  505. )
  506. pause>nul
  507. goto citizenManagement
  508.  
  509. :increaseTaxRate
  510. set /a tax+=1
  511. echo Tax rate has been increased. Current tax rate is %tax%.
  512. pause>nul
  513. goto citizenManagement
  514.  
  515. :decreaseTaxRate
  516. if %tax% GEQ 1 (
  517.     set /a tax-=1
  518.     echo Tax rate has been decreased. Current tax rate is %tax%.
  519. ) else (
  520.     echo Tax rate cannot be decreased further.
  521. )
  522. pause>nul
  523. goto citizenManagement
  524.  
  525. :options
  526. cls
  527. echo -----------------------------------------
  528. echo                Options
  529. echo -----------------------------------------
  530. echo 1- Village Name
  531. echo 2- Reset Game
  532. echo 3- Return
  533. echo -----------------------------------------
  534. choice /c 123 /n >nul
  535. if %errorlevel% == 1 goto name
  536. if %errorlevel% == 2 goto reset
  537. if %errorlevel% == 3 goto game
  538. goto options
  539.  
  540. :name
  541. cls
  542. echo ------------------------------
  543. echo Current Village Name: %name%
  544. echo ------------------------------
  545. echo Enter New Village Name:
  546. set /p name=
  547. goto options
  548.  
  549. :reset
  550. cls
  551. echo ------------------------
  552. echo   Reset Game Data
  553. echo ------------------------
  554. echo 1- Yes
  555. echo 2- No
  556. echo ------------------------
  557. choice /c 12 /n >nul
  558. if %errorlevel% == 1 (
  559.     call :data
  560.     goto game
  561. )
  562. if %errorlevel% == 2 goto game
  563. goto options
  564.  
Advertisement
Comments
  • CheikoAsami
    65 days
    # text 0.29 KB | 0 0
    1. Who ever reported this for Abuse Content is a sad individual. There is nothing abusive about this Text Based Village Manager Game, it's neither malicious, harmful, or invasive. It's a literal game and someone decided to report it for no reason. Could it be Jealousy? Could it be Pettiness? Who knows.
Add Comment
Please, Sign In to add comment
Advertisement