Exemplo n.º 1
0
 protected void drawLookingThingy() //draw a thingy that shows this unit's direction
 {
     if (!World.isActorPresent(CoordX + lookX, CoordY + lookY))
     {
         char thingy = '?';
         if (lookX == 0)
         {
             thingy = '|';
         }
         if (lookY == 0)
         {
             thingy = '-';
         }
         if (lookX * lookY == 1)
         {
             thingy = '\\';
         }
         if (lookX * lookY == -1)
         {
             thingy = '/';
         }
         Console.SetCursorPosition(CoordX + lookX, CoordY + lookY);
         Console.Write(thingy);
     }
     //TODO!
 }
Exemplo n.º 2
0
 public void MoveOrOpenOrAttack(int x, int y) //-1 or 0 or 1 for x and y
 {
     if (World.IsDoorPresent(CoordX + x, CoordY + y))
     {
         if (World.TryUnlockDoor(CoordX + x, CoordY + y, Inv.GetAllKeys))
         {
             Timing.AddActionTime(TimeCost.OpenDoorCost(this));
             Log.AddLine("You have unlocked the door with your key.");
             return;
         }
         if (World.TryOpenDoor(CoordX + x, CoordY + y))
         {
             Timing.AddActionTime(TimeCost.OpenDoorCost(this));
             Log.AddLine("You opened the door.");
             return;
         }
     }
     if (World.IsPassable(CoordX + x, CoordY + y))
     {
         CoordX += x;
         CoordY += y;
         Timing.AddActionTime(TimeCost.MoveCost(this));
         if (World.isItemPresent(CoordX, CoordY))
         {
             List <Item> list = World.getItemListAt(CoordX, CoordY);
             int         numberOfItemsOnFloor = list.Count();
             if (numberOfItemsOnFloor > 1)
             {
                 Log.AddLine("You see here: " + list[0].DisplayName + " and " + (numberOfItemsOnFloor - 1).ToString() + " more items");
             }
             else
             {
                 Log.AddLine("You see here: " + list[0].DisplayName);
             }
         }
         return;
     }
     if (World.isActorPresent(CoordX + x, CoordY + y))
     {
         Actor attacked = World.getActorAt(CoordX + x, CoordY + y);
         Attack.MeleeAttack(this, attacked);
     }
     else if (!World.IsPassable(CoordX + x, CoordY + y))
     {
         Log.AddLine("Locked! You need a key.");
     }
     //World.Redraw(CoordX-x, CoordY-y);
 }
Exemplo n.º 3
0
 public static void DrawWorldAtCoordinate(int x, int y)
 {
     if (World.player.CoordX == x && World.player.CoordY == y)
     {
         World.player.Draw();
         return;
     }
     if (World.isActorPresent(x, y))
     {
         World.getActorAt(x, y).Draw();
         return;
     }
     if (World.isItemPresent(x, y))
     {
         World.getItemAt(x, y).Draw();
         return;
     }
     Console.SetCursorPosition(x, y);
     Console.ForegroundColor = World.map[x, y].Color;
     Console.Write(World.map[x, y].Appearance);
 }
Exemplo n.º 4
0
        void strangleDialogue()
        {
            Log.AddLine("Grab in which direction?");
            ConsoleKeyInfo keyPressed = Console.ReadKey(true);

            KeyToVector.ProcessInput(keyPressed);
            int strangleX = CoordX + KeyToVector.x, strangleY = CoordY + KeyToVector.y;

            if (strangleX == CoordX && strangleY == CoordY)
            {
                int randomMessageNumber = MyRandom.getRandomInt(3);
                switch (randomMessageNumber)
                {
                case 0:
                    Log.AddLine("Wanna strangle yourself huh?");
                    break;

                case 1:
                    Log.AddLine("Suicide will not help with your mission.");
                    break;

                case 2:
                    Log.AddLine("If you wanna touch yourself, get a room, please.");
                    break;
                }
                return;
            }
            if (World.isActorPresent(strangleX, strangleY))
            {
                Attack.Strangle(this, World.getActorAt(strangleX, strangleY));
                Timing.AddActionTime(TimeCost.StrangleCost(this));
            }
            else
            {
                Log.AddLine("There's nobody here!");
            }
        }