예제 #1
0
        private static void DoCrossBridge(Player player, Location location)
        {
            if (player == null)
            {
                throw new ArgumentNullException($"Error: LocationAction DoCrossBridge null player.");
            }
            if (location == null)
            {
                throw new ArgumentNullException($"Error: LocationAction DoCrossBridge null location.");
            }

            if (player.IsAlive && player.Location == location)
            {
                GameEngine.SayToLocation(location, $"{player.Name} tries to cross the bridge...");
                GameEngine.SayToLocation(location, $"A nasty goblin charges at {player.Genderize("him", "her", "it")} from under the bridge and attacks!");
                Player newGoblin = Prefabs.SpawnUnit(UnitType.WeakGoblin, location);
                PlayerActions.Attack(newGoblin, player);
                newGoblin.ResetTimeToAct();
            }
            else
            {
                GameEngine.SayToLocation(player.Location, $"{player.Name} was about to search the foliage but didn't succeed...");
            }
        }
예제 #2
0
        private static void DoSearchForest(Player player, Location location)
        {
            if (player == null)
            {
                throw new ArgumentNullException($"Error: LocationAction DoSearchForest null player.");
            }
            if (location == null)
            {
                throw new ArgumentNullException($"Error: LocationAction DoSearchForest null location.");
            }

            if (player.IsAlive && player.Location == location)
            {
                GameEngine.SayToLocation(location, $"{player.Name} searches the area.");
                if (!player.HasFlag(QuestFlags.ForestEmerald))
                {
                    player.AddFlag(QuestFlags.ForestEmerald);
                    if (player is Player)
                    {
                        GameEngine.SayToLocation(location, $"{player.Name} looks very closely at a green object...it's an emerald! {player.Genderize("He", "She", "It")} picks it up.");
                        (player).AddItem(ItemType.Emerald);
                        player.Notify("  *  Once you find some armor you can insert this to gain a passive ability!");
                    }
                    else
                    {
                        GameEngine.SayToLocation(location, $"{player.Name} looks very closely at a green object...it's an emerald!");
                        location.AddItem(ItemType.Emerald);
                    }
                }
                else if (player is Player && !(player).HasItem(ItemType.Stick))
                {
                    GameEngine.SayToLocation(location, $"{player.Name} discovers a nice stick!");
                    player.Notify("  *  It has a crooked head. You might even be able to pull something from the river.");
                    GameEngine.SayToLocation(location, $"{player.Name} picks up a stick.");
                    (player).AddItem(ItemType.Stick);
                }
                else
                {
                    switch (new Random().Next(5))
                    {
                    case 0:
                        player.Notify("  *  You discovered a Long Sword and some Chain Mail hidden behind a tree!");
                        GameEngine.SayToLocation(location, $"{player.Name} suddenly looks very excited! Then not.");
                        player.Notify("  *  Oh wait...it was just a shadow.");
                        break;

                    case 1:
                        player.Notify("  *  A huge spider is crawling up one of the trees! Prepare yourself!");
                        GameEngine.SayToLocation(location, $"{player.Name} gets startled by the local wildlife!");
                        Prefabs.SpawnUnit(UnitType.Spiderling, location);
                        break;

                    case 2:
                        GameEngine.SayToLocation(location, $"{player.Name} looks very closely at a blue object.");
                        player.Notify("  *  You discovered a beautiful blue butterfly. A shame it serves no purpose.");
                        break;

                    case 3:
                        player.Notify("  *  You don't find anything of interest.");
                        break;

                    case 4:
                        GameEngine.SayToLocation(location, $"{player.Name} discovers a nice stick!");
                        if (player is Player)
                        {
                            (player).AddItem(ItemType.Stick);
                        }
                        else
                        {
                            player.Location.AddItem(ItemType.Stick);
                        }
                        break;
                    }
                }
            }
            else
            {
                GameEngine.SayToLocation(player.Location, $"{player.Name} was about to search the foliage but didn't succeed...");
            }
        }