Пример #1
0
def talisman(*args, **kwargs):
    results = []
    talisman = read_yaml("artifacts.yaml")['talisman']
    log = talisman['quotes'][randint(0,len(talisman)-1)]

    results.append({'used': True,
                    'message': Message(cout(talisman,log),tcod.lighter_purple)})
    return results
Пример #2
0
import tcod
from game_messages import Message

from yaml_functions import read_yaml, cout
from batchim import 받침

SYS_LOG = read_yaml("system_log.yaml")


class Inventory:
    def __init__(self, capacity):
        self.capacity = capacity
        self.items = []

    def add_item(self, item):
        results = []

        if len(self.items) >= self.capacity:  # 용량 초과
            results.append({
                'item_added':
                None,
                'message':
                Message(SYS_LOG["inventory_full"], tcod.yellow)
            })
        else:  # 아이템 주움
            results.append({
                'item_added':
                item,
                'message':
                Message(cout(SYS_LOG["get_item"], 받침(item.name, 1)),
                        tcod.light_green)
Пример #3
0
def init_data():
    SYS_LOG = read_yaml("system_log.yaml")
    return SYS_LOG
Пример #4
0
"""
나도 이게 뭐가 뭔지 모르겠다. 열흘은 더 조사해야함. 아무튼 지금은 미완성이고 쓰지 말 것
"""

import tcod
from yaml_functions import read_yaml
from renderer.render_functions import RenderOrder

# 엔티티
from entity import Entity

from components.ai import BasicAi
from components.fighter import Fighter

# 미리 생성된 몬스터들
monster_list = read_yaml('pgen_monsters.yaml')


def load_and_create_monster(monster_name, x=None, y=None):
    Minfo = monster_list.get(monster_name)

    def loadk(key):
        return Minfo.get(key)

    # 기본 정보 불러오기
    name = loadk('name')
    char = loadk('char')

    # 색상: 문자열 또는 리스트
    mon_color = loadk('color')
    if type(mon_color) == str:
Пример #5
0
import os
import tcod
from yaml_functions import read_yaml

CONFIG = read_yaml("config.yaml","!default")

# 폰트 로딩
FILE_PATH = os.path.dirname(os.path.abspath(__file__))
GRAPHIC_PATH = '\\graphics\\fonts\\'
FONT = FILE_PATH + GRAPHIC_PATH + CONFIG['FONT']

FLAGS = tcod.context.SDL_WINDOW_RESIZABLE

SCREEN_WIDTH = CONFIG['SCREEN_WIDTH']
SCREEN_HEIGHT = CONFIG['SCREEN_HEIGHT']

WIDTH = int(SCREEN_WIDTH * CONFIG['FONT_WIDTH'])
HEIGHT = int(SCREEN_HEIGHT * CONFIG['FONT_HEIGHT'])
TILESET_TTF = tcod.tileset.load_truetype_font(FONT,
                                                CONFIG['FONT_WIDTH'],
                                                CONFIG['FONT_HEIGHT'])

MAP_WIDTH, MAP_HEIGHT = CONFIG['MAP_WIDTH'], CONFIG['MAP_HEIGHT']
BAR_WIDTH = CONFIG['BAR_WIDTH']

PANEL_HEIGHT = SCREEN_HEIGHT - MAP_HEIGHT
PANEL_Y = SCREEN_HEIGHT - PANEL_HEIGHT
MESSAGE_X = 1
MESSAGE_WIDTH = SCREEN_WIDTH - 2 #- BAR_WIDTH - 2
MESSAGE_HEIGHT = PANEL_HEIGHT - 2 #1
Пример #6
0
import tcod
import math, time
import numpy as np
from dice import roll_dice

from random import randint
from game_messages import Message
from renderer.animation_functions import refresh_console, draw_animation, get_line

from yaml_functions import read_yaml, cout
from batchim import 받침

from init_constants import CENTER_X, CENTER_Y, SCREEN_WIDTH, SCREEN_HEIGHT, colors

SYS_LOG = read_yaml("system_log.yaml")
ITEM_LOG = read_yaml("item_log.yaml")

def heal(*args, **kwargs):
    entity = args[0]
    amount = kwargs.get('amount')
    which_heal = kwargs.get('which')
    if not which_heal:
        which_heal = 'hp'

    results = []

    if which_heal == 'hp':
        if entity._Fighter.hp == entity._Fighter.max_hp:
            results.append({'consumed': False, 'message': Message(SYS_LOG['full_health'], tcod.yellow)})
        else:
            entity._Fighter.heal(amount)