StatBlock.h header

#include <ew/core/StatBlock.h>

Namespace ew::core

StatBlock class

class ew::core::StatBlock

A creature/NPC stat block for tabletop play (DESIGN 4.17). Deliberately system-agnostic: rather than hard-coding D&D or Pathfinder fields, it carries a free system label, an ordered list of labelled StatEntry statistics, an ordered list of named StatBlockAction actions, and freeform notes – so a block for any system (or a homebrew one) fits, and a starter set of fields for a chosen system is supplied separately (ew::app statBlockTemplate). A first-class content object, so stat blocks are saved with the project, listed, searched, shared through a library, and undone/redone like anything else.

Members

ew::core::StatBlock::StatBlock(ContentId id, QString title)

Creates an empty stat block with identity id and the given title.

const QString & ew::core::StatBlock::title() const

The block's display name (usually the creature/NPC name).

void ew::core::StatBlock::setTitle(QString title)

Sets the block's display name.

const QString & ew::core::StatBlock::system() const

The game system this block is written for (e.g. "D&D 5e", "Pathfinder 2e", or empty for a homebrew/system-neutral block). Free text.

void ew::core::StatBlock::setSystem(QString system)

Sets the game system this block is written for.

const std::vector< StatEntry > & ew::core::StatBlock::stats() const

The labelled statistics (AC, HP, ability scores, CR, ...), in display order.

void ew::core::StatBlock::setStats(std::vector< StatEntry > stats)

Sets the labelled statistics, in display order.

const std::vector< StatBlockAction > & ew::core::StatBlock::actions() const

The named actions / attacks / traits, in display order.

void ew::core::StatBlock::setActions(std::vector< StatBlockAction > actions)

Sets the named actions / attacks / traits, in display order.

const QString & ew::core::StatBlock::notes() const

Freeform notes (tactics, lore, description). Markdown is permitted.

void ew::core::StatBlock::setNotes(QString notes)

Sets the freeform notes.

StatBlockAction struct

struct ew::core::StatBlockAction

One named action, attack, trait, or ability on a StatBlock (e.g. name "Bite", text "+5 to hit, reach 5 ft., 2d6+3 piercing").

Members

QString ew::core::StatBlockAction::name

The action's name (e.g. "Bite").

QString ew::core::StatBlockAction::text

The action's descriptive text (e.g. "+5 to hit, reach 5 ft., 2d6+3 piercing").

bool ew::core::StatBlockAction::operator==(const StatBlockAction &other) const =default

Actions compare equal when their name and text match.

StatEntry struct

struct ew::core::StatEntry

One labelled statistic on a StatBlock (e.g. label "AC", value "17"). Kept as free label/value text rather than fixed fields so any game system's block can be represented.

Members

QString ew::core::StatEntry::label

The statistic's label (e.g. "AC").

QString ew::core::StatEntry::value

The statistic's value text (e.g. "17").

bool ew::core::StatEntry::operator==(const StatEntry &other) const =default

Entries compare equal when their label and value match.