Skip to content

Commit

Permalink
Added a third consolidation plot
Browse files Browse the repository at this point in the history
  • Loading branch information
jwvhewitt committed Jun 3, 2024
1 parent f273c7b commit 354e293
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 21 deletions.
6 changes: 3 additions & 3 deletions game/content/ghplots/challengeplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def custom_init(self, nart: GHNarrativeRequest):
def _is_good_npc(self, nart: GHNarrativeRequest, candidate):
return (
isinstance(candidate, gears.base.Character) and nart.camp.is_not_lancemate(candidate) and
self.elements["CHALLENGE"].is_involved(nart, candidate)
self.elements["CHALLENGE"].is_involved(nart.camp, candidate)
)

def _win_the_mission(self, camp):
Expand Down Expand Up @@ -635,7 +635,7 @@ class EBInformationBroker(ChallengePlot):
offer_msg="{NPC} is a {NPC.job} who can usually be found at {NPC_SCENE}. They say {NPC.gender.subject_pronoun} knows something about {ENEMY_FACTION}.",
memo="The {NPC.job} {NPC} may have information about {ENEMY_FACTION}'s {BASE_NAME}.", memo_location="{NPC_SCENE}",
offer_subject="{NPC} is a local information broker",
offer_subject_data="{NPC}'s information'",
offer_subject_data="{NPC}'s information",
prohibited_npcs=("NPC",)
)

Expand Down Expand Up @@ -706,7 +706,7 @@ def NPC_offers(self, camp):
if self._rumor_memo_delivered:
mylist.append(Offer(
"I know where to find {ENEMY_FACTION}'s {BASE_NAME}, and for just ${DONATION:,} that info could be yours.".format(**self.elements),
ContextTag([context.CUSTOM]), data={"reply": "Tell me what you know about {ENEMY_FACTION}'s {BASE_NAME}.",},
ContextTag([context.CUSTOM]), data={"reply": "Tell me what you know about {ENEMY_FACTION}'s {BASE_NAME}.".format(**self.elements),},
subject=mysubject, subject_start=True
))
else:
Expand Down
120 changes: 117 additions & 3 deletions game/content/ghplots/wmw_consolidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,96 @@


# A consolidation plot gets the following elements:
# METROSCENE, METRO, WORLD_MAP_WAR
# METROSCENE, METRO, MISSION_GATE, WORLD_MAP_WAR
# FORMER_FACTION: The faction you just kicked out. May be None.


class EliminateScoutsConsolidation(Plot):
LABEL = WMW_CONSOLIDATION
scope = "METRO"
active = True

intro_ready = True

def custom_init(self, nart):
self.elements["ALLIED_FACTION"] = self.elements["WORLD_MAP_WAR"].player_team
self.elements["ENEMY_FACTION"] = self.elements["WORLD_MAP_WAR"].get_enemy_faction(nart.camp, self.elements["WORLD_MAP_WAR"].player_team)

self.register_element("CHALLENGE", Challenge(
"Fight {ENEMY_FACTION} in {METROSCENE}".format(**self.elements),
ghchallenges.FIGHT_CHALLENGE, [self.elements["ENEMY_FACTION"]],
involvement=ghchallenges.InvolvedMetroFactionNPCs(self.elements["METROSCENE"], self.elements["ALLIED_FACTION"]),
active=False,
data={
"challenge_objectives": [
"defend {METROSCENE}".format(**self.elements),
"keep {ENEMY_FACTION} out of {METROSCENE}".format(**self.elements),
],
"challenge_fears": [
"attack {METROSCENE}".format(**self.elements),
"attack {ALLIED_FACTION}".format(**self.elements)
],
"enemy_objectives": [
"take control of {METROSCENE}".format(**self.elements),
"drive {ALLIED_FACTION} from {METROSCENE}".format(**self.elements),
],
"mission_intros": [
"Agents of {ENEMY_FACTION} have been spotted near {METROSCENE}.".format(**self.elements),
"Mecha belonging to {ENEMY_FACTION} are operating in the area.".format(**self.elements),
],
"mission_objectives": [
ghchallenges.DescribedObjective(
missionbuilder.BAMO_AID_ALLIED_FORCES,
"Enemy forces have been skirmishing against {ALLIED_FACTION}.".format(**self.elements),
"aid {ALLIED_FACTION}".format(**self.elements),
"end {ALLIED_FACTION}'s occupation of {METROSCENE}".format(**self.elements),
"I defeated you and {ENEMY_FACTION}".format(**self.elements),
"you led {ALLIED_FACTION} to victory against {ENEMY_FACTION}".format(**self.elements),
"you defeated a patrol belonging to {ALLIED_FACTION}".format(**self.elements),
"I defeated the aggression of {ALLIED_FACTION}".format(**self.elements)
),
ghchallenges.DescribedObjective(
missionbuilder.BAMO_CAPTURE_BUILDINGS,
"It's thought that {ENEMY_FACTION} must have a base of operations nearby.".format(**self.elements),
"destroy your base".format(**self.elements),
"protect {ENEMY_FACTION}'s presence in {METROSCENE}".format(**self.elements),
"I captured {ENEMY_FACTION}'s base near {METROSCENE}".format(**self.elements),
"you destroyed my secret base".format(**self.elements),
"you scored a victory for {ENEMY_FACTION}".format(**self.elements),
"I showed you that {ENEMY_FACTION} is not easily removed".format(**self.elements)
),
ghchallenges.DescribedObjective(
missionbuilder.BAMO_SURVIVE_THE_AMBUSH,
"Several of our patrols have been ambushed by {ENEMY_FACTION}.".format(**self.elements),
"put a halt to your operations in {METROSCENE}".format(**self.elements),
"cause as much trouble as possible for {ALLIED_FACTION}".format(**self.elements),
win_pp="I survived your ambush".format(**self.elements),
win_ep="you proved to be more resilient than I thought".format(**self.elements),
lose_pp="you caught me off-guard".format(**self.elements),
lose_ep="you wandered straight into my ambush".format(**self.elements)
),
]
},
memo=pbge.challenges.ChallengeMemo(
"You must eliminate the scout team from {ENEMY_FACTION} who have been spotted near {METROSCENE}.".format(**self.elements)
), memo_active=True, deactivate_on_win=True, num_simultaneous_plots=2
))

