Added dialogues for the mayor
[butaba-adventures.git] / maingame.py
index 931e993..9efc5cd 100644 (file)
@@ -134,12 +134,16 @@ class MainGame:
                                                                          os.path.join ("dialogues", "bulisa3.dlg"),
                                                                          os.path.join ("dialogues", "bulisa4.dlg"),
                                                                          os.path.join ("dialogues", "bulisa5.dlg"),
-                                                                         os.path.join ("dialogues", "bulisa6.dlg") ] )
+                                                                         os.path.join ("dialogues", "bulisa6.dlg"),
+                                                                         os.path.join ("dialogues", "bulisa7.dlg") ] )
 
                npc_mayor = npcs.Mayor (5, 4, self.img_mayorleft, self.img_mayorright,
                                                                        self.img_mayorfront, self.img_mayorback,
                                                                        self.img_mayor_portrait, constants.FRONT,
-                                                                       (2, 2, 2, 2))
+                                                                       (2, 2, 2, 2),
+                                                                       [ os.path.join ("dialogues", "mayor1.dlg"),
+                                                                         os.path.join ("dialogues", "mayor2.dlg"),
+                                                                         os.path.join ("dialogues", "mayor3.dlg") ])
 
                chest1.objects = [ gold50, gold25, key2, gold10 ]
 
@@ -356,6 +360,31 @@ class MainGame:
                if isinstance (npc, npcs.Bulisa):
                        # interact with Bulisa
                        self.interact_npc_bulisa (npc)
+               elif isinstance (npc, npcs.Mayor):
+                       # interact with the Mayor
+                       self.interact_npc_mayor (npc)
+
+       # interact with the mayor
+       def interact_npc_mayor (self, npc):
+               resp_id = None
+
+               if gamestate.flag["mission_charity_money"] is True:
+                       npc.currentdialog = 2
+                       resp_id = utility.dialogue_play (self.screen, self.img_dialogue, npc, self.butaba.portrait, 0, 90)
+               elif gamestate.flag["mission_charity_informed_mayor"] is True:
+                       npc.currentdialog = 1
+                       resp_id = utility.dialogue_play (self.screen, self.img_dialogue, npc, self.butaba.portrait, 0, 90)
+               else:
+                       npc.currentdialog = 0
+                       resp_id = utility.dialogue_play (self.screen, self.img_dialogue, npc, self.butaba.portrait, 0, 90)
+
+
+               # deal with the respnses
+               if resp_id == "missioncharityaccepted":
+                       gamestate.flag["mission_charity_money"] = True
+               # response ID is none
+               elif resp_id is None:
+                       self.status_message = "You cannot initiate a conversation with %s" % npc.charname
 
        # interact with NPC Bulisa
        def interact_npc_bulisa (self, npc):
@@ -364,8 +393,12 @@ class MainGame:
 
                # check for global game states (starting from later flags to earlier ones
 
+               # whether butaba is doing the mayor charity mission
+               if gamestate.flag["mission_charity_money"] is True:
+                       npc.currentdialog = 6
+                       resp_id = utility.dialogue_play (self.screen, self.img_dialogue, npc, self.butaba.portrait, 0, 90)
                # whether the drawing water from well mission completed
-               if gamestate.flag["mission_charity_informed"] is True:
+               elif gamestate.flag["mission_charity_informed"] is True:
                        npc.currentdialog = 5
                        resp_id = utility.dialogue_play (self.screen, self.img_dialogue, npc, self.butaba.portrait, 0, 90)
                elif gamestate.flag['mission_bulisa_water_from_well_complete'] is True:
@@ -413,6 +446,9 @@ class MainGame:
                # Butaba is informed about the mayor's charity
                elif resp_id == "informedcharitymission":
                        gamestate.flag["mission_charity_informed"] = True
+               # if mayor has been told about Butaba
+               elif resp_id == "mayortoldaboutbutaba":
+                       gamestate.flag["mission_charity_informed_mayor"] = True
                # if response ID is none
                elif resp_id is None:
                        self.status_message = "You cannot initiate a conversation with %s" % npc.charname