def custom_init(self, nart):
        super().custom_init(nart)
        myedge = self.elements["DZ_EDGE"]
        self.register_element("FACTION", self.get_enemy_faction(nart))
        self.add_sub_plot(nart,
                          "ADD_REMOTE_OFFICE",
                          ident="ENEMYRO",
                          spstate=PlotState(
                              rank=self.rank + 5,
                              elements={
                                  "METRO":
                                  myedge.start_node.destination.metrodat,
                                  "METROSCENE": myedge.start_node.destination,
                                  "LOCALE": myedge.start_node.destination,
                                  "MISSION_GATE": myedge.start_node.entrance
                              }).based_on(self))
        self.add_sub_plot(
            nart,
            self.RATCHET_SETUP,
            ident="MISSION",
            spstate=PlotState(
                elements={
                    "METRO": myedge.start_node.destination.metrodat,
                    "METROSCENE": myedge.start_node.destination,
                    "MISSION_GATE": myedge.start_node.entrance
                }).based_on(self))

        return True
Beispiel #2
0
    def custom_init(self, nart):
        self.plots_to_run = list()
        if nart.camp.dead_party:
            self.plots_to_run.append(
                self.add_sub_plot(nart, "RECOVER_DEAD_PARTY"))

        # Deal with dispossessed lancemates.
        for pc in [
                pc for pc in nart.camp.get_lancemates()
                if not nart.camp.get_pc_mecha(pc)
        ]:
            mek = nart.camp.get_backup_mek(pc)
            if mek:
                nart.camp.assign_pilot_to_mecha(pc, mek)
            else:
                self.plots_to_run.append(
                    self.add_sub_plot(nart,
                                      "LANCEMATE_NEEDS_MECHA",
                                      spstate=PlotState().based_on(
                                          self, {"NPC": pc})))

        # Deal with incapacitated lancemates.
        for pc in list(nart.camp.incapacitated_party):
            nart.camp.incapacitated_party.remove(pc)
            nart.camp.party.append(pc)
            self.plots_to_run.append(
                self.add_sub_plot(nart,
                                  "LANCEMATE_NEEDS_HOSPITAL",
                                  spstate=PlotState().based_on(
                                      self, {"NPC": pc})))

        return True
    def custom_init(self, nart):
        myedge = self.elements["DZ_EDGE"]
        self.rank = self.BASE_RANK + random.randint(1,6) - random.randint(1,6)
        self.register_element("DZ_EDGE_STYLE",myedge.style)
        self.register_element("FACTION",self.get_enemy_faction(nart))

        self.add_sub_plot(nart,"ADD_REMOTE_OFFICE",ident="ENEMYRO",spstate=PlotState(rank=self.rank+5,elements={"METRO":myedge.start_node.destination.metrodat,"LOCALE":myedge.start_node.destination,"MISSION_GATE":myedge.start_node.entrance}).based_on(self))
        self.add_sub_plot(nart,self.RATCHET_SETUP,ident="MISSION",spstate=PlotState(elements={"METRO":myedge.start_node.destination.metrodat,"LOCALE":myedge.start_node.destination,"MISSION_GATE":myedge.start_node.entrance}).based_on(self))

        self.road_cleared = False

        return True
