Skip to main content

Formula<T>

A class in Root.Township, Alta.Intelligence.

Scoring rule that runs a function you supply on the agent (cast to T) and the target. Made by CreateTargetOperation.Formula; built-in creature actions use it for custom checks.

Constructors​

MemberWhat it is
Formula(string name, Func<T, ITarget, float> evaluate)Creates a Formula from name and evaluate.

Fields​

2 private and internal fields
MemberWhat it is
private Func<T, ITarget, float> evaluateThe function that does the scoring.
private string nameName shown by ToString, for debugging.

Methods​

MemberWhat it is
override float Evaluate(Agent agent, ITarget target)Casts the agent to T and returns the function's result. Throws if the agent isn't a T.
override string ToString()Returns "Formula (name)".