1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
package bjc.dicelang.dicev2;
import java.util.Random;
import java.util.function.IntSupplier;
/**
* Utility class for creating die pools.
* @author Ben Culkin
*
*/
public class Dies {
/**
* Create a die that always returns a given value.
* @param val The value.
* @return A die that always returns the specified value.
*/
public static Die scalar(long val) {
return new ScalarDie(val);
}
/**
* Create a random polyhedral dice.
* @param dice The number of dice in the pool.
* @param sides The nuumber of sides on the dice.
* @return A polyhedral dice, in the given configuration.
*/
public static Die polyhedral(int dice, int sides) {
return new PolyhedralDie(dice, sides);
}
/**
* Create a random polyhedral dice.
* @param rnd The RNG to use.
* @param dice The number of dice in the pool.
* @param sides The nuumber of sides on the dice.
* @return A polyhedral dice, in the given configuration.
*/
public static Die polyhedral(Random rnd, int dice, int sides) {
return new PolyhedralDie(rnd, dice, sides);
}
/**
* Create a number of fudge dice.
* @param dice The number of dice.
* @return A die pool with the fudge dice to use.
*/
public static Die fudge(int dice) {
return new FudgeDie(dice);
}
/**
* Create a number of fudge dice.
* @param rnd The RNG to use.
* @param dice The number of dice.
* @return A die pool with the fudge dice to use.
*/
public static Die fudge(Random rnd, int dice) {
return new FudgeDie(rnd, dice);
}
/**
* Create a composite series of dice.
* @param numDice The number of dice to roll.
* @param numSides The number of sides on the dice.
* @return A composite dice with the given parameters.
*/
public static Die composite(Die numDice, Die numSides) {
return new CompositeDie(numDice, numSides);
}
/**
* Create a composite series of dice.
* @param numDice The number of dice to roll.
* @param numSides The number of sides on the dice.
* @param rerollSides Should the number of dice be rolled more than once per pool?
* @return A composite dice with the given parameters.
*/
public static Die composite(Die numDice, Die numSides, boolean rerollSides) {
return new CompositeDie(numDice, numSides, rerollSides);
}
/**
* Create a composite series of dice.
* @param rnd The RNG to use.
* @param numDice The number of dice to roll.
* @param numSides The number of sides on the dice.
* @return A composite dice with the given parameters.
*/
public static Die composite(Random rnd, Die numDice, Die numSides) {
return new CompositeDie(rnd, numDice, numSides);
}
/**
* Create a composite series of dice.
* @param rnd The RNG to use.
* @param numDice The number of dice to roll.
* @param numSides The number of sides on the dice.
* @param rerollSides Should the number of dice be rolled more than once per pool?
* @return A composite dice with the given parameters.
*/
public static Die composite(Random rnd, Die numDice, Die numSides, boolean rerollSides) {
return new CompositeDie(rnd, numDice, numSides, rerollSides);
}
/**
* A computed die pool.
* @param numDice The provider for the number of dice.
* @param numSides The provider for the number of sides.
* @return The computed die.
*/
public static Die computed(IntSupplier numDice, IntSupplier numSides) {
return new ComputedDie(numDice, numSides);
}
/**
* A computed die pool.
* @param numDice The provider for the number of dice.
* @param numSides The provider for the number of sides.
* @param rerollSides Should the number of dice be rolled more than once per pool?
* @return The computed die.
*/
public static Die computed(IntSupplier numDice, IntSupplier numSides, boolean rerollSides) {
return new ComputedDie(numDice, numSides, rerollSides);
}
/**
* A computed die pool.
* @param rnd The RNG to use.
* @param numDice The provider for the number of dice.
* @param numSides The provider for the number of sides.
* @return The computed die.
*/
public static Die computed(Random rnd, IntSupplier numDice, IntSupplier numSides) {
return new ComputedDie(rnd, numDice, numSides);
}
/**
* A computed die pool.
* @param rnd The RNG to use.
* @param numDice The provider for the number of dice.
* @param numSides The provider for the number of sides.
* @param rerollSides Should the number of dice be rolled more than once per pool?
* @return The computed die.
*/
public static Die computed(Random rnd, IntSupplier numDice, IntSupplier numSides, boolean rerollSides) {
return new ComputedDie(rnd, numDice, numSides, rerollSides);
}
}
|