Skip to content

Commit

Permalink
Added "Sleeper Cell" consolidation plot
Browse files Browse the repository at this point in the history
  • Loading branch information
jwvhewitt committed Jun 2, 2024
1 parent 7b23dfc commit f273c7b
Show file tree
Hide file tree
Showing 14 changed files with 656 additions and 26 deletions.
39 changes: 39 additions & 0 deletions data/jobs_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,5 +554,44 @@
"MechaFighting": -1
},
"local_requirements": ["DeadZone"]
},
{
"name": "Priest",
"skills": ["Negotiation"],
"tags": ["Faithworker"]
},
{
"name": "Monk",
"skills": ["Concentration"],
"tags": ["Faithworker"],
"skill_modifiers": {
"Concentration": 1
}
},
{
"name": "Neodruid",
"skills": ["Wildcraft"],
"tags": ["Faithworker"],
"local_requirements": ["DeadZone"]
},
{
"name": "Technoshaman",
"skills": ["Science", "Computers"],
"tags": ["Faithworker", "Academic"]
},
{
"name": "Warrior Monk",
"tags": ["Faithworker", "Adventurer"],
"always_combatant": true,
"skill_modifiers": {
"MechaGunnery": -1,
"MechaPiloting": -1,
"CloseCombat": 3,
"RangedCombat": -1,
"Athletics": 2,
"Vitality": 2,
"Concentration": 1
}
}

]
374 changes: 367 additions & 7 deletions game/content/ghplots/challengeplots.py

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions game/content/ghplots/peopleplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,29 @@ def _is_best_scene(self,nart,candidate):

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


# ***************************
# *** ADD_FAITHWORKER ***
# ***************************
# Add a faithworker of some type.

class RandomFaithworker(Plot):
LABEL = "ADD_FAITHWORKER"
JOB_NAMES = ("Priest", "Monk", "Warrior Monk", "Neodruid", "Technoshaman")

def custom_init(self, nart):
npc = gears.selector.random_character(
job = gears.jobs.ALL_JOBS[random.choice(self.JOB_NAMES)],
age=random.randint(50,90),
local_tags=tuple(self.elements["METROSCENE"].attributes)
)
self.seek_element(nart, "LOCALE", self._is_best_scene, scope=self.elements["METROSCENE"], backup_seek_func=self._is_good_scene)
self.register_element("NPC", npc, dident="LOCALE")
return True

def _is_best_scene(self,nart,candidate):
return isinstance(candidate, gears.GearHeadScene) and gears.tags.SCENE_PUBLIC in candidate.attributes and candidate.attributes.intersection({gears.tags.SCENE_CULTURE, gears.tags.SCENE_TEMPLE})

def _is_good_scene(self,nart,candidate):
return isinstance(candidate, gears.GearHeadScene) and gears.tags.SCENE_PUBLIC in candidate.attributes
3 changes: 2 additions & 1 deletion game/content/ghplots/ropp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def custom_init(self, nart):
war_teams = dict()
war_teams[gears.factions.TheSolarNavy] = worldmapwar.WarStats(
nart.camp.campdata["SCENARIO_ELEMENT_UIDS"]['00000001'],
color=1, unpopular=True, occtype=wmw_occupation.WMWO_MARTIAL_LAW
color=1, unpopular=False, occtype=wmw_occupation.WMWO_MARTIAL_LAW
)

war_teams[gears.factions.TreasureHunters] = worldmapwar.WarStats(
Expand Down Expand Up @@ -77,6 +77,7 @@ def __setstate__(self, state):
self.__dict__.update(state)
wardict = self.elements[worldmapwar.WORLD_MAP_TEAMS]
wardict[gears.factions.TheSolarNavy].occtype = wmw_occupation.WMWO_MARTIAL_LAW
wardict[gears.factions.TheSolarNavy].unpopular = False
wardict[gears.factions.AegisOverlord].occtype = wmw_occupation.WMWO_IRON_FIST

def ROPPWAR_WIN(self, camp: gears.GearHeadCampaign):
Expand Down
60 changes: 54 additions & 6 deletions game/content/ghplots/wmw_consolidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,54 @@
# METROSCENE, METRO, WORLD_MAP_WAR
# FORMER_FACTION: The faction you just kicked out. May be None.

class SleeperCellConsolidation(Plot):
# The enemy have left behind some operatives to cause problems later.
LABEL = WMW_CONSOLIDATION
scope = "METRO"
active = True

@classmethod
def matches(cls, pstate: PlotState):
# Former Faction is needed.
return pstate.elements.get("FORMER_FACTION")

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

self.register_element("CHALLENGE", Challenge(
"Locate {FORMER_FACTION} Sleeper Cell".format(**self.elements),
ghchallenges.LOCATE_ENEMY_BASE_CHALLENGE,
(self.elements["FORMER_FACTION"],),
involvement=ghchallenges.InvolvedMetroFactionNPCs(
self.elements["METROSCENE"], self.elements["ALLIED_FACTION"]
),
data={
"base_name": "sleeper cell"
},
memo=pbge.challenges.ChallengeMemo(
"You should locate and destroy {FORMER_FACTION}'s sleeper cell in {METROSCENE}.".format(**self.elements)
), active=True, memo_active=True, deactivate_on_win=True, num_simultaneous_plots=3,
))

self.intro_ready = True
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):
#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))
self.elements["CHALLENGE"].activate(camp)
self.intro_ready = False


class DiplomaticConsolidation(Plot):
# Talk to residents and try to convince them that the occupation is OK.
LABEL = WMW_CONSOLIDATION
Expand All @@ -32,9 +80,10 @@ class DiplomaticConsolidation(Plot):

DEFAULT_CHALLENGE_STEP = 1

CHALLENGE_SUBJECTS = (
"",
)
@classmethod
def matches(cls, pstate: PlotState):
wmw = pstate.elements.get("WORLD_MAP_WAR")
return wmw and wmw.player_team and not wmw.war_teams[wmw.player_team].unpopular

def custom_init(self, nart):
self.elements["ALLIED_FACTION"] = self.elements["WORLD_MAP_WAR"].player_team
Expand Down Expand Up @@ -67,8 +116,7 @@ def custom_init(self, nart):
),
), memo=pbge.challenges.ChallengeMemo(
"You should ensure that the residents of {METROSCENE} are okay with the presence of {ALLIED_FACTION}.".format(**self.elements)
), memo_active=True, deactivate_on_win=True

), memo_active=True, deactivate_on_win=True, num_simultaneous_plots=1
))

return True
Expand All @@ -84,7 +132,7 @@ def _advance_challenge(self, camp):

def METROSCENE_ENTER(self, camp):
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}. Check the area for signs of potential insurgency.".format(**self.elements))
self.elements["CHALLENGE"].activate(camp)
self.intro_ready = False

2 changes: 1 addition & 1 deletion game/content/ghplots/worldmapwar.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def capture(self, camp, attacking_fac, node):
else:
self.legend.set_color(node, 0)

if attacking_fac is self.player_team:
if attacking_fac is self.player_team and not self.get_war_status(camp):
self.just_captured = node.destination
if metroscene and game.content.load_dynamic_plot(
camp, "WMW_CONSOLIDATION", PlotState(elements={
Expand Down
12 changes: 7 additions & 5 deletions game/ghdialogue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def harvest(mod, class_to_collect):

class SkillBasedPartyReply(object):
def __init__(
self, myoffer: Offer, camp, mylist, stat_id, skill_id, rank, difficulty=gears.stats.DIFFICULTY_EASY,
no_random=True,
self, myoffer: Offer, camp: gears.GearHeadCampaign, mylist, stat_id, skill_id, rank,
difficulty=gears.stats.DIFFICULTY_EASY, no_random=True,
message_format='{} says "{}"', **kwargs
):
# Check the skill of each party member against a target number. If any party member can
Expand Down Expand Up @@ -135,19 +135,21 @@ def custom_menu_fun(self, reply, mymenu: pbge.rpgmenu.Menu, pcgrammar):


class TagBasedPartyReply(SkillBasedPartyReply):
def __init__(self, myoffer, camp, mylist, needed_tags, message_format='{} says "{}"'):
def __init__(self, myoffer, camp: gears.GearHeadCampaign, mylist, needed_tags, forbidden_tags=(), message_format='{} says "{}"', allow_pc=True):
# Check the skill of each party member against a target number. If any party member can
# make the test, they get to say the line of dialogue.
# If nobody makes the test, don't add myoffer to mylist.
self.camp = camp
self.offer = myoffer
self.message_format = message_format
self.needed_tags = set(needed_tags)
winners = [pc for pc in camp.get_active_party() if self.needed_tags.issubset(pc.get_pilot().get_tags())]
winners = [pc.get_pilot() for pc in camp.get_active_party() if self.needed_tags.issubset(pc.get_pilot().get_tags())]
if camp.pc in winners and not allow_pc:
winners.remove(camp.pc)
self.pc = None
if winners:
pc = random.choice(winners)
if pc.get_pilot() is camp.pc:
if pc is camp.pc:
mylist.append(myoffer)
else:
mylist.append(myoffer)
Expand Down
Loading

0 comments on commit f273c7b

Please sign in to comment.