Ejemplo n.º 1
0
        public override void Initialize()
        {
            /*
             The Bar is south of the Foyer. The printed name of the bar is "Foyer Bar".
            The Bar is dark.  "The bar, much rougher than you'd have guessed
            after the opulence of the foyer to the north, is completely empty.
            There seems to be some sort of message scrawled in the sawdust on the floor."
             */

            Short = "Foyer Bar";
            Long = "The bar, much rougher than you'd have guessed after the opulence of the foyer to the north, is completely empty. There seems to be some sort of message scrawled in the sawdust on the floor.";
            RoomType = RMUD.RoomType.Interior;
            AmbientLighting = LightingLevel.Dark;

            OpenLink(Direction.NORTH, "Foyer");

            // The scrawled message is scenery in the Bar. Understand "floor" or "sawdust" as the message.

            var message = new MudObject();
            message.SimpleName("message", "floor", "sawdust", "scrawled");
            AddScenery(message);

            //Neatness is a kind of value. The neatnesses are neat, scuffed, and trampled. The message has a neatness. The message is neat.

            bool messageScuffed = false;

            /*
            Instead of examining the message:
            increase score by 1;
            say "The message, neatly marked in the sawdust, reads...";
            end the game in victory.

            Instead of examining the trampled message:
            say "The message has been carelessly trampled, making it difficult to read.
            You can just distinguish the words...";
            end the game saying "You have lost".
             */
            message.Perform<MudObject, MudObject>("describe")
                .Do((actor, item) =>
                {
                    if (messageScuffed)
                    {
                        SendMessage(actor, "The message has been carelessly trampled, making it difficult to read. You can just distinguish the words...");
                        SendMessage(actor, "YOU HAVE LOST.");
                        Core.Shutdown();
                    }
                    else
                    {
                        SendMessage(actor, "The message, neatly marked in the sawdust, reads...");
                        SendMessage(actor, "YOU HAVE WON!");
                        Core.Shutdown();
                    }
                    return PerformResult.Stop;
                });

            /*
             Instead of doing something other than going in the bar when in darkness:
            if the message is not trampled, change the neatness of the message
            to the neatness after the neatness of the message;
            say "In the dark? You could easily disturb something."
             */
            Perform<PossibleMatch, Actor>("before acting")
                .When((match, actor) => AmbientLighting == LightingLevel.Dark)
                .Do((match, actor) =>
                {
                    if (match.TypedValue<CommandEntry>("COMMAND").IsNamed("GO"))
                        return PerformResult.Continue;
                    messageScuffed = true;
                    SendMessage(actor, "In the dark? You could easily disturb something.");
                    return PerformResult.Stop;
                });

            /*
             Instead of going nowhere from the bar when in darkness:
            now the message is trampled;
            say "Blundering around in the dark isn't a good idea!"
             */
            Perform<PossibleMatch, Actor>("before command")
                .When((match, actor) => AmbientLighting == LightingLevel.Dark
                    && match.TypedValue<CommandEntry>("COMMAND").IsNamed("GO")
                    && (match.ValueOrDefault("DIRECTION") as Direction?).Value != Direction.NORTH)
                .Do((match, actor) =>
                {
                    messageScuffed = true;
                    SendMessage(actor, "Blundering around in the dark isn't a good idea!");
                    return PerformResult.Stop;
                });
        }
Ejemplo n.º 2
0
        public static void DefaultResponse(this MudObject To, Func <MudObject, MudObject, MudObject, PerformResult> FuncResponse)
        {
            To.InitializeConversationTopics();

            To.Perform <MudObject, MudObject, MudObject>("topic response").When((actor, npc, topic) => topic == null).Do(FuncResponse);
        }
Ejemplo n.º 3
0
        public static RuleBuilder <MudObject, MudObject, PerformResult> PerformNoTopicsToDiscuss(this MudObject To)
        {
            To.InitializeConversationTopics();

            return(To.Perform <MudObject, MudObject>("no topics to discuss").ThisOnly(1));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Factory that creates a Describe rule that applies only to the object it is called on.
 /// </summary>
 /// <param name="Object"></param>
 /// <returns></returns>
 public static RuleBuilder <MudObject, MudObject, PerformResult> PerformDescribe(this MudObject Object)
 {
     return(Object.Perform <MudObject, MudObject>("describe").ThisOnly(1));
 }
Ejemplo n.º 5
0
 public static RuleBuilder <MudObject, MudObject, PerformResult> PerformGreet(this MudObject To)
 {
     return(To.Perform <MudObject, MudObject>("greet").ThisOnly(1));
 }
Ejemplo n.º 6
0
 public static RuleBuilder <MudObject, MudObject, PerformResult> PerformOpened(this MudObject Object)
 {
     return(Object.Perform <MudObject, MudObject>("opened").ThisOnly(1));
 }
Ejemplo n.º 7
0
 public static RuleBuilder <MudObject, MudObject, MudObject, PerformResult> PerformUnlocked(this MudObject Object)
 {
     return(Object.Perform <MudObject, MudObject, MudObject>("unlocked"));
 }
Ejemplo n.º 8
0
 public static RuleBuilder <MudObject, MudObject, PerformResult> PerformClose(this MudObject ThisObject)
 {
     return(ThisObject.Perform <MudObject, MudObject>("close").ThisOnly(1));
 }
Ejemplo n.º 9
0
 public static RuleBuilder <MudObject, MudObject, MudObject, PerformResult> PerformPushDirection(this MudObject Object)
 {
     return(Object.Perform <MudObject, MudObject, MudObject>("push direction").When((actor, subject, link) => System.Object.ReferenceEquals(subject, Object)));
 }
Ejemplo n.º 10
0
 public static RuleBuilder <MudObject, MudObject, PerformResult> PerformGo(this MudObject Object)
 {
     return(Object.Perform <MudObject, MudObject>("go"));
 }