diff options
| author | Ben Culkin <scorpress@gmail.com> | 2020-04-13 18:32:11 -0400 |
|---|---|---|
| committer | Ben Culkin <scorpress@gmail.com> | 2020-04-13 18:32:11 -0400 |
| commit | 5a26fb2c0d899b1c80fabb39366a7b7db4d8ca41 (patch) | |
| tree | 19e19dab7c72aaee504a07e9434cde8c379092c8 /dice/src/main/java/bjc/dicelang/dicev2/CompoundDieMod.java | |
| parent | 25fbdca78518df0cb096544e912cdb3913f348fd (diff) | |
Add some javadoc
Add some javadoc comments
Diffstat (limited to 'dice/src/main/java/bjc/dicelang/dicev2/CompoundDieMod.java')
| -rw-r--r-- | dice/src/main/java/bjc/dicelang/dicev2/CompoundDieMod.java | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/dice/src/main/java/bjc/dicelang/dicev2/CompoundDieMod.java b/dice/src/main/java/bjc/dicelang/dicev2/CompoundDieMod.java index 6b752f2..519170b 100644 --- a/dice/src/main/java/bjc/dicelang/dicev2/CompoundDieMod.java +++ b/dice/src/main/java/bjc/dicelang/dicev2/CompoundDieMod.java @@ -6,17 +6,44 @@ import java.util.ArrayList; import java.util.List; import java.util.function.LongPredicate; +/** + * Create a compounding dice. + * + * Compounding dice are rolled more than once, if they pass a given predicate. + * @author Ben Culkin + * + */ public class CompoundDieMod extends Die { + /** + * The pool of dice that make up this compound die mod. + */ public final Die[] dice; + /** + * The compare point to determine when to compound. + */ public final LongPredicate compound; + /** + * Whether or not the compounding should 'penetrate' (subtract 1 before exploding) + */ public final boolean penetrate; + /** + * Create a new compound die. + * @param compound The predicate to compound on. + * @param dice The pool of dice to roll. + */ public CompoundDieMod(LongPredicate compound, Die... dice) { this(compound, false, dice); } - + + /** + * Create a new compound die. + * @param compound The predicate to compound on. + * @param penetrate Whether or not compounding should penetrate. + * @param dice The pool of dice to roll. + */ public CompoundDieMod(LongPredicate compound, boolean penetrate, Die... dice) { super(); @@ -27,6 +54,7 @@ public class CompoundDieMod extends Die { this.penetrate = penetrate; } + @Override public long[] roll() { List<Long> lst = new ArrayList<>(5); @@ -51,6 +79,7 @@ public class CompoundDieMod extends Die { return ListUtils.toPrimitive(lst); } + @Override public long rollSingle() { Die die = dice[0]; @@ -70,11 +99,13 @@ public class CompoundDieMod extends Die { } /* :UnoptimizableDice */ + @Override public boolean canOptimize() { return false; } + @Override public long optimize() { - throw new UnsupportedOperationException("Exploding dice can't be optimized"); + throw new UnsupportedOperationException("Compounding dice can't be optimized"); } } |
