NotQuiteParadise2

Stat

class Stat(base_value)[source]

Bases: abc.ABC

A container for an Entities Stat and related functionality.

base_value is used as the reference for modifiers. value is the result after modifiers are applied. override forces a specific value to be used, ignoring modifiers.

__init__(base_value)[source]
apply_modifier(func: Callable, key: Any)[source]

Add a modifier

When value is calculated, func will be called with the base value

Parameters
  • func – Any callable function

  • key – Unique identifier for adding and removing

property base_value
has_modifier(key: Any)[source]

Check if modifier is applied

Parameters

key – Unique identifier for adding and removing

override(value)[source]

Force the value and ignore modifiers

remove_modifier(key: Any)[source]

Remove a modifier

Parameters

key – Unique identifier for adding and removing

reset()[source]

Remove any modifiers and override.

property value