Angband
z-dice.h
Go to the documentation of this file.
1 
19 #ifndef INCLUDED_Z_DICE_H
20 #define INCLUDED_Z_DICE_H
21 
22 #include "h-basic.h"
23 
24 #include "z-rand.h"
25 #include "z-expression.h"
26 
27 typedef struct dice_s dice_t;
28 
29 dice_t *dice_new(void);
30 void dice_free(dice_t *dice);
31 bool dice_parse_string(dice_t *dice, const char *string);
32 int dice_bind_expression(dice_t *dice, const char *name,
33  const expression_t *expression);
34 void dice_random_value(dice_t *dice, random_value *v);
35 int dice_evaluate(dice_t *dice, int level, aspect aspect, random_value *v);
36 int dice_roll(dice_t *dice, random_value *v);
37 bool dice_test_values(dice_t *dice, int base, int dice_count, int sides,
38  int bonus);
39 bool dice_test_variables(dice_t *dice, const char *base, const char *dice_name,
40  const char *sides, const char *bonus);
41 
42 #endif /* INCLUDED_Z_DICE_H */
Definition: z-dice.c:30
bool dice_test_variables(dice_t *dice, const char *base, const char *dice_name, const char *sides, const char *bonus)
Check that the dice object has the given variables for the component.
Definition: z-dice.c:611
int dice_evaluate(dice_t *dice, int level, aspect aspect, random_value *v)
Fully evaluates the dice object, using randcalc().
Definition: z-dice.c:557
Creating, storing, and deserializing simple math expressions.
void dice_free(dice_t *dice)
Deallocate a dice object.
Definition: z-dice.c:210
int dice_bind_expression(dice_t *dice, const char *name, const expression_t *expression)
Bind an expression to a variable name.
Definition: z-dice.c:268
Definition: game-world.h:24
dice_t * dice_new(void)
Allocate and initialize a new dice object.
Definition: z-dice.c:195
Definition: z-expression.c:28
The lowest level header.
bool dice_test_values(dice_t *dice, int base, int dice_count, int sides, int bonus)
Test the dice object against the given values.
Definition: z-dice.c:597
void dice_random_value(dice_t *dice, random_value *v)
Extract a random_value by evaluating any bound expressions.
Definition: z-dice.c:506
int dice_roll(dice_t *dice, random_value *v)
Evaluates the dice object, using damroll() (base + XdY).
Definition: z-dice.c:579
A struct representing a strategy for making a dice roll.
Definition: z-rand.h:40
bool dice_parse_string(dice_t *dice, const char *string)
Parse a formatted string for values and variables to represent a dice roll.
Definition: z-dice.c:309
aspect
Random aspects used by damcalc, m_bonus_calc, and ranvals.
Definition: z-rand.h:55
Intialize random names
Definition: init.c:756
A Random Number Generator for Angband.