public void TestLookAtGemInNoBag() { Player asad = new Player("Asad", "an Assassin"); LookCommand com = new LookCommand(); Assert.AreEqual(com.Execute(asad, new string[] { "look", "at", "gem", "in", "bag" }), "I cannot find the bag"); }
public void TestLookAtUnk() { Player asad = new Player("Asad", "an Assassin"); LookCommand com = new LookCommand(); Assert.AreEqual(com.Execute(asad, new string[] { "look", "at", "gem" }), "I cannot find the gem in the inventory"); }
public void TestInvalidLook() { Player asad = new Player("Asad", "an Assassin"); LookCommand com = new LookCommand(); Assert.AreEqual(com.Execute(asad, new string[] { "look", "around" }), "What do you want to look at?"); Assert.AreEqual(com.Execute(asad, new string[] { "hello" }), "Error in look input"); Assert.AreEqual(com.Execute(asad, new string[] { "look", "at", "a", "at", "b" }), "What do you want to look in?"); }
public void TestLookAtMe() { Item myGloriousItem = new Item(new string[] { "Midas" }, "Hand of midas gives gold", "kills the target unit instantly and grants the caster 200 reliable gold"); Player asad = new Player("Asad", "an Assassin"); asad.Inventory.Put(myGloriousItem); LookCommand com = new LookCommand(); Assert.AreEqual(com.Execute(asad, new string[] { "look", "at", "inventory" }), "Asad, an Assassin\nYou are carrying:\n\tHand of midas gives gold (Midas)"); }
public void TestLookAtNoGemInBag() { Player asad = new Player("Asad", "an Assassin"); Bag bag = new Bag(new string[] { "bag" }, "a black bag", "Bag with guns."); asad.Inventory.Put(bag); LookCommand com = new LookCommand(); Assert.AreEqual(com.Execute(asad, new string[] { "look", "at", "gem", "in", "bag" }), "I cannot find the gem in the bag"); }
public void TestLookAtGem() { Item myGloriousItem = new Item(new string[] { "gem" }, "kala gem", "kills everyone as soon as they touch it"); Player asad = new Player("Asad", "an Assassin"); asad.Inventory.Put(myGloriousItem); LookCommand com = new LookCommand(); Assert.AreEqual(com.Execute(asad, new string[] { "look", "at", "gem" }), "kills everyone as soon as they touch it"); }
public void TestLookAtGemInBag() { Player asad = new Player("Asad", "an Assassin"); Item myGloriousItem = new Item(new string[] { "gem" }, "kala gem", "kills everyone as soon as they touch it"); Bag bag = new Bag(new string[] { "bag" }, "a black bag", "Bag with guns."); LookCommand com = new LookCommand(); bag.Inventory.Put(myGloriousItem); asad.Inventory.Put(bag); Assert.AreEqual(com.Execute(asad, new string[] { "look", "at", "gem", "in", "bag" }), "kills everyone as soon as they touch it"); }
public static void Main(string[] args) { Console.Write(" ^^ \n"); Console.Write(" ^^ @@@@@@@@@ \n"); Console.Write(" ^^ ^^ @@@@@@@@@@@@@@@ \n"); Console.Write(" @@@@@@@@@@@@@@@@@@ ^^ \n"); Console.Write(" @@@@@@@@@@@@@@@@@@@@ \n"); Console.Write(" ~~~~ ~~ ~~~~~ ~~~~~~~~ ~~ &&&&&&&&&&&&&&&&&&&& ~~~~~~~ ~~~~~~~~~~~ ~~~ \n"); Console.Write(" ~ ~~ ~ ~ ~~~~~~~~~~~~~~~~~~~~ ~ ~~ ~~ ~ \n"); Console.Write(" WELCOME TO ~~ ~~ ~~ ~~ ~~~~~~~ ~~ ~~~~ ~ ~~~ ~ ~~~ ~ ~~ \n"); Console.Write(" SWINADVENTURE ~~~~~~~~~~~~~~~ \n"); Console.Write(" GAME ~ ~ ~~~~~~ ~~ ~ ~~ ~ ~~ ~~ ~ \n"); Console.Write(" \n"); Console.Write("Enter your characters name: "); // Player name input string pname = Console.ReadLine(); Console.Write("What character do you want to be? "); // Player description string pdesc = Console.ReadLine(); // --------------------------------GAME USAGE----------------------------------------------- Player player = new Player(pname, pdesc); // Create Player object Item item_1 = new Item(new string[] { "blade" }, "shadow blade", "Makes you invisible for 14 seconds"); // Create first item object used in game player.Inventory.Put(item_1); // Put Item "blade" in Player's Inventory Item item_2 = new Item(new string[] { "desolator" }, "armour reduction", "Your attacks reduce the target's armor by 7 for 15 seconds"); // Create second item object used in game player.Inventory.Put(item_2); // Put Item "desolator" in Player's Inventory Bag bag = new Bag(new string[] { "bag" }, "weapons bag", "carry all weapons"); // Create Bag object player.Inventory.Put(bag); // Put Bag in Player's Inventory bag.Inventory.Put(item_2); // Put first item in bag bag.Inventory.Put(item_1); // Put second item in bag // ----------------------------------------------------------------------------------------- Command look = new LookCommand(); string[] text = new string[10]; // Initiate Game loop do { Console.WriteLine(""); Console.Write("Command -> "); text = Console.ReadLine().Split(' '); if (text[0] != "quit") { if (look.AreYou(text[0])) { Console.WriteLine(look.Execute(player, text)); } else { Console.WriteLine("I don't understand " + text[0] + "."); } } }while (text[0] != "quit"); // exit Game loop with exit Console.WriteLine("Thank you for playing!, " + pname + "!\tPress ENTER to quit the game."); // Display message on abort Console.ReadLine(); }