Beispiel #4
0
    def initialize_plots(self, plot, nart):
        """

        :type plot: Plot
        """
        ok = True
        towns = list()
        for n in self.nodes:
            if n.sub_plot_label:
                ok = plot.add_sub_plot(nart,
                                       n.sub_plot_label,
                                       ident=n.sub_plot_ident,
                                       spstate=PlotState(rank=60 -
                                                         n.pos[0] * 3,
                                                         elements={
                                                             "DZ_NODE": n
                                                         }).based_on(plot))
                if ok:
                    n.destination = ok.elements["LOCALE"]
                    n.entrance = ok.elements["ENTRANCE"]
                    if "DZ_NODE_FRAME" in ok.elements:
                        n.frame = ok.elements["DZ_NODE_FRAME"]
                    towns.append(n)
                else:
                    break
        for e in self.edges:
            if e.sub_plot_label:
                ok = plot.add_sub_plot(nart,
                                       e.sub_plot_label,
                                       ident=e.sub_plot_ident,
                                       spstate=PlotState(elements={
                                           "DZ_EDGE": e
                                       }).based_on(plot))
                if ok:
                    e.eplot = ok
                    if "DZ_EDGE_STYLE" in ok.elements:
                        e.style = ok.elements["DZ_EDGE_STYLE"]
                else:
                    break
        if towns:
            towns.sort(key=lambda x: x.pos[0])
            mytown = towns[min(random.randint(1,
                                              len(towns) - 2),
                               random.randint(1,
                                              len(towns) - 2))]
            plot.add_sub_plot(nart,
                              "DZD_MAGNUSMECHA",
                              elements={
                                  "METROSCENE": mytown.destination,
                                  "METRO": mytown.destination.metrodat
                              })
        return ok
 def attempt_treatment(self, camp: gears.GearHeadCampaign,
                       npc: gears.base.Character):
     pbge.alert("You attempt to treat {} for {}...".format(
         npc, self.elements["DISEASE"]))
     if camp.do_skill_test(
             gears.stats.Knowledge,
             gears.stats.Medicine,
             self.rank,
             difficulty=gears.stats.DIFFICULTY_HARD,
     ):
         pbge.alert("{} is cured!".format(npc))
         camp.dole_xp(50)
         npc.relationship.history.append(
             gears.relationships.Memory(
                 "you cured me of {DISEASE}".format(**self.elements),
                 "I cured you of {DISEASE}".format(**self.elements),
                 reaction_mod=15,
                 memtags=(gears.relationships.MEM_AidedByPC, )))
         self._advance_challenge(camp)
     else:
         pbge.alert("You fail. {} goes home to rest.".format(npc))
         myvac = game.content.load_dynamic_plot(
             camp, "NPC_VACATION",
             PlotState().based_on(self, update_elements={"NPC": npc}))
         myvac.freeze_now(camp)
 def custom_init(self, nart):
     super().custom_init(nart)
     myedge = self.elements["DZ_EDGE"]
     self.add_sub_plot(
         nart,
         "DZRE_KERBEROS_ATTACKS",
         ident="MISSION",
         spstate=PlotState(
             elements={
                 "METRO": myedge.start_node.destination.metrodat,
                 "METROSCENE": myedge.start_node.destination,
                 "MISSION_GATE": myedge.start_node.entrance
             }).based_on(self))
     self._got_rumor = False
     mysp = self.add_sub_plot(nart,
                              "ADD_EXPERT",
                              elements={
                                  "METRO":
                                  myedge.start_node.destination.metrodat,
                                  "METROSCENE":
                                  myedge.start_node.destination
                              })
     self.elements["NPC"] = mysp.elements["NPC"]
     self.elements["EXPERT_LOC"] = mysp.elements["LOCALE"]
     return True
