def on_render(self, console: tcod.Console) -> None: """Render an inventory menu, which displays the items in the inventory, and the letter to select them. Will move to a different position based on where the player is located, so the player can always see where they are. """ super().on_render(console) number_of_items_in_inventory = len(self.engine.player.inventory.items) height = 16 if height <= 3: height = 3 if self.engine.player.x <= 30: x = 20 else: x = 0 y = 0 width = len(self.TITLE) + 40 console.draw_frame( x=x, y=y, width=width, height=height, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), )
def render_ui_box( console: Console, engine: Engine, ) -> None: console.draw_rect(x=1, y=44, width=98, height=5, ch=1, bg=color.ui_box_bg) console.draw_frame(1, 44, 98, 5, "", True, color.ui_box_fg, color.ui_box_bg) console.draw_rect(x=22, y=45, width=1, height=3, ch=9474, fg=color.ui_box_fg) console.print(x=2, y=45, string=engine.player.name, fg=color.ui_box_fg)
def render_messages(cls, console: tcod.Console, x: int, y: int, width: int, height: int, messages: Reversible[Message], ) -> None: """Render the messages provided. The `messages` are rendered starting at the last message and working backwards. """ console.draw_frame( x=x, y=y, width=width, height=height, title="Ship Log", ) width-=2 height-=2 y_offset = height - 1 for message in reversed(messages): for line in reversed(list(cls.wrap(message.full_text, width))): console.print(x=x+1, y=y + y_offset+1, string=line, fg=message.fg) y_offset -= 1 if y_offset < 0: return # No more space to print messages.
def render(self, console: tcod.Console, *, fg:Optional[Tuple[int,int,int]]=None, bg:Optional[Tuple[int,int,int]]=None, x=0, y=0 ): console.draw_frame( x=self.x+x, y=self.y+y, title=self.title, width=self.width, height=self.height, fg=fg if fg else self.fg, bg=bg if bg else self.bg, ) console.print_box( x=self.x+1+x,y=self.y+1+y, height=self.height-2, width=self.width-2, fg=fg if fg else self.fg, bg=bg if bg else self.bg, string=self.text ) console.print( x=self.x + 1 + x, y=self.y + 1 + self.index + y - self.offset, string=f"{self.index_items[self.index]:<{self.width_2}}", bg=fg if fg else self.fg, fg=bg if bg else self.bg )
def render(self, console: tcod.Console, *, x:int=0, y:int=0, fg:Optional[Tuple[int,int,int]]=None, bg:Optional[Tuple[int,int,int]]= None, text:Optional[str]=None, alignment:Optional[int]=None ): console.draw_frame( x=x+self.x, y=y+self.y, width=self.width, height=self.height, title=self.title, fg=fg if fg else self.fg, bg=bg if bg else self.bg, ) string_text = text if text is not None else self.text console.print_box( x=x+self.x+1, y=y+self.y+1, height=self.height-2, width=self.width-2, string=string_text, fg=fg if fg else self.fg, bg=bg if bg else self.bg, alignment=alignment if alignment is not None else self.alignment )
def render_menu(console: Console, map_height: int, menu_width: int) -> None: console.draw_frame(0, map_height, menu_width, 7, "MENU", True, fg=(255, 255, 255), bg=(0, 0, 0)) console.draw_frame(80, 0, 20, 43, "EVENTS", True, fg=(255, 255, 255), bg=(0, 0, 0))
def render_command_box(console: Console, gameData:GameData, title:str): console.draw_frame( x=CONFIG_OBJECT.command_display_x, y=CONFIG_OBJECT.command_display_y, width=CONFIG_OBJECT.command_display_end_x - CONFIG_OBJECT.command_display_x, height=CONFIG_OBJECT.command_display_end_y - CONFIG_OBJECT.command_display_y, title=title )
def on_render(self, console: tcod.Console) -> None: super().on_render(console) x, y = self.engine.mouse_location console.draw_frame(x=x - self.radius - 1, y=y - self.radius - 1, width=self.radius**2, height=self.radius**2, fg=color.red, clear=False)
def on_render(self, console: Console) -> None: super().on_render(console) if self.engine.player.x <= 30: x = 40 else: x = 30 y = 0 width = len(self.TITLE) + 4 console.draw_frame( x=x, y=y, width=width, height=7, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) console.print( x=x + 1, y=y + 1, string=f"Level: {self.engine.player.level.current_level}", ) console.print( x=x + 1, y=y + 2, string=f"XP: {self.engine.player.level.current_xp}", ) console.print( x=x + 1, y=y + 3, string= f"XP to next level: {self.engine.player.level.experience_to_next_level}", ) console.print( x=x + 1, y=y + 4, string=f"Attack: {self.engine.player.fighter.power}", ) console.print( x=x + 1, y=y + 5, string=f"Defense: {self.engine.player.fighter.defense}", )
def on_render(self, console: tcod.Console) -> None: """Render an inventory menu, which displays the items in the inventory, and the letter to select them. Will move to a different position based on where the player is located, so the player can always see where they are. """ super().on_render(console) number_of_items_in_inventory = len(self.engine.player.inventory.items) height = number_of_items_in_inventory + 2 if height <= 3: height = 3 if self.engine.player.x <= 30: x = 40 else: x = 0 y = 0 width = len(self.TITLE) + 4 console.draw_frame( x=x, y=y, width=width, height=height, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) console.print(x + 1, y, f" {self.TITLE} ", fg=(0, 0, 0), bg=(255, 255, 255)) if number_of_items_in_inventory > 0: for i, item in enumerate(self.engine.player.inventory.items): item_key = chr(ord("a") + i) is_equipped = self.engine.player.equipment.item_is_equipped( item) item_string = f"({item_key}) {item.name}" if is_equipped: item_string = f"{item_string} (E)" console.print(x + 1, y + i + 1, item_string) else: console.print(x + 1, y + 1, "(Empty)")
def on_render(self, console: tcod.Console) -> None: """highlight the tile under the cursor""" super().on_render(console) x, y = self.engine.mouse_location # draw a rectangle around teh targeted area console.draw_frame( x=x - self.radius - 1, y=y - self.radius - 1, width=self.radius ** 2, height=self.radius ** 2, fg=color.red, clear=False, )
def on_render(self, console: tcod.Console) -> None: """Highlight the tile under the cursor.""" super().on_render(console) x, y = self.engine.mouse_location # Draw a rectangle around the targeted area, so the player can see the affected tiles. console.draw_frame( x=x - self.radius - 1, y=y - self.radius - 1, width=self.radius**2, height=self.radius**2, fg=color.red, clear=False, )
def on_render(self, console: tcod.Console) -> None: """Renders the character info screen at the given location""" super().on_render(console) if self.engine.player.x <= 30: x = 40 else: x = 0 y = 0 width = len(self.TITLE) + 4 console.draw_frame( x=x, y=y, width=width, height=9, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) console.print( x=x + 1, y=y + 1, string=f"Level: {self.engine.player.level.current_level}") console.print(x=x + 1, y=y + 2, string=f"XP: {self.engine.player.level.current_xp} / " f"{self.engine.player.level.experience_to_next_level}") console.print( x=x + 1, y=y + 4, string=f"Strength: {self.engine.player.fighter.strength}") console.print( x=x + 1, y=y + 5, string=f"Constitution: {self.engine.player.fighter.constitution}") console.print(x=x + 1, y=y + 6, string=f"Agility: {self.engine.player.fighter.agility}") console.print( x=x + 1, y=y + 7, string=f"Intelligence: {self.engine.player.fighter.intelligence}")
def on_render(self, console: tcod.Console) -> None: """Renders the character's level up screen at the given location""" super().on_render(console) if self.engine.player.x <= 30: x = 40 else: x = 0 console.draw_frame(x=x, y=0, width=35, height=10, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0)) console.print(x=x + 1, y=1, string="Congratulations! You leveled up!") console.print(x=x + 1, y=2, string="Select an attribute to increase") console.print(x=x + 1, y=4, string=f"a) HP ({self.engine.player.fighter.max_hp} > " f"{self.engine.player.fighter.max_hp + 20})") console.print( x=x + 1, y=5, string=f"b) Strength ({self.engine.player.fighter.strength} > " f"{self.engine.player.fighter.strength + 1})") console.print( x=x + 1, y=6, string= f"c) Constitution ({self.engine.player.fighter.constitution} > " f"{self.engine.player.fighter.constitution + 1})") console.print( x=x + 1, y=7, string=f"d) Agility ({self.engine.player.fighter.agility} > " f"{self.engine.player.fighter.agility + 1})") console.print( x=x + 1, y=8, string= f"e) Intelligence ({self.engine.player.fighter.intelligence} > " f"{self.engine.player.fighter.intelligence + 1})")
def on_render(self, console: tcod.Console) -> None: super().on_render(console) if self.engine.player.x <= 30: x = 40 else: x = 0 y = 0 width = len(self.TITLE) + 4 console.draw_frame( x=x, y=y, width=width, height=7, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) console.print( x=x + 1, y=y + 1, string=f"Level: {self.engine.player.level.current_level}") console.print(x=x + 1, y=y + 2, string=f"XP: {self.engine.player.level.current_xp}") console.print( x=x + 1, y=y + 3, string= f"XP for next level: {self.engine.player.level.experience_to_next_level}", ) console.print( x=x + 1, y=y + 4, string= f"Strength: {self.engine.player.strength} (+{self.engine.player.str_bonus})" ) console.print( x=x + 1, y=y + 5, string= f"Dexterity: {self.engine.player.dexterity} (+{self.engine.player.dex_bonus})" )
def render(self, console: tcod.Console, *, x:int=0, y:int=0, fg:Optional[Tuple[int,int,int]]=None, bg:Optional[Tuple[int,int,int]]= None, text:Optional[str]=None, cursor_position:Optional[int]=None ): fg, bg = (fg if fg else self.fg), (bg if bg else self.bg) console.draw_frame( x=x+self.x, y=y+self.y, width=self.width, height=self.height, title=self.title, fg=fg, bg=bg, ) string_text = text if text is not None else self.text console.print_box( x=x+self.x+1, y=y+self.y+1, height=self.height-2, width=self.width-2, string=string_text, fg=fg, bg=bg, alignment=self.alignment, ) if cursor_position is not None: try: char = string_text[cursor_position] except IndexError: char = " " console.print( x=self.x + 1 + (self.width - 2) + cursor_position - len(string_text) if self.alignment == constants.RIGHT else self.x + 1 + cursor_position, y=self.y+1, string=char, fg=bg, bg=fg, )
def render_inventory_menu(console: Console, engine: Engine) -> None: """ Render an inventory menu, which displays the items in the inventory, and the letter to select them. Will move to a different position based on where the player is located, so the player can always see where they are. """ console.draw_frame(80, 0, 20, 43, "INVENTORY", True, fg=(255, 255, 255), bg=(0, 0, 0)) number_of_items_in_inventory = len(engine.player.inventory.items) width = 20 # number_of_items_in_inventory + 2 height = engine.player.inventory.capacity + 2 if height <= 3: height = 3 # TODO: Fix these values, not quite right if engine.player.x <= 20: x = 20 else: x = 0 if engine.player.y <= 20: y = 20 else: y = 0 # console.draw_frame(x=x, y=y, width=width, height=height, title="Inventory", clear=True, fg=(255, 255, 255), # bg=(0, 0, 0)) letter_index = ord('a') for i in range(engine.player.inventory.capacity): try: text = f"({chr(letter_index)}) {engine.player.inventory.items[i].name}" except AttributeError: text = f"({chr(letter_index)})" console.print(81, y=i+1, string=text) letter_index += 1
def render_task(console: Console, motivation: int, T_energy: int, special: bool) -> None: console.draw_frame(x=1, y=1, width=33, height=9, title="Accept the task?", fg=colors.salmon, bg=colors.bar_filled) console.print( x=2, y=2, string= f"""motivation: {motivation}\nT energy gain: {T_energy}\nspecial?: {special}\n \n[y]- accept task\n[n]- move onwards""", fg=colors.bar_text)
def on_render(self, console: tcod.Console) -> None: super().on_render(console) number_of_items_in_inventory = len(self.engine.player.inventory.items) height = number_of_items_in_inventory + 2 if height <= 3: height = 3 if self.engine.player.x <= 30: x = 40 else: x = 0 y = 0 width = len(self.TITLE) + 4 console.draw_frame( x=x, y=y, width=width, height=height, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) if number_of_items_in_inventory > 0: for i, item in enumerate(self.engine.player.inventory.items): item_key = chr(ord("a") + i) is_equipped = self.engine.player.equipment.item_is_equipped( item) item_string = f"({item_key}) {item.name}" if is_equipped: item_string = f"{item.string} (E)" console.print(x + 1, y + i + 1, item_string) else: console.print(x + 1, y + 1, "(Empty)")
def on_render(self, console: tcod.Console) -> None: """render an inventory menu which displays the inventory items select with corresponding letter move to a different position based on user location so the playre can see where they are""" super().on_render(console) number_of_items_in_inventory = len(self.engine.player.inventory.items) height = number_of_items_in_inventory + 2 if height <= 3: height = 3 if self.engine.player.x <= 30: x = 40 else: x = 0 y = 0 width = len(self.TITLE) + 4 console.draw_frame( x=x, y=y, width=width, height=height, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) if number_of_items_in_inventory > 0: for i, item in enumerate(self.engine.player.inventory.items): item_key = chr(ord("a") + i) is_equipped = self.engine.player.equipment.item_is_equipped(item) item_string = f"({item_key}) {item.name}" if is_equipped: item_string = f"{item_string} (E)" console.print(x + 1, y + i + 1, item_string) else: console.print(x + 1, y + 1, "(Empty)")
def on_render(self, console: tcod.Console) -> None: """Render an ability menu, which displays the spells in the ability menu, and the letter to select them. Will move to a different position based on where the player is located, so the player can always see where they are. """ super().on_render(console) number_of_abilities_in_ability_menu = len( self.engine.player.ability_menu.abilities) height = number_of_abilities_in_ability_menu + 2 if height <= 3: height = 3 if self.engine.player.x <= 30: x = 40 else: x = 0 y = 0 width = len(self.TITLE) + 4 console.draw_frame( x=x, y=y, width=width, height=height, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) if number_of_abilities_in_ability_menu > 0: for i, item in enumerate( self.engine.player.ability_menu.abilities): item_key = chr(ord("a") + i) console.print(x + 1, y + i + 1, f"({item_key}) {item.name}") else: console.print(x + 1, y + 1, "(Empty)")
def on_render(self, console: Console) -> None: super().on_render(console) if self.engine.player.x <= 30: x = 40 else: x = 0 console.draw_frame( x=x, y=0, width=35, height=8, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) console.print(x=x + 1, y=1, string="Congratulations! You level up!") console.print(x=x + 1, y=2, string="Select an attribute to increase.") console.print( x=x + 1, y=4, string=f"a) Health: raise from {self.engine.player.fighter.max_hp}", ) console.print( x=x + 1, y=5, string= f"b) Strength (+1 on attack, from {self.engine.player.fighter.power}", ) console.print( x=x + 1, y=6, string= f"c) Agility (+1 on defense, from {self.engine.player.fighter.defense}", )
def render_position(console: Console, gameData:GameData): w = CONFIG_OBJECT.position_info_end_x - CONFIG_OBJECT.position_info_x h = CONFIG_OBJECT.position_info_end_y - CONFIG_OBJECT.position_info_y console.draw_frame( x=CONFIG_OBJECT.position_info_x, y=CONFIG_OBJECT.position_info_y, width=w, height=h, title=gameData.condition.text, fg=gameData.condition.fg, bg=gameData.condition.bg ) console.print_box( x=CONFIG_OBJECT.position_info_x+1, y=CONFIG_OBJECT.position_info_y+1, string=gameData.info_description, width=w-2, height=h-2 )
def on_render(self, console: tcod.Console) -> None: super().on_render(console) if self.engine.player.x <= 30: x = 40 else: x = 0 console.draw_frame( x=x, y=0, width=35, height=8, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) console.print(x=x + 1, y=1, string="Congratulations! You level up!") console.print(x=x + 1, y=2, string="Select an attribute to increase.") console.print( x=x + 1, y=4, string= f"a) Constitution (+20 HP, from {self.engine.player.fighter.max_hp})", ) console.print( x=x + 1, y=5, string=f"b) Strength (from {self.engine.player.strength})", ) console.print( x=x + 1, y=6, string=f"c) Dexterity (from {self.engine.player.dexterity})", )
def on_render(self, console: tcod.Console) -> None: super().on_render(console) if self.engine.player.x <= 30: x = 40 else: x = 0 console.draw_frame( x=x, y=0, width=35, height=8, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) console.print(x=x + 1, y=1, string="congrats, lup!") console.print(x=x + 1, y=2, string="Select an attribute to increase") console.print( x=x + 1, y=4, string=f"a) Constitution (+20HP, from {self.engine.player.fighter.max_hp})", ) console.print( x=x + 1, y=5, string=f"b) Strength (+1 attack, from {self.engine.player.fighter.power})", ) console.print( x=x + 1, y=6, string=f"c) Agility (+ defense, from {self.engine.player.fighter.defense})", )
def on_render(self, console: tcod.Console) -> None: super().on_render(console) # Draw the main state as the background. log_console = Console(console.width - 6, console.height - 6) # Draw the frame with a custom banner title log_console.draw_frame(0, 0, log_console.width, log_console.height) log_console.print_box(0, 0, log_console.width, 1, "-|Message History|-", alignment=tcod.CENTER) # Render the message log using the cursor param self.engine.message_log.render_messages( log_console, 1, 1, log_console.width - 2, log_console.height - 2, self.engine.message_log.messages[:self.cursor + 1], ) log_console.blit(console, 3, 3)
def render_other_ship_info(console: Console, gamedata:GameData, ship:Optional[Starship]=None): start_x = CONFIG_OBJECT.other_ship_display_x start_y = CONFIG_OBJECT.other_ship_display_y width = CONFIG_OBJECT.other_ship_display_end_x - CONFIG_OBJECT.other_ship_display_x height = CONFIG_OBJECT.other_ship_display_end_y - CONFIG_OBJECT.other_ship_display_y ship_planet_or_star = gamedata.selected_ship_planet_or_star if ship_planet_or_star: if isinstance(ship_planet_or_star, Starship): if not gamedata.ship_scan: gamedata.ship_scan = gamedata.selected_ship_planet_or_star.scan_for_print( gamedata.player.sensors.determin_precision ) print_ship_info( console=console, x=start_x, y=start_y, width=width, height=height, self=ship_planet_or_star, scan=gamedata.ship_scan, precision=gamedata.player.sensors.determin_precision ) elif isinstance(ship_planet_or_star, Planet): console.draw_frame( x=start_x, y=start_y, width=width, height=height, title="Planet" ) console.print( x=start_x+3, y=start_y+4, string=f"Planet at {ship_planet_or_star.local_coords.x}, {ship_planet_or_star.local_coords.y}" ) planet_status = ship_planet_or_star.planet_habbitation.description console.print_box( x=start_x+3, y=start_y+6, width=width-6, height=6, string=f"Planet status: {planet_status}\n\nPlanet development: {ship_planet_or_star.infastructure:.3}" ) elif isinstance(ship_planet_or_star, Star): console.draw_frame( x=start_x, y=start_y, width=width, height=height, title="Star" ) x, y = ship_planet_or_star.local_coords.x, ship_planet_or_star.local_coords.y console.print_rect( x=start_x+3, y=start_y+4, string=f"{ship_planet_or_star.name} star at {x}, {y}", height=4, width=width - (3 + 2) ) else: console.draw_frame( x=start_x, y=start_y, width=width, height=height, title="No Ship/Planet Selected" )
def print_ship_info( console:Console, x:int, y:int, width:int, height:int, self:Starship, scan:Dict[str,Any], precision:int ): ship_status = self.ship_status try: cloak_is_on = self.cloak.cloak_is_turned_on except AttributeError: cloak_is_on = False frame_fg = ( colors.cloaked if self is self.game_data.player and cloak_is_on else colors.white ) console.draw_frame( x=x, y=y, width=width, height=height, title=self.proper_name, fg=frame_fg, bg=colors.black ) console.print( x=x+2, y=y+2, string=f"Position: {self.local_coords.x}, {self.local_coords.y}", fg=colors.white ) if ship_status == STATUS_HULK: console.print_box( x+2, y=y+3, width=width - 4, height=4, string=f"Remains of the {self.proper_name}", fg=colors.white ) else: add_to_y = 4 for i, n, d, c, m in zip( range(2), ( "Hull:", "Energy:" ), ( scan['hull'][0], scan['energy'][0] ), ( scan['hull'][1], scan['energy'][1] ), ( self.ship_class.max_hull, self.ship_class.max_energy, ) ): console.print(x=x+3, y=y+i+add_to_y, string=f"{n:>16}", fg=colors.white) console.print(x=x+3+16, y=y+i+add_to_y, string=f"{d: =4}", fg=c) console.print(x=x+3+16+4, y=y+i+add_to_y, string=f"/{m: =4}", fg=colors.white) add_to_y += 1 try: n = "Shields:" d = scan['shields'][0] c = scan['shields'][1] m = self.ship_class.max_shields add_to_y += 1 console.print(x=x+3, y=y+add_to_y, string=f"{n:>16}", fg=colors.white) console.print(x=x+3+16, y=y+add_to_y, string=f"{d: =4}", fg=c) console.print(x=x+3+16+4, y=y+add_to_y, string=f"/{m: =4}", fg=colors.white) except KeyError: pass try: n = "Polarization:" d = scan['polarization'][0] c = scan['polarization'][1] m = self.ship_class.polarized_hull add_to_y += 1 console.print(x=x+3, y=y+add_to_y, string=f"{n:>16}", fg=colors.white) console.print(x=x+3+16, y=y+add_to_y, string=f"{d: =4}", fg=c) console.print(x=x+3+16+4, y=y+add_to_y, string=f"/{m: =4}", fg=colors.white) except KeyError: pass try: hd, hc = scan["hull_damage"] n = "Perm. Hull Dam.:" add_to_y+=1 console.print(x=x+3, y=y+i+add_to_y, string=f"{n:>16}", fg=colors.white) console.print(x=x+3+16, y=y+i+add_to_y, string=f"{hd: =4}", fg=hc) except KeyError: pass add_to_y+=1 sys_x_position = (width - 2) // 2 if not self.ship_class.is_automated: try: injured_crew_amount = scan['injured_crew'][0] injured_crew_color = scan['injured_crew'][1] r = 2 if injured_crew_amount else 1 except KeyError: injured_crew_amount=0 injured_crew_color=colors.white r = 1 for i, n, d, c, m in zip( range(r), ( "Able Crew:", "Injured Crew:" ), ( scan['able_crew'][0], injured_crew_amount ), ( scan['able_crew'][1], injured_crew_color ), ( self.ship_class.max_crew, self.ship_class.max_crew ) ): console.print(x=x+3, y=y+i+add_to_y, string=f"{n:>16}", fg=colors.white) console.print(x=x+3+16, y=y+i+add_to_y, string=f"{d: =4}", fg=c) console.print(x=x+3+16+4, y=y+i+add_to_y, string=f"/{m: =4}", fg=colors.white) add_to_y += r try: d_n = scan["cloak_cooldown"][0] d_c = scan["cloak_cooldown"][1] m = self.ship_class.cloak_cooldown console.print(x=x+3, y=y+add_to_y, string=f"{'C. Cooldown:':>16}", fg=colors.white) console.print(x=x+3+16, y=y+add_to_y, string=f"{d_n: =4}", fg=d_c) console.print(x=x+3+16+4, y=y+add_to_y, string=f"/{m: =4}", fg=colors.white) add_to_y+=1 except KeyError: pass try: boarders:Tuple[Nation, Tuple[int,int]] = scan["boarders"] add_to_y+=1 console.print(x=x+sys_x_position, y=y+add_to_y, string=f"{'-- Boarders --'}", alignment=tcod.CENTER, fg=colors.white) add_to_y+=1 for k, v in boarders: console.print(x=x+3, y=y+add_to_y, string=f"{k.name_short} {v[0]} {v[1]}") add_to_y+=1 except KeyError: pass add_to_y+=1 if self.ship_class.ship_type_can_fire_torps: max_torps = self.ship_class.max_torpedos console.print( x=x+3+2, y=y+add_to_y, string=f"Torpedo Tubes:{self.ship_class.torp_tubes: =2}", fg=colors.white ) ''' console.print( x=x+3+3, y=y+add_to_y+1, string=f"Max Torpedos:{max_torps: =2}", fg=colors.white ) ''' add_to_y+=1 for i, t in enumerate(self.ship_class.torp_dict.keys()): console.print( x=x+3, y=y+add_to_y, string=f"{t.cap_name + ':':>16}", fg=colors.white ) console.print( x=x+3+16, y=y+add_to_y, string=f"{self.torpedo_launcher.torps[t]: =2}", fg=scan["torpedo_color"] ) console.print( x=x+3+16+4, y=y+add_to_y, string=f"/{max_torps: =2}", fg=colors.white ) add_to_y+=1 names, keys = self.ship_class.system_names, self.ship_class.system_keys #add_to_y+=1 console.print(x=x+sys_x_position, y=y+add_to_y, string="-- Systems --", alignment=tcod.CENTER, fg=colors.white) add_to_y+=1 for n, k, i in zip(names, keys, range(len(keys))): scanned = scan[k][0] scan_color = scan[k][1] #k = keys[i-(s+3)] #n__n = f"{n:>17}" n__n = scan[k][2] s__s = f"{scanned}" console.print(x=x+3, y=y+i+add_to_y, string=f"{n__n}", fg=colors.white) console.print(x=x+3+17, y=y+i+add_to_y, string=f"{s__s}", fg=scan_color)
def on_render(self, console: tcod.Console) -> None: super().on_render(console) if self.engine.player.x <= 30: x = 40 else: x = 0 y = 0 width = len(self.TITLE) + 8 console.draw_frame( x=x, y=y, width=width, height=13, title=self.TITLE, clear=True, fg=(255, 255, 255), bg=(0, 0, 0), ) console.print( x=x + 1, y=y + 1, string=f"Main Class: {self.engine.player.Class.class_lvl}") console.print( x=x + 1, y=y + 2, string=f"Subclass: {self.engine.player.Subclass.class_lvl}") console.print(x=x + 1, y=y + 3, string=f"XP: {self.engine.player.level.current_xp}") console.print( x=x + 1, y=y + 4, string= f"Total Level: {self.engine.player.Class.class_lvl + self.engine.player.Subclass.class_lvl}" ) console.print( x=x + 1, y=y + 4, string= f"XP for next Main Level: {self.engine.player.Class.experience_to_next_level}", ) console.print( x=x + 1, y=y + 5, string= f"XP for next Sub Level: {self.engine.player.Subclass.experience_to_next_level}", ) console.print(x=x + 1, y=y + 6, string=f"Attack: {self.engine.player.fighter.power}") console.print(x=x + 1, y=y + 7, string=f"Defense: {self.engine.player.fighter.defense}") console.print( x=x + 1, y=y + 8, string=f"Mana Regen: {self.engine.player.fighter.mana_regen}")
def print_system(console:Console, gamedata:GameData): x = CONFIG_OBJECT.subsector_display_x y = CONFIG_OBJECT.subsector_display_y width = CONFIG_OBJECT.subsector_width heigth = CONFIG_OBJECT.subsector_height player = gamedata.player console.print_box( x=x+1, y=y+1, width=width * 2, height=heigth * 2, string=GRID, fg=colors.blue, ) console.draw_frame( x=x + (player.local_coords.x * 2), y=y + (player.local_coords.y * 2), width=3, height=3, fg=colors.yellow, clear=False ) if player.game_data.selected_ship_planet_or_star is not None: selected = player.game_data.selected_ship_planet_or_star console.draw_frame( x=x + (selected.local_coords.x * 2), y=y + (selected.local_coords.y * 2), height=3, width=3, fg=colors.orange, clear=False ) console.draw_frame( x=x, y=y, width=width * 2 + 1, height=heigth * 2 + 1, title="System", clear=False ) sector:SubSector = player.get_sub_sector for c, star in sector.stars_dict.items(): console.print( x=x + (c.x * 2) + 1, y=y + (c.y * 2) + 1, string="*", fg=star.color,bg=star.bg ) ships = gamedata.visible_ships_in_same_sub_sector_as_player #number_of_ships = len(ships) for c, planet in sector.planets_dict.items(): console.print( x=x + (c.x * 2) + 1, y=y + (c.y * 2) + 1, string="#", fg=planet.player_display_status.color ) for s in ships: if s.ship_status.is_visible: """ console.draw_frame( x=x + (s.local_coords.x * 2), y=y + (s.local_coords.y * 2), width=3, height=3, fg=colors.white ) """ console.print( x=x + (s.local_coords.x * 2) + 1, y=y + (s.local_coords.y * 2) + 1, string=s.ship_class.symbol, fg=s.ship_status.override_color if s.ship_status.override_color else s.ship_class.nation.nation_color ) console.print( x=x + (player.local_coords.x * 2) + 1, y=y + (player.local_coords.y * 2) + 1, string=player.ship_class.symbol, fg=colors.lime)