Mercurial > skaapsteker
changeset 483:b48c194c4af9
Some haiku and encoding fixes.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 09 Apr 2011 22:05:27 +0200 |
parents | 200d25350d87 |
children | b15b0bd933a5 |
files | data/game.json data/npcs/kitsune.json scripts/npc-test skaapsteker/dialogue.py skaapsteker/gamestate.py |
diffstat | 5 files changed, 29 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/data/game.json Sat Apr 09 22:03:42 2011 +0200 +++ b/data/game.json Sat Apr 09 22:05:27 2011 +0200 @@ -31,7 +31,9 @@ "all_fishmonger_demons_dead": false, "kanedas_agreement_disrupted": false, "final_battle_lost": false, - "final_battle_won": false + "final_battle_won": false, + "haiku_wins": 0, + "haiku_losses": 0 }, "items": { "tealeaf": { "type": "TeaLeaf", "level": "temple", "pos": [1, 7] }, @@ -49,11 +51,11 @@ "salmon": { "type": "Salmon", "level": "_limbo", "pos": [1, 3] }, "no_mask": { "type": "NoMask", "level": "theatre", "pos": [10, 10], "broken": false }, "no_costume": { "type": "NoCostume", "level": "theatre", "pos": [13, 10] }, - "haiku1": { "type": "HaikuScroll", "level": "temple", "pos": [14, 16], "text": "Remaining in it?" }, - "haiku2": { "type": "HaikuScroll", "level": "_limbo", "pos": [0, 0], "text": "The end of autumn." }, - "haiku3": { "type": "HaikuScroll", "level": "_limbo", "pos": [0, 0], "text": "With no leaves to blow." }, - "haiku4": { "type": "HaikuScroll", "level": "_limbo", "pos": [0, 0], "text": "And it passes by." }, - "haiku5": { "type": "HaikuScroll", "level": "_limbo", "pos": [0, 0], "text": "The Galaxy." }, + "haiku1": { "type": "HaikuScroll", "level": "temple", "pos": [14, 16], "text": "remaining in it?" }, + "haiku2": { "type": "HaikuScroll", "level": "_limbo", "pos": [0, 0], "text": "the end of autumn." }, + "haiku3": { "type": "HaikuScroll", "level": "_limbo", "pos": [0, 0], "text": "with no leaves to blow." }, + "haiku4": { "type": "HaikuScroll", "level": "_limbo", "pos": [0, 0], "text": "and it passes by." }, + "haiku5": { "type": "HaikuScroll", "level": "_limbo", "pos": [0, 0], "text": "the Galaxy." }, "aburage_00": { "type": "Aburage", "level": "temple", "pos": [18, 5] }, "aburage_01": { "type": "Aburage", "level": "temple", "pos": [1, 15] }, "aburage_02": { "type": "Aburage", "level": "temple", "pos": [5, 4] },
--- a/data/npcs/kitsune.json Sat Apr 09 22:03:42 2011 +0200 +++ b/data/npcs/kitsune.json Sat Apr 09 22:05:27 2011 +0200 @@ -1,6 +1,6 @@ { "start" : { - "on_entry" : "world.haiku_losses = 0; world.haiku_wins = 0", + "on_entry" : "world.missions.haiku_losses = 0; world.missions.haiku_wins = 0", "text" : "I’ve been watching you for a time but I never thought you would get this far! You have been very wily and devious.", "auto_next": "state.onlyone" }, @@ -60,11 +60,11 @@ ] }, "haiku_right" : { - "on_entry" : "world.haiku_wins += 1", + "on_entry" : "world.missions.haiku_wins += 1", "events" : [ - { "matches" : "world.haiku_wins == 1 and world.haiku_losses == 0", "next": "state.haiku_1win_0loss" }, - { "matches" : "world.haiku_wins == 1 and world.haiku_losses == 1", "next": "state.haiku_1win_1loss" }, - { "matches" : "world.haiku_wins == 2", "next": "state.haiku_2wins" } + { "matches" : "world.missions.haiku_wins == 1 and world.missions.haiku_losses == 0", "next": "state.haiku_1win_0loss" }, + { "matches" : "world.missions.haiku_wins == 1 and world.missions.haiku_losses == 1", "next": "state.haiku_1win_1loss" }, + { "matches" : "world.missions.haiku_wins == 2", "next": "state.haiku_2wins" } ] }, "haiku_1win_0loss" : { @@ -80,12 +80,12 @@ "auto_next": "state.won" }, "haiku_wrong" : { - "on_entry" : "world.haiku_losses += 1", + "on_entry" : "world.missions.haiku_losses += 1", "text" : "Ha, that’s wrong! One point to me.", "events" : [ - { "matches" : "world.haiku_losses == 1 and world.haiku_wins == 0", "next": "state.haiku2" }, - { "matches" : "world.haiku_losses == 1 and world.haiku_wins == 1", "next": "state.haiku3" }, - { "matches" : "world.haiku_losses == 2", "next": "state.lost" } + { "matches" : "world.missions.haiku_losses == 1 and world.missions.haiku_wins == 0", "next": "state.haiku2" }, + { "matches" : "world.missions.haiku_losses == 1 and world.missions.haiku_wins == 1", "next": "state.haiku3" }, + { "matches" : "world.missions.haiku_losses == 2", "next": "state.lost" } ] }, "lost" : {
--- a/scripts/npc-test Sat Apr 09 22:03:42 2011 +0200 +++ b/scripts/npc-test Sat Apr 09 22:05:27 2011 +0200 @@ -34,17 +34,25 @@ while True: state = dsm.get_state() - print "%s:" % dsm.state, state.text + text = state.text + if text is not None: + text = text.encode('utf-8') + print "%s:" % dsm.state, text print "--" for i, choice in state.choices: print "%d: %s" % (i, choice) - print "L: Leave" + if state.auto_next: + print "N: Next" + else: + print "L: Leave" print "--" key = raw_input("Choice? ") key = key.strip().upper() if key == "L": break + if key == "N": + dsm.auto_next() elif key.isdigit(): dsm.choice(int(key))
--- a/skaapsteker/dialogue.py Sat Apr 09 22:03:42 2011 +0200 +++ b/skaapsteker/dialogue.py Sat Apr 09 22:05:27 2011 +0200 @@ -22,7 +22,7 @@ self.world = world self._me = getattr(self.world.npcs, name) self.states = AttrDict() - src = json.loads(data.load(json_filename).read()) + src = json.loads(data.load(json_filename).read(), encoding='utf-8') for state, state_src in src.iteritems(): pseudo_path = [json_filename, state] self.states[state] = DsmState(state, state_src, pseudo_path)
--- a/skaapsteker/gamestate.py Sat Apr 09 22:03:42 2011 +0200 +++ b/skaapsteker/gamestate.py Sat Apr 09 22:05:27 2011 +0200 @@ -46,7 +46,7 @@ if game_file is None: game_file = self._game_file raw_data = open(game_file, "rb").read() - self.data = json.loads(raw_data) + self.data = json.loads(raw_data, encoding='utf-8') self.world = StateProxy(self.data) def new_game(self):