Beispiel #7
0
 def t_START(self, camp):
     # Attempt to load at least one challenge plot, then load some more plots.
     if self.should_load_plot(camp):
         game.content.load_dynamic_plot(
             camp,
             self.CHALLENGE_LABEL,
             pstate=PlotState(rank=self.calc_rank(camp)).based_on(self))
     while self.should_load_plot(camp):
         myplot = game.content.load_dynamic_plot(
             camp,
             self.SUBPLOT_LABEL,
             pstate=PlotState(rank=self.calc_rank(camp)).based_on(self))
         if not myplot:
             print("Warning: No plot found for {}".format(
                 self.SUBPLOT_LABEL))
             break
    def custom_init(self, nart):
        # Step one: Determine the military faction that will be the basis of our splinter.
        city = self.elements["LOCALE"]
        city_fac = city.faction
        if city_fac in nart.camp.faction_relations:
            candidates = [fac for fac in nart.camp.faction_relations[city_fac].allies if gears.tags.Military in fac.factags]
            if candidates:
                myfac = random.choice(candidates)
                mycircle = self.register_element("FACTION",gears.factions.Circle(myfac))
                if myfac in nart.camp.faction_relations and nart.camp.faction_relations[myfac].enemies:
                    hated_fac = random.choice(nart.camp.faction_relations[myfac].enemies)
                    hated_origin = random.choice(hated_fac.LOCATIONS)
                    if hated_origin not in myfac.LOCATIONS:
                        self.hates = hated_origin
                    else:
                        self.hates = None
                else:
                    self.hates = None
                self.add_sub_plot(nart,"PLACE_LOCAL_REPRESENTATIVES")
                # Add at least one loyalist, too.
                self.add_sub_plot(nart,"PLACE_LOCAL_REPRESENTATIVES",spstate=PlotState(elements={"FACTION":myfac}).based_on(self))

            self.adventure_seed = None
            self.mission_giver = None
            return bool(candidates)
    def custom_init( self, nart ):
        team1 = teams.Team(name="Player Team")
        myscene = gears.GearHeadScene(35,35,"Radio Tower Area",player_team=team1,scale=gears.scale.MechaScale)
        myscenegen = pbge.randmaps.SceneGenerator(myscene, game.content.gharchitecture.MechaScaleDeadzone())
        self.register_scene( nart, myscene, myscenegen, ident="LOCALE" )
        myscene.exploration_music = 'Lines.ogg'
        myscene.combat_music = 'Late.ogg'

        mygoal = self.register_element("_goalroom",pbge.randmaps.rooms.FuzzyRoom(10,10,parent=myscene,anchor=pbge.randmaps.anchors.middle))

        team1 = teams.Team(name="Player Team")
        team2 = teams.Team(name="Civilian Team")
        intscene = gears.GearHeadScene(10,10,"Radio Tower Interior",player_team=team1,civilian_team=team2,scale= gears.scale.HumanScale)
        intscenegen = pbge.randmaps.SceneGenerator(intscene, game.content.gharchitecture.DefaultBuilding())
        self.register_scene( nart, intscene, intscenegen, ident="GOALSCENE" )

        introom = self.register_element('_introom', pbge.randmaps.rooms.OpenRoom(7, 7, anchor=pbge.randmaps.anchors.middle, decorate=pbge.randmaps.decor.OmniDec(win=game.content.ghterrain.Window)), dident="GOALSCENE")
        self.move_element(self.elements["PERSON"],introom)
        intscene.local_teams[self.elements["PERSON"]] = team2
        self.register_element('WAYPOINT', game.content.ghwaypoints.RetroComputer(), dident="_introom")

        world_scene = self.elements["WORLD"]

        wm_con = game.content.plotutility.WMCommTowerConnection(self, world_scene, myscene)
        if random.randint(1,3) != 1:
            wm_con.room1.tags = (dd_main.ON_THE_ROAD,)
        int_con = game.content.plotutility.IntCommTowerConnection(self, myscene, intscene, room1=mygoal, room2=introom)

        tplot = self.add_sub_plot(nart, "DZD_MECHA_ENCOUNTER", spstate=PlotState().based_on(self,{"ROOM":mygoal}), necessary=False)
        return True
 def FIGHTCETUS_WIN(self, camp):
     pstate = PlotState(adv=Adventure("Resolution")).based_on(self)
     if camp.campdata[DZDCVAR_NUM_ALLIANCES] >= 3:
         content.load_dynamic_plot(camp, "DZDCEND_DZALLIANCE", pstate)
     else:
         content.load_dynamic_plot(camp, "DZDCEND_TDFMISSILES", pstate)
     self.end_plot(camp, True)
    def _load_next_fight(self, camp):
        # Load the next fight against Cetus. In case you run out of villages, load the BAD END.
        if self.cetus_path:
            mytown = self.cetus_path.pop(0)
            camp.campdata[DZDCVAR_CETUS_TOWN] = mytown.destination
            pstate = PlotState(
                adv=Adventure("CetusFight"),
                elements={"METROSCENE": mytown.destination, "METRO": mytown.destination.metrodat,
                          "MISSION_GATE": mytown.entrance},
            ).based_on(self)
            sp = content.load_dynamic_plot(camp, "DZDC_FIGHT_CETUS", pstate)
            self.subplots["FIGHTCETUS"] = sp

        else:
            pstate = PlotState(adv=Adventure("Resolution")).based_on(self)
            content.load_dynamic_plot(camp, "DZDCEND_BAD", pstate)
            self.end_plot(camp, True)
