Safe Haskell | None |
---|---|
Language | Haskell2010 |
Game time and speed.
- data Time
- timeZero :: Time
- timeClip :: Time
- timeTurn :: Time
- timeSecond :: Time
- timeEpsilon :: Time
- absoluteTimeAdd :: Time -> Time -> Time
- absoluteTimeSubtract :: Time -> Time -> Time
- absoluteTimeNegate :: Time -> Time
- timeFit :: Time -> Time -> Int
- timeFitUp :: Time -> Time -> Int
- newtype Delta a = Delta a
- timeShift :: Time -> Delta Time -> Time
- timeDeltaToFrom :: Time -> Time -> Delta Time
- timeDeltaSubtract :: Delta Time -> Delta Time -> Delta Time
- timeDeltaReverse :: Delta Time -> Delta Time
- timeDeltaScale :: Delta Time -> Int -> Delta Time
- timeDeltaPercent :: Delta Time -> Int -> Delta Time
- timeDeltaToDigit :: Delta Time -> Delta Time -> Char
- ticksPerMeter :: Speed -> Delta Time
- data Speed
- toSpeed :: Int -> Speed
- fromSpeed :: Speed -> Int
- speedZero :: Speed
- speedWalk :: Speed
- speedLimp :: Speed
- speedThrust :: Speed
- modifyDamageBySpeed :: Int64 -> Speed -> Int64
- speedScale :: Rational -> Speed -> Speed
- timeDeltaDiv :: Delta Time -> Int -> Delta Time
- speedAdd :: Speed -> Speed -> Speed
- speedNegate :: Speed -> Speed
- speedFromWeight :: Int -> Int -> Speed
- rangeFromSpeedAndLinger :: Speed -> Int -> Int
Documentation
Game time in ticks. The time dimension. One tick is 1 microsecond (one millionth of a second), one turn is 0.5 s.
At least once per clip all moves are resolved and a frame or a frame delay is generated. Currently one clip is 0.05 s, but it may change, and the code should not depend on this fixed value.
One turn is 0.5 s. The code may depend on that. Actors at normal speed (2 m/s) take one turn to move one tile (1 m by 1 m).
timeSecond :: Time Source #
This many ticks fits in a single second. Do not export,
timeEpsilon :: Time Source #
An infinitesimal time period.
absoluteTimeAdd :: Time -> Time -> Time Source #
Absolute time addition, e.g., for summing the total game session time from the times of individual games.
absoluteTimeNegate :: Time -> Time Source #
Absolute time negation. To be used for reversing time flow, e.g., for comparing absolute times in the reverse order.
timeFit :: Time -> Time -> Int Source #
How many time intervals of the latter kind fits in an interval of the former kind.
timeFitUp :: Time -> Time -> Int Source #
How many time intervals of the latter kind cover an interval of the former kind (rounded up).
One-dimentional vectors. Introduced to tell apart the 2 uses of Time: as an absolute game time and as an increment.
Delta a |
timeDeltaToFrom :: Time -> Time -> Delta Time Source #
Time time vector between the second and the first absolute times. The arguments are in the same order as in the underlying scalar subtraction.
timeDeltaSubtract :: Delta Time -> Delta Time -> Delta Time Source #
Time time vector between the second and the first absolute times. The arguments are in the same order as in the underlying scalar subtraction.
timeDeltaScale :: Delta Time -> Int -> Delta Time Source #
Scale the time vector by an Int
scalar value.
timeDeltaPercent :: Delta Time -> Int -> Delta Time Source #
Take the given percent of the time vector.
timeDeltaToDigit :: Delta Time -> Delta Time -> Char Source #
Represent the main 10 thresholds of a time range by digits, given the total length of the time range.
ticksPerMeter :: Speed -> Delta Time Source #
The number of time ticks it takes to walk 1 meter at the given speed.
Speed in meters per 1 million seconds (m/Ms). Actors at normal speed (2 m/s) take one time turn (0.5 s) to make one step (move one tile, which is 1 m by 1 m).
fromSpeed :: Speed -> Int Source #
Pretty-printing of speed in the format used in content definitions.
Limp speed (1 m/s) that suffices to move one tile in two turns. This is the minimal speed for projectiles to fly just one space and drop.
speedThrust :: Speed Source #
Sword thrust speed (10 m/s). Base weapon damages, both melee and ranged, are given assuming this speed and ranged damage is modified accordingly when projectile speeds differ. Differences in melee weapon swing speeds are captured in damage bonuses instead, since many other factors influence total damage.
Billiard ball is 25 ms, sword swing at the tip is 35 ms, medieval bow is 70 ms, AK47 is 700 ms.
modifyDamageBySpeed :: Int64 -> Speed -> Int64 Source #
Modify damage when projectiles is at a non-standard speed. Energy and so damage is proportional to the square of speed, hence the formula.
speedNegate :: Speed -> Speed Source #
Speed negation.
speedFromWeight :: Int -> Int -> Speed Source #
Calculate projectile speed from item weight in grams and velocity percent modifier. See https://github.com/LambdaHack/LambdaHack/wiki/Item-statistics.