Skip to content

Commit

Permalink
Updated Bear Bastard's Mecha Camp
Browse files Browse the repository at this point in the history
  • Loading branch information
jwvhewitt committed Aug 12, 2023
1 parent 94ad902 commit 7b5f227
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 18 deletions.
9 changes: 9 additions & 0 deletions game/combat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,15 @@ def activate_foe(self, foe):
pbge.my_state.view.handle_anim_sequence()
self.roll_initiative()

def check_party_activation(self):
# Add party members who became party members after combat already started. They might be active and they might
# not be.
for m in self.scene.contents:
if m not in self.active and self.scene.local_teams.get(m) is self.scene.player_team and isinstance(m,
gears.base.Combatant):
self.camp.check_trigger('ACTIVATE', m)
self.active.append(m)

def num_enemies(self):
"""Return the number of active, hostile characters."""
n = 0
Expand Down
220 changes: 206 additions & 14 deletions game/content/ghplots/bbmc_main.py

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion game/content/ghplots/multimission.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def call_stage(self, camp, mmission):
if dest:
dest(camp)
elif mmission.elements.get("ONE_SHOT", True):
print("Losing mission!")
mmission._lose_mission(camp)


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 @@ -256,13 +256,20 @@ def get_attack_missionseed(self, camp, attacking_team, start_node, target_node:
"LOSS_FUN": DefenderWinsEffect(attacking_team, target_node, self, True),
"TARGET_GATE": target_node.entrance, "TARGET_SCENE": target_node.destination,
"ENEMY_FACTION": target_node.destination.faction, "ALLIED_FACTION": attacking_team,
"NUM_STAGES": 2,
"NUM_STAGES": min(max(self.get_defense_strength(target_node)//2 + 1, 2), 5),
"MISSION_GRAMMAR": mission_grammar
})
)

return mybattle

def __setstate__(self, state):
# For saves from V0.946 or earlier, make sure there's a just_captured property.
self.__dict__.update(state)
if "just_captured" not in state:
self.just_captured = None



class WorldMapWarTurn:
DEFENDER_POSITIONS = [(-6, -16), (6, -16), (-12, -8), (-4, -8), (4, -8), (12, -8),
Expand Down
25 changes: 23 additions & 2 deletions game/content/plotutility.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,7 @@ class LMSkillsSelfIntro(Offer):
def __init__(self, npc: gears.base.Character):
items = list()
data = dict()
rank = min(max((npc.renown - 1) // 20, 0), 4)
items.append(self.RANK_GRAM[rank])
items.append(self.get_rank_gram(npc))

if not npc.mecha_pref:
AutoJoiner.get_mecha_for_character(npc)
Expand All @@ -545,6 +544,28 @@ def __init__(self, npc: gears.base.Character):
context=ContextTag((context.SELFINTRO,)), data=data, is_generic=True
)

@classmethod
def get_rank_gram(cls, npc):
rank = min(max((npc.renown - 1) // 20, 0), 4)
return cls.RANK_GRAM[rank]


class SkillExperienceEffect:
# An effect for conversations which will boost skill XP. Only works once. May include a secondary function to
# call.
def __init__(self, skill, xp_amount, other_fun=None):
self.ready = True
self.skill = skill
self.xp_amount = xp_amount
self.other_fun = other_fun

def __call__(self, camp: gears.GearHeadCampaign):
if self.ready:
self.ready = False
camp.dole_xp(self.xp_amount, self.skill)
if self.other_fun:
self.other_fun(camp)


class EffectCallPlusNPC:
# Normally an effect call from dialogue or using a waypoint calls a function with signature (camp).
Expand Down
4 changes: 4 additions & 0 deletions game/ghdialogue/ghreplies.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@
destination=Cue(ContextTag([context.ANSWER])),
context=ContextTag([context.QUERY]))

SELFINTRO_CUSTOM = Reply("{reply}",
destination=Cue(ContextTag([context.CUSTOM])),
context=ContextTag([context.SELFINTRO]))

SELFINTRO_GOODBYE = Reply("[SELFINTRO:GOODBYE]",
context=ContextTag([context.SELFINTRO]),
destination=Cue(ContextTag([context.GOODBYE])))
Expand Down
2 changes: 2 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Updated Bear Bastard's Mecha Camp scenario
* Added check_party_activation method to combat
* NPCs will give useful rumors first, then random chat
* Added pre-fx to conversation offers
* Single firing weapons can now cause critical hits, as in previous GearHead games
Expand Down

0 comments on commit 7b5f227

Please sign in to comment.