Beispiel #12
0
 def win_a_mission(self, camp):
     self.rank_modifier += random.randint(1, 3)
     self.mission_patience -= 1
     if self.active and self.mission_patience < 1 and not self.ran_out_of_patience:
         self.subplots["MISSION"] = game.content.load_dynamic_plot(
             camp, AUTOFIND_ENEMY_BASE_MISSION,
             PlotState(rank=self.rank + self.rank_modifier).based_on(self))
         self.ran_out_of_patience = True
 def custom_init(self, nart):
     super().custom_init(nart)
     myedge = self.elements["DZ_EDGE"]
     self.add_sub_plot(
         nart,
         "DZRE_MECHA_GRAVEYARD",
         ident="MISSION",
         spstate=PlotState(
             elements={
                 "METRO": myedge.start_node.destination.metrodat,
                 "METROSCENE": myedge.start_node.destination,
                 "MISSION_GATE": myedge.start_node.entrance
             }).based_on(self))
     return True
 def custom_init(self, nart):
     super().custom_init(nart)
     myedge = self.elements["DZ_EDGE"]
     self.register_element("FACTION", self.get_enemy_faction(nart))
     self.add_sub_plot(
         nart,
         "DZRE_BLACKMARKETBLUES",
         ident="MISSION",
         spstate=PlotState(
             elements={
                 "METRO": myedge.start_node.destination.metrodat,
                 "METROSCENE": myedge.start_node.destination,
                 "MISSION_GATE": myedge.start_node.entrance
             }).based_on(self))
     return True
Beispiel #15
0
    def initialize_plots(self, plot, nart):
        """

        :type plot: Plot
        """
        ok = True
        for n in self.nodes:
            if n.sub_plot_label:
                ok = plot.add_sub_plot(nart,
                                       n.sub_plot_label,
                                       ident=n.sub_plot_ident,
                                       spstate=PlotState(elements={
                                           "DZ_NODE": n
                                       }).based_on(plot))
                if ok:
                    n.destination = ok.elements["LOCALE"]
                    n.entrance = ok.elements["ENTRANCE"]
                    if "DZ_NODE_FRAME" in ok.elements:
                        n.frame = ok.elements["DZ_NODE_FRAME"]
                else:
                    break
        for e in self.edges:
            if e.sub_plot_label:
                ok = plot.add_sub_plot(nart,
                                       e.sub_plot_label,
                                       ident=e.sub_plot_ident,
                                       spstate=PlotState(elements={
                                           "DZ_EDGE": e
                                       }).based_on(plot))
                if ok:
                    e.eplot = ok
                    if "DZ_EDGE_STYLE" in ok.elements:
                        e.style = ok.elements["DZ_EDGE_STYLE"]
                else:
                    break
        return ok
    def custom_init( self, nart ):
        myscene = self.elements["LOCALE"]
        enemy_fac = self.elements.get(dd_tarot.ME_FACTION)
        destscene = self.seek_element(nart, "_DEST", self._is_best_scene, scope=myscene)

        mynpc = self.register_element("NPC",gears.selector.random_character(rank=random.randint(self.rank-10,self.rank+10),local_tags=(gears.personality.Luna,)),dident="_DEST")
        destscene.local_teams[mynpc] = destscene.civilian_team

        self.register_element(dd_tarot.ME_CRIME,"the destruction of a Lunar refugee camp")
        self.register_element(dd_tarot.ME_CRIMED,"destroyed {}'s refugee camp".format(mynpc))

        sp = self.add_sub_plot(nart,"WAR_CRIME_WITNESS",spstate=PlotState(elements={"FACTION":enemy_fac,"MISSION_RETURN":(self.elements["LOCALE"],self.elements["MISSION_GATE"])}).based_on(self),ident="MISSION")
        self.mission_accepted = False
        self.mission_finished = False
        self.got_rumor = False

        return True
    def custom_init(self, nart):
        self.rank = 15 + random.randint(1, 6) - random.randint(1, 6)
        self.register_element("DZ_EDGE_STYLE", RoadEdge.STYLE_YELLOW)
        self.register_element("FACTION", plotutility.RandomBanditCircle())

        myedge = self.elements["DZ_EDGE"]
        self.add_sub_plot(
            nart,
            "DZRE_BanditProblem",
            ident="MISSION",
            spstate=PlotState(
                elements={
                    "METRO": myedge.start_node.destination.metrodat,
                    "LOCALE": myedge.start_node.destination,
                    "MISSION_GATE": myedge.start_node.entrance
                }).based_on(self))

        return True
Beispiel #18
0
    def custom_init(self, nart):
        team1 = teams.Team(name="Player Team")
        return_to = (self.elements["METROSCENE"],
                     self.elements["MISSION_GATE"])
        outside_scene = gears.GearHeadScene(
            35,
            35,
            plotutility.random_deadzone_spot_name(),
            player_team=team1,
            scale=gears.scale.MechaScale,
            exploration_music="Lines.ogg",
            combat_music="Late.ogg",
            exit_scene_wp=return_to)
        myscenegen = pbge.randmaps.SceneGenerator(
            outside_scene,
            game.content.gharchitecture.MechaScaleSemiDeadzone())
        self.register_scene(nart,
                            outside_scene,
                            myscenegen,
                            ident="LOCALE",
                            dident="METROSCENE",
                            temporary=True)

        mygoal = self.register_element(
            "_goalroom",
            pbge.randmaps.rooms.FuzzyRoom(random.randint(8, 15),
                                          random.randint(8, 15),
                                          parent=outside_scene,
                                          anchor=pbge.randmaps.anchors.middle))

        self.register_element("ENTRANCE_ROOM",
                              pbge.randmaps.rooms.OpenRoom(
                                  5,
                                  5,
                                  anchor=random.choice(
                                      pbge.randmaps.anchors.EDGES)),
                              dident="LOCALE")
        myent = self.register_element(
            "ENTRANCE",
            game.content.ghwaypoints.Exit(
                anchor=pbge.randmaps.anchors.middle,
                dest_scene=self.elements["METROSCENE"],
                dest_entrance=self.elements["MISSION_GATE"]),
            dident="ENTRANCE_ROOM")

        inside_scene = self.elements["GOAL_SCENE"]
        inside_room = self.elements.get("GOAL_ROOM")
        if not inside_room:
            introom = self.register_element(
                'GOAL_ROOM',
                pbge.randmaps.rooms.ClosedRoom(
                    random.randint(6, 10),
                    random.randint(6, 10),
                    anchor=pbge.randmaps.anchors.south,
                ),
                dident="GOAL_SCENE")
        int_con = game.content.plotutility.IntConcreteBuildingConnection(
            self, outside_scene, inside_scene, room1=mygoal, room2=inside_room)

        self.add_sub_plot(nart,
                          "MECHA_ENCOUNTER",
                          spstate=PlotState().based_on(
                              self, {
                                  "ROOM": mygoal,
                                  "FACTION": self.elements.get("ENEMY_FACTION")
                              }),
                          necessary=False)

        self.location_unlocked = False
        self.add_sub_plot(nart,
                          "REVEAL_LOCATION",
                          spstate=PlotState(elements={
                              "INTERESTING_POINT":
                              "There's a mysterious bunker out there."
                          }, ).based_on(self),
                          ident="LOCATE")
        return True
Beispiel #19
0
    def choose_world_map_encounter(
            self,
            camp: gears.GearHeadCampaign,
            metroscene,
            return_wp,
            encounter_chance=25,
            dest_scene=None,
            dest_wp=None,
            rank=None,
            scenegen=pbge.randmaps.SceneGenerator,
            architecture=gharchitecture.MechaScaleDeadzone,
            environment=gears.tags.GroundEnv,
            **kwargs):
        candidate_seeds = list()
        # Step one: harvest any world map encounters that may exist within this adventure already.
        for p in camp.active_plots():
            if p is not self and hasattr(p, "generate_world_map_encounter"):
                myseed = p.generate_world_map_encounter(
                    camp,
                    metroscene,
                    return_wp,
                    dest_scene=dest_scene,
                    dest_wp=dest_wp,
                    rank=rank,
                    scenegen=scenegen,
                    architecture=architecture,
                    environment=environment,
                    **kwargs)

                if myseed:
                    if hasattr(myseed, "priority"):
                        candidate_seeds += [
                            myseed,
                        ] * myseed.priority
                    else:
                        candidate_seeds.append(myseed)

                    if hasattr(myseed, "mandatory") and myseed.mandatory:
                        encounter_chance = 100

        # Step two: Attempt to load a generic world map encounter plot.
        for t in range(random.randint(2, 6)):
            myplotstate = PlotState(rank=rank,
                                    elements={
                                        "METROSCENE": metroscene,
                                        "DEST_SCENE": dest_scene,
                                        "KWARGS": kwargs.copy()
                                    })
            myplot = game.content.load_dynamic_plot(camp, "RWMENCOUNTER",
                                                    myplotstate)
            if myplot:
                myseed = myplot.generate_world_map_encounter(
                    camp,
                    metroscene,
                    return_wp,
                    dest_scene=dest_scene,
                    dest_wp=dest_wp,
                    rank=rank,
                    scenegen=scenegen,
                    architecture=architecture,
                    environment=environment,
                    **kwargs)
                if myseed:
                    if hasattr(myseed, "priority"):
                        candidate_seeds += [
                            myseed,
                        ] * myseed.priority
                    else:
                        candidate_seeds.append(myseed)

                    if hasattr(myseed, "mandatory") and myseed.mandatory:
                        encounter_chance = 100

        if candidate_seeds and random.randint(1, 100) <= encounter_chance:
            return random.choice(candidate_seeds)