return True

def CHALLENGE_WIN(self, camp):
pbge.BasicNotification("Consolidation complete!", count=160)
camp.check_trigger("WIN", self)
self.elements["WORLD_MAP_WAR"].player_can_act = True
self.end_plot(camp)

def METROSCENE_ENTER(self, camp):
if self.intro_ready:
pbge.alert("The next step is to consolidate your victory in {METROSCENE}. There have been reports of scouts from {ENEMY_FACTION} operating nearby.".format(**self.elements))
self.elements["CHALLENGE"].activate(camp)
self.intro_ready = False


class SleeperCellConsolidation(Plot):
# The enemy have left behind some operatives to cause problems later.
LABEL = WMW_CONSOLIDATION
Expand Down Expand Up @@ -52,20 +139,47 @@ def custom_init(self, nart):
))

self.intro_ready = True
self.finished_challenge = False
self.mission_name = "Attack {FORMER_FACTION}'s sleeper cell".format(**self.elements)
return True

def CHALLENGE_WIN(self, camp):
pbge.BasicNotification("Consolidation complete!", count=160)
missionbuilder.NewMissionNotification(self.mission_name, mission_gate=self.elements["MISSION_GATE"])
self.finished_challenge = True
self.memo = Memo("You have located {FORMER_FACTION}'s sleeper cell in {METROSCENE} and can attack them at any time from {MISSION_GATE}.".format(**self.elements), location=self.elements["METROSCENE"])

EXTRA_OBJECTIVES = (missionbuilder.BAMO_LOCATE_ENEMY_FORCES, missionbuilder.BAMO_CAPTURE_BUILDINGS)

def get_mission(self, camp):
sgen, archi = gharchitecture.get_mecha_encounter_scenegen_and_architecture(self.elements["METROSCENE"])
return missionbuilder.BuildAMissionSeed(
camp, self.mission_name,
self.elements["METROSCENE"], self.elements["MISSION_GATE"],
allied_faction=self.elements["ALLIED_FACTION"],
enemy_faction=self.elements["FORMER_FACTION"], rank=self.rank,
objectives=[missionbuilder.BAMO_DEFEAT_COMMANDER, ] + [random.choice(self.EXTRA_OBJECTIVES)],
one_chance=True,
scenegen=sgen, architecture=archi,
cash_reward=120,
on_win=self._win_da_mission
)

def _win_da_mission(self, camp):
camp.check_trigger("WIN", self)
pbge.BasicNotification("Consolidation complete!", count=160)
self.elements["WORLD_MAP_WAR"].player_can_act = True
self.end_plot(camp)

def MISSION_GATE_menu(self, camp, thingmenu):
if self.finished_challenge:
thingmenu.add_item(self.mission_name, self.get_mission(camp))

