Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication4
- {
- class Program
- {
- static private BehindTheScenes bts;
- static void Main(string[] args)
- {
- bts = new BehindTheScenes();
- bts.GetBiomeNumber();
- bts.GetBiome();
- Console.WriteLine("You appeared in a" + bts.biome + ". ");
- System.Threading.Thread.Sleep(10);
- bts.BiomeData();
- while (bts.GameRunning == true)
- {
- System.Threading.Thread.Sleep(10);
- bts.Choices();
- bts.answer = Console.ReadLine();
- bts.MakeChoice();
- }
- }
- }
- [Serializable]
- class BehindTheScenes
- {
- public string biome;
- int biomeChooser;
- public string answer;
- string animals = "";
- int chance = 0;
- int hunger = 10;
- string word;
- int foodAmount;
- string foodType;
- int Food1Amount = 0;
- int Food2Amount = 0;
- int Food3Amount = 0;
- int Food4Amount = 0;
- int Food5Amount = 0;
- int KillTime = 5000;
- int TravelTime = 7000;
- int hungerLoss;
- public bool GameRunning = true;
- string eatAnswer;
- int foodTypeID;
- int VillageFoodAmount;
- int hungerLimit = 10;
- int health = 10;
- int healthLimit = 10;
- int torches;
- int caveLootID;
- int woodAmount;
- int canLootStructures = 0;
- int torchPlaced = 0;
- int healthLoss;
- int healthRegen = 0;
- int IfCanLootVillage = 0;
- int woodValue;
- int secretIngredient;
- int caravanchance = 0;
- string answeraddition = "";
- int caravanlootID;
- int ifcanrobcaravan = 0;
- int caravanWood;
- public void Save() //not yet used
- {
- IFormatter formatter = new BinaryFormatter();
- Stream stream = new FileStream("TextSurvivalSave.bin",
- FileMode.Create,
- FileAccess.Write, FileShare.None);
- formatter.Serialize(stream, this);
- stream.Close();
- }
- public static void Load(ref BehindTheScenes bts) //not yet used
- {
- IFormatter formatter = new BinaryFormatter();
- Stream stream = new FileStream("TextSurvivalSave.bin",
- FileMode.Open,
- FileAccess.Read,
- FileShare.Read);
- bts = (BehindTheScenes)formatter.Deserialize(stream);
- stream.Close();
- }
- public void CaravanGen()
- {
- if(biome == " desert")
- {
- Random rnd = new Random();
- caravanchance = rnd.Next(1, 1);
- if (caravanchance == 1)
- {
- answeraddition = " and a caravan...";
- ifcanrobcaravan = 1;
- }
- else
- {
- answeraddition = "";
- }
- }
- }
- public void GetVilllage()
- {
- Random rnd = new Random();
- if (biome == " forest")
- {
- chance = rnd.Next(1, 3);
- if(chance == 1)
- {
- IfCanLootVillage = 1;
- Console.WriteLine("----------------------");
- Console.WriteLine("You entered a village!");
- }
- }
- if (biome == " plain")
- {
- chance = rnd.Next(1, 3);
- if (chance == 1)
- {
- IfCanLootVillage = 1;
- Console.WriteLine("----------------------");
- Console.WriteLine("You entered a village!");
- }
- }
- }
- public void GetBiomeNumber()
- {
- Random rnd = new Random();
- biomeChooser = rnd.Next(1 , 12);
- }
- public void GetBiome()
- {
- if (biomeChooser == 1| biomeChooser == 2)
- {
- biome = " forest";
- }
- if (biomeChooser == 3 | biomeChooser == 4)
- {
- biome = " desert";
- }
- if (biomeChooser == 5 | biomeChooser == 6)
- {
- biome = " jungle";
- }
- if (biomeChooser == 7 | biomeChooser == 8)
- {
- biome = "n ocean";
- }
- if (biomeChooser == 9 | biomeChooser == 10)
- {
- biome = " plain";
- }
- if (biomeChooser == 11 | biomeChooser == 12)
- {
- canLootStructures = 1;
- biome = " cave";
- }
- }
- public void BiomeData()
- {
- if(biome == " forest")
- {
- Console.WriteLine("You feel cold.");
- }
- if(biome == " desert")
- {
- Console.WriteLine("You feel hot!");
- }
- if(biome == " jungle")
- {
- Console.WriteLine("It is too damp to breathe properly!");
- }
- if(biome == "n ocean")
- {
- Console.WriteLine("At least you can swim");
- }
- if(biome == " plain")
- {
- Console.WriteLine("You can see something in the distance... maybe...");
- }
- if (biome == " cave")
- {
- Console.WriteLine("It is dark around");
- }
- }
- public void AnimalCalculation()
- {
- if (biome == " desert")
- {
- animals = "no animals";
- }
- if (biome == "n ocean")
- {
- animals = "squids";
- }
- if (biome == " jungle")
- {
- animals = "chickens";
- }
- if (biome == " forest")
- {
- animals = "cows";
- }
- if(biome == " plain")
- {
- animals = "sheep";
- }
- if (biome == " cave")
- {
- animals = "zombies";
- }
- }
- public void WordChooser /*????????*/ ()
- {
- Random rnd = new Random();
- int WordChance = rnd.Next(1, 4);
- if (WordChance == 1)
- {
- word = "several ";
- }
- if (WordChance == 2)
- {
- word = "some ";
- }
- if (WordChance == 3)
- {
- word = "a few ";
- }
- if (WordChance == 4)
- {
- word = " ";
- }
- }
- public void Choices()
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("1.Look around");
- Console.WriteLine("2.Attack closest animal");
- Console.WriteLine("3.Move north");
- Console.WriteLine("4.Move south");
- Console.WriteLine("5.Move east");
- Console.WriteLine("6.Move west");
- Console.WriteLine("7.Loot village");
- Console.WriteLine("8.Eat");
- Console.WriteLine("9.Try looting the cave");
- Console.WriteLine("10.Place a torch");
- Console.WriteLine("11.Make a torch");
- Console.WriteLine("12.Remove a nearby tree");
- Console.WriteLine("13.Inventory");
- if(caravanchance == 1)
- {
- Console.WriteLine("14.Rob caravan");
- }
- Console.WriteLine("----------------------");
- }
- public void lootCalculation()
- {
- if (animals == "cows")
- {
- Random rnd = new Random();
- foodAmount = rnd.Next(1, 5);
- Food1Amount = Food1Amount + foodAmount;
- foodType = "beef";
- }
- if (animals == "chickens")
- {
- Random rnd = new Random();
- foodAmount = rnd.Next(1, 2);
- Food2Amount = Food2Amount + foodAmount;
- foodType = "chicken";
- }
- if (animals == "sheep")
- {
- Random rnd = new Random();
- foodAmount = rnd.Next(1, 4);
- Food3Amount = Food3Amount + foodAmount;
- foodType = "mutton";
- }
- }
- public void FoodTypeID()
- {
- Random rnd = new Random();
- foodTypeID = rnd.Next(1, secretIngredient);
- }
- public void VillageFoodAmountCalc()
- {
- Random rnd = new Random();
- VillageFoodAmount = rnd.Next(1, 4);
- foodAmount = VillageFoodAmount;
- }
- public void VillageLootCalculation()
- {
- if (IfCanLootVillage == 1)
- {
- Random rnd = new Random();
- int LootNumber = rnd.Next(1, 3);
- if (LootNumber == 1)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You found a mighty sword! Kill time reduced by 2 seconds!");
- KillTimeProtection();
- KillTime = KillTime - 2000;
- IfCanLootVillage = 0;
- }
- if (LootNumber == 2)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You found stirdy boots! Travel time reduced by 3 seconds!");
- TravelTimeProtection();
- TravelTime = TravelTime - 3000;
- IfCanLootVillage = 0;
- }
- if (LootNumber == 3)
- {
- FoodTypeID();
- VillageFoodAmountCalc();
- if (foodTypeID == 1)
- {
- Food1Amount = Food1Amount + VillageFoodAmount;
- }
- if (foodTypeID == 2)
- {
- Food2Amount = Food2Amount + VillageFoodAmount;
- }
- if (secretIngredient == 4 && foodTypeID == 3)
- {
- Food3Amount = Food3Amount + VillageFoodAmount;
- }
- if (secretIngredient == 4 && foodTypeID == 4)
- {
- foodType = "secret ingredient";
- Food4Amount = Food4Amount + foodAmount;
- }
- Console.WriteLine("----------------------");
- Console.WriteLine("You found " + foodAmount + " " + foodType);
- IfCanLootVillage = 0;
- }
- }
- else
- {
- if (chance == 1)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You already did that!");
- }
- else
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You arent in a village!");
- }
- }
- }
- public void KillTimeProtection()
- {
- if (KillTime - 2000 < 0)
- {
- KillTime = 500;
- }
- }
- public void TravelTimeProtection()
- {
- if (TravelTime - 3000 < 0)
- {
- TravelTime = 500;
- }
- }
- public void Hunger()
- {
- Random rnd = new Random();
- hungerLoss = rnd.Next(1, 3);
- hunger = hunger - hungerLoss;
- Console.WriteLine("You lost " + hungerLoss + " hunger. You have " + hunger + " left");
- Death();
- }
- public void Eat()
- {
- if (Food1Amount >= 1 | Food2Amount >= 1 | Food3Amount >= 1 | Food4Amount >= 0)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("----1.Eat Beef (" + Food1Amount + ")");
- Console.WriteLine("----2.Eat Chicken (" + Food2Amount + ")");
- Console.WriteLine("----3.Eat Mutton (" + Food3Amount + ")");
- Console.WriteLine("----4.Eat Secret Ingredient (" + Food4Amount + ")");
- eatAnswer = Console.ReadLine();
- if (eatAnswer == "1")
- {
- if (Food1Amount > 0)
- {
- Food1Amount = Food1Amount - 1;
- hunger = hunger + 3;
- if (hunger > hungerLimit)
- {
- hunger = hungerLimit;
- }
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("You replenished 3 hunger! You have " + hunger + " hunger now!");
- Random rnd = new Random();
- healthRegen = rnd.Next(3);
- HealthRegen();
- }
- else
- {
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("You haven't got any of it left!");
- }
- }
- if (eatAnswer == "2")
- {
- if (Food2Amount > 0)
- {
- Food2Amount = Food2Amount - 1;
- hunger = hunger + 1;
- if (hunger > hungerLimit)
- {
- hunger = hungerLimit;
- }
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("You replenished 2 hunger! You have " + hunger + " hunger now!");
- Random rnd = new Random();
- healthRegen = rnd.Next(1);
- HealthRegen();
- }
- else
- {
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("You haven't got any of this left!");
- }
- }
- if (eatAnswer == "3")
- {
- if (Food3Amount > 0)
- {
- Food3Amount = Food3Amount - 1;
- hunger = hunger + 2;
- if (hunger > hungerLimit)
- {
- hunger = hungerLimit;
- }
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("You replenished 2 hunger! You have " + hunger + " hunger now!");
- Random rnd = new Random();
- healthRegen = rnd.Next(2);
- HealthRegen();
- }
- else
- {
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("You haven't got any of it!");
- }
- }
- if (eatAnswer == "4")
- {
- if (Food4Amount > 0)
- {
- Food4Amount = Food4Amount - 1;
- hunger = hunger + 100;
- if (hunger > hungerLimit)
- {
- hunger = hungerLimit;
- }
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("You replenished 100 hunger! You have " + hunger + " hunger now!");
- Random rnd = new Random();
- healthRegen = rnd.Next(100, 110);
- HealthRegen();
- }
- else
- {
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("You dont have any!");
- }
- }
- if (eatAnswer == "" | eatAnswer == " ")
- {
- }
- }
- else
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You dont have any food!");
- }
- }
- public void AnimalLoot()
- {
- if (biome == " forest" | biome == " plain" | biome == " jungle")
- {
- if (animals == "cows")
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You got " + foodAmount + " " + foodType);
- }
- if (animals == "chickens")
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You got " + foodAmount + " " + foodType);
- }
- if (animals == "sheep")
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You got " + foodAmount + " " + foodType);
- }
- }
- else
- {
- int TempKillTime = 0;
- TempKillTime = KillTime;
- KillTime = 0;
- Console.WriteLine("----------------------");
- Console.WriteLine("There are no useful animals around!");
- KillTime = TempKillTime;
- }
- }
- public void HealthLoss()
- {
- Random rnd = new Random();
- healthLoss = rnd.Next(1, 2);
- health = health - healthLoss;
- Console.WriteLine("You lost " + healthLoss + " health in the process. You have " + health + " health left");
- Death();
- }
- public void HealthRegen()
- {
- health = health + healthRegen;
- healthLimiter();
- Console.WriteLine("You regenerated " + healthRegen + " health! You have " + health + " now!");
- }
- public void healthLimiter()
- {
- if (health > healthLimit)
- {
- health = healthLimit;
- }
- }
- public void Death()
- {
- if (hunger <= 0)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You starved to death! Game Over!");
- Console.WriteLine("Please consider subscribing to my VK group vk.com/dandelay");
- Console.WriteLine("----------------------");
- Console.ReadLine();
- GameRunning = false;
- }
- if (health <= 0)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You were killed! Game Over!");
- Console.WriteLine("Please consider subscribing to my VK group vk.com/dandelay");
- Console.WriteLine("----------------------");
- Console.ReadLine();
- GameRunning = false;
- }
- }
- public void caveLoot()
- {
- if (biome == " cave" && canLootStructures == 1)
- {
- Console.WriteLine("Looting...");
- System.Threading.Thread.Sleep(5000);
- Random rnd = new Random();
- caveLootID = rnd.Next(1, 7);
- if (caveLootID == 1)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You found very well made boots! Travel time reduced by 4 seconds");
- TravelTime = TravelTime - 4000;
- TravelTimeProtection();
- canLootStructures = 0;
- }
- if (caveLootID == 2)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You found 10 chicken!");
- Food2Amount = Food2Amount + 10;
- canLootStructures = 0;
- }
- if (caveLootID == 3)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You found a big heavy sword! Travel time increased by 3 seconds and kill time reduced by 3 seconds!");
- TravelTime = TravelTime + 3000;
- KillTime = KillTime - 3000;
- KillTimeProtection();
- canLootStructures = 0;
- }
- if (caveLootID == 4)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You found 3 torches");
- torches = torches + 3;
- canLootStructures = 0;
- }
- if (caveLootID == 5)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You found 5 wood!");
- woodAmount = woodAmount + 5;
- canLootStructures = 0;
- }
- if (caveLootID == 6 | caveLootID == 7)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You found nothing!");
- }
- HealthLoss();
- }
- else
- {
- if (biome == " cave")
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You already did that!");
- }
- else
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You aren't in a cave now!");
- }
- }
- }
- public void PlaceTorch()
- {
- if (torches > 0)
- {
- if (biome == " cave")
- {
- torchPlaced = 1;
- torches = torches - 1;
- Console.WriteLine("----------------------");
- Console.WriteLine("Placed 1 torch");
- }
- else
- {
- Console.WriteLine("You dont need them here!");
- }
- }
- else
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You dont have any!");
- }
- }
- public void showInventory()
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("---- 1. You have " + health + " health.");
- Console.WriteLine("---- 1. You have " + hunger + " hunger.");
- Console.WriteLine("---- 1. You have " + Food1Amount + " beef.");
- Console.WriteLine("---- 2. You have " + Food2Amount + " chicken.");
- Console.WriteLine("---- 3. You have " + Food3Amount + " mutton.");
- Console.WriteLine("---- 4. You have " + Food4Amount + " secret ingredients.");
- Console.WriteLine("---- 5. You have " + Food5Amount + " camel meat.");
- Console.WriteLine("---- 6. You have " + torches + " torches.");
- Console.WriteLine("---- 7. You have " + woodAmount + " wood.");
- }
- public void MakeTorch()
- {
- if (woodAmount >= 5)
- {
- torches = torches + 1;
- woodAmount = woodAmount - 5;
- Console.WriteLine("Making torch...");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("----------------------------");
- Console.WriteLine("Made 1 torch, lost 5 wood");
- }
- else
- {
- Console.WriteLine("----------------------------");
- Console.WriteLine("You dont have enought wood. You need 5, and you have " + woodAmount);
- }
- }
- public void RemoveTrees()
- {
- if (biome == " forest" | biome == " jungle")
- {
- Random rnd = new Random();
- woodValue = rnd.Next(5, 10);
- Console.WriteLine("Removing...");
- System.Threading.Thread.Sleep(5000);
- woodAmount = woodAmount + woodValue;
- Console.WriteLine("You acquired " + woodValue + " wood!");
- }
- else
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You can't see any trees around!");
- }
- }
- public void RobCaravan()
- {
- Random rnd = new Random();
- caravanlootID = rnd.Next(1, 5);
- Console.WriteLine("Robbing...");
- System.Threading.Thread.Sleep(5000);
- if (ifcanrobcaravan == 1)
- {
- if (caravanlootID == 1)
- {
- Random Random = new Random();
- caravanWood = rnd.Next(10, 15);
- woodAmount = woodAmount + caravanWood;
- Console.WriteLine("You found " + caravanWood + " wood!");
- }
- if (caravanlootID == 2)
- {
- int caravanTorch;
- Random Random = new Random();
- caravanTorch = Random.Next(1, 10);
- torches = torches + caravanTorch;
- Console.WriteLine("You found " + caravanTorch + " torches!");
- }
- if (caravanlootID == 3)
- {
- int caravanFood;
- Random Random = new Random();
- caravanFood = rnd.Next(1, 4);
- Food5Amount = Food5Amount + caravanFood;
- Console.WriteLine("You found " + caravanFood + " camel meat!");
- }
- if(caravanlootID == 4 | caravanlootID == 5)
- {
- Console.WriteLine("Bad luck, you found nothing!");
- }
- ifcanrobcaravan = 0;
- Random rand = new Random();
- healthLoss = rand.Next(5, 6);
- HealthLoss();
- }
- else
- {
- Console.WriteLine("You already did it!");
- }
- }
- public void MakeChoice()
- {
- System.Threading.Thread.Sleep(100);
- if (answer == "1")
- {
- WordChooser();
- AnimalCalculation();
- if (biome == " desert")
- {
- CaravanGen();
- Console.WriteLine("----------------------");
- Console.WriteLine("You only see infinite sand" + answeraddition + "...");
- }
- if (biome == "n ocean")
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You see " + word + animals);
- }
- if (biome == " forest" | biome == " plain" || biome == " jungle")
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You see " + word + animals);
- }
- if (biome == " cave")
- {
- if (torchPlaced == 1)
- {
- Console.WriteLine("----------------------");
- Console.WriteLine("You see " + word + animals);
- }
- else
- {
- if (torchPlaced == 0)
- {
- Console.WriteLine("It is too dark to see!");
- }
- }
- }
- }
- if (answer == "2")
- {
- torchPlaced = 0;
- if (biome == " forest" | biome == " plain" | biome == " jungle")
- {
- lootCalculation();
- Console.WriteLine("----------------------");
- Console.WriteLine("Attacking...");
- if (animals == "")
- {
- int TempKillTime;
- TempKillTime = KillTime;
- KillTime = 0;
- Console.WriteLine("------------------------------------------------------------");
- Console.WriteLine("You didnt discover any animals here yet! Try looking around!");
- KillTime = TempKillTime;
- }
- else
- {
- System.Threading.Thread.Sleep(KillTime);
- AnimalLoot();
- Hunger();
- }
- }
- else
- {
- int TempKillTime = 0;
- TempKillTime = KillTime;
- KillTime = 0;
- Console.WriteLine("----------------------");
- Console.WriteLine("There are no useful animals around!");
- KillTime = TempKillTime;
- }
- }
- if (answer == "3" | answer == "4" | answer == "5" | answer == "6")
- {
- torchPlaced = 0;
- Console.WriteLine("Travelling...");
- TravelTimeProtection();
- System.Threading.Thread.Sleep(TravelTime);
- GetBiomeNumber();
- GetBiome();
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("You moved to a" + biome + ". ");
- GetVilllage();
- Hunger();
- }
- if (answer == "7")
- {
- VillageLootCalculation();
- }
- if (answer == "8")
- {
- Eat();
- }
- if (answer == "9")
- {
- caveLoot();
- }
- if (answer == "10")
- {
- PlaceTorch();
- }
- if (answer == "11")
- {
- MakeTorch();
- }
- if (answer == "12")
- {
- RemoveTrees();
- }
- if (answer == "13")
- {
- showInventory();
- }
- if (answeraddition == " and a caravan...")
- {
- if (answer == "14")
- {
- RobCaravan();
- }
- }
- else
- {
- }
- if (answer == "/gamemode creative")
- {
- hunger = 21474836;
- hungerLimit = 21474836;
- health = 21474836;
- healthLimit = 21474836;
- KillTime = 500;
- TravelTime = 500;
- secretIngredient = 4;
- Console.WriteLine("----------------------------");
- Console.WriteLine("YOU ARE NOW IN CREATIVE MODE");
- }
- if (answer == "/gamemode survival")
- {
- hunger = 10;
- hungerLimit = 10;
- health = 10;
- healthLimit = 10;
- KillTime = 5000;
- TravelTime = 7000;
- secretIngredient = 3;
- Console.WriteLine("----------------------------");
- Console.WriteLine("YOU ARE NOW IN SURVIVAL MODE");
- }
- }
- }
- }
- //vk.com/dandelay
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement