示例#1
0
class RLM_StraightOutOfWork(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"

    RUMOR = Rumor(
        rumor="{NPC} is an unemployed cavalier",
        offer_msg="You can find {NPC} at {NPC_SCENE}. I'm sure {NPC.gender.subject_pronoun} would be happy to embark on a new adventure.",
        memo="{NPC}  is an unemployed cavalier looking for a new lance to join.",
        prohibited_npcs=("NPC",)
    )

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship()
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        self.hire_cost = get_hire_cost(camp, npc)
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate():
                if npc.get_reaction_score(camp.pc, camp) > 20:
                    mylist.append(Offer("[IWOULDLOVETO] [THANKS_FOR_CHOOSING_ME]",
                                        context=ContextTag((context.PROPOSAL, context.JOIN)),
                                        data={"subject": "joining my lance"},
                                        effect=self._join_lance
                                        ))
                else:
                    mylist.append(Offer("Normally I charge ${:,} up front. [DOYOUACCEPTMYOFFER]".format(self.hire_cost),
                                        context=ContextTag((context.PROPOSAL, context.JOIN)),
                                        data={"subject": "joining my lance"},
                                        subject=self, subject_start=True,
                                        ))
                    mylist.append(Offer("[DENY_JOIN] [GOODBYE]",
                                        context=ContextTag((context.DENY, context.JOIN)), subject=self
                                        ))
                    if camp.credits >= self.hire_cost:
                        mylist.append(Offer("[THANKS_FOR_CHOOSING_ME] [LETSGO]",
                                            context=ContextTag((context.ACCEPT, context.JOIN)), subject=self,
                                            effect=self._pay_to_join
                                            ))
                mylist.append(Offer(
                    "[HELLO] [WAITINGFORMISSION]", context=ContextTag((context.HELLO,))
                ))
            mylist.append(LMSkillsSelfIntro(npc))

        return mylist

    def _pay_to_join(self, camp):
        camp.credits -= self.hire_cost
        self._join_lance(camp)

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
 def custom_init(self, nart: GHNarrativeRequest):
     self.candidates = [
         c for c in nart.challenges
         if c.chaltype == ghchallenges.DIPLOMACY_CHALLENGE
     ]
     if self.candidates:
         npc = self.seek_element(nart,
                                 "NPC",
                                 self._is_good_npc,
                                 lock=True,
                                 scope=self.elements["METROSCENE"])
         mychallenge = self.register_element(
             "CHALLENGE", self._get_challenge_for_npc(nart, npc))
         self.register_element("NPC_SCENE", npc.scene)
         self.register_element("ENEMY_FACTION", mychallenge.key[0])
         self.expiration = TimeAndChallengeExpiration(nart.camp,
                                                      mychallenge,
                                                      time_limit=5)
         self.RUMOR = Rumor(
             "{} has strong opinions about {}".format(
                 npc, mychallenge.data["challenge_subject"]),
             offer_msg=
             "I'm sure {NPC.gender.subject_pronoun} would love to argue with you about it. You can find {NPC.gender.object_pronoun} at {NPC_SCENE}.",
             memo="{} wants to argue about {}".format(
                 npc, mychallenge.data["challenge_subject"]),
             prohibited_npcs=("NPC", ))
         del self.candidates
         return True
示例#3
0
class DaveHasAPlot(Plot):
    LABEL = "zRANDOM_PLOT"
    active = True
    scope = "METRO"

    RUMOR = Rumor("{NPC} at {NPC_SCENE} has a plot")

    def custom_init(self, nart):
        npc = self.seek_element(nart,
                                "NPC",
                                self.is_good_npc,
                                scope=self.elements["METROSCENE"])
        self.elements["NPC_SCENE"] = npc.scene
        self.expiration = TimeExpiration(nart.camp, time_limit=5)
        return True

    def is_good_npc(self, nart, candidate):
        return (isinstance(candidate, gears.base.Character))

    def METROSCENE_ENTER(self, camp: gears.GearHeadCampaign):
        pbge.alert("Days remaining: {}".format(self.expiration.time_limit -
                                               camp.day))

    def NPC_offers(self, camp):
        mylist = list()
        mylist.append(
            Offer(
                "I've got a plot!",
                context=ContextTag([
                    context.HELLO,
                ]),
            ))
        return mylist
示例#4
0
class RLM_Mercenary(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"
    UNIQUE = True

    RUMOR = Rumor(
        rumor="{NPC} is hoping to make some quick cash",
        offer_msg="As far as I know {NPC} can usually be found at {NPC_SCENE}.",
        memo="{NPC} is a mercenary pilot looking for a job.",
        prohibited_npcs=("NPC",)
    )

    @classmethod
    def matches(self, pstate):
        """Returns True if this plot matches the current plot state."""
        return pstate.elements["NPC"].job and {gears.tags.Adventurer, gears.tags.Military}.intersection(
            pstate.elements["NPC"].job.tags)

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship(expectation=gears.relationships.E_MERCENARY)
        # This character gets extra mecha points, showing their good investment sense.
        npc.relationship.data["mecha_level_bonus"] = 10
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        self.hire_cost = get_hire_cost(camp, npc)
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate():
                mylist.append(Offer("I'll join your lance for a mere ${}. [DOYOUACCEPTMYOFFER]".format(self.hire_cost),
                                    context=ContextTag((context.PROPOSAL, context.JOIN)),
                                    data={"subject": "joining my lance"},
                                    subject=self, subject_start=True,
                                    ))
                mylist.append(Offer("[DENY_JOIN] [GOODBYE]",
                                    context=ContextTag((context.DENY, context.JOIN)), subject=self
                                    ))
                if camp.credits >= self.hire_cost:
                    mylist.append(Offer("[THANKS_FOR_CHOOSING_ME] [LETSGO]",
                                        context=ContextTag((context.ACCEPT, context.JOIN)), subject=self,
                                        effect=self._join_lance
                                        ))
            mylist.append(Offer(
                "[HELLO] I am a mercenary pilot, looking for my next contract.", context=ContextTag((context.HELLO,))
            ))
            mylist.append(LMSkillsSelfIntro(npc))

        return mylist

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        camp.credits -= self.hire_cost
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
示例#5
0
class RLM_Professional(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"
    UNIQUE = True

    RUMOR = Rumor(
        rumor="{NPC} is an experienced pilot looking for work",
        offer_msg="You can usually find {NPC} at {NPC_SCENE}. Bring cash if you're planning to hire {NPC.gender.object_pronoun}.",
        memo="{NPC}  is an experienced pilot looking for work.",
        prohibited_npcs=("NPC",)
    )

    @classmethod
    def matches(self, pstate):
        """Returns True if this plot matches the current plot state."""
        return pstate.elements["NPC"].renown > 35

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship(expectation=gears.relationships.E_PROFESSIONAL)
        # This character gets 10 extra stat points, showing their elite nature.
        npc.roll_stats(10, clear_first=False)
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        self.hire_cost = get_hire_cost(camp, npc)
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate():
                mylist.append(Offer(
                    "[NOEXPOSURE] I think ${:,} is a fair signing price. [DOYOUACCEPTMYOFFER]".format(self.hire_cost),
                    context=ContextTag((context.PROPOSAL, context.JOIN)), data={"subject": "joining my lance"},
                    subject=self, subject_start=True,
                ))
                mylist.append(Offer("[DENY_JOIN] [GOODBYE]",
                                    context=ContextTag((context.DENY, context.JOIN)), subject=self
                                    ))
                if camp.credits >= self.hire_cost:
                    mylist.append(Offer("[THANKS_FOR_CHOOSING_ME] [LETSGO]",
                                        context=ContextTag((context.ACCEPT, context.JOIN)), subject=self,
                                        effect=self._join_lance
                                        ))
            mylist.append(Offer(
                "[HELLO] I see you are also a cavalier.", context=ContextTag((context.HELLO,))
            ))
            mylist.append(LMSkillsSelfIntro(npc))

        return mylist

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        camp.credits -= self.hire_cost
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
示例#6
0
class RLM_PersonForHire(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"

    RUMOR = Rumor(
        rumor="{NPC} is a {NPC.job} for hire",
        offer_msg="If you want a {NPC.job} on your team, you can find {NPC} at {NPC_SCENE}.",
        memo="{NPC} is a {NPC.job} for hire.",
        prohibited_npcs=("NPC",)
    )

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship()
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        self.hire_cost = get_hire_cost(camp, npc)
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate():
                mylist.append(Offer("My signing rate is ${:,}. [DOYOUACCEPTMYOFFER]".format(self.hire_cost),
                                    context=ContextTag((context.PROPOSAL, context.JOIN)),
                                    data={"subject": "joining my lance"},
                                    subject=self, subject_start=True,
                                    ))
                mylist.append(Offer("[DENY_JOIN] [GOODBYE]",
                                    context=ContextTag((context.DENY, context.JOIN)), subject=self
                                    ))
                if camp.credits >= self.hire_cost:
                    mylist.append(Offer("[THANKS_FOR_CHOOSING_ME] [LETSGO]",
                                        context=ContextTag((context.ACCEPT, context.JOIN)), subject=self,
                                        effect=self._pay_to_join
                                        ))
                mylist.append(Offer(
                    "[HELLO] [WAITINGFORMISSION]", context=ContextTag((context.HELLO,))
                ))
            mylist.append(LMSkillsSelfIntro(npc))

        return mylist

    def _pay_to_join(self, camp):
        camp.credits -= self.hire_cost
        self._join_lance(camp)

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
示例#7
0
class RLM_FarmKid(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"
    UNIQUE = True

    RUMOR = Rumor(
        rumor="{NPC} wants to get out of {METROSCENE}",
        offer_msg="I think {NPC.gender.subject_pronoun} is just tired of small town life. You should be able to find {NPC} at {NPC_SCENE}.",
        memo="{NPC} is bored with small town life and wants to get out of {METROSCENE}.",
        prohibited_npcs=("NPC",)
    )

    @classmethod
    def matches(self, pstate):
        """Returns True if this plot matches the current plot state."""
        return "METROSCENE" in pstate.elements and gears.tags.Village in pstate.elements["METROSCENE"].attributes

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship(attitude=gears.relationships.A_JUNIOR,
                                                            expectation=gears.relationships.E_ADVENTURE)
        npc.relationship.data["mecha_level_bonus"] = -15
        npc.statline[gears.stats.Wildcraft] += random.randint(1,5)
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate() and npc.get_reaction_score(camp.pc, camp) > 0:
                mylist.append(Offer("And there's my way out of {METROSCENE}! [LETSGO]".format(**self.elements),
                                    context=ContextTag((context.JOIN,)),
                                    effect=self._join_lance
                                    ))
            mylist.append(Offer(
                "[HELLO] This town is boring... if I had a way out, I'd take it in a second.", context=ContextTag((context.HELLO,))
            ))
        mylist.append(LMSkillsSelfIntro(npc))

        return mylist

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
示例#8
0
class RLM_Beginner(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"
    UNIQUE = True

    RUMOR = Rumor(
        rumor="{NPC} has dreams of someday becoming a cavalier",
        offer_msg="As far as I know {NPC} usually hangs out at {NPC_SCENE}.",
        memo="{NPC} dreams of becoming a cavalier.",
        prohibited_npcs=("NPC",)
    )

    @classmethod
    def matches(self, pstate):
        """Returns True if this plot matches the current plot state."""
        return pstate.elements["NPC"].renown < 25

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship(attitude=gears.relationships.A_JUNIOR)
        # This character gets fewer mecha points.
        npc.relationship.data["mecha_level_bonus"] = -10
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate():
                mylist.append(Offer("I can't believe you asked me... [LETSGO]",
                                    context=ContextTag((context.JOIN,)),
                                    effect=self._join_lance
                                    ))
            mylist.append(Offer(
                "[HELLO] Some day I want to become a cavalier like you.", context=ContextTag((context.HELLO,))
            ))
        mylist.append(LMSkillsSelfIntro(npc))
        return mylist

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
示例#9
0
class RLM_Friendly(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"
    UNIQUE = True

    RUMOR = Rumor(
        rumor="{NPC} is looking for a lance to join",
        offer_msg="You can usually find {NPC} at {NPC_SCENE}, if you're planning to invite {NPC.gender.object_pronoun} to join your lance.",
        memo="{NPC} is looking for a lance to join.",
        prohibited_npcs=("NPC",)
    )

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship(attitude=gears.relationships.A_FRIENDLY)
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate() and npc.get_reaction_score(camp.pc, camp) > 0:
                mylist.append(Offer("[THANKS_FOR_CHOOSING_ME] [LETSGO]",
                                    context=ContextTag((context.JOIN,)),
                                    effect=self._join_lance
                                    ))
            mylist.append(Offer(
                "[HELLO] [WAITINGFORMISSION]", context=ContextTag((context.HELLO,))
            ))
        mylist.append(LMSkillsSelfIntro(npc))

        return mylist

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
示例#10
0
class RLM_DamagedGoodsSale(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"
    UNIQUE = True

    RUMOR = Rumor(
        rumor="{NPC} is a down on {NPC.gender.possessive_determiner} luck cavalier looking for another chance",
        offer_msg="You can find {NPC} at {NPC_SCENE}. Don't say that you weren't warned.",
        memo="{NPC} is an out of work pilot with a questionable past.",
        prohibited_npcs=("NPC",)
    )

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship(expectation=gears.relationships.E_IMPROVER)
        # This NPC gets a stat bonus but a crappy mech to show their history.
        npc.relationship.data["mecha_level_bonus"] = -15
        npc.roll_stats(5, clear_first=False)
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        self.hire_cost = get_hire_cost(camp, npc) // 2
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate():
                if npc.get_reaction_score(camp.pc, camp) > 20:
                    mylist.append(Offer("[IWOULDLOVETO] I'll do my best to not let you down.",
                                        context=ContextTag((context.PROPOSAL, context.JOIN)),
                                        data={"subject": "joining my lance"},
                                        effect=self._join_lance
                                        ))
                else:
                    mylist.append(
                        Offer("I'll sign up with you for just ${}. [DOYOUACCEPTMYOFFER]".format(self.hire_cost),
                              context=ContextTag((context.PROPOSAL, context.JOIN)),
                              data={"subject": "joining my lance"},
                              subject=self, subject_start=True,
                              ))
                    mylist.append(Offer("[DENY_JOIN] [GOODBYE]",
                                        context=ContextTag((context.DENY, context.JOIN)), subject=self
                                        ))
                    if camp.credits >= self.hire_cost:
                        mylist.append(Offer("[THANKS_FOR_CHOOSING_ME] I'll do my best to not let you down.",
                                            context=ContextTag((context.ACCEPT, context.JOIN)), subject=self,
                                            effect=self._pay_to_join
                                            ))
                mylist.append(Offer(
                    "[HELLO] The life of a cavalier is full of ups and downs... right now I'm in one of those downs.",
                    context=ContextTag((context.HELLO,))
                ))
            else:
                mylist.append(Offer(
                    "[HELLO] Be careful out there... all it takes is one little mistake to cost you everything.",
                    context=ContextTag((context.HELLO,))
                ))
            mylist.append(LMSkillsSelfIntro(npc))

        return mylist

    def _pay_to_join(self, camp):
        camp.credits -= self.hire_cost
        self._join_lance(camp)

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
示例#11
0
class MurderMysteryBountyHunter(Plot):
    LABEL = "MURDER_MYSTERY_CHALLENGE"
    scope = "METRO"
    UNIQUE = True
    active = True

    RUMOR = Rumor(
        "{NPC} has been investigating {MYSTERY}",
        offer_msg=
        "{NPC} is a bounty hunter; I don't think {NPC.gender.subject_pronoun} is very good at investigation, though. You can talk to {NPC.gender.object_pronoun} at {NPC_SCENE}.",
        memo="{NPC} is a bounty hunter investigating {MYSTERY}",
        prohibited_npcs=("NPC", ))

    def custom_init(self, nart):
        npc = gears.selector.random_character(
            rank=max(random.randint(self.rank - 10, self.rank + 10), 25),
            local_tags=tuple(self.elements["METROSCENE"].attributes),
            job=gears.jobs.ALL_JOBS["Bounty Hunter"])
        scene = self.seek_element(nart,
                                  "NPC_SCENE",
                                  self._is_best_scene,
                                  scope=self.elements["METROSCENE"],
                                  backup_seek_func=self._is_ok_scene)
        self.register_element("NPC", npc, dident="NPC_SCENE")

        mymystery: pbge.okapipuzzle.OkapiPuzzle = self.elements["MYSTERY"]
        self.elements["CULPRIT"] = mymystery.solution[0].gameob

        involved_set = set()
        for d in mymystery.decks:
            for c in d.cards:
                if c.gameob:
                    involved_set.add(c.gameob)
        excluded_set = involved_set.copy()
        excluded_set.add(npc)

        mychallenge = self.register_element(
            "CHALLENGE",
            pbge.challenges.MysteryChallenge(
                str(mymystery),
                self.elements["MYSTERY"],
                memo=pbge.challenges.MysteryMemo(
                    "{NPC} sent you to investigate {MYSTERY.name}.".format(
                        **self.elements)),
                active=False,
                oppoffers=[
                    pbge.challenges.
                    AutoOffer(dict(
                        msg="[I_KNOW_THINGS_ABOUT_STUFF] [LISTEN_TO_MY_INFO]",
                        context=ContextTag([
                            context.CUSTOM,
                        ]),
                        effect=self._get_a_clue,
                        data={
                            "reply":
                            "Do you know anything about {MYSTERY}?".format(
                                **self.elements),
                            "stuff":
                            "{MYSTERY}".format(**self.elements)
                        },
                        dead_end=True),
                              active=True,
                              uses=99,
                              involvement=ghchallenges.
                              InvolvedIfCluesRemainAnd(
                                  self.elements["MYSTERY"],
                                  ghchallenges.InvolvedMetroResidentNPCs(
                                      self.elements["METROSCENE"],
                                      exclude=excluded_set)),
                              access_fun=ghchallenges.AccessSocialRoll(
                                  gears.stats.Perception,
                                  gears.stats.Negotiation,
                                  self.rank,
                                  untrained_ok=True)),
                    pbge.challenges.AutoOffer(
                        dict(
                            msg="[THINK_ABOUT_THIS] [I_REMEMBER_NOW]",
                            context=ContextTag([
                                context.CUSTOM,
                            ]),
                            data={
                                "reply":
                                "Do you remember anything about the {MYSTERY}?"
                                .format(**self.elements),
                                "stuff":
                                "the {MYSTERY}".format(**self.elements)
                            },
                            dead_end=True),
                        active=True,
                        uses=99,
                        involvement=ghchallenges.
                        InvolvedIfUnassociatedCluesRemainAnd(
                            mymystery, mymystery.decks[0],
                            pbge.challenges.InvolvedSet(involved_set)),
                        npc_effect=self._get_unassociated_clue,
                    ),
                ],
            ))

        return True

    def _is_best_scene(self, nart, candidate):
        return (isinstance(candidate, gears.GearHeadScene)
                and gears.tags.SCENE_PUBLIC in candidate.attributes
                and gears.tags.SCENE_GOVERNMENT in candidate.attributes)

    def _is_ok_scene(self, nart, candidate):
        return isinstance(candidate, gears.GearHeadScene
                          ) and gears.tags.SCENE_PUBLIC in candidate.attributes

    def _get_unassociated_clue(self, camp, npc):
        candidates = [
            c for c in self.elements["MYSTERY"].unknown_clues
            if not c.is_involved(npc)
        ]
        if candidates:
            self.elements["CHALLENGE"].advance(camp, random.choice(candidates))
        else:
            self.elements["CHALLENGE"].advance(camp)

    def _get_a_clue(self, camp):
        self.elements["CHALLENGE"].advance(camp)

    def NPC_offers(self, camp: gears.GearHeadCampaign):
        mylist = list()

        if not self.elements["CHALLENGE"].active:
            mylist.append(
                Offer(
                    "[HELLO] I've been investigating {MYSTERY}, but so far I've only found a few leads."
                    .format(**self.elements),
                    ContextTag([
                        context.HELLO,
                    ]),
                ))

            mylist.append(
                Offer(
                    "Here, I'll share my notes with you. So far I have a list of suspects, some possible motives... not much.",
                    ContextTag([
                        context.CUSTOM,
                    ]),
                    subject=str(self.elements["MYSTERY"]),
                    data={"reply": "Maybe I could help you with that."},
                    effect=self._start_challenge,
                    dead_end=True))
        else:
            mylist.append(
                Offer(
                    "[HELLO] Have you learned anything about {MYSTERY}?".
                    format(**self.elements),
                    ContextTag([
                        context.HELLO,
                    ]),
                ))

            if self.elements["CHALLENGE"].is_won():
                mylist.append(
                    Offer(
                        "[GOOD_JOB] {CULPRIT} will be going away for a long time... Here's your share of the reward."
                        .format(**self.elements),
                        ContextTag([
                            context.CUSTOM,
                        ]),
                        data={
                            "reply":
                            "I have. {MYSTERY.solution_text}".format(
                                **self.elements)
                        },
                        effect=self._win_challenge))

            mylist.append(
                Offer("Great. Please let me know if you discover any leads.".
                      format(**self.elements),
                      ContextTag([
                          context.CUSTOM,
                      ]),
                      data={"reply": "[STILL_WORKING_ON_IT]"}))

        return mylist

    def _start_challenge(self, camp):
        self.elements["CHALLENGE"].activate(camp)
        self.memo = pbge.memos.Memo(
            "{NPC} asked you to help investigate {MYSTERY}.".format(
                **self.elements), self.elements["NPC_SCENE"])

    def _win_challenge(self, camp: gears.GearHeadCampaign):
        camp.check_trigger("WIN", self)
        camp.dole_xp(100)
        camp.freeze(self.elements["CULPRIT"])
        camp.credits += gears.selector.calc_mission_reward(self.rank, 150)
        self.end_plot(camp)

    def t_UPDATE(self, camp: gears.GearHeadCampaign):
        if not self.elements["NPC"].is_operational():
            camp.check_trigger("LOSE", self)
            self.end_plot(camp)
示例#12
0
class InvestigativeReporter(Plot):
    LABEL = "POLITICAL_MYSTERY_CHALLENGE"
    scope = "METRO"
    UNIQUE = True
    active = True

    RUMOR = Rumor(
        "{NPC} has been looking for {NPC.gender.possessive_determiner} next big story",
        offer_msg=
        "{NPC} is a reporter; {NPC.gender.subject_pronoun} thinks there's some kind of scandal happening in {METROSCENE}. You can talk to {NPC.gender.object_pronoun} at {NPC_SCENE}.",
        memo=
        "{NPC} is a reporter looking for {NPC.gender.possessive_determiner} next big story.",
        prohibited_npcs=("NPC", ))

    VV_DETAILS = {
        gears.personality.Justice:
        ["Corruption has been rampant; our leaders act with impunity."],
        gears.personality.Peace: [
            "People don't feel safe here. Statistically, they're right to feel that way."
        ],
        gears.personality.Fellowship: [
            "Trust and cooperation are at all-time lows. People are suspicious of their neighbors."
        ],
        gears.personality.Duty: [
            "There's plenty of military spending, but nothing to show for it. I suspect kickbacks."
        ],
        gears.personality.Glory: [
            "We've seen the standard of living fall year after year, but no explanation for why."
        ],
    }

    def custom_init(self, nart):
        npc = gears.selector.random_character(
            rank=max(random.randint(self.rank - 10, self.rank + 10), 25),
            local_tags=tuple(self.elements["METROSCENE"].attributes),
            job=gears.jobs.ALL_JOBS["Reporter"])
        scene = self.seek_element(nart,
                                  "NPC_SCENE",
                                  self._is_best_scene,
                                  scope=self.elements["METROSCENE"],
                                  backup_seek_func=self._is_ok_scene)
        self.register_element("NPC", npc, dident="NPC_SCENE")

        mymystery: pbge.okapipuzzle.OkapiPuzzle = self.elements["MYSTERY"]
        involved_set = set()
        for d in mymystery.decks:
            for c in d.cards:
                if c.gameob:
                    involved_set.add(c.gameob)
        excluded_set = involved_set.copy()
        excluded_set.add(npc)

        mychallenge = self.register_element(
            "CHALLENGE",
            pbge.challenges.MysteryChallenge(
                "{} Mystery".format(self.elements["METROSCENE"]),
                self.elements["MYSTERY"],
                memo=pbge.challenges.MysteryMemo(
                    "{NPC} sent you to investigate {MYSTERY.name}.".format(
                        **self.elements)),
                active=False,
                oppoffers=[
                    pbge.challenges.
                    AutoOffer(dict(
                        msg="[I_KNOW_THINGS_ABOUT_STUFF] [LISTEN_TO_MY_INFO]",
                        context=ContextTag([
                            context.CUSTOM,
                        ]),
                        effect=self._get_a_clue,
                        data={
                            "reply":
                            "Do you know anything about the {MYSTERY}?".format(
                                **self.elements),
                            "stuff":
                            "the {MYSTERY}".format(**self.elements)
                        },
                        dead_end=True),
                              active=True,
                              uses=99,
                              involvement=ghchallenges.
                              InvolvedIfCluesRemainAnd(
                                  self.elements["MYSTERY"],
                                  ghchallenges.InvolvedMetroResidentNPCs(
                                      self.elements["METROSCENE"],
                                      exclude=excluded_set)),
                              access_fun=ghchallenges.AccessSocialRoll(
                                  gears.stats.Perception,
                                  gears.stats.Negotiation,
                                  self.rank,
                                  untrained_ok=True)),
                    pbge.challenges.AutoOffer(
                        dict(
                            msg="[THINK_ABOUT_THIS] [I_REMEMBER_NOW]",
                            context=ContextTag([
                                context.CUSTOM,
                            ]),
                            data={
                                "reply":
                                "Do you remember anything about the {MYSTERY}?"
                                .format(**self.elements),
                                "stuff":
                                "the {MYSTERY}".format(**self.elements)
                            },
                            dead_end=True),
                        active=True,
                        uses=99,
                        involvement=ghchallenges.
                        InvolvedIfUnassociatedCluesRemainAnd(
                            mymystery, mymystery.decks[0],
                            pbge.challenges.InvolvedSet(involved_set)),
                        npc_effect=self._get_unassociated_clue,
                    ),
                ],
            ))

        return True

    def _is_best_scene(self, nart, candidate):
        return (isinstance(candidate, gears.GearHeadScene)
                and gears.tags.SCENE_PUBLIC in candidate.attributes
                and gears.tags.SCENE_MEETING in candidate.attributes)

    def _is_ok_scene(self, nart, candidate):
        return isinstance(candidate, gears.GearHeadScene
                          ) and gears.tags.SCENE_PUBLIC in candidate.attributes

    def _get_unassociated_clue(self, camp, npc):
        candidates = [
            c for c in self.elements["MYSTERY"].unknown_clues
            if not c.is_involved(npc)
        ]
        if candidates:
            self.elements["CHALLENGE"].advance(camp, random.choice(candidates))
        else:
            self.elements["CHALLENGE"].advance(camp)

    def _get_a_clue(self, camp):
        self.elements["CHALLENGE"].advance(camp)

    def NPC_offers(self, camp: gears.GearHeadCampaign):
        mylist = list()

        if not self.elements["CHALLENGE"].active:
            mylist.append(
                Offer(
                    "[HELLO] Do you know anything about the {MYSTERY}?".format(
                        **self.elements),
                    ContextTag([
                        context.HELLO,
                    ]),
                ))

            vv = self.elements.get("VIOLATED_VIRTUES")
            details = [
                "This could extend to the highest levels of government.",
                "The leadership is almost certainly compromised."
            ]
            for virt in vv:
                details += self.VV_DETAILS.get(virt, [])

            mylist.append(
                Offer(
                    "There's something going wrong in {}. {} [LET_ME_KNOW_IF_YOU_HEAR_ANYTHING]"
                    .format(self.elements["METROSCENE"],
                            random.choice(details)),
                    ContextTag([
                        context.CUSTOM,
                    ]),
                    subject=str(self.elements["MYSTERY"]),
                    data={
                        "reply": "Not really; why don't you tell me about it?"
                    },
                    effect=self._start_challenge))
        else:
            mylist.append(
                Offer(
                    "[HELLO] Have you learned anything about the {MYSTERY}?".
                    format(**self.elements),
                    ContextTag([
                        context.HELLO,
                    ]),
                ))

            if self.elements["CHALLENGE"].is_won():
                mylist.append(
                    Offer(
                        "[GOOD_JOB] This information will be a big help to everyone in {METROSCENE}... I'll make sure it's on the landing page of every newsnet!"
                        .format(**self.elements),
                        ContextTag([
                            context.CUSTOM,
                        ]),
                        data={
                            "reply":
                            "I have. {MYSTERY.solution_text}".format(
                                **self.elements)
                        },
                        effect=self._win_challenge))

            mylist.append(
                Offer("Great. Please let me know if you discover any leads.".
                      format(**self.elements),
                      ContextTag([
                          context.CUSTOM,
                      ]),
                      data={"reply": "[STILL_WORKING_ON_IT]"}))

        return mylist

    def _start_challenge(self, camp):
        self.elements["CHALLENGE"].activate(camp)
        self.memo = None

    def _win_challenge(self, camp: gears.GearHeadCampaign):
        camp.check_trigger("WIN", self)
        camp.dole_xp(200)
        self.end_plot(camp)

    def t_UPDATE(self, camp: gears.GearHeadCampaign):
        if not self.elements["NPC"].is_not_destroyed():
            camp.check_trigger("LOSE", self)
            self.end_plot(camp)
示例#13
0
class BasicCombatBaseSearch(Plot):
    LABEL = SEEK_ENEMY_BASE_MISSION
    active = True
    scope = "METRO"

    RUMOR = Rumor(
        "{NPC} lost a fight to {ENEMY_FACTION}",
        offer_msg=
        "You can ask {NPC} about {ENEMY_FACTION} yourself; speak to {NPC.gender.object_pronoun} at {NPC_SCENE}.",
        memo="{NPC} lost a battle against {ENEMY_FACTION}.",
        prohibited_npcs=("NPC", ))

    MISSION_NAME = "Avenge {NPC}"
    MISSION_OBJECTIVES = (missionbuilder.BAMO_LOCATE_ENEMY_FORCES,
                          SEBO_SEARCH_FOR_BASE)

    def custom_init(self, nart):
        npc = self.seek_element(nart,
                                "NPC",
                                self.is_good_npc,
                                scope=self.elements["METROSCENE"],
                                lock=True)
        self.elements["NPC_SCENE"] = npc.scene
        sgen, archi = gharchitecture.get_mecha_encounter_scenegen_and_architecture(
            self.elements["METROSCENE"])
        self.mission_seed = missionbuilder.BuildAMissionSeed(
            nart.camp,
            self.MISSION_NAME.format(**self.elements),
            self.elements["METROSCENE"],
            self.elements["MISSION_GATE"],
            self.elements["ENEMY_FACTION"],
            npc.faction,
            self.rank,
            objectives=self.MISSION_OBJECTIVES,
            scenegen=sgen,
            architecture=archi,
            on_win=self.elements["SEMIWIN_FUN"],
            custom_elements={
                "FIND_BASE_FUN": self.elements["WIN_FUN"],
                "ENEMY_BASE_NAME": self.elements["ENEMY_BASE_NAME"]
            })
        self.mission_active = False
        self.expiration = gears.TimeOrNPCExpiration(nart.camp, npcs=("NPC", ))
        return True

    def is_good_npc(self, nart, candidate):
        return (isinstance(candidate, gears.base.Character)
                and candidate.combatant and candidate not in nart.camp.party
                and gears.tags.SCENE_PUBLIC in candidate.scene.attributes
                and not nart.camp.are_faction_allies(
                    candidate, self.elements["ENEMY_FACTION"]))

    def NPC_offers(self, camp):
        mylist = list()
        if not self.mission_active:
            mylist.append(
                Offer("[HELLO] [FACTION_MUST_BE_PUNISHED]",
                      ContextTag([
                          context.HELLO,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])}))

            mylist.append(
                Offer("[FACTION_DEFEATED_ME] [WILL_YOU_AVENGE_ME]",
                      ContextTag([
                          context.MISSION,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])},
                      subject=self,
                      subject_start=True))

            mylist.append(
                Offer("[IWillSendMissionDetails]; [GOODLUCK]",
                      ContextTag([
                          context.ACCEPT,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])},
                      effect=self._accept_mission,
                      subject=self))

            mylist.append(
                Offer("[UNDERSTOOD]",
                      ContextTag([
                          context.DENY,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])},
                      effect=self._deny_misssion,
                      subject=self))

            mylist.append(
                Offer("[FACTION_DEFEATED_ME]",
                      ContextTag([
                          context.UNFAVORABLE_HELLO,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])}))

            mylist.append(
                Offer(
                    "Well if you're so good, why don't you try beating {} yourself?!"
                    .format(self.elements["ENEMY_FACTION"]),
                    ContextTag([
                        context.UNFAVORABLE_CUSTOM,
                    ]),
                    data={"reply": "[I_WOULD_NOT_HAVE_LOST]"},
                    effect=self._accept_mission))

        return mylist

    def _accept_mission(self, camp):
        self.mission_active = True
        self.RUMOR.disable_rumor(self)
        self.expiration = None
        missionbuilder.NewMissionNotification(self.mission_seed.name,
                                              self.elements["MISSION_GATE"])

    def _deny_misssion(self, camp):
        self.end_plot(camp, True)

    def MISSION_GATE_menu(self, camp, thingmenu):
        if self.mission_active:
            thingmenu.add_item(self.mission_seed.name, self.mission_seed)

    def t_UPDATE(self, camp):
        # If the adventure has ended, get rid of it.
        if self.mission_seed.ended:
            self.end_plot(camp, True)
示例#14
0
class TruckerKnowledge(Plot):
    LABEL = "REVEAL_LOCATION"
    active = True
    scope = "METRO"

    RUMOR = Rumor(
        "{NPC} saw something unusual outside of town",
        offer_msg="You can ask {NPC} about that; {NPC}'s usually at {_DEST}.",
        memo="{NPC} saw something unusual outside of town.",
        memo_location="_DEST",
        prohibited_npcs=("NPC", ),
        offer_subject_data="what {NPC} saw")

    def custom_init(self, nart):
        myscene = self.elements["METROSCENE"]
        destscene = self.seek_element(nart,
                                      "_DEST",
                                      self._is_best_scene,
                                      scope=myscene,
                                      must_find=False)
        if not destscene:
            destscene = self.seek_element(nart,
                                          "_DEST",
                                          self._is_good_scene,
                                          scope=myscene)
        mynpc = self.register_element("NPC",
                                      gears.selector.random_character(
                                          rank=random.randint(10, 50),
                                          job=gears.jobs.ALL_JOBS["Trucker"],
                                          local_tags=myscene.attributes),
                                      dident="_DEST")
        destscene.local_teams[mynpc] = destscene.civilian_team
        self.got_rumor = False
        return True

    def _is_best_scene(self, nart, candidate):
        return (isinstance(candidate, pbge.scenes.Scene)
                and gears.tags.SCENE_PUBLIC in candidate.attributes
                and gears.tags.SCENE_TRANSPORT in candidate.attributes)

    def _is_good_scene(self, nart, candidate):
        return isinstance(candidate, pbge.scenes.Scene
                          ) and gears.tags.SCENE_PUBLIC in candidate.attributes

    def NPC_offers(self, camp):
        mylist = list()
        mylist.append(
            Offer(
                msg=
                "[HELLO] During my last trip into town I saw something really strange out there...",
                context=ContextTag((context.HELLO, )),
            ))
        mylist.append(
            Offer(
                msg=
                "I was driving through {LOCALE}, like I usually do. {INTERESTING_POINT}"
                .format(**self.elements),
                context=ContextTag((context.INFO, )),
                effect=self._get_info,
                data={"subject": "what you saw outside of town"},
                no_repeats=True))

        return mylist

    def _get_info(self, camp):
        camp.check_trigger("WIN", self)
        missionbuilder.NewLocationNotification(self.elements["LOCALE"],
                                               self.elements["MISSION_GATE"])
        self.end_plot(camp)
class RecoverTheSupplies(Plot):
    LABEL = "CHALLENGE_PLOT"
    active = True
    scope = "METRO"
    RUMOR = Rumor(
        "{NPC} is looking for a pilot to recover stolen materials",
        offer_msg=
        "The materials are needed to make {THING}. You can speak to {NPC} at {NPC_SCENE} if you want the mission.",
        memo=
        "{NPC} is looking for a pilot to recover the materials needed for {THING}.",
        prohibited_npcs=("NPC", ))

    @classmethod
    def matches(cls, pstate: PlotState):
        return "METROSCENE" in pstate.elements and "MISSION_GATE" in pstate.elements

    def custom_init(self, nart: GHNarrativeRequest):
        self.candidates = [
            c for c in nart.challenges
            if c.chaltype == ghchallenges.MAKE_CHALLENGE
        ]
        if self.candidates:
            npc = self.seek_element(nart,
                                    "NPC",
                                    self._is_good_npc,
                                    lock=True,
                                    scope=self.elements["METROSCENE"])
            mychallenge = self.register_element(
                "CHALLENGE", self._get_challenge_for_npc(nart, npc))
            self.register_element("NPC_SCENE", npc.scene)
            self.register_element("THING", mychallenge.key[0])
            self.expiration = TimeAndChallengeExpiration(nart.camp,
                                                         mychallenge,
                                                         time_limit=5)

            mgram = missionbuilder.MissionGrammar(
                "recover the supplies needed for {THING}".format(
                    **self.elements), "keep my rightfully looted cargo",
                "I recovered the supplies needed in {METROSCENE}".format(
                    **self.elements),
                "you stole the cargo that I had just stolen",
                "you stole supplies that {METROSCENE} needed to make {THING}".
                format(**self.elements),
                "I ransomed the cargo that {METROSCENE} needed to make {THING} back to them for a nice profit"
                .format(**self.elements))

            sgen, archi = gharchitecture.get_mecha_encounter_scenegen_and_architecture(
                self.elements["METROSCENE"])
            # Create the mission seed. Turn the defeat_trigger off because we'll be handling that manually.
            self.mission_seed = missionbuilder.BuildAMissionSeed(
                nart.camp,
                "{NPC}'s Mission".format(**self.elements),
                self.elements["METROSCENE"],
                self.elements["MISSION_GATE"],
                allied_faction=npc.faction,
                enemy_faction=plotutility.RandomBanditCircle(nart.camp),
                rank=self.rank,
                objectives=[
                    missionbuilder.BAMO_DEFEAT_THE_BANDITS,
                    missionbuilder.BAMO_RECOVER_CARGO
                ],
                one_chance=True,
                scenegen=sgen,
                architecture=archi,
                mission_grammar=mgram,
                cash_reward=120,
                on_win=self._win_the_mission,
                defeat_trigger_on=False)

            self.mission_active = False
            del self.candidates
            return True

    def _get_challenge_for_npc(self, nart, npc):
        candidates = [
            c for c in self.candidates if c.is_involved(nart.camp, npc)
        ]
        if candidates:
            return random.choice(candidates)

    def _is_good_npc(self, nart: GHNarrativeRequest, candidate):
        return (isinstance(candidate, gears.base.Character)
                and nart.camp.is_not_lancemate(candidate)
                and self._get_challenge_for_npc(nart, candidate))

    def _win_the_mission(self, camp):
        comp = self.mission_seed.get_completion(True)
        self.elements["CHALLENGE"].advance(camp, max((comp - 61) // 15, 1))
        self.end_plot(camp)

    def NPC_offers(self, camp):
        mylist = list()

        if not self.mission_active:
            mylist.append(
                Offer(
                    "[LOOKING_FOR_CAVALIER] Some bandits have captured the materials we need for {THING}."
                    .format(**self.elements),
                    ContextTag([context.HELLO, context.MISSION])))

            mylist.append(
                Offer(
                    "Your job will be to eliminate the bandits and recover the needed supplies. [DOYOUACCEPTMISSION]",
                    ContextTag([context.MISSION]),
                    subject=self,
                    subject_start=True))

            mylist.append(
                Offer("[IWillSendMissionDetails]; [GOODLUCK]",
                      ContextTag([context.ACCEPT]),
                      effect=self.activate_mission,
                      subject=self))

            mylist.append(
                Offer("[UNDERSTOOD] [GOODBYE]",
                      ContextTag([context.DENY]),
                      effect=self.end_plot,
                      subject=self))

        return mylist

    def t_START(self, camp):
        if self.LABEL == "DZRE_TEST" and not self.mission_active:
            self.mission_active = True

    def t_UPDATE(self, camp):
        if self.mission_seed.ended:
            self.end_plot(camp)

    def activate_mission(self, camp):
        self.mission_active = True
        missionbuilder.NewMissionNotification(self.mission_seed.name,
                                              self.elements["MISSION_GATE"])

    def MISSION_GATE_menu(self, camp, thingmenu):
        if self.mission_seed and self.mission_active:
            thingmenu.add_item(self.mission_seed.name, self.mission_seed)
class ObviouslyIllPerson(Plot):
    LABEL = "CHALLENGE_PLOT"
    active = True
    scope = "METRO"

    RUMOR = Rumor(
        "{NPC} has been looking sick",
        offer_msg=
        "I don't know if it's {DISEASE} or something else, but {NPC} at {NPC_SCENE} has definitely been looking unwell.",
        memo="{NPC} looks sick and may have {DISEASE}.",
        prohibited_npcs=("NPC", ))

    @classmethod
    def matches(cls, pstate: PlotState):
        return "METROSCENE" in pstate.elements

    def custom_init(self, nart: GHNarrativeRequest):
        self.candidates = [
            c for c in nart.challenges
            if c.chaltype == ghchallenges.EPIDEMIC_CHALLENGE
        ]
        if self.candidates:
            npc = self.seek_element(nart,
                                    "NPC",
                                    self._is_good_npc,
                                    lock=True,
                                    scope=self.elements["METROSCENE"])
            mychallenge = self.register_element(
                "CHALLENGE", self._get_challenge_for_npc(nart, npc))
            self.elements["DISEASE"] = mychallenge.key[0]
            self.register_element("NPC_SCENE", npc.scene)
            self.expiration = TimeAndChallengeExpiration(nart.camp,
                                                         mychallenge,
                                                         time_limit=25)
            del self.candidates
            self.add_sub_plot(nart, "NPC_VACATION", ident="VACATION")
            return True

    def _get_challenge_for_npc(self, nart, npc):
        candidates = [
            c for c in self.candidates if c.is_involved(nart.camp, npc)
        ]
        if candidates:
            return random.choice(candidates)

    def _is_good_npc(self, nart: GHNarrativeRequest, candidate):
        return (isinstance(candidate, gears.base.Character)
                and nart.camp.is_not_lancemate(candidate)
                and self._get_challenge_for_npc(nart, candidate))

    def _win_the_mission(self, camp):
        self.elements["CHALLENGE"].advance(camp, 3)
        self.end_plot(camp)

    def _semi_win(self, camp):
        self.subplots["VACATION"].freeze_now(camp)
        self.elements["CHALLENGE"].advance(camp, 1)
        self.end_plot(camp)

    def NPC_offers(self, camp):
        mylist = list()

        mylist.append(
            Offer(
                "No, but I can't have {DISEASE}... [I_AM_STILL_STANDING]".
                format(**self.elements),
                ContextTag([context.CUSTOM]),
                subject=self,
                subject_start=True,
                data={
                    "reply":
                    "You don't look well. Have you been tested for {DISEASE}?".
                    format(**self.elements)
                }))

        ghdialogue.SkillBasedPartyReply(
            Offer("[I_FEEL_BETTER_NOW] [THANKS_FOR_HELP]",
                  ContextTag([
                      context.CUSTOMREPLY,
                  ]),
                  effect=self._win_the_mission,
                  data={"reply": "I'm a medic; let me treat you."},
                  subject=self), camp, mylist, gears.stats.Knowledge,
            gears.stats.Medicine, self.rank, gears.stats.DIFFICULTY_AVERAGE)

        mylist.append(
            Offer(
                "[MAYBE_YOU_ARE_RIGHT] I better not take any chances.".format(
                    **self.elements),
                ContextTag([context.CUSTOMREPLY]),
                subject=self,
                effect=self._semi_win,
                data={"reply":
                      "At least you should go home and have a rest."}))

        return mylist
示例#17
0
class RLM_Medic(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"
    UNIQUE = True
    VIRTUES = (gears.personality.Peace, gears.personality.Fellowship)

    RUMOR = Rumor(
        rumor="{NPC} wants to leave {NPC.scene} so {NPC.gender.subject_pronoun} can make a positive difference in the world",
        offer_msg="{NPC} is a {NPC.job}; {NPC.gender.subject_pronoun} has been working at {NPC_SCENE} but is hoping to get back behind the seat of a mech.",
        memo="{NPC} is a {NPC.job} who wants to join a lance.",
        prohibited_npcs=("NPC",)
    )

    @classmethod
    def matches(self, pstate):
        """Returns True if this plot matches the current plot state."""
        return pstate.elements["NPC"].job and gears.tags.Medic in pstate.elements["NPC"].job.tags

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship(expectation=gears.relationships.E_GREATERGOOD)
        new_virtue = random.choice(self.VIRTUES)
        if new_virtue not in npc.personality:
            npc.personality.add(new_virtue)
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate():
                mylist.append(Offer("[THANKS_FOR_CHOOSING_ME] [LETSGO]",
                                    context=ContextTag((context.JOIN,)),
                                    effect=self._join_lance
                                    ))
            else:
                mylist.append(Offer(
                    "You've got a full crew right now, but if you ever find yourself in need of a qualified medic come back and find me.",
                    context=ContextTag((context.JOIN,)),
                    effect=self._defer_join
                ))
        mylist.append(Offer(
            "[HELLO] Lately I've been spending too much time here, when I'd rather be out in the danger zone saving lives.",
            context=ContextTag((context.HELLO,))
        ))
        mylist.append(LMSkillsSelfIntro(npc))

        return mylist

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)

    def _defer_join(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        self.end_plot(camp)
示例#18
0
class RLM_RatherGeneric(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"

    RUMOR = Rumor(
        rumor="{NPC} is looking for a new lance to join",
        offer_msg="You can find {NPC} at {NPC_SCENE}.",
        memo="{NPC} is looking for a new lance.",
        prohibited_npcs=("NPC",)
    )

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship()
        return True

    def NPC_offers(self, camp):
        mylist = list()
        npc = self.elements["NPC"]
        self.hire_cost = get_hire_cost(camp, npc)
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if camp.can_add_lancemate():
                if npc.get_reaction_score(camp.pc, camp) > 60:
                    mylist.append(Offer("[IWOULDLOVETO] [THANKS_FOR_CHOOSING_ME]",
                                        context=ContextTag((context.PROPOSAL, context.JOIN)),
                                        data={"subject": "joining my lance"},
                                        effect=self._join_lance
                                        ))
                else:
                    mylist.append(Offer("My regular signing rate is ${}. [DOYOUACCEPTMYOFFER]".format(self.hire_cost),
                                        context=ContextTag((context.PROPOSAL, context.JOIN)),
                                        data={"subject": "joining my lance"},
                                        subject=self, subject_start=True,
                                        ))
                    mylist.append(Offer("[DENY_JOIN] [GOODBYE]",
                                        context=ContextTag((context.DENY, context.JOIN)), subject=self
                                        ))
                    if camp.credits >= self.hire_cost:
                        mylist.append(Offer("[THANKS_FOR_CHOOSING_ME] [LETSGO]",
                                            context=ContextTag((context.ACCEPT, context.JOIN)), subject=self,
                                            effect=self._pay_to_join
                                            ))
                mylist.append(Offer(
                    "[HELLO] [WAITINGFORMISSION]", context=ContextTag((context.HELLO,))
                ))
            else:
                mylist.append(Offer(
                    "[HELLO] Must be nice going off, having adventures with your lancemates. I'd like to do that again someday.",
                    context=ContextTag((context.HELLO,))
                ))
            mylist.append(LMSkillsSelfIntro(npc))

        return mylist

    def _pay_to_join(self, camp):
        camp.credits -= self.hire_cost
        self._join_lance(camp)

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
class DethroneByDuelingSupporter(Plot):
    LABEL = "CHALLENGE_PLOT"
    active = True
    scope = "METRO"
    RUMOR = Rumor(
        "{NPC} is a loyal supporter of {LEADER}",
        offer_msg=
        "You can talk to {NPC} at {NPC_SCENE} if you want to change {NPC.gender.possessive_determiner} mind.",
        memo="{NPC} is a loyal supporter of {LEADER}.",
        prohibited_npcs=("NPC", ))

    @classmethod
    def matches(cls, pstate: PlotState):
        return "METROSCENE" in pstate.elements and "MISSION_GATE" in pstate.elements

    def custom_init(self, nart: GHNarrativeRequest):
        self.candidates = [
            c for c in nart.challenges
            if c.chaltype == ghchallenges.DETHRONE_CHALLENGE
        ]
        if self.candidates:
            npc = self.seek_element(nart,
                                    "NPC",
                                    self._is_good_npc,
                                    lock=True,
                                    scope=self.elements["METROSCENE"])
            mychallenge = self.register_element(
                "CHALLENGE", self._get_challenge_for_npc(nart, npc))
            self.register_element("NPC_SCENE", npc.scene)

            self.expiration = TimeAndChallengeExpiration(nart.camp,
                                                         mychallenge,
                                                         time_limit=5)

            sgen, archi = gharchitecture.get_mecha_encounter_scenegen_and_architecture(
                self.elements["METROSCENE"])
            # Create the mission seed. Turn the defeat_trigger off because we'll be handling that manually.
            self.mission_seed = missionbuilder.BuildAMissionSeed(
                nart.camp,
                "Duel {NPC}".format(**self.elements),
                self.elements["METROSCENE"],
                self.elements["MISSION_GATE"],
                enemy_faction=npc.faction,
                rank=self.rank,
                objectives=[missionbuilder.BAMO_DUEL_NPC],
                one_chance=True,
                scenegen=sgen,
                architecture=archi,
                cash_reward=120,
                solo_mission=True,
                on_win=self._win_the_mission,
                custom_elements={missionbuilder.BAME_NPC: npc},
                make_enemies=False)

            self.elements["LEADER"] = mychallenge.key[0]

            self.mission_active = False
            del self.candidates
            return True

    def _get_challenge_for_npc(self, nart, npc):
        candidates = [
            c for c in self.candidates if c.is_involved(nart.camp, npc)
        ]
        if candidates:
            return random.choice(candidates)

    def _is_good_npc(self, nart: GHNarrativeRequest, candidate):
        return (isinstance(candidate, gears.base.Character)
                and nart.camp.is_not_lancemate(candidate)
                and candidate.combatant
                and self._get_challenge_for_npc(nart, candidate))

    def _win_the_mission(self, camp):
        comp = self.mission_seed.get_completion(True)
        self.elements["CHALLENGE"].advance(camp, max((comp - 51) // 10, 3))
        self.end_plot(camp)

    def _conversation_win(self, camp: gears.GearHeadCampaign):
        if camp.party_has_personality(
                self.elements["CHALLENGE"].data["violated_virtue"]):
            npc: gears.base.Character = self.elements["NPC"]
            npc.relationship.reaction_mod += 10
        self.elements["CHALLENGE"].advance(camp, 4)
        self.end_plot(camp)

    def NPC_offers(self, camp):
        mylist = list()

        if not self.mission_active:
            mychallenge: pbge.challenges.Challenge = self.elements["CHALLENGE"]

            mylist.append(
                Offer(
                    "[HELLO] {LEADER} is a great {LEADER.gender.noun} and deserves our support."
                    .format(**self.elements), ContextTag([
                        context.HELLO,
                    ])))

            mylist.append(
                Offer("[YOU_DONT_UNDERSTAND] The truth is that {}.".format(
                    random.choice(mychallenge.data["reasons_to_support"])),
                      ContextTag([context.CUSTOM]),
                      data={
                          "reply":
                          "But {}!".format(
                              random.choice(
                                  mychallenge.data["reasons_to_dethrone"]))
                      },
                      subject=self,
                      subject_start=True))

            mylist.append(
                Offer("[YOU_DONT_UNDERSTAND] In reality {}.".format(
                    random.choice(mychallenge.data["reasons_to_support"])),
                      ContextTag([context.UNFAVORABLE_CUSTOM]),
                      data={
                          "reply":
                          "You know that {}!".format(
                              random.choice(
                                  mychallenge.data["reasons_to_dethrone"]))
                      },
                      subject=self,
                      subject_start=True))

            mylist.append(
                Offer(
                    "[ACCEPT_CHALLENGE] I will meet you outside of town, to defend the honor of {LEADER}!"
                    .format(**self.elements),
                    ContextTag([context.CUSTOMREPLY]),
                    effect=self.activate_mission,
                    subject=self,
                    data={
                        "reply": "[ARE_YOU_WILLING_TO_BET_YOUR_LIFE_ON_THAT]"
                    }))

            vv = mychallenge.data.get("violated_virtue")
            if vv and vv in self.elements["NPC"].personality:
                ghdialogue.SkillBasedPartyReply(
                    Offer(
                        "[MAYBE_YOU_ARE_RIGHT_ABOUT_OPINION] [I_MUST_CONSIDER_MY_NEXT_STEP]",
                        ContextTag([
                            context.CUSTOMREPLY,
                        ]),
                        effect=self._conversation_win,
                        data={
                            "reply":
                            "[HAVE_YOU_CONSIDERED]",
                            "consider_this":
                            "{} is working against {}".format(
                                self.elements["LEADER"], vv),
                            "opinion":
                            "{LEADER} may not be as great as I thought".format(
                                **self.elements)
                        },
                        subject=self), camp, mylist, gears.stats.Perception,
                    gears.stats.Negotiation, self.rank,
                    gears.stats.DIFFICULTY_AVERAGE)

        return mylist

    def t_START(self, camp):
        if self.LABEL == "DZRE_TEST" and not self.mission_active:
            self.mission_active = True

    def t_UPDATE(self, camp):
        if self.mission_seed.ended:
            self.end_plot(camp)

    def activate_mission(self, camp):
        self.mission_active = True
        missionbuilder.NewMissionNotification(self.mission_seed.name,
                                              self.elements["MISSION_GATE"])

    def MISSION_GATE_menu(self, camp, thingmenu):
        if self.mission_seed and self.mission_active:
            thingmenu.add_item(self.mission_seed.name, self.mission_seed)
示例#20
0
class RLM_HauntedByTyphon(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"
    UNIQUE = True

    RUMOR = Rumor(
        rumor="{NPC} is one of the pilots who fought against Typhon, and lost",
        offer_msg="{NPC.gender.subject_pronoun} hasn't piloted a mek since {NPC.gender.possessive_determiner} defeat. You can usually find {NPC} at {NPC_SCENE}; maybe speaking to another cavalier will improve {NPC.gender.possessive_determiner} mood.",
        memo="{NPC} is a cavalier who was defeated by Typhon and hasn't piloted a mek since.",
        prohibited_npcs=("NPC",)
    )

    @classmethod
    def matches(self, pstate):
        """Returns True if this plot matches the current plot state."""
        return gears.personality.GreenZone in pstate.elements["NPC"].personality

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship(attitude=gears.relationships.A_DESPAIR)
        npc.statline[gears.stats.Cybertech] += random.randint(1, 5)
        if gears.personality.Grim not in npc.personality:
            npc.personality.add(gears.personality.Grim)
        if gears.personality.Cheerful in npc.personality:
            npc.personality.remove(gears.personality.Cheerful)
        return nart.camp.year > 157

    def NPC_offers(self, camp: gears.GearHeadCampaign):
        mylist = list()
        npc = self.elements["NPC"]
        self.hire_cost = get_hire_cost(camp, npc) * 2
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            if self._rumor_memo_delivered:
                if camp.can_add_lancemate():
                    if npc.get_reaction_score(camp.pc, camp) > 60:
                        mylist.append(Offer("[IWOULDLOVETO] It's about time for me to get back in the saddle.",
                                            context=ContextTag((context.PROPOSAL, context.JOIN)),
                                            data={"subject": "joining my lance"},
                                            effect=self._join_lance
                                            ))
                    else:
                        mylist.append(
                            Offer("It'd take ${:,} to get me in the seat of a mech again. [DOYOUACCEPTMYOFFER]".format(
                                self.hire_cost),
                                  context=ContextTag((context.PROPOSAL, context.JOIN)),
                                  data={"subject": "joining my lance"},
                                  subject=self, subject_start=True,
                                  ))
                        mylist.append(Offer("[DENY_JOIN] [GOODBYE]",
                                            context=ContextTag((context.DENY, context.JOIN)), subject=self
                                            ))
                        if camp.credits >= self.hire_cost:
                            mylist.append(Offer("Huh, I really didn't expect you to pony up that much cash... [LETSGO]",
                                                context=ContextTag((context.ACCEPT, context.JOIN)), subject=self,
                                                effect=self._pay_to_join
                                                ))
            elif camp.pc.has_badge(gears.oldghloader.TYPHON_SLAYER.name):
                mylist.append(Offer(
                    "[HELLO] You're one of the cavaliers who defeated Typhon, aren't you?",
                    context=ContextTag([context.HELLO, ]), subject=npc, subject_start=True
                ))
                mylist.append(Offer(
                    "You probably don't remember me... I'm one of the pilots who also took part in the battle of Snake Lake, but just for a minute. Literally just a minute. Never even saw Typhon itself. Haven't piloted a mecha since.",
                    context=ContextTag([context.CUSTOM, ]), subject=npc,
                    data={"reply": "Yes, I am."}
                ))
                if npc.get_reaction_score(camp.pc, camp) > 20:
                    mylist.append(Offer("[IWOULDLOVETO] [LETSGO]",
                                        context=ContextTag((context.CUSTOMREPLY,)),
                                        data={"reply": "[INFO_PERSONAL:JOIN]"}, subject=npc,
                                        effect=self._join_lance
                                        ))
                else:
                    mylist.append(Offer("Nah, adventuring is a mug's game. I'm staying right here.",
                                        context=ContextTag((context.CUSTOMREPLY,)),
                                        data={"reply": "[INFO_PERSONAL:JOIN]"}, subject=npc,
                                        effect=self.end_plot
                                        ))
            mylist.append(LMSkillsSelfIntro(npc))

        else:
            mylist.append(Offer(
                "[HELLO] Be careful out there... all it takes is one little mistake to cost you everything.",
                context=ContextTag((context.HELLO,))
            ))
            self.end_plot(camp)

        return mylist

    def _pay_to_join(self, camp):
        camp.credits -= self.hire_cost
        self._join_lance(camp)

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
class BasicFightChallenge(Plot):
    LABEL = "CHALLENGE_PLOT"
    active = True
    scope = "METRO"
    RUMOR = Rumor(
        "{NPC} is looking for a pilot to fight {ENEMY_FACTION}",
        offer_msg=
        "You can speak to {NPC} at {NPC_SCENE} if you want the mission.",
        memo="{NPC} is looking for a pilot to fight {ENEMY_FACTION}.",
        prohibited_npcs=("NPC", ))

    DEFAULT_OBJECTIVES = (
        ghchallenges.DescribedObjective(
            missionbuilder.BAMO_LOCATE_ENEMY_FORCES,
            "mecha from {ENEMY_FACTION} have been detected nearby"),
        ghchallenges.DescribedObjective(
            missionbuilder.BAMO_DEFEAT_COMMANDER,
            "an agent of {ENEMY_FACTION} has been operating in this area"))

    @classmethod
    def matches(cls, pstate: PlotState):
        return "METROSCENE" in pstate.elements and "MISSION_GATE" in pstate.elements

    def custom_init(self, nart: GHNarrativeRequest):
        self.candidates = [
            c for c in nart.challenges
            if c.chaltype == ghchallenges.FIGHT_CHALLENGE
        ]
        if self.candidates:
            #mychallenge = self.register_element("CHALLENGE", random.choice(self.candidates))
            npc = self.seek_element(nart,
                                    "NPC",
                                    self._is_good_npc,
                                    lock=True,
                                    scope=self.elements["METROSCENE"])
            mychallenge = self.register_element(
                "CHALLENGE", self._get_challenge_for_npc(nart, npc))
            self.register_element("NPC_SCENE", npc.scene)
            self.register_element("ENEMY_FACTION", mychallenge.key[0])
            self.expiration = TimeAndChallengeExpiration(nart.camp,
                                                         mychallenge,
                                                         time_limit=5)

            my_dobjectives = random.sample(
                list(self.DEFAULT_OBJECTIVES) +
                mychallenge.data.get("mission_objectives", []), 2)
            self.mission_desc = random.choice(
                my_dobjectives).mission_desc.format(**self.elements)

            mgram = missionbuilder.MissionGrammar(
                random.choice(
                    mychallenge.data.get("challenge_objectives", [
                        "[defeat_you]",
                    ]) + list(c.objective_pp for c in my_dobjectives)),
                random.choice(
                    mychallenge.data.get("enemy_objectives", [
                        "[defeat_you]",
                    ]) + list(c.objective_ep for c in my_dobjectives)),
                random.choice([c.win_pp for c in my_dobjectives]),
                random.choice([c.win_ep for c in my_dobjectives]),
                random.choice([c.lose_pp for c in my_dobjectives]),
                random.choice([c.lose_ep for c in my_dobjectives]))

            sgen, archi = gharchitecture.get_mecha_encounter_scenegen_and_architecture(
                self.elements["METROSCENE"])
            # Create the mission seed. Turn the defeat_trigger off because we'll be handling that manually.
            self.mission_seed = missionbuilder.BuildAMissionSeed(
                nart.camp,
                "{NPC}'s Mission".format(**self.elements),
                self.elements["METROSCENE"],
                self.elements["MISSION_GATE"],
                allied_faction=npc.faction,
                enemy_faction=self.elements["ENEMY_FACTION"],
                rank=self.rank,
                objectives=[c.objective for c in my_dobjectives],
                one_chance=True,
                scenegen=sgen,
                architecture=archi,
                mission_grammar=mgram,
                cash_reward=120,
                on_win=self._win_the_mission,
                defeat_trigger_on=False)

            self.mission_active = False
            del self.candidates
            return True

    def _get_challenge_for_npc(self, nart, npc):
        candidates = [
            c for c in self.candidates if c.is_involved(nart.camp, npc)
        ]
        if candidates:
            return random.choice(candidates)

    def _is_good_npc(self, nart: GHNarrativeRequest, candidate):
        return (isinstance(candidate, gears.base.Character)
                and candidate not in nart.camp.party and
                (not candidate.relationship or gears.relationships.RT_LANCEMATE
                 not in candidate.relationship.tags)
                and self._get_challenge_for_npc(nart, candidate))

    def _win_the_mission(self, camp):
        comp = self.mission_seed.get_completion(True)
        self.elements["CHALLENGE"].advance(camp, max((comp - 61) // 10, 1))
        self.end_plot(camp)

    def get_mission_intro(self):
        mylist = ["[MechaMissionVsEnemyFaction]."]
        mychallenge = self.elements["CHALLENGE"]
        mylist += mychallenge.data.get("mission_intros", [])

        return random.choice(mylist)

    def NPC_offers(self, camp):
        mylist = list()

        if not self.mission_active:
            mylist.append(
                Offer("[LOOKING_FOR_CAVALIER] {}".format(
                    self.get_mission_intro()),
                      ContextTag([context.HELLO, context.MISSION]),
                      data={"enemy_faction": self.elements["ENEMY_FACTION"]}))

            mylist.append(
                Offer("{}. [DOYOUACCEPTMISSION]".format(self.mission_desc),
                      ContextTag([context.MISSION]),
                      data={"enemy_faction": self.elements["ENEMY_FACTION"]},
                      subject=self,
                      subject_start=True))

            mylist.append(
                Offer("[IWillSendMissionDetails]; [GOODLUCK]",
                      ContextTag([context.ACCEPT]),
                      effect=self.activate_mission,
                      subject=self))

            mylist.append(
                Offer("[UNDERSTOOD] [GOODBYE]",
                      ContextTag([context.DENY]),
                      effect=self.end_plot,
                      subject=self))

        return mylist

    def t_START(self, camp):
        if self.LABEL == "DZRE_TEST" and not self.mission_active:
            self.mission_active = True

    def t_UPDATE(self, camp):
        if self.mission_seed.ended:
            self.end_plot(camp)

    def activate_mission(self, camp):
        self.mission_active = True
        missionbuilder.NewMissionNotification(self.mission_seed.name,
                                              self.elements["MISSION_GATE"])

    def MISSION_GATE_menu(self, camp, thingmenu):
        if self.mission_seed and self.mission_active:
            thingmenu.add_item(self.mission_seed.name, self.mission_seed)
示例#22
0
class RLM_MechaOtaku(Plot):
    LABEL = "RLM_Relationship"
    active = True
    scope = "METRO"
    UNIQUE = True

    RUMOR = Rumor(
        rumor="{NPC} is obsessed with mecha; maybe someday {NPC.gender.subject_pronoun} will become a cavalier",
        offer_msg="{NPC} usually hangs out at {NPC_SCENE}. Since you're a mecha pilot yourself, I'm sure {NPC.gender.subject_pronoun}'d be thrilled to talk with you.",
        memo="{NPC} is obsessed with mecha.",
        prohibited_npcs=("NPC",)
    )

    @classmethod
    def matches(self, pstate):
        """Returns True if this plot matches the current plot state."""
        return pstate.elements["NPC"].statline[gears.stats.Knowledge] > 12

    def custom_init(self, nart):
        npc = self.elements["NPC"]
        npc.relationship = gears.relationships.Relationship(expectation=gears.relationships.E_MECHANIAC)
        npc.statline[gears.stats.Repair] += random.randint(1, 5)
        npc.statline[gears.stats.Science] += random.randint(1, 5)
        self._did_mecha_chat = False
        return True

    def NPC_offers(self, camp: gears.GearHeadCampaign):
        mylist = list()
        npc: gears.base.Character = self.elements["NPC"]
        self.hire_cost = get_hire_cost(camp, npc)
        if gears.relationships.RT_LANCEMATE not in npc.relationship.tags:
            mylist.append(LMSkillsSelfIntro(npc))
            if not self._did_mecha_chat:
                mylist.append(Offer(
                    "[HELLO] I just checked cav-net and it says you are a cavalier?",
                    context=ContextTag((context.HELLO,)), subject=npc, subject_start=True
                ))

                pcmek: gears.base.Mecha = camp.get_pc_mecha(camp.pc)
                if pcmek:
                    engine, gyro = pcmek.get_engine_rating_and_gyro_status()
                    if engine > 1700:
                        opinion = "That makes it one of the most powerful mecha out there. When an engine that size blows up, it's really something."
                    elif engine > 1100:
                        opinion = "That makes it a powerful mecha. You could probably be an arena contender with something like that."
                    elif engine > 750:
                        opinion = "That makes it solidly above average. A good mecha, but maybe not a great one."
                    elif engine > 450:
                        opinion = "That is enough power to get by, I guess. If I were you I'd consider upgrading to a bigger engine."
                    elif engine > 0:
                        opinion = "That's a really tiny engine. Like, barely enough to move with. I'm not sure you could run a metro bus on that."
                    else:
                        opinion = "I don't know why you'd pilot a mecha without an engine in it, but I'll assume you have your reasons."
                    mylist.append(Offer(
                        "Did you know that the {} you pilot has a class {} engine? {}".format(pcmek.get_full_name(), engine, opinion),
                        context=ContextTag((context.CUSTOM,)), subject=npc,
                        data={"reply": "Yes, I am. Would you like to talk about mecha?"},
                        effect=self._complete_mecha_chat
                    ))

                else:
                    mylist.append(Offer(
                        "Well, it also says here that you are currently dispossessed, so I don't know what we would have to talk about. I have a {}.".format(npc.mecha_pref),
                        context=ContextTag((context.CUSTOM,)), subject=npc,
                        data={"reply": "Yes, I am. Would you like to talk about mecha?"},
                        effect=self._complete_mecha_chat
                    ))

                mylist.append(Offer(
                    "Mine is a {}. I'm hoping to get a better one someday but to do that I'd have to become a cavalier and go on missions.".format(npc.mecha_pref),
                    context=ContextTag((context.CUSTOMREPLY,)), subject=npc,
                    data={"subject": "your mecha", "reply": "[HELLO:INFO]"},
                    effect=self._complete_mecha_chat
                ))

            else:
                mylist.append(Offer(
                    "[HELLO] I have a {} and someday I will get the chance to use it.".format(npc.mecha_pref),
                    context=ContextTag((context.HELLO,))
                ))

                mylist.append(Offer(
                    "I would love to be a cavalier someday. First I'd need a lance to join. Trying to do that job by yourself is a quick path to an early grave. Or at least you could lose your mecha. I don't want to lose my mecha.",
                    context=ContextTag((context.INFO,context.PERSONAL)), subject=npc,
                    data={"subject": "cavaliers"}, no_repeats=True
                ))

                if camp.can_add_lancemate():
                    if camp.renown > npc.renown:
                        mylist.append(Offer("[IWOULDLOVETO] [THANKS_FOR_CHOOSING_ME]",
                                            context=ContextTag((context.PROPOSAL, context.JOIN)),
                                            data={"subject": "joining my lance"},
                                            effect=self._join_lance
                                            ))
                    else:
                        mylist.append(
                            Offer("I would love to join your lance but the standard rate for a pilot of my ranking is ${:,}. [DOYOUACCEPTMYOFFER]".format(self.hire_cost),
                                  context=ContextTag((context.PROPOSAL, context.JOIN)),
                                  data={"subject": "joining my lance"},
                                  subject=self, subject_start=True,
                                  ))
                        mylist.append(Offer("[DENY_JOIN] [GOODBYE]",
                                            context=ContextTag((context.DENY, context.JOIN)), subject=self
                                            ))
                        if camp.credits >= self.hire_cost:
                            mylist.append(Offer("[THANKS_FOR_CHOOSING_ME] [LETSGO]",
                                                context=ContextTag((context.ACCEPT, context.JOIN)), subject=self,
                                                effect=self._pay_to_join
                                                ))
        else:
            self.end_plot(camp)

        return mylist

    def _complete_mecha_chat(self, camp):
        self._did_mecha_chat = True

    def _pay_to_join(self, camp):
        camp.credits -= self.hire_cost
        self._join_lance(camp)

    def _join_lance(self, camp):
        npc = self.elements["NPC"]
        npc.relationship.tags.add(gears.relationships.RT_LANCEMATE)
        effect = game.content.plotutility.AutoJoiner(npc)
        effect(camp)
        self.end_plot(camp)
class RaiseArmyChallenge(Plot):
    LABEL = "CHALLENGE_PLOT"
    active = True
    scope = "METRO"

    RUMOR = Rumor(
        "{NPC} has been trying to acquire some mecha for the war effort",
        offer_msg=
        "In addition to soldiers and pilots, we're also going to need machines. {NPC} is working hard at {NPC_SCENE} to get as many mecha in battle condition as we can get.",
        memo="{NPC} needs help obtaining mecha for the war effort.",
        prohibited_npcs=("NPC", ))

    @classmethod
    def matches(cls, pstate: PlotState):
        return "METROSCENE" in pstate.elements

    def custom_init(self, nart: GHNarrativeRequest):
        self.candidates = [
            c for c in nart.challenges
            if c.chaltype == ghchallenges.RAISE_ARMY_CHALLENGE
        ]
        if self.candidates:
            npc = self.seek_element(nart,
                                    "NPC",
                                    self._is_good_npc,
                                    lock=True,
                                    scope=self.elements["METROSCENE"])
            mychallenge = self.register_element(
                "CHALLENGE", self._get_challenge_for_npc(nart, npc))
            self.register_element("NPC_SCENE", npc.scene)

            self.expiration = TimeAndChallengeExpiration(nart.camp,
                                                         mychallenge,
                                                         time_limit=5)
            del self.candidates

            return True

    def _get_challenge_for_npc(self, nart, npc):
        candidates = [
            c for c in self.candidates if c.is_involved(nart.camp, npc)
        ]
        if candidates:
            return random.choice(candidates)

    def _is_good_npc(self, nart: GHNarrativeRequest, candidate):
        return (isinstance(candidate, gears.base.Character)
                and nart.camp.is_not_lancemate(candidate) and candidate.job
                and {
                    gears.tags.Craftsperson, gears.tags.Merchant,
                    gears.tags.CorporateWorker
                }.intersection(candidate.job.tags)
                and self._get_challenge_for_npc(nart, candidate))

    def _win_the_mission(self, camp):
        self.elements["CHALLENGE"].advance(camp, 3)
        self.end_plot(camp)

    def NPC_offers(self, camp):
        mylist = list()
        mychallenge: pbge.challenges.Challenge = self.elements["CHALLENGE"]

        if "threat" in mychallenge.data:
            mylist.append(
                Offer(
                    "[HELLO] I need to obtain more mecha for the battle against {}."
                    .format(mychallenge.data["threat"]),
                    ContextTag([
                        context.HELLO,
                    ])))
        else:
            mylist.append(
                Offer(
                    "[HELLO] I need to obtain more mecha for the war effort.",
                    ContextTag([
                        context.HELLO,
                    ])))

        ghdialogue.SkillBasedPartyReply(
            Offer(
                "[THANKS_FOR_HELP] With your guidance we've been able to strip one wreck for the parts to get two more running again.",
                ContextTag([
                    context.CUSTOM,
                ]),
                effect=self._win_the_mission,
                subject="obtain more mecha",
                data={
                    "reply":
                    "I can use my repair knowledge to help you get some of these wrecks back into working order."
                }), camp, mylist, gears.stats.Knowledge, gears.stats.Repair,
            self.rank, gears.stats.DIFFICULTY_HARD)

        ghdialogue.SkillBasedPartyReply(
            Offer(
                "[THANKS_FOR_HELP] The improvements you've suggested should produce immediate savings in both time and resources.",
                ContextTag([
                    context.CUSTOM,
                ]),
                effect=self._win_the_mission,
                subject="obtain more mecha",
                data={
                    "reply":
                    "My scientific knowledge might be able to increase your mecha production capacity."
                }), camp, mylist, gears.stats.Knowledge, gears.stats.Science,
            self.rank, gears.stats.DIFFICULTY_AVERAGE)

        if self._rumor_memo_delivered:
            mylist.append(
                Offer(
                    "Yes, I've been hard at work to obtain more mecha for {}. We have a ton of salvage, but nothing that will put up a fight."
                    .format(mychallenge.key[0]),
                    ContextTag([
                        context.INFO,
                    ]),
                    data={"subject": "the war effort"}))

        return mylist
示例#24
0
class TownEnemyCombatBaseSearch(BasicCombatBaseSearch):
    RUMOR = Rumor(
        "{NPC} is looking for someone to fight {ENEMY_FACTION}",
        offer_msg=
        "If you want to get the job, you can find {NPC} at {NPC_SCENE}.",
        memo="{NPC} is looking for someone to fight {ENEMY_FACTION}.",
        prohibited_npcs=("NPC", ))

    MISSION_NAME = "{NPC}'s Mission"
    MISSION_OBJECTIVES = (missionbuilder.BAMO_LOCATE_ENEMY_FORCES,
                          SEBO_SEARCH_FOR_BASE)

    def is_good_npc(self, nart, candidate):
        return (isinstance(candidate, gears.base.Character)
                and candidate.combatant and candidate not in nart.camp.party
                and gears.tags.SCENE_PUBLIC in candidate.scene.attributes
                and nart.camp.are_faction_enemies(
                    candidate, self.elements["ENEMY_FACTION"]))

    def NPC_offers(self, camp):
        mylist = list()
        if not self.mission_active:
            mylist.append(
                Offer("[HELLO] [LOOKING_FOR_CAVALIER]",
                      ContextTag([context.HELLO, context.MISSION]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])}))

            mylist.append(
                Offer("[MechaMissionVsEnemyFaction]; [THEYAREOURENEMY]",
                      ContextTag([
                          context.MISSION,
                      ]),
                      data={
                          "enemy_faction": str(self.elements["ENEMY_FACTION"]),
                          "they": str(self.elements["ENEMY_FACTION"])
                      },
                      subject=self,
                      subject_start=True))

            mylist.append(
                Offer("[GOODLUCK] [IWillSendMissionDetails].",
                      ContextTag([
                          context.ACCEPT,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])},
                      effect=self._accept_mission,
                      subject=self))

            mylist.append(
                Offer("[UNDERSTOOD]",
                      ContextTag([
                          context.DENY,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])},
                      effect=self._deny_misssion,
                      subject=self))

            mylist.append(
                Offer("Get out of here; I've got work to do.",
                      ContextTag([
                          context.UNFAVORABLE_HELLO,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])},
                      effect=self._deny_misssion))
        return mylist
示例#25
0
class OmegaTalksTyphon(Plot):
    LABEL = "DZD_OMEGA1004"
    active = True
    scope = "METRO"

    RUMOR = Rumor(
        "there's a robot hanging out at {NPC_SCENE}",
        offer_msg=
        "He seems to be a nice guy... I just never met a robot that's a person before. But once you start talking you forget that he's made of metal.",
        offer_subject="a robot hanging out",
        offer_subject_data="the robot",
        memo="There's a robot hanging out at {NPC_SCENE}.",
        prohibited_npcs=("NPC"))

    QOL = gears.QualityOfLife(community=1)

    def custom_init(self, nart):
        scene = self.seek_element(nart,
                                  "NPC_SCENE",
                                  self._is_best_scene,
                                  scope=self.elements["METROSCENE"],
                                  backup_seek_func=self._is_okay_scene)
        npc = self.register_element("NPC",
                                    nart.camp.get_major_npc("Omega 1004"),
                                    dident="NPC_SCENE")
        self._got_initial_story = False
        self._got_typhon_story = False

        self.infoblasts = (OneShotInfoBlast(
            "Snake Lake",
            "I was presenting arguments in favor of Constitutional Amendment 79-MS, which granted full citizenship rights to all sentient beings no matter if they are organic, mechanical, or biomechanical. The news media called this 'The Omega Law' but it is not a law it is a constitutional amendment."
        ), )
        self.shop = services.SkillTrainer([
            gears.stats.Biotechnology, gears.stats.Wildcraft,
            gears.stats.Science
        ])

        return True

    def _is_best_scene(self, nart, candidate):
        return (isinstance(candidate, gears.GearHeadScene)
                and gears.tags.SCENE_PUBLIC in candidate.attributes
                and gears.tags.SCENE_BUILDING in candidate.attributes)

    def _is_okay_scene(self, nart, candidate):
        return isinstance(candidate, gears.GearHeadScene
                          ) and gears.tags.SCENE_PUBLIC in candidate.attributes

    def NPC_offers(self, camp):
        mylist = list()
        if not self._got_initial_story:
            if camp.pc.has_badge("Typhon Slayer"):
                mylist.append(
                    Offer(
                        "[THANKS] I replaced all of my rusted out body panels, had some chrome installed, and bought myself a genuine face. It's top quality synthetic polyvinyl chloride.",
                        ContextTag([context.CUSTOM]),
                        data={
                            "reply": "Omega! You're looking good these days."
                        },
                        subject=self,
                        subject_start=True))
            else:
                mylist.append(
                    Offer(
                        "Yes, your information is correct, though I am not certain I feel comfortable with that being my best known achievement. It is a pleasure to meet a fellow cavalier.",
                        ContextTag([context.CUSTOM]),
                        data={
                            "reply":
                            "Aren't you the robot that helped defeat Typhon?"
                        },
                        subject=self,
                        subject_start=True))

            mylist.append(
                Offer(
                    "I am happy to be back at my old task, cataloging neofauna in the trans-Eurasian dead zone. I spent far too much of the past year indoors at the parliament buildings in Snake Lake. I would be happy to discuss my research with you sometime.",
                    ContextTag([context.CUSTOMREPLY]),
                    data={"reply": "What have you been doing lately?"},
                    subject=self,
                    effect=self._do_introduction))
        else:
            mylist.append(
                Offer(
                    "Nothing would make me happier... other than possibly discovering a new type of feral synthoid.",
                    ContextTag([context.CUSTOM]),
                    data={
                        "reply":
                        "I would like to discuss your research findings."
                    },
                    dead_end=True,
                    effect=self.shop))
            if random.randint(1, 2) == 1 and not self._got_typhon_story:
                mylist.append(
                    Offer(
                        "I have been thinking about Typhon again, and how tragic its life was. Imagine being created solely as a weapon. A living, feeling tool of death. And think of Cetus, never truly born, but experimented upon and tortured for centuries. I run the scenarios again and again yet cannot find a happy ending.",
                        ContextTag([context.CUSTOM]),
                        data={
                            "reply":
                            "You look sort of down today... Is anything wrong?"
                        },
                        subject=self.shop,
                        subject_start=True))

            mylist.append(
                Offer(
                    "And that is what bothers me- unlike my human lancemates, it was not fear or will to survive that led me to kill Typhon. It was the cold equation that Typhon must die so many others could live. Even with the benefit of hindsight I see no other solutions.",
                    ContextTag([context.CUSTOMREPLY]),
                    data={"reply": "You did the only thing you could do."},
                    subject=self.shop,
                    effect=self._do_typhon_talk))

            mylist.append(
                Offer(
                    "Yet as cavaliers we must always try to make things better. I know my actions that day were mathematically justified. It was the cold equation that Typhon must die so many others could live. Still, I mourn for the creature that was never given a chance to really exist.",
                    ContextTag([context.CUSTOMREPLY]),
                    data={
                        "reply": "Life isn't fair. In fact usually it sucks."
                    },
                    subject=self.shop,
                    effect=self._do_typhon_talk))

        for ib in self.infoblasts:
            if ib.active:
                mylist.append(ib.build_offer())

        return mylist

    def _do_introduction(self, camp):
        self._got_initial_story = True
        self.RUMOR = False
        self.memo = pbge.memos.Memo(
            "Omega 1004 at {NPC_SCENE} offered to discuss his research with you."
            .format(**self.elements),
            location=self.elements["NPC_SCENE"])

    def _do_typhon_talk(self, camp):
        self._got_typhon_story = True
示例#26
0
class CriminalCombatBaseSearch(BasicCombatBaseSearch):
    RUMOR = Rumor(
        "{NPC} had a shipment of cargo stolen by {ENEMY_FACTION}",
        offer_msg=
        "Go talk to {NPC} at {NPC_SCENE}; maybe you can get a mission out of it.",
        memo=
        "{NPC} is looking for someone to recover cargo stolen by {ENEMY_FACTION}.",
        prohibited_npcs=("NPC", ))

    MISSION_NAME = "{NPC}'s Mission"
    MISSION_OBJECTIVES = (missionbuilder.BAMO_RECOVER_CARGO,
                          SEBO_SEARCH_FOR_BASE)

    @classmethod
    def matches(self, pstate):
        return "ENEMY_FACTION" in pstate.elements and gears.tags.Criminal in pstate.elements[
            "ENEMY_FACTION"].factags

    def is_good_npc(self, nart, candidate):
        return (isinstance(candidate, gears.base.Character)
                and candidate not in nart.camp.party
                and gears.tags.SCENE_PUBLIC in candidate.scene.attributes and {
                    gears.tags.Merchant, gears.tags.CorporateWorker,
                    gears.tags.Laborer
                }.intersection(candidate.get_tags()))

    def NPC_offers(self, camp):
        mylist = list()
        if not self.mission_active:
            mylist.append(
                Offer("[HELLO] [LOOKING_FOR_CAVALIER]",
                      ContextTag([context.HELLO, context.MISSION]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])}))

            mylist.append(
                Offer("[MechaMissionVsEnemyFaction]; [THEYARETHIEVES]",
                      ContextTag([
                          context.MISSION,
                      ]),
                      data={
                          "enemy_faction": str(self.elements["ENEMY_FACTION"]),
                          "they": str(self.elements["ENEMY_FACTION"])
                      },
                      subject=self,
                      subject_start=True))

            mylist.append(
                Offer("[GOODLUCK] [IWillSendMissionDetails].",
                      ContextTag([
                          context.ACCEPT,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])},
                      effect=self._accept_mission,
                      subject=self))

            mylist.append(
                Offer("[UNDERSTOOD]",
                      ContextTag([
                          context.DENY,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])},
                      effect=self._deny_misssion,
                      subject=self))

            mylist.append(
                Offer("You've got no business being here.",
                      ContextTag([
                          context.UNFAVORABLE_HELLO,
                      ]),
                      data={"faction": str(self.elements["ENEMY_FACTION"])},
                      effect=self._deny_misssion))
        return mylist