LambdaHack-0.5.0.0: A game engine library for roguelike dungeon crawlers

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Common.Dice

Contents

Description

Representation of dice for parameters scaled with current level depth.

Synopsis

Frequency distribution for casting dice scaled with level depth

data Dice Source

Dice for parameters scaled with current level depth. To the result of rolling the first set of dice we add the second, scaled in proportion to current depth divided by maximal dungeon depth. The result if then multiplied by the scale --- to be used to ensure that dice results are multiples of, e.g., 10. The scale is set with |*|.

(|*|) :: Dice -> Int -> Dice infixl 5 Source

Multiplying the dice, after all randomness is resolved, by a constant. Infix declaration ensures that 1 + 2 |*| 3 parses as (1 + 2) |*| 3.

d :: Int -> Dice Source

A single simple dice.

ds :: Int -> Dice Source

Dice scaled with level.

maxDice :: Dice -> Int Source

Maximal value of dice. The scaled part taken assuming maximum level.

minDice :: Dice -> Int Source

Minimal value of dice. The scaled part ignored.

meanDice :: Dice -> Int Source

Mean value of dice. The level-dependent part is taken assuming the highest level, because that's where the game is the hardest. Assumes the frequencies are not null.

Dice for rolling a pair of integer parameters representing coordinates.

data DiceXY Source

Dice for rolling a pair of integer parameters pertaining to, respectively, the X and Y cartesian 2D coordinates.

Constructors

DiceXY !Dice !Dice 

maxDiceXY :: DiceXY -> (Int, Int) Source

Maximal value of DiceXY.

minDiceXY :: DiceXY -> (Int, Int) Source

Minimal value of DiceXY.

meanDiceXY :: DiceXY -> (Int, Int) Source

Mean value of DiceXY.

Internal operations