Example #1
0
        //Feeds the pet a Foodtype
        public void FeedPet(Pet pet, FoodType foodToEat)
        {
            //feed the pet food
            int gainedNuts = pet.food.Eat(foodToEat);

            string text = "";

            if (gainedNuts > 0)
            {
                text = String.Format("{0} just ate {1}, ",
                                        pet.name,
                                        foodToEat.ToString().ToLower());
            }
            //print the
            text = text + "{0} satiation level is: {1}\n";
            string formatted = String.Format(text,
                                            pet.pronoun,
                                            pet.food.satiation);
            Tools.Print(newFG: Program.defaultFG,
                        text: formatted,
                        newBG: ConsoleColor.DarkGreen);

            //vals: new object[] {pet.name, foodToEat, pet.food.satiation});
        }
Example #2
0
 public Status(Pet owner)
 {
     this.owner = owner;
 }
Example #3
0
 public Debuff(Pet owner)
     : base(owner)
 {
     base.owner = owner;
 }
Example #4
0
 public void BattlePet(Pet pet, Creature enemy)
 {
     Tools.Print("RAWR LET'S GO FIGHTING\n");
 }
Example #5
0
 public void CheckPetStats(Pet pet)
 {
     Tools.Print(newFG: ConsoleColor.Gray,
     text: "Current Pet's name {0}\n" +
                  "Current Satiation {1}\n" +
                  "Current EXP {2}\n"+
                  "HP {3}/{4}\n",
       vals: new object[] {pet.name,
                      pet.food.satiation,
                      pet.exp,
                      pet.battle.currentHP,
                      pet.battle.maxHP});
 }
Example #6
0
 public PetFoodComponent(Pet master)
 {
     this.master = master;
 }
Example #7
0
 public PetBattleComponent(Pet master)
 {
     this.master = master;
     this.currentHP = this.maxHP;
 }
Example #8
0
        static void Main(string[] args)
        {
            //debugging stuff

            ////checking how c# passes vars
            //int orig = 100;
            //int first = orig;
            //orig++;
            //Tools.Print("Orig {0} and first {1}\n", new object[]{orig, first});

            //seeing if you can convert chars to ints and back
            //char val = 'A'; // c=99 so a=97? B=66 so A=65?
            //val++;
            //int newVal = (int)val;
            //char newest = (char)newVal;
            //Tools.Print(newVal.ToString()) ;

            //testing if `c` and `C` are the same, they aren't
            //string val;
            //if ('c' == 'c') {val = "t"; }
            //else {  val = "f"; }
            //Tools.Print(val);

            /*char qwe = 'a';
            qwe++;
            Console.WriteLine(qwe);*/

            //end debugging

            //Intro to the app
            Console.Title = Meta.name_ver;

            Console.BackgroundColor = defaultBG;
            Console.ForegroundColor = defaultFG;

            //Print intro line
            string welcomeString = "Welcome to the PET GAME version: {0}\n\n";
            string welcomeArg = Meta.ver;
            Tools.Print(ConsoleColor.Black, ConsoleColor.White, welcomeString, welcomeArg);

            //Creates User with a default name
            User user = new User();
            user.inventory.AddItem(new FoodFruit());
            user.inventory.AddItem(new FoodApple());
            //user.inventory.AddItem(new FoodApple());
            //user.inventory.AddItem(new FoodMeat());

            //Gets the name of the pet.
            //string name = Tools.Prompt("What is the name of your new male Pet?");
            string name = "YourFirstPet";
            Pet yourPet = new Pet(user, name);

            //Intro message
            Tools.Print(newFG: ConsoleColor.DarkBlue,
                        newBG: ConsoleColor.Cyan,
                        text: "\nThis is the main loop for the game. \n" +
                            "It is here that you'll feed or fight your" +
                            "\npet in order to train the shit out of it" +
                            "\n\n\n\t\tBEGIN!\n");

            //main loop
            while (true)
            {
                //give the user a choice of actions.
                string choices = "\t[f]eed, [b]attle, [t]hrow, [s]tats or [q]uit.";
                KeyValuePair<string, string> action = getUserAction(choices);

                //feed the pet
                if (action.Value == "feed")
                {
                    //this is  a real shitty way of doing this. There
                    // shouldn't be a class all on its own... :(
                    FeedAction feeding = new FeedAction(user);

                    user.inventory.ShowInventory();

                    string choice = Tools.Prompt("Choose a key from your items to feed");
                    char charChoice = (char)choice[0];

                    feeding.FeedPet(yourPet, user.inventory.items[charChoice] as FoodType);
                    //feeding.FeedPet(yourPet, new FoodMeat());
                }
                //check stats of the current pet
                else if (action.Value == "stats")
                {
                    StatAction stats = new StatAction(user);
                    stats.CheckPetStats(yourPet);
                }

                else if (action.Value == "throw")
                {
                    Tools.Print(newBG:ConsoleColor.DarkRed, text:"You throw your pet against the wall\n");

                    yourPet.battle.TakeDamage(10);
                }

                else if (action.Value == "battle")
                {
                    Creature enemy = new Creature();

                    BattleAction battle = new BattleAction(user);
                    battle.BattlePet(yourPet, enemy);
                }

                //quit the main loop
                else if (action.Value == "quit")
                {
                    break;
                }

                //Tools.Print(newFG: ConsoleColor.Yellow, text:"This was the action chosen: {0}\n", vals:action);

            }

            //Wait for Key on exit
            Tools.Print(ConsoleColor.DarkRed,
                    ConsoleColor.DarkYellow,
                    "Press any key to exit {0}",
                    Meta.name_ver);
            Console.ReadKey();
        }
Example #9
0
        public PetMoodComponent(Pet master)
        {
            //define the pet which this mood belongs too
            this.master = master;

            //print confirmation.
            //Tools.Print(ConsoleColor.Green, ConsoleColor.DarkYellow, "This general mood belongs to: {0}\n", this.getMaster().ToString());
        }