going-rogue/erynrl/items.py
Eryn Wells 64844d124b A couple fixes in items.py
Reformat the items in items.py
Fix the type declaration of Item.background_color
2023-02-18 22:57:37 -08:00

38 lines
1 KiB
Python

# Eryn Wells <eryn@erynwells.me>
from dataclasses import dataclass
from typing import Optional, Tuple
@dataclass(frozen=True)
class Item:
'''A record of a kind of item
This class follows the "type class" pattern. It represents a kind of item, not a specific instance of that item.
(See `object.Item` for that.)
Attributes
----------
symbol : str
The symbol used to render this item on the map
foreground_color : Tuple[int, int, int]
The foreground color used to render this item on the map
background_color : Tuple[int, int, int], optional
The background color used to render this item on the map
name : str
The name of this item
description : str
A description of this item
'''
symbol: str
name: str
description: str
foreground_color: Tuple[int, int, int]
background_color: Optional[Tuple[int, int, int]] = None
Corpse = Item(
'%',
name="Corpse",
description="The corpse of a once-living being",
foreground_color=(128, 128, 255))