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



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



totalUsefulness :: COps -> FactionId -> FactionDict -> ItemFull -> Benefit Source #

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

Internal operations

effectToBenefit :: COps -> FactionId -> FactionDict -> 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 (via melee). 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 activation or conditions, the difference in value is only slight.