def METROSCENE_ENTER(self, camp):
#mychallenge = self.elements["CHALLENGE"]
#print(mychallenge.active)
#print(self.elements["METROSCENE"])
if self.intro_ready:
pbge.alert("The next step is to consolidate your victory in {METROSCENE}. ".format(**self.elements))
pbge.alert("The next step is to consolidate your victory in {METROSCENE}. Headquarters reports that {FORMER_FACTION} may have left behind a sleeper cell mecha team to cause problems for {ALLIED_FACTION}.".format(**self.elements))
self.elements["CHALLENGE"].activate(camp)
self.intro_ready = False

Expand Down
9 changes: 8 additions & 1 deletion game/content/ghplots/worldmapwar.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ def remove_team(self, camp, losing_fac):
self.legend.set_color(node, 0)
del self.war_teams[losing_fac]

def get_enemy_faction(self, camp:gears.GearHeadCampaign, faca):
candidates = [fac for fac in self.war_teams.keys() if fac is not faca and camp.are_faction_enemies(faca, fac)]
if candidates:
return random.choice(candidates)
else:
return camp.get_enemy_faction(faca)

WAR_WON = "WIN!"
WAR_LOST = "LOSE!"

Expand Down Expand Up @@ -251,7 +258,7 @@ def capture(self, camp, attacking_fac, node):
self.just_captured = node.destination
if metroscene and game.content.load_dynamic_plot(
camp, "WMW_CONSOLIDATION", PlotState(elements={
"METROSCENE": node.destination, "METRO": metroscene.metrodat,
"METROSCENE": node.destination, "METRO": metroscene.metrodat, "MISSION_GATE": node.entrance,
WORLD_MAP_WAR: self, "FORMER_FACTION": former_faction
}
)
Expand Down
82 changes: 68 additions & 14 deletions game/ghdialogue/ghgrammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -4010,20 +4010,74 @@

"[LOOKING_FOR_CAVALIER]": {
# The NPC has a mission for a cavalier.
Default: ["I need a cavalier for an upcoming mission.",
],
personality.Cheerful: ["This could be your lucky day; I'm looking to hire a cavalier...",
],
personality.Grim: ["I need to find a cavalier for this mission, since the last one I hired died...",
],
personality.Easygoing: ["Hey, are you looking for work?",
],
personality.Passionate: ["I need a hot-blooded pilot for an urgent mission!"
],
personality.Sociable: ["I suppose you've heard that I'm looking for a pilot.",
],
personality.Shy: ["I'm looking for a pilot.",
],
Default: [
"I need a cavalier for an upcoming mission.",
"I'm looking for a mecha pilot to do a mission.",
"I have a job available for a cavalier."
],
personality.Cheerful: [
"This could be your lucky day; I'm looking to hire a cavalier...",
"Do you want more money? Of course, we all do. Why not try this mission?",
"Good news! I have a job opening for a pilot just like you."
],
personality.Grim: [
"I need to find a cavalier for this mission, since the last one I hired died...",
"I need a highly skilled cavalier for a dangerous mission.",
"I have a job available, but there's no guarantee you'll come back alive."
],
personality.Easygoing: [
"Hey, are you looking for work?",
"I gotta find a cavalier to do a mission for me...",
"Wanna do a mission for me?"
],
personality.Passionate: [
"I need a hot-blooded pilot for an urgent mission!",
"There's an emergency, and I need to find a cavalier immediately!",
"Hey, do you want to prove yourself by doing this mission?"
],
personality.Sociable: [
"I suppose you've heard that I'm looking for a pilot.",
"I've been going through my contacts to find a skilled pilot for an upcoming mission.",
"I should tell you that I need a pilot for an upcoming mission, if you're interested."
],
personality.Shy: [
"I'm looking for a pilot.",
"I need a pilot to do a mission.",
"Are you looking for a job?",
],
MET_BEFORE: [
"I know you're not someone to turn down a mission, and I have one available.",
],
LOVE: [
"I've got a mission contract and you'd be the perfect cavalier for the job."
],
LIKE: [
"I think you'd be an ideal pilot for the mission I have."
],
DISLIKE: [
"I've been searching for a competent mecha pilot but I guess you could do this mission too.",
],
personality.Glory: [
"Fame and riches await any cavalier who can complete my mission!",
"You look like you're up for a challenge; I have a mission available...",
],
personality.Duty: [
"I need a responsible pilot to carry out this mission.",
"I have a mission for a dependable cavalier.",
],
personality.Fellowship: [
"Could you help me out by doing a mission?",
"It'd be a great help to me if you could do this job..."
],
personality.Peace: [
"Are you willing to fight for peace?",
],
tags.Adventurer: [
"Looking for adventure? Do I have a job for you!",
],
tags.Military: [
"I need a soldier for an upcoming operation.",
],
},

"[Luna]": {
Expand Down

0 comments on commit 354e293

Please sign in to comment.