LambdaHack- A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe HaskellNone




Actor preferences for targets and actions, based on actor attributes.



totalUsefulness :: COps -> Faction -> ItemFull -> Benefit Source #

Compute the whole Benefit structure, containing various facets of AI item preference, for an item with the given effects and aspects.

Note: result has non-strict fields, so arguments are forced to avoid leaks. When AI looks at items (including organs) more often, force the fields.

Internal operations

effectToBenefit :: COps -> Faction -> Bool -> Effect -> (Double, Double) Source #

How much AI benefits from applying the effect. The first component is benefit when applied to self, the second is benefit (preferably negative) when applied to enemy. This represents benefit from using the effect every avgItemDelay turns, so if the item is not durable, the value is adjusted down elsewhere. The benefit includes the drawback of having to use the actor's turn, except when there is battle and item is a weapon and so there is usually nothing better to do than to melee, or when the actor is stuck or idle or laying in wait or luring an enemy from a safe distance. So there is less than averageTurnValue included in each benefit, so in case when turn is not spent, e.g, periodic or conditions, the difference in value is only slight.