def color_dict_change_brightness(color_dict, mod): copy = color_dict.copy() for key in copy.keys(): if mod > 0: copy[key] = copy[key].__add__(Color(mod, mod, mod)) else: copy[key] = copy[key].__sub__(Color(-mod, -mod, -mod)) return copy
def apply_fov_gradient( tile_color, tile_distance, fov_radius, brightness_range=32, max_brightness=16, ): color_mod = (int(brightness_range * (tile_distance / fov_radius)) - max_brightness) # If the color modifier is above zero, the tile is darkened, otherwise it # is lightened if color_mod >= 0: return tile_color.__sub__(Color(color_mod, color_mod, color_mod)) color_mod = -color_mod return tile_color.__add__(Color(color_mod, color_mod, color_mod))
def get_memory_color(self, color): return color.__sub__( Color( self.memory_brightness_mod, self.memory_brightness_mod, self.memory_brightness_mod, ))
def biome_color(self, biome, x, y): r = biome_colors[biome].r g = biome_colors[biome].g b = biome_colors[biome].b count = 0 for i in range(4): ix = x + random.randint(-10, 10) iy = y + random.randint(-10, 10) if in_rectangle(ix, iy, self.width, self.height): c = biome_colors(self.biome_map[ix, iy]) r += c.r + random.randint(-10, 10) g += c.g + random.randint(-10, 10) b += c.b + random.randint(-10, 10) count += 1 r /= count g /= count b /= count r, g, b = clamp(0, 255, r), clamp(0, 255, g), clamp(0, 255, b) return Color(r, g, b)
WINDOW_TITLE: str = 'Quaff Quest' SCREEN_WIDTH: int = 80 SCREEN_HEIGHT: int = 50 BAR_WIDTH: int = 20 PANEL_HEIGHT: int = 7 PANEL_Y: int = SCREEN_HEIGHT - PANEL_HEIGHT MESSAGE_X: int = BAR_WIDTH + 2 MESSAGE_WIDTH: int = SCREEN_WIDTH - BAR_WIDTH - 2 MESSAGE_HEIGHT: int = PANEL_HEIGHT - 1 MAP_WIDTH: int = 80 MAP_HEIGHT: int = 43 ROOM_MAX_SIZE: int = 10 ROOM_MIN_SIZE: int = 6 MAX_ROOMS: int = 30 FOV_ALGORITHM: int = 0 FOV_LIGHT_WALLS: bool = True FOV_RADIUS: int = 10 COLORS: Dict[str, Color] = { 'dark_wall': Color(0, 0, 100), 'dark_ground': Color(50, 50, 150), 'light_wall': Color(130, 110, 50), 'light_ground': Color(200, 180, 50) }
from tcod import Color # Constants SCREEN_WIDTH = 80 SCREEN_HEIGHT = 43 PANEL_HEIGHT = 7 LIMIT_FPS = 20 MS_PER_UPDATE = 14 UPDATE_PER_FRAME_LIMIT = 10 MAP_WIDTH = 80 MAP_HEIGHT = 43 BAR_WIDTH = 20 MSG_X = BAR_WIDTH + 2 MSG_WIDTH = SCREEN_WIDTH - BAR_WIDTH - 2 MSG_HEIGHT = PANEL_HEIGHT - 1 color_dark_wall = Color(0, 0, 100) color_dark_ground = Color(50, 50, 150)
# # You should have received a copy of the GNU General Public License along # with 7 Days to Rigel. If not, see <https://www.gnu.org/licenses/>. from __future__ import annotations from typing import TYPE_CHECKING, Iterable, Union, Collection, Tuple, \ Callable, Sequence, List import random from dataclasses import dataclass from engine import BaseWorld, Tile, Point from tcod import Color if TYPE_CHECKING: from engine import Pointlike, Entity FLOOR_BG_COLOR = Color(29, 31, 33) FLOOR_FG_COLOR = Color(40, 42, 46) WALL_BG_COLOR = Color(55, 59, 65) WALL_FG_COLOR = Color(112, 120, 128) # Color(40, 42, 46) VIEWPORT_BG_COLOR = Color(0, 0, 0) VIEWPORT_FG_COLOR = Color(112, 120, 128) def floor_tile(room: str = None): return Tile(name="Floor", description="Empty floor.", bg_color=FLOOR_BG_COLOR, character=ord('.'), fg_color=FLOOR_FG_COLOR, walkable=True, room=room)
def set_color(self, key, red, green, blue): self.colors[key] = Color(red, green, blue)
def __init__(self): self.colors = { #indoors 'dark_wall': Color(0, 0, 100), 'dark_ground': Color(50, 50, 150), 'dark_door': Color(63, 50, 31), #'light_wall': Color(130, 110, 50), 'light_wall': Color(0, 0, 250), 'light_ground': Color(200, 180, 50), 'light_door': Color(127, 101, 63), 'purple_fill': Color(128, 0, 128), #outdoors 'light_water': Color(0, 0, 255), #Blue 'light_shallows': Color(100, 100, 255), #Blue 'light_sand': Color(255, 232, 165), #Amber 'light_plains': Color(0, 255, 0), #Green 'light_hills': Color(127, 101, 63), #Brown 'light_mountain': Color(127, 127, 127), #Grey 'light_snow': Color(255, 255, 255), #White 'dark_water': Color(0, 0, 191), #Blue 'dark_shallows': Color(63, 63, 255), #Blue 'dark_sand': Color(255, 219, 114), #Amber 'dark_plains': Color(0, 191, 0), #Green 'dark_hills': Color(94, 75, 47), #Brown 'dark_mountain': Color(95, 95, 95), #Grey 'dark_snow': Color(223, 223, 223), #White 'tree_green': Color(0, 63, 0), #Green #Entities 'console_white': Color(255, 255, 255), 'targeting_cyan': Color(0, 255, 255), 'ape_c_white': Color(230, 230, 230), 'orc_green': Color(63, 127, 63), 'troll_green': Color(0, 127, 0), 'spider_brown': Color(31, 24, 15), 'skeleton_white': Color(230, 230, 230), 'zombie_black': Color(0, 0, 0), 'ghoul_green': Color(63, 127, 63), 'banshee_blue': Color(0, 0, 127), 'potion_violet': Color(127, 0, 255), 'scroll_amber': Color(255, 232, 165) }
"""selection of pre-defined colors""" import tcod # Dungeon from tcod import Color door = Color(153, 115, 0) #light_fov = Color(127, 127, 127) - grayscale fg_light = Color(245, 245, 200 )#Color(220, 217, 162) dark_bg = Color(20, 20, 20) #dark_wall = Color(63, 63, 63) dark_wall_fg = Color(95, 95, 95) #dark_ground = Color(31, 31, 31) dark_ground_fg = Color(95, 95, 95) floor_default = Color(245, 245, 200) wall_default = Color(95, 95, 95) # Dungeon # stone = Color(104, 113, 112) granite = Color(148, 146, 123) clay = Color(153, 102, 51) # Entities blood_red = Color(127, 0, 0) blood_ins = Color(236,255,0) blood_slime = Color(176,255,0) # Materials # oak = Color(120, 81, 45) linen = Color(186, 183, 162)
,8P' 88 8P ,adPPPPP88 `8b d8' `"Y8ba, d8" 88 .a8P 88, ,88 `8b,d8' aa ]8I 8P' 88888888Y"' `"8bbdP"Y8 Y88' `"YbbdP"' d8' d8' 88888888ba 88 88 ,d 88 "8b "" 88 88 88 ,8P 88 MM88MMM ,adPPYba, 88aaaaaa8P' 88 ,adPPYb,d8 ,adPPYba, 88 88 a8" "8a 88""""88' 88 a8" `Y88 a8P_____88 88 88 8b d8 88 `8b 88 8b 88 8PP""""""" 88 88, "8a, ,a8" 88 `8b 88 "8a, ,d88 "8b, ,aa 88 "Y888 `"YbbdP"' 88 `8b 88 `"YbbdP"Y8 `"Ybbd8"' 88 aa, ,88 "Y8bbdP" ''' CREDITS = f"Licensed GPL. Copyright (c) %cSlavfox%c, 2019.\n" \ f"%c@Slavfoxman%c %chttps://slavfox.io/%c\n\n" \ f"Logo by David Fuchs, CC BY-SA 4.0." % ( COLCTRL_1, COLCTRL_STOP, COLCTRL_2, COLCTRL_STOP, COLCTRL_2, COLCTRL_STOP ) CREDITS_COLORS = { COLCTRL_1: Color(222, 147, 95), COLCTRL_2: Color(129, 162, 190) }
def color_step(original, step): return Color(*original) + Color(step, step, step)
tropical_mountain_forest = 10 tropical_seasonal_forest = 11 subtropical_desert = 12 cold_desert = 13 boreal_forest = 14 hot_desert = 15 savanna = 16 tropical_dry_forest = 17 tropical_evergreen_forest = 18 thorn_forest = 19 tropical_rain_forest = 20 temperate_forest = 21 biome_colors = { Biome.snow: Color(248, 248, 248), Biome.tundra: Color(221, 221, 187), Biome.bare: Color(187, 187, 187), Biome.scorched: Color(153, 153, 153), Biome.taiga: Color(204, 212, 187), Biome.shrubland: Color(194, 204, 187), Biome.grassland: Color(192, 212, 170), Biome.temperate_desert: Color(228, 232, 202), Biome.temperate_rain_forest: Color(164, 196, 168), Biome.temperate_deciduous_forest: Color(180, 201, 169), Biome.tropical_rain_forest: Color(156, 187, 169), Biome.tropical_seasonal_forest: Color(169, 204, 164), Biome.subtropical_desert: Color(233, 221, 199) } biome_diagram = [