Class SlotEngine
java.lang.Object
com.csse3200.game.components.slot.SlotEngine
Slot machine engine to generate random outcomes for UI and trigger corresponding effects.
Flow: 1) Roll trigger (default 80%). 2) If triggered, pick an event by weights and return triple reels of that event id. Otherwise, return a non-triple reels array. 3) Effect handling
* Output for UI: * - SpinResult#getReels(): int[3]
of ids in [0..7] * -
SpinResult#isEffectTriggered(): boolean
* - SpinResult#getEffect():
Optional<Effect>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration of all possible effects.static class
Configuration for SlotEngine.static final class
Immutable object representing the result of a spin. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct with default config and RNG.SlotEngine
(SlotMachineArea area) SlotEngine
(SlotEngine.SlotConfig config, Random random) Construct with injected config and RNG. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
spin()
Perform one spin: - If triggered: return triple reels and call effect.
-
Constructor Details
-
SlotEngine
public SlotEngine()Construct with default config and RNG. -
SlotEngine
Construct with injected config and RNG. -
SlotEngine
-
-
Method Details
-
setSlotMachineArea
-
spin
Perform one spin: - If triggered: return triple reels and call effect. - If not triggered: return non-triple reels with NONE.- Returns:
- SpinResult consumable by UI.
-
applyEffect
-