Beispiel #1
0
        void peepDialogue()
        {
            Log.AddLine("Peep in which direction?");
            ConsoleKeyInfo keyPressed = Console.ReadKey(true);

            KeyToVector.ProcessInput(keyPressed);
            int peepX = CoordX + KeyToVector.x, peepY = CoordY + KeyToVector.y;

            if (peepX == CoordX && peepY == CoordY)
            {
                int randomMessageNumber = MyRandom.getRandomInt(3);
                switch (randomMessageNumber)
                {
                case 0:
                    Log.AddLine("You feel SO introversive for a moment");
                    break;

                case 1:
                    Log.AddLine("You peep yourself. So interesting");
                    break;

                case 2:
                    Log.AddLine("If you wanna, hm, look at yourself, get a room, please.");
                    break;
                }
                return;
            }
            //don't peep through walls anymore! :D
            if (World.IsPassable(peepX, peepY) || World.IsDoorPresent(peepX, peepY))
            {
                isPeeping = true;
                lastPeepX = peepX;
                lastPeepY = peepY;
                WorldRendering.drawInCircleFOV(peepX, peepY, visibilityRadius);
                WorldRendering.drawUnitsInCircle(peepX, peepY, visibilityRadius);
                this.Draw();
                Console.ForegroundColor = ConsoleColor.Gray;
                Timing.AddActionTime(TimeCost.CloseDoorCost(this));
                Log.ReplaceLastLine("You carefully peep in that direction... Press space or esc to stop");
                keyPressed = Console.ReadKey(true);
                if (keyPressed.Key == ConsoleKey.Spacebar || keyPressed.Key == ConsoleKey.Escape)
                {
                    isPeeping = false;
                    Log.ReplaceLastLine("You carefully peep in that direction...");
                }
            }
            else
            {
                Log.ReplaceLastLine("You try to peep through this, but in vain.");
            }
        }
Beispiel #2
0
        void closeDoorDialogue()
        {
            Log.AddLine("Close door in which direction?");
            ConsoleKeyInfo keyPressed = Console.ReadKey(true);

            KeyToVector.ProcessInput(keyPressed);
            int doorX = CoordX + KeyToVector.x, doorY = CoordY + KeyToVector.y;

            if (doorX == CoordX && doorY == CoordY)
            {
                int randomMessageNumber = MyRandom.getRandomInt(3);
                switch (randomMessageNumber)
                {
                case 0:
                    Log.AddLine("Wow. You costumed like a door this Halloween?");
                    break;

                case 1:
                    Log.AddLine("You have almost closed yourself, but suddenly remembered that you're not a door.");
                    break;

                case 2:
                    Log.AddLine("Okay... Try another time");
                    break;
                }
                return;
            }
            if (World.TryCloseDoor(doorX, doorY))
            {
                Timing.AddActionTime(TimeCost.PeepCost(this));
                Log.ReplaceLastLine("You carefully closed the door.");
            }
            else
            {
                Log.ReplaceLastLine("You tried to close this, but something went wrong...");
            }
        }
Beispiel #3
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!");
            }
        }
Beispiel #4
0
 public void handleKeys(ConsoleKeyInfo keyPressed)
 {
     if (isPeeping)
     {
         Timing.AddActionTime(TimeCost.ContinuePeepCost(this));
         ContinuePeep(keyPressed);
         return;
     }
     //MOVING/WAITING
     if (keyPressed.Key == ConsoleKey.NumPad5) //skip turn
     {
         Timing.AddActionTime(TimeCost.SkipTurnCost(this));
         return;
     }
     KeyToVector.ProcessInput(keyPressed);
     if (KeyToVector.ProperButtonPressed)
     {
         MoveOrOpenOrAttack(KeyToVector.x, KeyToVector.y);
     }
     //ACTIONS
     if (keyPressed.Key == ConsoleKey.D1)
     {
         seeTheStats();
     }
     if (keyPressed.Key == ConsoleKey.C) //close door
     {
         closeDoorDialogue();
     }
     if (keyPressed.Key == ConsoleKey.D) //drop an item
     {
         Inv.DropDialogue();
     }
     if (keyPressed.Key == ConsoleKey.F) //fire current weapon
     {
         shootDialogue();
     }
     if (keyPressed.Key == ConsoleKey.G) //grab (pick up) an item
     {
         Inv.PickupDialogue();
     }
     if (keyPressed.Key == ConsoleKey.I) //show inventory
     {
         Inv.ShowInventory();
     }
     if (keyPressed.Key == ConsoleKey.P) //peep
     {
         peepDialogue();
     }
     if (keyPressed.Key == ConsoleKey.S) //strangle
     {
         strangleDialogue();
     }
     if (keyPressed.Key == ConsoleKey.W) //wield a weapon
     {
         Inv.WieldDialogue();
     }
     if (keyPressed.Key == ConsoleKey.Q) //ready the ammo
     {
         Inv.ReadyAmmoDialogue();
     }
     if (keyPressed.Key == ConsoleKey.R) //reload a gun
     {
         Inv.ReloadDialogue();
     }
     //TODO!
 }