Difference between revisions of "Dice/DieFlags"

From DiceRoller Documentation
 
(One intermediate revision by the same user not shown)
Line 24: Line 24:
 
| Dropped || Indicates the die result was not kept (dropped).
 
| Dropped || Indicates the die result was not kept (dropped).
 
|-
 
|-
| Extra || Indicates the die was added due to an explosion or reroll, and was not one of the original dice rolled.
+
| Extra || Indicates the die was added due to an explosion or reroll, and was not one of the original dice rolled. May appear on Literal dice to indicate it is a placeholder number (such as a placeholder 0 when no dice are rolled).
 
|-
 
|-
 
| Macro || Indicates the die was generated as part of a macro.
 
| Macro || Indicates the die was generated as part of a macro.
 +
|}
 +
 +
== Extension Methods ==
 +
{| class="wikitable"
 +
! style="width: 5em" |
 +
! Name !! Description
 +
|-
 +
| {{internal}} {{method}} || [[Dice/ExtensionMethods/IsRoll|IsRoll()]] || Determines whether or not the DieType represents a roll.
 
|}
 
|}
  

Latest revision as of 06:03, 15 April 2017

Metadata attached to a DieResult.

  • Namespace: Dice
  • Assembly: DiceRoller (in DiceRoller.dll)

Syntax

[Flags]
public enum DieFlags

Members

Member name Description
Critical Indicates the die was a critical, meant for display purposes.
Fumble Indicates the die was a fumble, meant for display purposes.
Success Indicates the die counted as a success.
Failure Indicates the die counted as a failure.
Dropped Indicates the die result was not kept (dropped).
Extra Indicates the die was added due to an explosion or reroll, and was not one of the original dice rolled. May appear on Literal dice to indicate it is a placeholder number (such as a placeholder 0 when no dice are rolled).
Macro Indicates the die was generated as part of a macro.

Extension Methods

Name Description
IsRoll() Determines whether or not the DieType represents a roll.

Remarks

This metadata is not used internally, but may be useful to expose to the end user by changing how die results are displayed appropriately. A die can be both a Critical and a Fumble at the same time, depending on the value of the critical/fumble extras. A die cannot be a success and failure at the same time. If no critical/fumble extras are specified, a die is considered a critical if it rolls its maximum result and a fumble if it rolls its minimum result.

When implementing custom functions, it is worthwhile to check for the Dropped flag so that dropped dice can be handled appropriately. For example, implementing a custom sum() function should probably not add the values of dropped dice.