changeset 557:e648501c2eea

victory scene hacked in
author Adrianna Pińska <adrianna.pinska@gmail.com>
date Sun, 10 Apr 2011 01:58:50 +0200
parents 354f84b945f8
children aa01ca54dce2
files data/npcs/kitsune.json skaapsteker/cutscene.py skaapsteker/dialogue.py
diffstat 3 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/data/npcs/kitsune.json	Sun Apr 10 01:55:24 2011 +0200
+++ b/data/npcs/kitsune.json	Sun Apr 10 01:58:50 2011 +0200
@@ -11,24 +11,13 @@
     "here" : {
         "text" : "But now we are here, face to face. How could you ever hope to defeat me?",
         "choices" : [
-            { "text": "In battle!", "next": "state.battle_start" },
             { "text": "In a haiku competition.", "next": "state.haiku_start", "if": "len(world.fox.scrolls) > 0" }
         ]
     },
-    "battle_start" : {
-        "text" : "Take your best shot!",
-        "auto_next": "state.battle"
-    },
     "haiku_start" : {
         "text" : "What? Play me at my own game? You can certainly try! You must beat me at two out of three challenges. Tell me which line is missing.",
         "auto_next": "state.haiku1"
     },
-    "battle" : {
-        "events" : [
-            { "matches" : "world.missions.final_battle_lost", "next": "state.lost" },
-            { "matches" : "world.missions.final_battle_won", "next": "state.won" }
-        ]
-    },
     "haiku1" : {
         "text" : "Over the wintry\nforest, winds howl in rage\n...?",
         "choices" : [
@@ -94,7 +83,8 @@
     },
     "won" : {
         "text" : "What? How? No! This is impossible – how could you defeat me? My power... slipping... my tails! Gone! Noooo...",
-        "auto_next": "state.defeated"
+        "auto_next": "state.defeated",
+        "on_exit": "end_game()"
     },
     "defeated" : {
     }
--- a/skaapsteker/cutscene.py	Sun Apr 10 01:55:24 2011 +0200
+++ b/skaapsteker/cutscene.py	Sun Apr 10 01:58:50 2011 +0200
@@ -35,7 +35,7 @@
         super(CutScene, self).dispatch(ev)
 
     def enter(self):
-        if self._background_music:
+        if self._background_music and self._soundsystem:
             self._soundsystem.play_background_music(self._background_music)
 
 
--- a/skaapsteker/dialogue.py	Sun Apr 10 01:55:24 2011 +0200
+++ b/skaapsteker/dialogue.py	Sun Apr 10 01:58:50 2011 +0200
@@ -1,7 +1,7 @@
 import json
 
 from . import data
-from .engine import OpenDialog, AddSpriteEvent
+from .engine import OpenDialog, AddSpriteEvent, ChangeScene
 
 
 class DSM(object):
@@ -48,6 +48,11 @@
         sprite = gamestate.create_item_sprite(item, to_level=to_level, to_pos=to_pos)
         AddSpriteEvent.post(sprite)
 
+    def _end_game(self):
+        """End the game"""
+        from .cutscene import VictoryCutScene
+        ChangeScene.post(VictoryCutScene(None, None))
+
     def _make_locals(self):
         my_locals = {
             "state": self.states,
@@ -55,6 +60,7 @@
             "npcs": self.world.npcs,
             "switch_to": self._switch_dialogue_to,
             "drop_item": self._drop_item,
+            "end_game": self._end_game,
         }
         return my_locals