Beispiel #20
0
 def _finish_first_quest(self,camp):
     pstate = PlotState(adv=Adventure("Conclusion")).based_on(self)
     content.load_dynamic_plot(camp, "DZD_CONCLUSION", pstate)
     self.first_quest_done = True
 def VILLAGE_WIN(self, camp: gears.GearHeadCampaign):
     # Cetus has been met, and possibly even defeated once. Start the final part of the conclusion.
     pstate = PlotState(adv=Adventure("Conclusion")).based_on(self)
     content.load_dynamic_plot(camp, "DZDC_NEW_DEADZONE_ORDER", pstate)
     self._load_next_fight(camp)
 def _resolve_unfound_plot(self, camp):
     self.subplots["MISSION"] = game.content.load_dynamic_plot(
         camp, AUTOFIND_ENEMY_BASE_MISSION,
         PlotState(rank=self.rank + self.rank_modifier).based_on(self))
     self.ran_out_of_patience = True
    def custom_init(self, nart):
        self.zombots_active = True
        self.got_shutdown = False
        self.safe_shutdown = False
        self.set_collector = False

        # Create the entry mission: PC must defeat the zombots guarding the defiled factory
        team1 = teams.Team(name="Player Team")
        return_to = (self.elements["METROSCENE"], self.elements["MISSION_GATE"])
        outside_scene = gears.GearHeadScene(
            35, 35, plotutility.random_deadzone_spot_name(), player_team=team1, scale=gears.scale.MechaScale,
            exploration_music="Komiku_-_01_-_Ancient_Heavy_Tech_Donjon.ogg",
            combat_music="Komiku_-_03_-_Battle_Theme.ogg", exit_scene_wp=return_to
        )
        myscenegen = pbge.randmaps.SceneGenerator(outside_scene, game.content.gharchitecture.MechaScaleDeadzone())
        self.register_scene(nart, outside_scene, myscenegen, ident="LOCALE", dident="METROSCENE")

        mygoal = self.register_element(
            "_goalroom",
            pbge.randmaps.rooms.FuzzyRoom(random.randint(8, 15), random.randint(8, 15),
                                          parent=outside_scene,
                                          anchor=pbge.randmaps.anchors.middle)
        )
        self.add_sub_plot(nart, "MONSTER_ENCOUNTER", elements={"ROOM": mygoal, "TYPE_TAGS": ("ROBOT", "ZOMBOT")},
                          ident="OUTENCOUNTER")

        room1 = self.register_element(
            "ENTRANCE_ROOM",
            pbge.randmaps.rooms.FuzzyRoom(
                5, 5, anchor=random.choice(pbge.randmaps.anchors.EDGES)), dident="LOCALE"
        )
        myent = self.register_element(
            "ENTRANCE", game.content.ghwaypoints.Exit(anchor=pbge.randmaps.anchors.middle,
                                                      dest_scene=self.elements["METROSCENE"],
                                                      dest_entrance=self.elements["MISSION_GATE"]),
            dident="ENTRANCE_ROOM"
        )

        # Local NPC can tell about the entry mission.
        self.add_sub_plot(nart, "REVEAL_LOCATION", ident="LOCATE", elements={
            "INTERESTING_POINT": "The zombie mecha seem to be attracted to the ancient ruined tower there."})
        self.location_unlocked = False

        # Add the defiled factory dungeon
        mydungeon = dungeonmaker.DungeonMaker(
            nart, self, self.elements["METROSCENE"], "Defiled Factory", gharchitecture.ScrapIronWorkshop(),
            self.rank,
            monster_tags=("ROBOT", "ZOMBOT", "FACTORY"),
            explo_music="Komiku_-_01_-_Ancient_Heavy_Tech_Donjon.ogg",
            combat_music="Komiku_-_03_-_Battle_Theme.ogg",
            connector=plotutility.StairsUpToStairsDownConnector,
            scene_tags=(gears.tags.SCENE_DUNGEON, gears.tags.SCENE_RUINS, gears.tags.SCENE_FACTORY),
            decor=gharchitecture.DefiledFactoryDecor()
        )
        d_entrance = pbge.randmaps.rooms.ClosedRoom(7, 7, anchor=pbge.randmaps.anchors.south)
        mydungeon.entry_level.contents.append(d_entrance)
        mycon2 = plotutility.TownBuildingConnection(
            self, outside_scene, mydungeon.entry_level,
            room1=mygoal,
            room2=d_entrance,
            door1=ghwaypoints.DZDDefiledFactory(name="Defiled Factory", anchor=pbge.randmaps.anchors.middle),
            door2=ghwaypoints.Exit(anchor=pbge.randmaps.anchors.south)
        )

        # Add the lore rooms
        levels = random.sample(mydungeon.levels, 3)
        while len(levels) < 3:
            levels.append(random.choice(mydungeon.levels))

        lr1 = self.register_element(
            "LORE_ROOM_1", pbge.randmaps.rooms.ClosedRoom(7, 7, ),
        )
        levels[0].contents.append(lr1)
        self.add_sub_plot(
            nart, "MONSTER_ENCOUNTER", spstate=PlotState(rank=self.rank + 6).based_on(self),
            elements={"ROOM": lr1, "LOCALE": levels[0], "TYPE_TAGS": ("CREEPY", "ZOMBOT")}
        )
        lorecompy1 = self.register_element("LORE1", ghwaypoints.RetroComputer(plot_locked=True, name="Computer",
                                          desc="You stand before the primary research terminal."),
                                        dident="LORE_ROOM_1")

        lr2 = self.register_element(
            "LORE_ROOM_2", pbge.randmaps.rooms.ClosedRoom(7, 7, ),
        )
        levels[1].contents.append(lr2)
        self.add_sub_plot(
            nart, "MONSTER_ENCOUNTER", spstate=PlotState(rank=self.rank + 6).based_on(self),
            elements={"ROOM": lr2, "LOCALE": levels[1], "TYPE_TAGS": ("CREEPY", "ZOMBOT")}
        )
        lorecompy2 = self.register_element("LORE2", ghwaypoints.RetroComputer(plot_locked=True, name="Computer",
                                          desc="You stand before the research overview terminal."),
                                        dident="LORE_ROOM_2")

        lr3 = self.register_element(
            "LORE_ROOM_3", pbge.randmaps.rooms.ClosedRoom(7, 7, ),
        )
        levels[2].contents.append(lr3)
        self.add_sub_plot(
            nart, "MONSTER_ENCOUNTER", spstate=PlotState(rank=self.rank + 6).based_on(self),
            elements={"ROOM": lr3, "LOCALE": levels[2], "TYPE_TAGS": ("ROBOT",)}
        )
        lorecompy3 = self.register_element("LORE3", ghwaypoints.RetroComputer(plot_locked=True, name="Computer",
                                          desc="You stand before the incubation chamber control terminal."),
                                        dident="LORE_ROOM_3")
        biotank_alpha = self.register_element("BIO_A", ghwaypoints.Biotank(plot_locked=True, name="Biotank",),
                                        dident="LORE_ROOM_3")
        biotank_beta = self.register_element("BIO_B", ghwaypoints.EmptyBiotank(plot_locked=True, name="Biotank",),
                                        dident="LORE_ROOM_3")

        self.alpha_full = True
        self.beta_full = False

        # Add the goal room
        final_room = self.register_element(
            "FINAL_ROOM", pbge.randmaps.rooms.ClosedRoom(9, 9, ),
        )
        mydungeon.goal_level.contents.append(final_room)
        self.add_sub_plot(
            nart, "MONSTER_ENCOUNTER", spstate=PlotState(rank=self.rank + 12).based_on(self),
            elements={"ROOM": final_room, "LOCALE": mydungeon.goal_level, "TYPE_TAGS": ("CREEPY", "ZOMBOT")}
        )
        mycompy = self.register_element("COMPY", ghwaypoints.OldMainframe(plot_locked=True, name="Factory Control",
                                                                          anchor=pbge.randmaps.anchors.middle,
                                                                          desc="You stand before the factory control mainframe."),
                                        dident="FINAL_ROOM")

        #print(self.elements["METROSCENE"])

        return True
    def __init__(self,
                 nart,
                 parent_plot: Plot,
                 parent_scene,
                 name,
                 architecture,
                 rank,
                 scene_tags=(gears.tags.SCENE_DUNGEON,
                             gears.tags.SCENE_SEMIPUBLIC),
                 monster_tags=(),
                 temporary=False,
                 connector=plotutility.StairsDownToStairsUpConnector,
                 explo_music="Good Night.ogg",
                 combat_music="Apex.ogg",
                 goal_room=None,
                 decor=gharchitecture.DungeonDecor()):
        self.name = name
        self.architecture = architecture
        self.rank = rank
        self.connector = connector
        self.proto_levels = list()
        self.levels = list()
        self.hi_branch = 0

        self.add_a_level(None, 1, 0)

        r_levels = list(self.proto_levels)
        random.shuffle(r_levels)
        self.goal_proto_level = max(r_levels, key=lambda l: l.depth)

        for proto in self.proto_levels:
            if proto.parent and proto.parent.real_scene:
                parent = proto.parent.real_scene
            else:
                parent = parent_scene
            sp = parent_plot.add_sub_plot(
                nart,
                proto.gen,
                spstate=PlotState(rank=rank + proto.depth * 3,
                                  elements={
                                      DG_NAME: proto.get_name(name),
                                      DG_ARCHITECTURE: architecture,
                                      DG_TEMPORARY: temporary,
                                      DG_SCENE_TAGS: scene_tags,
                                      DG_MONSTER_TAGS: monster_tags,
                                      DG_PARENT_SCENE: parent,
                                      DG_EXPLO_MUSIC: explo_music,
                                      DG_COMBAT_MUSIC: combat_music,
                                      DG_DECOR: decor
                                  }))
            proto.real_scene = sp.elements["LOCALE"]
            self.levels.append(proto.real_scene)
            if proto.terminal:
                sp.add_sub_plot(nart, "DUNGEON_GOAL")
            if parent and parent is not parent_scene:
                connector(
                    parent_plot,
                    parent,
                    proto.real_scene,
                )
            else:
                self.entry_level = proto.real_scene

        self.goal_level = self.goal_proto_level.real_scene
        if goal_room:
            self.goal_level.contents.append(goal_room)