def __init__(self, camp: gears.GearHeadCampaign): pbge.please_stand_by() self.camp = camp self.scene = camp.scene self.view = scenes.viewer.SceneView(camp.scene) self.mapcursor = pbge.image.Image('sys_mapcursor.png', 64, 64) self.time = 0 self.threat_tiles = set() self.threat_viewer = pbge.scenes.areaindicator.AreaIndicator( "sys_threatarea.png") self.record_count = 0 # Preload some portraits and sprites. self.preloads = list() for pc in self.scene.contents: if hasattr(pc, 'get_portrait'): self.preloads.append(pc.get_portrait()) if hasattr(pc, 'get_pilot'): pcp = pc.get_pilot() if pcp and pcp is not pc and hasattr(pcp, 'get_portrait'): self.preloads.append(pcp.get_portrait()) if hasattr(pc, 'get_sprite'): self.preloads.append(pc.get_sprite()) # Preload the music as well. if pbge.util.config.getboolean("GENERAL", "music_on"): if hasattr(self.scene, 'exploration_music'): pbge.my_state.locate_music(self.scene.exploration_music) if hasattr(self.scene, 'combat_music'): pbge.my_state.locate_music(self.scene.combat_music) # Update the view of all party members. first_pc = None for pc in camp.get_active_party(): if pc.pos and pc.is_operational(): x, y = pc.pos scenes.pfov.PCPointOfView( camp.scene, x, y, pc.get_sensor_range(self.scene.scale)) if not first_pc: first_pc = pc # Focus on the first PC. if first_pc: x, y = first_pc.pos self.view.focus(x, y) # Make sure all graphics are updated. for thing in self.scene.contents: if hasattr(thing, 'update_graphics'): thing.update_graphics() # Save the game, if the config says to. if pbge.util.config.getboolean("GENERAL", "auto_save"): camp.save()
def t_ENDCOMBAT(self, camp: gears.GearHeadCampaign): # The bouncer gets plot armor until the PCs can collect the card. npc: gears.base.Character = self.elements["BOUNCER"] if not npc.is_operational(): if camp.get_active_party(): pbge.alert( "You find an passcard for the elevator on {}'s belt.". format(npc)) self.win_missiom(camp) else: npc.wipe_damage()
def t_COMBATROUND(self, camp: gears.GearHeadCampaign): myteam = self.elements["_eteam"] heads = myteam.get_members_in_play(camp) num_heads = len(heads) # See if a new head is going to pop up. if num_heads > 0 and num_heads < 4 and random.randint(1, 2) == 1: mymon = gears.selector.get_design_by_full_name("DZD Kerberos") camp.scene.deploy_team([ mymon, ], myteam) pbge.my_state.view.play_anims( gears.geffects.SmokePoof(pos=mymon.pos)) camp.fight.activate_foe(mymon) heads.append(mymon) # See if a head will kidnap anyone. if not camp.campdata["KERBEROS_DUNGEON_OPEN"]: candidates = list() for pc in camp.get_active_party(): draggers = [ h for h in heads if camp.scene.distance(pc.pos, h.pos) <= 1 ] if len(draggers) > 1: candidates.append([pc, draggers]) if candidates: pc, draggers = random.choice(candidates) pilot = pc.get_pilot() is_pc = pilot == camp.pc if is_pc: pbge.alert( "Suddenly, the monster's heads wrap around your {} and begin to drag you underground..." .format(pc)) else: pbge.alert( "Suddenly, the monster's heads wrap around {} and begin to drag {} {} underground." .format(pilot, pilot.gender.possessive_determiner, pc)) pbge.my_state.view.play_anims( gears.geffects.SmokePoof(pos=pc.pos), *[gears.geffects.SmokePoof(pos=h.pos) for h in draggers]) for h in draggers: camp.scene.contents.remove(h) camp.campdata["KERBEROS_GRAB_FUN"](camp, pc) leftovers = [h for h in heads if h not in draggers] if leftovers: pbge.my_state.view.play_anims(*[ gears.geffects.SmokePoof(pos=h.pos) for h in leftovers ]) for h in leftovers: camp.scene.contents.remove(h) self.adv.cancel_adventure(camp)
def _pay_respects(self, camp: gears.GearHeadCampaign): self.paid_respects = True candidates = list() for pc in camp.get_active_party(): if pc is not camp.pc and isinstance(pc, gears.base.Character) and pc.get_tags().intersection( {gears.tags.Faithworker, gears.personality.Fellowship}): candidates.append(pc) pc.relationship.reaction_mod += random.randint(3, 8) if candidates: speaker = random.choice(candidates) else: speaker = camp.pc ghcutscene.SimpleMonologueDisplay("[EULOGY]", speaker)(camp) camp.dole_xp(100)
def abandon_distress_call(self, camp: gears.GearHeadCampaign): # Any non-criminal lancemates won't like this decision. candidates = [ npc for npc in camp.get_active_party() if isinstance(npc.get_pilot(), gears.base.Character) and gears.tags.Criminal not in npc.get_pilot().get_tags() and npc.get_pilot() is not camp.pc ] if candidates: npc = random.choice(candidates).get_pilot() npc.relationship.reaction_mod -= random.randint(6, 10) game.content.ghcutscene.SimpleMonologueDisplay( "[WE_SHOULD_HAVE_HELPED_THEM]", npc)(camp) self.cancel_the_adventure(camp)
def _heal_party(self, camp: gears.GearHeadCampaign): camp.credits -= self.coffee_price for pc in camp.get_active_party(): pc.restore_all() pbge.alert("After drinking the coffee, you feel ready to get back to the adventure!")