import { Color } from "./const";
import type { IChar, ISpriteDefinition } from "./types";

const l = (line: string, fg = Color.WHITE, bg = Color.BLACK): IChar[] =>
    Array.from(line).map((c) => [c, fg, bg]);

export const PLAYER_SPRITE: ISpriteDefinition = {
    frames: [
        [
            l('@', Color.YELLOW),
        ],
    ],
};

export const DOOR_SPRITE: ISpriteDefinition = {
    frames: [
        [
            l('┘ └'),
        ],
        [
            l('└'),
            l(' '),
            l('┌'),
        ],
        [
            l('┐ ┌'),
        ],
        [
            l('┘'),
            l(' '),
            l('┐'),
        ],
        [
            l('^', Color.CYAN),
        ],
        [
            l('_', Color.GREEN),
        ],
    ],
}

export const ITEM_KEY_SPRITE: ISpriteDefinition = {
    frames: [
        [
            l('ъ', Color.MAGENTA),
        ],
        [
            l('ъ', Color.YELLOW),
        ],
        [
            l('ъ', Color.CYAN),
        ],
        [
            l('ъ', Color.GREEN),
        ],
    ],
}