Skip to content

Reference

tilttek/random-character

Every public type of the package, with its role. The types marked internal may change in any version.

Rules

TypeRole
CreationRulesThe rules of a system: their key, the system's key, the stats and the fields in order.
StatsThe attributes the rules fill, the method, and the roll or the fixed values.
StatMethodEach in order, rolled array, or fixed array.
FieldA field drawn from a generator, named with placeholders, or rolled with dice; one value or up to 16.
FieldKindGenerated or rolled.
RulesCatalogueThe rules of an application, by key and by system.

Rolling

TypeRole
CharacterRollerThe service: checks rules against the systems and generators, and rolls characters from a seed given or drawn.
RandomCharacterA character: rules, system, seed, stats, fields, attributions and the values edited by hand.
Contract\CharacterObserverTold of each character rolled.
Event\CharacterRolledA roll, by the keys of the rules and of the system, and whether the seed was given.

Format

TypeRole
Format\RulesReaderReads a YAML or JSON document of the format tilttek-random-character/1 into a catalogue.
Format\SyntaxYAML or JSON, and the syntax of a file by its extension.

Exceptions

TypeRole
Exception\RandomCharacterExceptionThe interface every exception of the library implements.
Exception\InvalidRulesRules that cannot be built or rolled.
Exception\InvalidDocumentA document that cannot be read, at its place.
Exception\InvalidSeedA seed that cannot replay a character.
Exception\InvalidEditA change a character cannot take.
Exception\UnknownRulesNo rules of the key.
Exception\RollFailedA roll that could not give a character.

Internal

TypeRole
Internal\CheckThe checks of keys, field keys and dice notations.
Internal\FieldsOne mapping of a document, read field by field.