view data/npcs/guard.json @ 292:93352ab52f2e

Fix up possible inconsistencies in guard state machine fox shape handling by making liberal use of auto_next and splitting a state in two (one for the fox, one for the human).
author Simon Cross <hodgestar@gmail.com>
date Fri, 08 Apr 2011 21:59:42 +0200
parents 16ffe6f5dbb8
children c6d1165bb16f
line wrap: on
line source

{
    "start" : {
        "text" : "Shoo, filthy fox! How did you get in here?",
        "events" : [
            { "matches" : "world.fox.shape == 'human'", "next": "state.shapeshifted" },
            { "matches" : "world.fox.shape == 'human_with_fan'", "next": "state.disguised" }
        ]
    },
    "shapeshifted" : {
        "text" : "Excuse me, ma’am. The gate is closed.",
        "choices" : [
            { "text": "Why is that?", "next": "state.monks" },
            { "text": "Let me out now!", "next": "state.staycalm" },
            { "text": "Sayonara.", "next": "state.secondtry_human" }
        ],
        "events" : [
            { "matches" : "world.fox.shape == 'human_with_fan'", "next": "state.disguised" },
            { "matches" : "world.fox.shape == 'fox'", "next": "state.start" }
        ]
    },
    "monks" : {
        "text" : "The monks have asked us not to let anybody out.",
        "auto_next" : "state.noexceptions",
        "auto_next_text" : "Pretty please?"
    },
    "noexceptions" : {
        "text" : "Sorry, no exceptions.",
        "auto_next": "state.secondtry_human"
    },
    "staycalm" : {
        "text" : "Please stay calm. Perhaps you should go meditate?",
        "auto_next": "state.secondtry_human"
    },
    "secondtry_fox" : {
        "text" : "Shoo!",
        "events" : [
            { "matches" : "world.fox.shape == 'human_with_fan'", "next": "state.disguised" },
            { "matches" : "world.fox.shape == 'human'", "next": "state.secondtry_human" }
        ]
    },
    "secondtry_human" : {
        "text" : "The gate is locked, and it’s staying locked.",
        "events" : [
            { "matches" : "world.fox.shape == 'human_with_fan'", "next": "state.disguised" },
            { "matches" : "world.fox.shape == 'fox'", "next": "state.secondtry_fox" }
        ]
    },
    "disguised" : {
        "text" : "Ah, good evening, young lady! I’m afraid the gate is still closed for the night...",
        "choices" : [
            { "text": "Even for me?", "next": "state.notsafe" },
            { "text": "Sayonara." }
        ]
    },
    "notsafe" : {
        "text" : "Ah, well, it isn’t safe for pretty young women to be wandering around alone.",
        "choices" : [
            { "text": "It’s only for a moment. My house is just across the road.", "next": "state.hmm" }
        ]
    },
    "hmm" : {
        "text" : "Hmm...",
        "choices" : [
            { "text": "You could come join me for some sake later.", "next": "state.okay" }
        ]
    },
    "okay" : {
        "text" : "Ah, well, okay! I guess I could make an exception, just this once... Just across the road, you say...",
        "auto_next": "state.agreed"
    },
    "agreed" : {
    }
}