Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class World {
- //DECLARING ALL STAT'S P - Per tick || Q - Waiting to be built || B - Bonus
- //TICK VARIABLES
- static int TickCount =0;
- static int Ticker =0;
- //CALCULATING COSTS
- static int input;
- static int input2;
- static int Woodcost;
- static int Ironcost;
- static int Goldcost;
- static int Foodcost;
- static int Lancecost;
- static int Swordcost;
- static int Bowcost;
- static int Horsecost;
- static int LightAcost;
- static int HeavyAcost;
- static int Popcost;
- //UNITS
- static int ArchQ = 0;
- static int ArchP = 0;
- static int Arch = 10;
- static int PikeQ = 0;
- static int PikeP = 0;
- static int Pike = 10;
- static int SwordQ = 0;
- static int SwordP = 0;
- static int Sword = 10;
- static int CaragQ = 0;
- static int CaragP = 0;
- static int Carag = 10;
- static int EliteQ = 0;
- static int EliteP = 0;
- static int Elite = 10;
- static int MageQ = 0;
- static int MageP = 0;
- static int Mage = 10;
- static int WizardQ = 10;
- static int WizardP = 0;
- static int Wizard = 100;
- //WEAPONS
- static int SwordWQ = 0;
- static int SwordWP = 0;
- static int SwordW = 10;
- static int BowQ = 0;
- static int BowP = 0;
- static int Bow = 10;
- static int LanceQ = 0;
- static int LanceP = 0;
- static int Lance = 10;
- static int HorseQ = 0;
- static int HorseP = 0;
- static int Horse = 10;
- static int HeavyAQ = 0;
- static int HeavyAP = 0;
- static int HeavyA = 10;
- static int LightAQ = 0;
- static int LightAP = 0;
- static int LightA = 10;
- //RESOURCES
- static int Land =10;
- static int GoldP = 0;
- static int Gold = 100000;
- static int FoodP = 0;
- static int Food = 1000;
- static int IronP = 0;
- static int Iron = 1000;
- static int WoodP = 0;
- static int Wood = 1000;
- static int Pop = 1500;
- static int PopP = 0;
- static int FUpkeep = 0;
- static int GUpkeep =0;
- static int WoodOpt =6;
- static int IronOpt =4;
- static int FoodOpt =100;
- static int WeaponOpt=0;
- static int WoodB =0;
- static int GoldB =0;
- static int IronB =0;
- static int FoodB =0;
- static int PopB = 0;
- static int WeaponB =0;
- static int LandP =0;
- static int PopGap =0;
- static int PopCapacity =0;
- static Random generator = new Random();
- //WORKERS
- static int Miners = 0;
- static int Millers = 0;
- static int Farmers = 0;
- static int Explorers = 0;
- static int PopRoom = 0;
- static int Training = 10000;
- //BUILDINGS
- static int HouseQ = 0;
- static int HouseP = 0;
- static int House = 0;
- static int FarmQ = 0;
- static int FarmP = 0;
- static int Farm = 0;
- static int MillQ = 0;
- static int MillP = 0;
- static int Mill = 0;
- static int MineQ = 0;
- static int MineP = 0;
- static int Mine = 0;
- static int MarketQ = 0;
- static int MarketP = 0;
- static int Market = 0;
- static int CastleQ = 0;
- static int CastleP = 0;
- static int Castle = 0;
- static int TrainingCQ = 0;
- static int TrainingCP = 0;
- static int TrainingC = 0;
- static int ATrainingCQ = 0;
- static int ATrainingCP = 0;
- static int ATrainingC = 0;
- static int ForgeQ = 0;
- static int ForgeP = 0;
- static int Forge = 0;
- static int GuardHQ = 0;
- static int GuardHP = 0;
- static int GuardH = 0;
- static int GuardTQ = 0;
- static int GuardTP = 0;
- static int GuardRoom =10000;
- static int GuardT = 0;
- static int HospitalQ = 0;
- static int HospitalP = 0;
- static int Hospital = 0;
- static int SchoolQ = 0;
- static int SchoolP = 0;
- static int School = 0;
- static int SchoolRoom=10000;
- public static void main(String args[]){
- tick();
- //System.out.println("Welcome to Thardferr simulator 1.0!");
- //home();
- //double RandomNum = generator.nextInt(300)+0;
- //double y = (300/((10*55)+(10*2.5)))*RandomNum/100;
- //System.out.println(y);
- }
- static void home(){
- Scanner reader = new Scanner(System.in);
- System.out.println("Welcome home!");
- System.out.println("Gold: " + Gold + " Wood " + Wood + " Iron " + Iron + " Food " + Food + " Population: " + Pop);
- System.out.println("Army: 1 ||Buildings: 2 ||Population: 3 ||Spells: 4 ||Kingdom Stats: 5 ||Technology: 6 ~~~ Next Tick: 10 ~~~ Exit: 0");
- input = reader.nextInt();
- if(input == 1){
- army();
- }
- if(input == 2){
- buildings();
- }
- }
- static void buildings(){
- Scanner reader = new Scanner(System.in);
- System.out.println("Castles:" + Castle);
- System.out.println("Houses:" + House);
- System.out.println("Mills:" + Mill);
- System.out.println("Mines:" + Mine);
- System.out.println("Farms:" + Farm);
- System.out.println("Markets:" + Market);
- System.out.println("Training Centers:" + TrainingC);
- System.out.println("Advanced Training Centers:" + ATrainingC);
- System.out.println("Forges:" + Forge);
- System.out.println("Schools:" + School);
- System.out.println("Hospitals:" + Hospital);
- System.out.println("What would you like to do? Build: 1 || Or Destroy: 2? || Back: 0");
- input = reader.nextInt();
- if(input == 1){
- bbuildings();
- }
- if(input == 2){
- }
- if(input == 0){
- home();
- }
- }
- static void bbuildings(){
- Scanner reader = new Scanner(System.in);
- System.out.println("Which building would you like to build?");
- 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");
- input = reader.nextInt();
- while(input != 1 && input != 2 && input != 3 && input != 4 && input != 5 && input != 6 && input != 9 && input != 10 && input != 11 && input != 0){
- System.out.println("Incorrect input, try again.");
- input = reader.nextInt();
- }
- Woodcost=0;
- Ironcost=0;
- Goldcost=0;
- Foodcost=0;
- if(input == 1){
- }
- if(input == 2){
- }
- if(input == 4){
- }
- if(input == 5){
- }
- if(input == 6){
- }
- if(input == 7){
- }
- if(input == 8){
- }
- if(input == 9){
- }
- if(input == 10){
- }
- if(input == 11){
- }
- if(input == 0){
- buildings();
- }
- System.out.println("How many would you like to construct?");
- input2 = reader.nextInt();
- while((Goldcost*input2)>Gold||(Woodcost*input2)>Wood||(Ironcost*input2)>Iron||(Foodcost*input2)>Food){
- System.out.println("You do not have sufficient resources for that many units. ");
- System.out.println("How many would you like to construct?");
- input2 = reader.nextInt();
- }
- Gold -= (Goldcost*input2);
- Iron -= (Ironcost*input2);
- Wood -= (Woodcost*input2);
- Food -= (Foodcost*input2);
- }
- static void army(){
- Scanner reader = new Scanner(System.in);
- System.out.println("You currently have: " + Arch + " Archers, with " + ArchQ + " being trained.");
- System.out.println("You currently have: " + Sword + " Swordsmen, with " + SwordQ + " being trained.");
- System.out.println("You currently have: " + Pike + " Lancemen, with " + PikeQ + " being trained.");
- System.out.println("You currently have: " + Wizard + " Wizards, with " + WizardQ + " being trained.");
- System.out.println("You currently have: " + Carag + " Caragous, with " + CaragQ + " being trained.");
- System.out.println("You currently have: " + Elite + " Elite Archers, with " + EliteQ + " being trained.");
- System.out.println("You currently have: " + Mage + " Mages, with " + MageQ + " being trained.");
- System.out.println();
- System.out.println("Would you like to train units, or un-train units?");
- System.out.println("Train: 1 - Un-Train: 2 - Back: 0");
- input = reader.nextInt();
- if(input == 1){
- if(GuardRoom == 0){
- System.out.println("There is not enough room in your guard houses to train units. Disband units, or choose another option");
- army();
- }
- tarmy();
- }
- if(input == 2){
- if(GuardRoom == GuardH*40){
- System.out.println("You have no units to un-train.");
- army();
- }
- utarmy();
- }
- if(input == 0){
- home();
- }
- }
- static void tarmy(){
- Scanner reader = new Scanner(System.in);
- System.out.println("Which unit would you like to train? ~~~ Back: 0");
- System.out.println("Archer - 1 Swordsman - 2 Lancemen - 3 Caragous - 4 Elite Arhcers - 5 Mages - 6 Wizards - 9");
- input = reader.nextInt();
- while(input != 1 && input != 2 && input != 3 && input != 4 && input != 5 && input != 6 && input != 9 && input != 0){
- System.out.println("Incorrect input, try again.");
- input = reader.nextInt();
- }
- Goldcost = 0;
- Horsecost = 0;
- HeavyAcost = 0;
- Swordcost = 0;
- Lancecost = 0;
- Popcost = 1;
- LightAcost = 0;
- Bowcost = 0;
- if(input == 1){
- Goldcost = 150;
- Bowcost = 1;
- }
- if(input == 2){
- Goldcost = 100;
- Swordcost = 1;
- LightAcost = 1;
- }
- if(input == 3){
- Goldcost = 100;
- Lancecost = 1;
- LightAcost = 1;
- }
- if(input == 4){
- Goldcost = 1500;
- Horsecost = 1;
- HeavyAcost = 1;
- Swordcost = 1;
- Lancecost = 1;
- }
- if(input == 5){
- Goldcost = 1500;
- Horsecost = 1;
- HeavyAcost = 1;
- Swordcost = 1;
- Lancecost = 1;
- }
- if(input == 6){
- Goldcost = 1500;
- Horsecost = 1;
- HeavyAcost = 1;
- Swordcost = 1;
- Lancecost = 1;
- }
- if(input == 9){
- Goldcost = 1;
- }
- //Checking whether we have the materials for the no. of units
- System.out.println("How many would you like to train?");
- input2 = reader.nextInt();
- 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){
- System.out.println(Goldcost*input2 + " goldcost *input2");
- System.out.println(Bowcost*input2+ "bowcust");
- System.out.println(Swordcost*input2);
- System.out.println(Horsecost*input2);
- System.out.println(Popcost*input2);
- System.out.println(HeavyAcost*input2);
- System.out.println("You do not have sufficient resources for that many units. ");
- System.out.println("How many units would you like to train?");
- input2 = reader.nextInt();
- }
- //Subtracting used materials
- Training -=(Popcost*input2);
- Gold -=(Goldcost*input2);
- Sword -=(Swordcost*input2);
- Horse -=(Horsecost*input2);
- Bow -=(Bowcost*input2);
- Lance -=(Lancecost*input2);
- LightA -=(LightAcost*input2);
- HeavyA -=(HeavyAcost*input2);
- //Adding the units to Q
- if(input == 1){
- ArchQ += input2;
- }
- if(input == 2){
- SwordQ += input2;
- }
- if(input == 3){
- LanceQ += input2;
- }
- if(input == 4){
- CaragQ += input2;
- }
- if(input == 5){
- EliteQ += input2;
- }
- if(input == 6){
- MageQ += input2;
- }
- if(input == 9){
- WizardQ += input2;
- }
- System.out.println("Operation succesful!");
- System.out.println(WizardQ);
- System.out.println(CaragQ);
- System.out.println(SwordQ);
- System.out.println(LanceQ);
- System.out.println(ArchQ);
- army();
- }
- static void utarmy(){
- Scanner reader = new Scanner(System.in);
- System.out.println("Which unit would you like to un-train? ~~~ Back: 0");
- System.out.println("Archer - 1 Swordsman - 2 Lancemen - 3 Caragous - 4 Elite Arhcers - 5 Mages - 6 Wizards - 9");
- input = reader.nextInt();
- while(input != 1 && input != 2 && input != 3 && input != 4 && input != 5 && input != 6 && input != 9 && input != 0){
- System.out.println("Incorrect input, try again.");
- input = reader.nextInt();
- }
- Goldcost = 0;
- Horsecost = 0;
- HeavyAcost = 0;
- Swordcost = 0;
- Lancecost = 0;
- Popcost = 1;
- LightAcost = 0;
- Bowcost = 0;
- //Checking whether we have the units for the no. of un-units
- System.out.println("How many would you like to un-train?");
- input2 = reader.nextInt();
- if(input == 1){
- if(Arch ==0){
- System.out.println("Oops! It seems there are no units to un-train.");
- }
- while(input2 > Arch){
- System.out.println("You do not have enough units to preform that action");
- System.out.println();
- System.out.println("How many would you like to un-train?");
- input2 = reader.nextInt();
- }
- Goldcost = 150;
- Bowcost = 1;
- }
- if(input == 2){
- if(Sword ==0){
- System.out.println("Oops! It seems there are no units to un-train.");
- }
- while(input2 > Sword){
- System.out.println("You do not have enough units to preform that action");
- System.out.println();
- System.out.println("How many would you like to un-train?");
- input2 = reader.nextInt();
- }
- Goldcost = 100;
- Swordcost = 1;
- LightAcost = 1;
- }
- if(input == 3){
- if(Lance ==0){
- System.out.println("Oops! It seems there are no units to un-train.");
- }
- while(input2 > Lance){
- System.out.println("You do not have enough units to preform that action");
- System.out.println();
- System.out.println("How many would you like to un-train?");
- input2 = reader.nextInt();
- }
- Goldcost = 100;
- Lancecost = 1;
- LightAcost = 1;
- }
- if(input == 4){
- if(Carag ==0){
- System.out.println("Oops! It seems there are no units to un-train.");
- }
- while(input2 > Carag){
- System.out.println("You do not have enough units to preform that action");
- System.out.println();
- System.out.println("How many would you like to un-train?");
- input2 = reader.nextInt();
- }
- Goldcost = 1500;
- Horsecost = 1;
- HeavyAcost = 1;
- Swordcost = 1;
- Lancecost = 1;
- }
- if(input == 5){
- if(Elite ==0){
- System.out.println("Oops! It seems there are no units to un-train.");
- }
- while(input2 > Elite){
- System.out.println("You do not have enough units to preform that action");
- System.out.println();
- System.out.println("How many would you like to un-train?");
- input2 = reader.nextInt();
- }
- Goldcost = 1500;
- Horsecost = 1;
- HeavyAcost = 1;
- Swordcost = 1;
- Lancecost = 1;
- }
- if(input == 6){
- if(Mage ==0){
- System.out.println("Oops! It seems there are no units to un-train.");
- }
- while(input2 > Mage){
- System.out.println("You do not have enough units to preform that action");
- System.out.println();
- System.out.println("How many would you like to un-train?");
- input2 = reader.nextInt();
- }
- Goldcost = 1500;
- Horsecost = 1;
- HeavyAcost = 1;
- Swordcost = 1;
- Lancecost = 1;
- }
- if(input == 9){
- if(Wizard ==0){
- System.out.println("Oops! It seems there are no units to un-train.");
- }
- while(input2 > Wizard){
- System.out.println("You do not have enough units to preform that action");
- System.out.println();
- System.out.println("How many would you like to un-train?");
- input2 = reader.nextInt();
- }
- Goldcost = 1;
- }
- //Salvaging half of the used materials
- Training +=(Popcost*input2*.5);
- Gold +=(Goldcost*input2*.5);
- Sword +=(Swordcost*input2*.5);
- Horse +=(Horsecost*input2*.5);
- Bow +=(Bowcost*input2*.5);
- Lance +=(Lancecost*input2*.5);
- LightA +=(LightAcost*input2*.5);
- HeavyA +=(HeavyAcost*input2*.5);
- //Disbanding Units
- if(input == 1){
- ArchQ -= input2;
- }
- if(input == 2){
- SwordQ -= input2;
- }
- if(input == 3){
- LanceQ -= input2;
- }
- if(input == 4){
- CaragQ -= input2;
- }
- if(input == 5){
- EliteQ -= input2;
- }
- if(input == 6){
- MageQ -= input2;
- }
- if(input == 9){
- WizardQ -= input2;
- }
- System.out.println("Operation succesful!");
- System.out.println(WizardQ);
- System.out.println(CaragQ);
- System.out.println(SwordQ);
- System.out.println(LanceQ);
- System.out.println(ArchQ);
- army();
- }
- static void tick(){
- //Resources + Population + Land
- Wood += WoodP;
- Gold +=GoldP;
- Iron+=IronP;
- Food+=FoodP;
- WoodP=(Mill*WoodOpt*80*Mill/Millers)*(WoodB/10);
- GoldP=Market/Land*Pop*2;
- IronP=(Mine*IronOpt*100*Mine/Miners)*(IronB/10);
- FoodP=(Farm*FoodOpt*60*Farm/Farmers)*(FoodB/10);
- Land += LandP;
- LandP = 0;
- Pop += PopP;
- PopCapacity = (House*100)+Castle+Forge+Farm+Mill+Mine+Market+TrainingC+ATrainingC+Hospital+GuardH+GuardT+School;
- PopGap = PopCapacity-Pop;
- PopP = PopGap/7;
- System.out.println("Millers produce "+ WoodP);
- System.out.println("Miners produce "+ IronP);
- System.out.println("Farmers produce "+ FoodP);
- System.out.println();
- System.out.println("farm "+Farm + FoodOpt+ "Food opt" + Farm+"farm" + Farmers+"farmers" + FoodB+"Foodb");
- Land += LandP;
- int RandomNum = generator.nextInt(300)+0;
- LandP = (int) ((300/((10*55)+(10*2.5)))*RandomNum/100);
- System.out.println(LandP);
- //
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement