Safe Haskell | None |
---|
Game time and speed.
- data Time
- timeZero :: Time
- timeClip :: Time
- timeTurn :: Time
- timeAdd :: Time -> Time -> Time
- timeFit :: Time -> Time -> Int
- timeNegate :: Time -> Time
- timeScale :: Time -> Int -> Time
- timeEpsilon :: Time
- timeToDigit :: Time -> Time -> Char
- data Speed
- toSpeed :: Double -> Speed
- speedZero :: Speed
- speedNormal :: Speed
- speedScale :: Rational -> Speed -> Speed
- speedAdd :: Speed -> Speed -> Speed
- speedNegate :: Speed -> Speed
- ticksPerMeter :: Speed -> Time
- traveled :: Speed -> Time -> Int
- speedFromWeight :: Int -> Int -> Speed
- rangeFromSpeed :: Speed -> 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.1 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).
timeFit :: Time -> Time -> IntSource
How many time intervals of the latter kind fits in an interval of the former kind.
timeNegate :: Time -> TimeSource
Negate a time interval. Can be used to subtract from a time or to reverse the ordering on time.
An infinitesimal time period.
timeToDigit :: Time -> Time -> CharSource
Represent the main 10 thresholds of a time range by digits, given the total length of the time range.
Speed in meters per 1 million seconds (m/Ms). Actors at normal speed (2 m/s) take one time turn (0.5 s) to move one tile (1 m by 1 m).
Normal speed (2 m/s) that suffices to move one tile in one turn.
speedScale :: Rational -> Speed -> SpeedSource
Scale speed by an Int
scalar value.
speedNegate :: Speed -> SpeedSource
Speed negation.
ticksPerMeter :: Speed -> TimeSource
The number of time ticks it takes to walk 1 meter at the given speed.
traveled :: Speed -> Time -> IntSource
Distance in meters (so also in tiles, given the chess metric) traveled in a given time by a body with a given speed.
speedFromWeight :: Int -> Int -> SpeedSource
Calculate projectile speed from item weight in grams and speed bonus in percents. See https://github.com/kosmikus/LambdaHack/wiki/Item-statistics.
rangeFromSpeed :: Speed -> IntSource
Calculate maximum range in meters of a projectile from its speed. See https://github.com/kosmikus/LambdaHack/wiki/Item-statistics. With this formula, each projectile flies for exactly one second, that is 2 turns, and then drops to the ground. Dividing and multiplying by 2 ensures both turns of flight cover the same distance.