Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.93 KB | None | 0 0
  1. import java.util.*;
  2.  
  3.  
  4. public class World {
  5.  
  6. //DECLARING ALL STAT'S P - Per tick || Q - Waiting to be built || B - Bonus
  7.  
  8. //TICK VARIABLES
  9.  
  10. static int TickCount =0;
  11. static int Ticker =0;
  12.  
  13. //CALCULATING COSTS
  14.  
  15. static int input;
  16. static int input2;
  17. static int Woodcost;
  18. static int Ironcost;
  19. static int Goldcost;
  20. static int Foodcost;
  21. static int Lancecost;
  22. static int Swordcost;
  23. static int Bowcost;
  24. static int Horsecost;
  25. static int LightAcost;
  26. static int HeavyAcost;
  27. static int Popcost;
  28.  
  29. //UNITS
  30.  
  31. static int ArchQ = 0;
  32. static int ArchP = 0;
  33. static int Arch = 10;
  34. static int PikeQ = 0;
  35. static int PikeP = 0;
  36. static int Pike = 10;
  37. static int SwordQ = 0;
  38. static int SwordP = 0;
  39. static int Sword = 10;
  40. static int CaragQ = 0;
  41. static int CaragP = 0;
  42. static int Carag = 10;
  43. static int EliteQ = 0;
  44. static int EliteP = 0;
  45. static int Elite = 10;
  46. static int MageQ = 0;
  47. static int MageP = 0;
  48. static int Mage = 10;
  49. static int WizardQ = 10;
  50. static int WizardP = 0;
  51. static int Wizard = 100;
  52.  
  53. //WEAPONS
  54.  
  55. static int SwordWQ = 0;
  56. static int SwordWP = 0;
  57. static int SwordW = 10;
  58. static int BowQ = 0;
  59. static int BowP = 0;
  60. static int Bow = 10;
  61. static int LanceQ = 0;
  62. static int LanceP = 0;
  63. static int Lance = 10;
  64. static int HorseQ = 0;
  65. static int HorseP = 0;
  66. static int Horse = 10;
  67. static int HeavyAQ = 0;
  68. static int HeavyAP = 0;
  69. static int HeavyA = 10;
  70. static int LightAQ = 0;
  71. static int LightAP = 0;
  72. static int LightA = 10;
  73.  
  74. //RESOURCES
  75.  
  76.  
  77. static int Land =10;
  78. static int GoldP = 0;
  79. static int Gold = 100000;
  80. static int FoodP = 0;
  81. static int Food = 1000;
  82. static int IronP = 0;
  83. static int Iron = 1000;
  84. static int WoodP = 0;
  85. static int Wood = 1000;
  86. static int Pop = 1500;
  87. static int PopP = 0;
  88. static int FUpkeep = 0;
  89. static int GUpkeep =0;
  90. static int WoodOpt =6;
  91. static int IronOpt =4;
  92. static int FoodOpt =100;
  93. static int WeaponOpt=0;
  94. static int WoodB =0;
  95. static int GoldB =0;
  96. static int IronB =0;
  97. static int FoodB =0;
  98. static int PopB = 0;
  99. static int WeaponB =0;
  100. static int LandP =0;
  101. static int PopGap =0;
  102. static int PopCapacity =0;
  103. static Random generator = new Random();
  104.  
  105. //WORKERS
  106.  
  107. static int Miners = 0;
  108. static int Millers = 0;
  109. static int Farmers = 0;
  110. static int Explorers = 0;
  111. static int PopRoom = 0;
  112. static int Training = 10000;
  113.  
  114. //BUILDINGS
  115.  
  116. static int HouseQ = 0;
  117. static int HouseP = 0;
  118. static int House = 0;
  119. static int FarmQ = 0;
  120. static int FarmP = 0;
  121. static int Farm = 0;
  122. static int MillQ = 0;
  123. static int MillP = 0;
  124. static int Mill = 0;
  125. static int MineQ = 0;
  126. static int MineP = 0;
  127. static int Mine = 0;
  128. static int MarketQ = 0;
  129. static int MarketP = 0;
  130. static int Market = 0;
  131. static int CastleQ = 0;
  132. static int CastleP = 0;
  133. static int Castle = 0;
  134. static int TrainingCQ = 0;
  135. static int TrainingCP = 0;
  136. static int TrainingC = 0;
  137. static int ATrainingCQ = 0;
  138. static int ATrainingCP = 0;
  139. static int ATrainingC = 0;
  140. static int ForgeQ = 0;
  141. static int ForgeP = 0;
  142. static int Forge = 0;
  143. static int GuardHQ = 0;
  144. static int GuardHP = 0;
  145. static int GuardH = 0;
  146. static int GuardTQ = 0;
  147. static int GuardTP = 0;
  148. static int GuardRoom =10000;
  149. static int GuardT = 0;
  150. static int HospitalQ = 0;
  151. static int HospitalP = 0;
  152. static int Hospital = 0;
  153. static int SchoolQ = 0;
  154. static int SchoolP = 0;
  155. static int School = 0;
  156. static int SchoolRoom=10000;
  157.  
  158. public static void main(String args[]){
  159. tick();
  160. //System.out.println("Welcome to Thardferr simulator 1.0!");
  161. //home();
  162. //double RandomNum = generator.nextInt(300)+0;
  163. //double y = (300/((10*55)+(10*2.5)))*RandomNum/100;
  164. //System.out.println(y);
  165. }
  166. static void home(){
  167. Scanner reader = new Scanner(System.in);
  168. System.out.println("Welcome home!");
  169. System.out.println("Gold: " + Gold + " Wood " + Wood + " Iron " + Iron + " Food " + Food + " Population: " + Pop);
  170. System.out.println("Army: 1 ||Buildings: 2 ||Population: 3 ||Spells: 4 ||Kingdom Stats: 5 ||Technology: 6 ~~~ Next Tick: 10 ~~~ Exit: 0");
  171. input = reader.nextInt();
  172. if(input == 1){
  173. army();
  174. }
  175. if(input == 2){
  176. buildings();
  177. }
  178. }
  179. static void buildings(){
  180. Scanner reader = new Scanner(System.in);
  181. System.out.println("Castles:" + Castle);
  182. System.out.println("Houses:" + House);
  183. System.out.println("Mills:" + Mill);
  184. System.out.println("Mines:" + Mine);
  185. System.out.println("Farms:" + Farm);
  186. System.out.println("Markets:" + Market);
  187. System.out.println("Training Centers:" + TrainingC);
  188. System.out.println("Advanced Training Centers:" + ATrainingC);
  189. System.out.println("Forges:" + Forge);
  190. System.out.println("Schools:" + School);
  191. System.out.println("Hospitals:" + Hospital);
  192. System.out.println("What would you like to do? Build: 1 || Or Destroy: 2? || Back: 0");
  193. input = reader.nextInt();
  194. if(input == 1){
  195. bbuildings();
  196. }
  197. if(input == 2){
  198.  
  199. }
  200. if(input == 0){
  201. home();
  202. }
  203. }
  204. static void bbuildings(){
  205. Scanner reader = new Scanner(System.in);
  206. System.out.println("Which building would you like to build?");
  207. System.out.println("Castle:1 || House:2 || Mill:3 || Mine:4 || Farm:5 || Market:6 || Training Center:7 || Advanced Training Center:8 || Forge:9 || School: 10 || Hospital: 11 ~~~ Back:0");
  208. input = reader.nextInt();
  209. while(input != 1 && input != 2 && input != 3 && input != 4 && input != 5 && input != 6 && input != 9 && input != 10 && input != 11 && input != 0){
  210. System.out.println("Incorrect input, try again.");
  211. input = reader.nextInt();
  212. }
  213. Woodcost=0;
  214. Ironcost=0;
  215. Goldcost=0;
  216. Foodcost=0;
  217. if(input == 1){
  218.  
  219. }
  220. if(input == 2){
  221.  
  222. }
  223. if(input == 4){
  224.  
  225. }
  226. if(input == 5){
  227.  
  228. }
  229. if(input == 6){
  230.  
  231. }
  232. if(input == 7){
  233.  
  234. }
  235. if(input == 8){
  236.  
  237. }
  238. if(input == 9){
  239.  
  240. }
  241. if(input == 10){
  242.  
  243. }
  244. if(input == 11){
  245.  
  246. }
  247. if(input == 0){
  248. buildings();
  249. }
  250. System.out.println("How many would you like to construct?");
  251. input2 = reader.nextInt();
  252. while((Goldcost*input2)>Gold||(Woodcost*input2)>Wood||(Ironcost*input2)>Iron||(Foodcost*input2)>Food){
  253. System.out.println("You do not have sufficient resources for that many units. ");
  254. System.out.println("How many would you like to construct?");
  255. input2 = reader.nextInt();
  256. }
  257. Gold -= (Goldcost*input2);
  258. Iron -= (Ironcost*input2);
  259. Wood -= (Woodcost*input2);
  260. Food -= (Foodcost*input2);
  261. }
  262. static void army(){
  263. Scanner reader = new Scanner(System.in);
  264. System.out.println("You currently have: " + Arch + " Archers, with " + ArchQ + " being trained.");
  265. System.out.println("You currently have: " + Sword + " Swordsmen, with " + SwordQ + " being trained.");
  266. System.out.println("You currently have: " + Pike + " Lancemen, with " + PikeQ + " being trained.");
  267. System.out.println("You currently have: " + Wizard + " Wizards, with " + WizardQ + " being trained.");
  268. System.out.println("You currently have: " + Carag + " Caragous, with " + CaragQ + " being trained.");
  269. System.out.println("You currently have: " + Elite + " Elite Archers, with " + EliteQ + " being trained.");
  270. System.out.println("You currently have: " + Mage + " Mages, with " + MageQ + " being trained.");
  271. System.out.println();
  272. System.out.println("Would you like to train units, or un-train units?");
  273. System.out.println("Train: 1 - Un-Train: 2 - Back: 0");
  274. input = reader.nextInt();
  275. if(input == 1){
  276. if(GuardRoom == 0){
  277. System.out.println("There is not enough room in your guard houses to train units. Disband units, or choose another option");
  278. army();
  279. }
  280. tarmy();
  281. }
  282. if(input == 2){
  283. if(GuardRoom == GuardH*40){
  284. System.out.println("You have no units to un-train.");
  285. army();
  286. }
  287. utarmy();
  288. }
  289. if(input == 0){
  290. home();
  291. }
  292. }
  293. static void tarmy(){
  294. Scanner reader = new Scanner(System.in);
  295. System.out.println("Which unit would you like to train? ~~~ Back: 0");
  296. System.out.println("Archer - 1 Swordsman - 2 Lancemen - 3 Caragous - 4 Elite Arhcers - 5 Mages - 6 Wizards - 9");
  297. input = reader.nextInt();
  298. while(input != 1 && input != 2 && input != 3 && input != 4 && input != 5 && input != 6 && input != 9 && input != 0){
  299. System.out.println("Incorrect input, try again.");
  300. input = reader.nextInt();
  301. }
  302.  
  303. Goldcost = 0;
  304. Horsecost = 0;
  305. HeavyAcost = 0;
  306. Swordcost = 0;
  307. Lancecost = 0;
  308. Popcost = 1;
  309. LightAcost = 0;
  310. Bowcost = 0;
  311.  
  312. if(input == 1){
  313. Goldcost = 150;
  314. Bowcost = 1;
  315. }
  316. if(input == 2){
  317. Goldcost = 100;
  318. Swordcost = 1;
  319. LightAcost = 1;
  320. }
  321. if(input == 3){
  322. Goldcost = 100;
  323. Lancecost = 1;
  324. LightAcost = 1;
  325. }
  326. if(input == 4){
  327. Goldcost = 1500;
  328. Horsecost = 1;
  329. HeavyAcost = 1;
  330. Swordcost = 1;
  331. Lancecost = 1;
  332. }
  333. if(input == 5){
  334. Goldcost = 1500;
  335. Horsecost = 1;
  336. HeavyAcost = 1;
  337. Swordcost = 1;
  338. Lancecost = 1;
  339. }
  340. if(input == 6){
  341. Goldcost = 1500;
  342. Horsecost = 1;
  343. HeavyAcost = 1;
  344. Swordcost = 1;
  345. Lancecost = 1;
  346. }
  347. if(input == 9){
  348. Goldcost = 1;
  349. }
  350.  
  351. //Checking whether we have the materials for the no. of units
  352.  
  353. System.out.println("How many would you like to train?");
  354. input2 = reader.nextInt();
  355. while((Goldcost*input2)>Gold||(Swordcost*input2)>Sword||(Horsecost*input2)>Horse||(Bowcost*input2)>Bow||(Popcost*input2)>Training||(Lancecost*input2)>Lance||(LightAcost*input2)>LightA||(HeavyAcost*input2)>HeavyA){
  356. System.out.println(Goldcost*input2 + " goldcost *input2");
  357. System.out.println(Bowcost*input2+ "bowcust");
  358. System.out.println(Swordcost*input2);
  359. System.out.println(Horsecost*input2);
  360. System.out.println(Popcost*input2);
  361. System.out.println(HeavyAcost*input2);
  362. System.out.println("You do not have sufficient resources for that many units. ");
  363. System.out.println("How many units would you like to train?");
  364. input2 = reader.nextInt();
  365. }
  366. //Subtracting used materials
  367. Training -=(Popcost*input2);
  368. Gold -=(Goldcost*input2);
  369. Sword -=(Swordcost*input2);
  370. Horse -=(Horsecost*input2);
  371. Bow -=(Bowcost*input2);
  372. Lance -=(Lancecost*input2);
  373. LightA -=(LightAcost*input2);
  374. HeavyA -=(HeavyAcost*input2);
  375.  
  376. //Adding the units to Q
  377.  
  378. if(input == 1){
  379. ArchQ += input2;
  380. }
  381. if(input == 2){
  382. SwordQ += input2;
  383. }
  384. if(input == 3){
  385. LanceQ += input2;
  386. }
  387. if(input == 4){
  388. CaragQ += input2;
  389. }
  390. if(input == 5){
  391. EliteQ += input2;
  392. }
  393. if(input == 6){
  394. MageQ += input2;
  395. }
  396. if(input == 9){
  397. WizardQ += input2;
  398. }
  399.  
  400. System.out.println("Operation succesful!");
  401.  
  402. System.out.println(WizardQ);
  403. System.out.println(CaragQ);
  404. System.out.println(SwordQ);
  405. System.out.println(LanceQ);
  406. System.out.println(ArchQ);
  407. army();
  408. }
  409. static void utarmy(){
  410. Scanner reader = new Scanner(System.in);
  411. System.out.println("Which unit would you like to un-train? ~~~ Back: 0");
  412. System.out.println("Archer - 1 Swordsman - 2 Lancemen - 3 Caragous - 4 Elite Arhcers - 5 Mages - 6 Wizards - 9");
  413. input = reader.nextInt();
  414. while(input != 1 && input != 2 && input != 3 && input != 4 && input != 5 && input != 6 && input != 9 && input != 0){
  415. System.out.println("Incorrect input, try again.");
  416. input = reader.nextInt();
  417. }
  418.  
  419. Goldcost = 0;
  420. Horsecost = 0;
  421. HeavyAcost = 0;
  422. Swordcost = 0;
  423. Lancecost = 0;
  424. Popcost = 1;
  425. LightAcost = 0;
  426. Bowcost = 0;
  427.  
  428. //Checking whether we have the units for the no. of un-units
  429.  
  430. System.out.println("How many would you like to un-train?");
  431. input2 = reader.nextInt();
  432. if(input == 1){
  433. if(Arch ==0){
  434. System.out.println("Oops! It seems there are no units to un-train.");
  435. }
  436. while(input2 > Arch){
  437. System.out.println("You do not have enough units to preform that action");
  438. System.out.println();
  439. System.out.println("How many would you like to un-train?");
  440. input2 = reader.nextInt();
  441. }
  442. Goldcost = 150;
  443. Bowcost = 1;
  444. }
  445. if(input == 2){
  446. if(Sword ==0){
  447. System.out.println("Oops! It seems there are no units to un-train.");
  448. }
  449. while(input2 > Sword){
  450. System.out.println("You do not have enough units to preform that action");
  451. System.out.println();
  452. System.out.println("How many would you like to un-train?");
  453. input2 = reader.nextInt();
  454. }
  455. Goldcost = 100;
  456. Swordcost = 1;
  457. LightAcost = 1;
  458. }
  459. if(input == 3){
  460. if(Lance ==0){
  461. System.out.println("Oops! It seems there are no units to un-train.");
  462. }
  463. while(input2 > Lance){
  464. System.out.println("You do not have enough units to preform that action");
  465. System.out.println();
  466. System.out.println("How many would you like to un-train?");
  467. input2 = reader.nextInt();
  468. }
  469. Goldcost = 100;
  470. Lancecost = 1;
  471. LightAcost = 1;
  472. }
  473. if(input == 4){
  474. if(Carag ==0){
  475. System.out.println("Oops! It seems there are no units to un-train.");
  476. }
  477. while(input2 > Carag){
  478. System.out.println("You do not have enough units to preform that action");
  479. System.out.println();
  480. System.out.println("How many would you like to un-train?");
  481. input2 = reader.nextInt();
  482. }
  483. Goldcost = 1500;
  484. Horsecost = 1;
  485. HeavyAcost = 1;
  486. Swordcost = 1;
  487. Lancecost = 1;
  488. }
  489. if(input == 5){
  490. if(Elite ==0){
  491. System.out.println("Oops! It seems there are no units to un-train.");
  492. }
  493. while(input2 > Elite){
  494. System.out.println("You do not have enough units to preform that action");
  495. System.out.println();
  496. System.out.println("How many would you like to un-train?");
  497. input2 = reader.nextInt();
  498. }
  499. Goldcost = 1500;
  500. Horsecost = 1;
  501. HeavyAcost = 1;
  502. Swordcost = 1;
  503. Lancecost = 1;
  504. }
  505. if(input == 6){
  506. if(Mage ==0){
  507. System.out.println("Oops! It seems there are no units to un-train.");
  508. }
  509. while(input2 > Mage){
  510. System.out.println("You do not have enough units to preform that action");
  511. System.out.println();
  512. System.out.println("How many would you like to un-train?");
  513. input2 = reader.nextInt();
  514. }
  515. Goldcost = 1500;
  516. Horsecost = 1;
  517. HeavyAcost = 1;
  518. Swordcost = 1;
  519. Lancecost = 1;
  520. }
  521. if(input == 9){
  522. if(Wizard ==0){
  523. System.out.println("Oops! It seems there are no units to un-train.");
  524. }
  525. while(input2 > Wizard){
  526. System.out.println("You do not have enough units to preform that action");
  527. System.out.println();
  528. System.out.println("How many would you like to un-train?");
  529. input2 = reader.nextInt();
  530. }
  531. Goldcost = 1;
  532. }
  533.  
  534. //Salvaging half of the used materials
  535. Training +=(Popcost*input2*.5);
  536. Gold +=(Goldcost*input2*.5);
  537. Sword +=(Swordcost*input2*.5);
  538. Horse +=(Horsecost*input2*.5);
  539. Bow +=(Bowcost*input2*.5);
  540. Lance +=(Lancecost*input2*.5);
  541. LightA +=(LightAcost*input2*.5);
  542. HeavyA +=(HeavyAcost*input2*.5);
  543.  
  544. //Disbanding Units
  545.  
  546. if(input == 1){
  547. ArchQ -= input2;
  548. }
  549. if(input == 2){
  550. SwordQ -= input2;
  551. }
  552. if(input == 3){
  553. LanceQ -= input2;
  554. }
  555. if(input == 4){
  556. CaragQ -= input2;
  557. }
  558. if(input == 5){
  559. EliteQ -= input2;
  560. }
  561. if(input == 6){
  562. MageQ -= input2;
  563. }
  564. if(input == 9){
  565. WizardQ -= input2;
  566. }
  567.  
  568. System.out.println("Operation succesful!");
  569.  
  570. System.out.println(WizardQ);
  571. System.out.println(CaragQ);
  572. System.out.println(SwordQ);
  573. System.out.println(LanceQ);
  574. System.out.println(ArchQ);
  575. army();
  576. }
  577. static void tick(){
  578.  
  579. //Resources + Population + Land
  580.  
  581. Wood += WoodP;
  582. Gold +=GoldP;
  583. Iron+=IronP;
  584. Food+=FoodP;
  585. WoodP=(Mill*WoodOpt*80*Mill/Millers)*(WoodB/10);
  586. GoldP=Market/Land*Pop*2;
  587. IronP=(Mine*IronOpt*100*Mine/Miners)*(IronB/10);
  588. FoodP=(Farm*FoodOpt*60*Farm/Farmers)*(FoodB/10);
  589. Land += LandP;
  590. LandP = 0;
  591. Pop += PopP;
  592. PopCapacity = (House*100)+Castle+Forge+Farm+Mill+Mine+Market+TrainingC+ATrainingC+Hospital+GuardH+GuardT+School;
  593. PopGap = PopCapacity-Pop;
  594. PopP = PopGap/7;
  595. System.out.println("Millers produce "+ WoodP);
  596. System.out.println("Miners produce "+ IronP);
  597. System.out.println("Farmers produce "+ FoodP);
  598. System.out.println();
  599. System.out.println("farm "+Farm + FoodOpt+ "Food opt" + Farm+"farm" + Farmers+"farmers" + FoodB+"Foodb");
  600. Land += LandP;
  601. int RandomNum = generator.nextInt(300)+0;
  602. LandP = (int) ((300/((10*55)+(10*2.5)))*RandomNum/100);
  603. System.out.println(LandP);
  604.  
  605. //
  606. }
  607.  
  608.  
  609.  
  610. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement