def __init__(self, camp, plot, character: gears.base.Character, dest_scene, dest_team, allow_death=False, upgrade_mek=True, suppress_warnings=False): # Record the character's original location, move them to the new location. # Only set suppress_warnings to True if you know what you're doing, i.e. you are me. It only suppresses the # warning about characters not being locked; this is only a problem if you are in an adventure with random # plots or dynamic content. That would mean most adventures. self.original_scene = character.scene if not suppress_warnings: if character not in plot.get_locked_elements(): print( "Warning: Character {} should be locked by {} before moving!" .format(character, plot)) if not (hasattr(character, "container") and character.container): print( "Warning: Character {} moved by {} has no original container!". format(character, plot)) character.container = None elif not self.original_scene: print("Warning: Character {} moved by {} has no original scene!". format(character, plot)) if not plot.active: print("Warning: Plot {} not active") if not plot.scope: print("Warning: Plot {} has no scope set") character.restore_all() self.character = character self.original_container = character.container self.is_lancemate = character in camp.party if self.is_lancemate: AutoLeaver(character)(camp) # Check to see if the character can use a mecha in the destination scene. if character.combatant and dest_scene.scale is gears.scale.MechaScale: mek = AutoJoiner.get_mecha_for_character(character) if mek: if upgrade_mek: gears.champions.upgrade_to_champion(mek) mek.load_pilot(character) character = mek self.dest = dest_scene character.place(dest_scene, team=dest_team) self.allow_death = allow_death plot.call_on_end.append(self) if hasattr(plot, "move_records"): plot.move_records.append((character, dest_scene.contents)) self.done = False
def __init__(self, camp, plot, character: gears.base.Character, dest_scene, dest_team, allow_death=False, upgrade_mek=True): # Record the character's original location, move them to the new location. self.original_scene = character.scene if character not in plot.get_locked_elements(): print( "Warning: Character {} should be locked by {} before moving!". format(character, plot)) if not (hasattr(character, "container") and character.container): print( "Warning: Character {} moved by {} has no original container!". format(character, plot)) character.container = None elif not self.original_scene: print("Warning: Character {} moved by {} has no original scene!". format(character, plot)) if not plot.active: print("Warning: Plot {} not active") if not plot.scope: print("Warning: Plot {} has no scope set") character.restore_all() self.character = character self.original_container = character.container self.is_lancemate = character in camp.party if self.is_lancemate: AutoLeaver(character)(camp) # Check to see if the character can use a mecha in the destination scene. if character.combatant and dest_scene.scale is gears.scale.MechaScale: mek = AutoJoiner.get_mecha_for_character(character) if mek: if upgrade_mek: gears.champions.upgrade_to_champion(mek) mek.load_pilot(character) character = mek self.dest = dest_scene character.place(dest_scene, team=dest_team) self.allow_death = allow_death plot.call_on_end.append(self) plot.move_records.append((character, dest_scene.contents)) self.done = False
def _is_good_npc(self, nart, candidate: gears.base.Character): if self.npc_is_ready_for_lancedev(nart.camp, candidate): return ( nart.camp.pc.has_badge("Criminal") and gears.tags.Police in candidate.get_tags() and candidate.relationship.role in (None,gears.relationships.R_OPPONENT) )
def create_and_invoke_with_pc(cls, pc: gears.base.Character): # Run the UI. myui = cls(pc, pc.portrait_gen, pc.get_portrait(), gears.portraits.Portrait.get_form_tags(pc)) pbge.my_state.widgets.append(myui) myui.children.append( pbge.widgets.LabelWidget(150, 220, 80, 0, text="Done", justify=0, on_click=myui.done_button, draw_border=True)) keepgoing = True while keepgoing and not myui.finished and not pbge.my_state.got_quit: ev = pbge.wait_event() if ev.type == pbge.TIMEREVENT: pbge.my_state.view() pbge.my_state.do_flip() elif ev.type == pygame.KEYDOWN: if ev.key == pygame.K_ESCAPE: keepgoing = False elif ev.key == pygame.K_F1: pygame.image.save(myui.portrait.bitmap, pbge.util.user_dir("out.png")) pbge.my_state.widgets.remove(myui)
def _get_generic_offers(self, npc: gears.base.Character, camp: gears.GearHeadCampaign): """Get any offers that could apply to non-element NPCs.""" goffs = list() if npc.faction is self.elements["FACTION"]: rank = self.rank + 10 - npc.get_reaction_score(camp.pc, camp)//10 qol: gears.QualityOfLife = self.elements["METRO"].get_quality_of_life() if qol.defense > 0: # This town has good defenses. Convincing them to help will be easier. diff = gears.stats.DIFFICULTY_EASY elif qol.defense < 0: diff = gears.stats.DIFFICULTY_LEGENDARY else: diff = gears.stats.DIFFICULTY_AVERAGE goffs.append(Offer( "[YOUR_PLAN_IS_HOPELESS] {}".format(random.choice(self.RETORTS)), context=ContextTag((context.CUSTOM,)), subject=self, subject_start=True, data={"reply":random.choice(self.PLEAS).format(**self.elements)} )) ghdialogue.SkillBasedPartyReply( Offer( "Alright, when you fight Cetus, you will have the support of {}.".format(self.elements["METROSCENE"]), context=ContextTag((context.CUSTOMREPLY,)), subject=self, data={"reply":self.NEGCHARM[min(camp.campdata.get(DZDCVAR_NUM_ALLIANCES,0),3)]}, effect=self._win_plot ), camp, goffs, gears.stats.Charm, gears.stats.Negotiation, rank, diff ) return goffs
def _get_generic_offers(self, npc: gears.base.Character, camp: gears.GearHeadCampaign): """ :type camp: gears.GearHeadCampaign :type npc: gears.base.Character """ mylist = list() if npc.relationship and gears.relationships.RT_LANCEMATE in npc.relationship.tags: if camp.can_add_lancemate() and npc not in camp.party: # If the NPC has the lancemate tag, they might join the party. if npc.get_reaction_score(camp.pc, camp) < -20: # A lancemate who is currently upset with the PC will not join the party. mylist.append( Offer("[JOIN_REFUSAL]", is_generic=True, context=ContextTag([context.JOIN]))) elif npc.relationship.data.get("LANCEMATE_TIME_OFF", 0) <= camp.day: mylist.append( Offer("[JOIN]", is_generic=True, context=ContextTag([context.JOIN]), effect=game.content.plotutility.AutoJoiner(npc))) else: # This NPC is taking some time off. Come back tomorrow. mylist.append( Offer("[COMEBACKTOMORROW_JOIN]", is_generic=True, context=ContextTag([context.JOIN]))) elif npc in camp.party and gears.tags.SCENE_PUBLIC in camp.scene.attributes: mylist.append( Offer("[LEAVEPARTY]", is_generic=True, context=ContextTag([context.LEAVEPARTY]), effect=game.content.plotutility.AutoLeaver(npc))) mylist.append(LMSkillsSelfIntro(npc)) return mylist
def __init__(self, camp: gears.GearHeadCampaign, pc: gears.base.Character): super().__init__(0, 0, 0, 0) self.camp = camp self.pc = pc self.portrait = pc.get_portrait() self.portrait_area = pbge.frects.Frect(-400, -300, 400, 600) right_column = widgets.ColumnWidget(50, -200, 250, 400, padding=32, center_interior=True) self.children.append(right_column) name_column = widgets.ColumnWidget(0, 0, right_column.w, 64, draw_border=True, center_interior=True) name_column.add_interior( widgets.LabelWidget(0, 0, 100, 0, "name", justify=0)) self.name_widget = widgets.TextEntryWidget(0, 0, right_column.w - 20, 32, pc.name, font=pbge.BIGFONT, justify=0) name_column.add_interior(self.name_widget) right_column.add_interior(name_column) right_column.add_interior( widgets.LabelWidget(0, 0, right_column.w, 0, "Edit Portrait", font=pbge.BIGFONT, justify=0, draw_border=True, on_click=self._edit_portrait)) right_column.add_interior( widgets.LabelWidget(0, 0, right_column.w, 0, "Edit Gender", font=pbge.BIGFONT, justify=0, draw_border=True, on_click=self._edit_gender, text_fun=self._gender_fun)) right_column.add_interior( widgets.LabelWidget(0, 0, 200, 0, "Done", font=pbge.BIGFONT, justify=0, draw_border=True, on_click=self._done)) self.finished = False