# Features Format Many features are complex. Here we lay out the format used when writing a feature. The overall structure of a feature is a dictionary as follows: * "name": NAME * "text": TEXT * "subfeatures": SUBFEATURES In addition to the hardcoded data provided in the feature, certain variables may be given at runtime. ## Variables Many features are very similar between creatures except for certain variables. When instantiated programatically, the feature is given the following: * NAME: The name of the creature with this feature * V0, V1, ... VN: Zero-indexed list of integer variables Certain portions of features accept these as parameters, either inline as in TEXT, or in the place of hardcoded variables for conditions or effects. In addition to these, certain attributes of the creature having this feature may be probed such as STR, DEX, CON, INT, WIS, CHA, or PROF. Finally, simple math can be provided in postfix notation surounded by parentheses. For example, to set a save DC equal to 8+int+prof: (8,INT,PROF,+,+). ## TEXT This is explanatory text. It accepts embedded variables in the form {VARNAME}. For example, the text "The {NAME}'s weapon attacks are magical. When the {NAME} hits with any weapon, the weapon deals an extra {V0}d{V1} radiant damage.", when applied to a "deva" with runtime variables (4, 8), we get: "The deva's weapon attacks are magical. When the deva hits with any weapon, the weapon deals an extra 4d8 radiant damage." ## Subfeatures Each feature consists of a list of "subfeatures", which are treated as independent features in the game, but are grouped together for clear organization. Each subfeature is a dictionary with the following elements: * "trigger": TRIGGER * "conditions": CONDITIONS * "effects": EFFECTS * "recharge": RECHARGE Several of the elements accept various nouns. ## NOUNS Nouns embedded into subfeature elements may be any of: * "self" * "creature" * "object" * "structure" * "target" * "point in space" * NAME Where NAME is interpreted by the game as a specific creature or object with a matching name. ### TRIGGER TRIGGER is a list containing any of the following followed by nouns corresponding to instances of N: * "on init" * "action" * "bonus action" * "free action" * "N start of turn" * "N end of turn" * "N takes damage" (pushes damage amount to variables list) * "N moves" * "N makes check against N" * "N forces N to save" * "N rolls a d20" * "N targets N by a spell" * "N attacks N" * "N hits N" * "N touches N" ### CONDITIONS CONDITIONS is a list of lists, all of which must evaluate True for effects to be applied. Each condition list is formatted [ CONDITION, variables ] where CONDITION is any of the following, prepend "not " to invert: * "N has property PROPERTY" * "N is hostile to N" * "N is allied to N" * "N wishes it to be so" * "N succeeds dc X ABILITY save by at least X" * "N fails dc X ABILITY save by at least X" * "N is within radius X of N" * "N can see N" * "N has completed >= X turns" * "N is at full hp" * "N has >= X hp" * "Damage received >= X" * "Damage received was a critical hit" * "Damage received was type TYPE" * "N has condition CONDITION" * "N has condition CONDITION given by N" * "N and N are on same plane of existence" * "N is on plane PLANE" * "N moved X distance straight toward N" * "N has X movement remaining" * "N made attack ATTACK" * "N has underside exposed" * "First time N uses feature on N during turn" * "N is flying" * "N is under effects of spell SPELL" * "N has spell from school SCHOOL cast on it" * "N is on terrain TERRAIN" * "N is inside an object" * "N is in lighting LIGHTING (sunlight, dim light, darkness, magical darkness)" * "N can understand >= X languages" * "N and N share a language" * "N has >= X heads" * "N has X spell slots remaining" * "N had advantage on most recent die roll" * "N had disadvantage on most recent die roll" * "N used a weapon on most recent attack" * "N is surprised" * "N is bound by N" * "N is aware of N" * "N and N are in the same web" ### EFFECTS EFFECTS is a list of dictionaries containing the following: * "target": NOUN * "effect": [EFFECT, variables] * "duration": DURATION Where EFFECT is any of the following (UNDER CONSTRUCTION DENOTED BY x): * Terrain in X ft radius is difficult * Set movement speed to X x * Increase movement speed by X x * Increase jump distance by X x * Increase jump height by X * Acquire condition CONDITION x * End condition CONDITION x * Acquire/override property PROPERTY x * Death x * Surprised x * Pushed X feet in DIRECTION direction x * Immune to feature FEATURE x * Immune to spells with trait SPELL\_TRAIT x * Disadvantage on rolls ROLL\_CLASS x * Advantage on rolls ROLL\_CLASS x * Automatic fail on rolls ROLL\_CLASS x * Automatic succeed on rolls ROLL\_CLASS x * Automatic critical hit x * Move X distance x * Deal X damage x * Disable other feature x * Know distance/direction to creature/object within X distance x * Reduce incoming damage by X * Regain X hp x * Weapon/armor corrodes x * Ignite flammable objects x * Expend spell slot x * Special movement x * Plane shift x * Grant spell effect x * Transparency (perpetual hidenness?) x * Prescribed actions (randomized), any of: x - Nothing x - Moves in random direction x - Attacks random creature within reach x * Telepathic command x * Learns creature's desires x * Spell storing x * Creates X diameter tunnel The duration of an effect may be omitted for instantaneous effects and is any of the following: * "End of turn" * "Start of next turn" * "End of next turn" * Until action is taken to end x * TIME??? x * Repeated saves??? x * Repeated saves at advantage/disadvantage with condition??? x * Until certain spell is cast??? x * Until other effect expires??? ### RECHARGE The recharge of a feature may be omitted to indicate that it is unlimited. Otherwise, it is a list of the following two items: * Integer indicating number of times the feature can be used * Any of "turn", "long rest", "short rest" indicating when spent uses are restored