<spanid="evennia-contrib-rpg-buffs-buff"></span><h1>evennia.contrib.rpg.buffs.buff<aclass="headerlink"href="#module-evennia.contrib.rpg.buffs.buff"title="Permalink to this headline">¶</a></h1>
<p>Buffs - Tegiminis 2022</p>
<p>A buff is a timed object, attached to a game entity, that modifies values, triggers
code, or both. It is a common design pattern in RPGs, particularly action games.</p>
<p>This contrib gives you a buff handler to apply to your objects, a buff class to extend them,
a sample property class to show how to automatically check modifiers, some sample buffs to learn from,
and a command which applies buffs.</p>
<sectionid="installation">
<h2>Installation<aclass="headerlink"href="#installation"title="Permalink to this headline">¶</a></h2>
<p>Assign the handler to a property on the object, like so.</p>
<h2>Using the Handler<aclass="headerlink"href="#using-the-handler"title="Permalink to this headline">¶</a></h2>
<p>To make use of the handler, you will need:</p>
<ulclass="simple">
<li><p>Some buffs to add. You can create these by extending the <strong>BaseBuff</strong> class from this module. You can see some examples in <strong>samplebuffs.py</strong>.</p></li>
<li><p>A way to add buffs to the handler. You can see a basic example of this in the <strong>CmdBuff</strong> command in this module.</p></li>
</ul>
<sectionid="applying-a-buff">
<h3>Applying a Buff<aclass="headerlink"href="#applying-a-buff"title="Permalink to this headline">¶</a></h3>
<p>Call the handler <strong>add(BuffClass)</strong> method. This requires a class reference, and also contains a number of
optional arguments to customize the buff’s duration, stacks, and so on.</p>
<divclass="highlight-default notranslate"><divclass="highlight"><pre><span></span><spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">buffs</span><spanclass="o">.</span><spanclass="n">add</span><spanclass="p">(</span><spanclass="n">StrengthBuff</span><spanclass="p">)</span><spanclass="c1"># A single stack of StrengthBuff with normal duration</span>
<spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">buffs</span><spanclass="o">.</span><spanclass="n">add</span><spanclass="p">(</span><spanclass="n">DexBuff</span><spanclass="p">,</span><spanclass="n">stacks</span><spanclass="o">=</span><spanclass="mi">3</span><spanclass="p">,</span><spanclass="n">duration</span><spanclass="o">=</span><spanclass="mi">60</span><spanclass="p">)</span><spanclass="c1"># Three stacks of DexBuff, with a duration of 60 seconds</span>
<spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">buffs</span><spanclass="o">.</span><spanclass="n">add</span><spanclass="p">(</span><spanclass="n">ReflectBuff</span><spanclass="p">,</span><spanclass="n">to_cache</span><spanclass="o">=</span><spanclass="p">{</span><spanclass="s1">'reflect'</span><spanclass="p">:</span><spanclass="mf">0.5</span><spanclass="p">})</span><spanclass="c1"># A single stack of ReflectBuff, with an extra cache value</span>
</pre></div>
</div>
</section>
<sectionid="modify">
<h3>Modify<aclass="headerlink"href="#modify"title="Permalink to this headline">¶</a></h3>
<p>Call the handler <strong>check(value, stat)</strong> method wherever you want to see the modified value.
This will return the value, modified by and relevant buffs on the handler’s owner (identified by
the <strong>stat</strong> string). For example:</p>
<divclass="highlight-default notranslate"><divclass="highlight"><pre><span></span><spanclass="c1"># The method we call to damage ourselves</span>
<h2>Buffs<aclass="headerlink"href="#buffs"title="Permalink to this headline">¶</a></h2>
<p>A buff is a class which contains a bunch of immutable data about itself - such as tickrate, triggers, refresh rules, and
so on - and which merges mutable data in from the cache when called.</p>
<p>Buffs are always instanced when they are called for a method. To access a buff’s properties and methods, you should do so through
this instance, rather than directly manipulating the buff cache on the object. You can modify a buff’s cache through various handler
methods instead.</p>
<p>You can see all the features of the <strong>BaseBuff</strong> class below, or browse <strong>samplebuffs.py</strong> to see how to create some common buffs. Buffs have
many attributes and hook methods you can overload to create complex, interrelated buffs.</p>
<dlclass="py function">
<dtid="evennia.contrib.rpg.buffs.buff.random">
<codeclass="sig-prename descclassname">evennia.contrib.rpg.buffs.buff.</code><codeclass="sig-name descname">random</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ x in the interval [0, 1).<aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.random"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py class">
<dtid="evennia.contrib.rpg.buffs.buff.BaseBuff">
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.rpg.buffs.buff.</code><codeclass="sig-name descname">BaseBuff</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">handler</span></em>, <emclass="sig-param"><spanclass="n">buffkey</span></em>, <emclass="sig-param"><spanclass="n">cache</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = 'template'</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">name</code><emclass="property"> = 'Template'</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.name"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">flavor</code><emclass="property"> = 'Template'</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.flavor"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">visible</code><emclass="property"> = True</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.visible"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">triggers</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.triggers"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">handler</code><emclass="property"> = None</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.handler"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">start</code><emclass="property"> = 0</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.start"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">duration</code><emclass="property"> = -1</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.duration"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">playtime</code><emclass="property"> = False</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.playtime"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">refresh</code><emclass="property"> = True</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.refresh"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">unique</code><emclass="property"> = True</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.unique"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">maxstacks</code><emclass="property"> = 1</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.maxstacks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">stacks</code><emclass="property"> = 1</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.stacks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">tickrate</code><emclass="property"> = 0</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.tickrate"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">mods</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.mods"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">cache</code><emclass="property"> = {}</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.cache"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">ticknum</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.ticknum"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns how many ticks this buff has gone through as an integer.</p>
<emclass="property">property </em><codeclass="sig-name descname">owner</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.owner"title="Permalink to this definition">¶</a></dt>
<dd><p>Return this buff’s owner (the object its handler is attached to)</p>
<emclass="property">property </em><codeclass="sig-name descname">timeleft</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.timeleft"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns how much time this buff has left. If -1, it is permanent.</p>
<emclass="property">property </em><codeclass="sig-name descname">ticking</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.ticking"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns if this buff ticks or not (tickrate => 1)</p>
<emclass="property">property </em><codeclass="sig-name descname">stacking</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.stacking"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns if this buff stacks or not (maxstacks > 1)</p>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">handler</span></em>, <emclass="sig-param"><spanclass="n">buffkey</span></em>, <emclass="sig-param"><spanclass="n">cache</span></em><spanclass="sig-paren">)</span>→ None<aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.__init__"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>handler</strong>– The handler this buff is attached to</p></li>
<li><p><strong>buffkey</strong>– The key this buff uses on the cache</p></li>
<li><p><strong>cache</strong>– The cache dictionary (what you get if you use <strong>handler.buffcache.get(key)</strong>)</p></li>
<codeclass="sig-name descname">conditional</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.conditional"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.conditional"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook function for conditional evaluation.</p>
<p>This must return True for a buff to apply modifiers, trigger effects, or tick.</p>
<codeclass="sig-name descname">remove</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">loud</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">expire</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.remove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.remove"title="Permalink to this definition">¶</a></dt>
<dd><p>Helper method which removes this buff from its handler. Use dispel if you are dispelling it instead.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>loud</strong>– (optional) Whether to call at_remove or not (default: True)</p></li>
<li><p><strong>expire</strong>– (optional) Whether to call at_expire or not (default: False)</p></li>
<li><p><strong>delay</strong>– (optional) How long you want to delay the remove call for</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_remove/at_expire method as kwargs</p></li>
<codeclass="sig-name descname">dispel</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">loud</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">delay</span><spanclass="o">=</span><spanclass="default_value">0</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.dispel"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.dispel"title="Permalink to this definition">¶</a></dt>
<dd><p>Helper method which dispels this buff (removes and calls at_dispel).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>loud</strong>– (optional) Whether to call at_remove or not (default: True)</p></li>
<li><p><strong>delay</strong>– (optional) How long you want to delay the remove call for</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_remove/at_dispel method as kwargs</p></li>
<codeclass="sig-name descname">pause</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.pause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.pause"title="Permalink to this definition">¶</a></dt>
<dd><p>Helper method which pauses this buff on its handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_pause method as kwargs</p>
<codeclass="sig-name descname">unpause</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.unpause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.unpause"title="Permalink to this definition">¶</a></dt>
<dd><p>Helper method which unpauses this buff on its handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_unpause method as kwargs</p>
<codeclass="sig-name descname">reset</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.reset"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.reset"title="Permalink to this definition">¶</a></dt>
<dd><p>Resets the buff start time as though it were just applied; functionally identical to a refresh</p>
<codeclass="sig-name descname">update_cache</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">to_cache</span><spanclass="p">:</span><spanclass="n">dict</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.update_cache"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.update_cache"title="Permalink to this definition">¶</a></dt>
<dd><p>Updates this buff’s cache using the given values, both internally (this instance) and on the handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>to_cache</strong>– The dictionary of values you want to add to the cache</p>
<codeclass="sig-name descname">at_init</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_init"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_init"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook function called when this buff object is initialized.</p>
<codeclass="sig-name descname">at_apply</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_apply"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_apply"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook function to run when this buff is applied to an object.</p>
<codeclass="sig-name descname">at_remove</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_remove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_remove"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook function to run when this buff is removed from an object.</p>
<codeclass="sig-name descname">at_dispel</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_dispel"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_dispel"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook function to run when this buff is dispelled from an object (removed by someone other than the buff holder).</p>
<codeclass="sig-name descname">at_expire</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_expire"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_expire"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook function to run when this buff expires from an object.</p>
<codeclass="sig-name descname">at_pre_check</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_pre_check"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_pre_check"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook function to run before this buff’s modifiers are checked.</p>
<codeclass="sig-name descname">at_post_check</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_post_check"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_post_check"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook function to run after this buff’s mods are checked.</p>
<codeclass="sig-name descname">at_trigger</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">trigger</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_trigger"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_trigger"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook for the code you want to run whenever the effect is triggered.
Passes the trigger string to the function, so you can have multiple
<codeclass="sig-name descname">at_tick</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">initial</span><spanclass="p">:</span><spanclass="n">bool</span></em>, <emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_tick"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_tick"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook for actions that occur per-tick, a designer-set sub-duration.
<strong>initial</strong> tells you if it’s the first tick that happens (when a buff is applied).</p>
<codeclass="sig-name descname">at_pause</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_pause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_pause"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">at_unpause</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BaseBuff.at_unpause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BaseBuff.at_unpause"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook for when this buff is unpaused.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="evennia.contrib.rpg.buffs.buff.Mod">
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.rpg.buffs.buff.</code><codeclass="sig-name descname">Mod</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">stat</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">modifier</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">value</span></em>, <emclass="sig-param"><spanclass="n">perstack</span><spanclass="o">=</span><spanclass="default_value">0.0</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#Mod"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.Mod"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">stat</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">modifier</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">value</span></em>, <emclass="sig-param"><spanclass="n">perstack</span><spanclass="o">=</span><spanclass="default_value">0.0</span></em><spanclass="sig-paren">)</span>→ None<aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#Mod.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.Mod.__init__"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>stat</strong>– The stat the buff affects. Normally matches the object attribute name</p></li>
<li><p><strong>mod</strong>– The modifier the buff applies. “add” for add/sub or “mult” for mult/div</p></li>
<li><p><strong>value</strong>– The value of the modifier</p></li>
<li><p><strong>perstack</strong>– How much is added to the base, per stack (including first).</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="py attribute">
<dtid="evennia.contrib.rpg.buffs.buff.Mod.stat">
<codeclass="sig-name descname">stat</code><emclass="property"> = 'null'</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.Mod.stat"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">modifier</code><emclass="property"> = 'add'</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.Mod.modifier"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py attribute">
<dtid="evennia.contrib.rpg.buffs.buff.Mod.value">
<codeclass="sig-name descname">value</code><emclass="property"> = 0</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.Mod.value"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">perstack</code><emclass="property"> = 0</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.Mod.perstack"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.rpg.buffs.buff.</code><codeclass="sig-name descname">BuffHandler</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">owner</span></em>, <emclass="sig-param"><spanclass="n">dbkey</span><spanclass="o">=</span><spanclass="default_value">'buffs'</span></em>, <emclass="sig-param"><spanclass="n">autopause</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">owner</span></em>, <emclass="sig-param"><spanclass="n">dbkey</span><spanclass="o">=</span><spanclass="default_value">'buffs'</span></em>, <emclass="sig-param"><spanclass="n">autopause</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.__init__"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>owner</strong>– The object this handler is attached to</p></li>
<li><p><strong>dbkey</strong>– (optional) The string key of the db attribute to use for the buff cache</p></li>
<li><p><strong>autopause</strong>– (optional) Whether this handler autopauses playtime buffs on owning object’s unpuppet</p></li>
<codeclass="sig-name descname">ownerref</code><emclass="property"> = None</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.ownerref"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">dbkey</code><emclass="property"> = 'buffs'</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.dbkey"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">autopause</code><emclass="property"> = False</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.autopause"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">owner</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.owner"title="Permalink to this definition">¶</a></dt>
<dd><p>The object this handler is attached to.</p>
<emclass="property">property </em><codeclass="sig-name descname">buffcache</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.buffcache"title="Permalink to this definition">¶</a></dt>
<dd><p>The object attribute we use for the buff cache. Auto-creates if not present.</p>
<emclass="property">property </em><codeclass="sig-name descname">traits</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.traits"title="Permalink to this definition">¶</a></dt>
<dd><p>All buffs on this handler that modify a stat.</p>
<emclass="property">property </em><codeclass="sig-name descname">effects</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.effects"title="Permalink to this definition">¶</a></dt>
<dd><p>All buffs on this handler that trigger off an event.</p>
<emclass="property">property </em><codeclass="sig-name descname">playtime</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.playtime"title="Permalink to this definition">¶</a></dt>
<dd><p>All buffs on this handler that only count down during active playtime.</p>
<emclass="property">property </em><codeclass="sig-name descname">paused</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.paused"title="Permalink to this definition">¶</a></dt>
<dd><p>All buffs on this handler that are paused.</p>
<emclass="property">property </em><codeclass="sig-name descname">expired</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.expired"title="Permalink to this definition">¶</a></dt>
<dd><p>All buffs on this handler that have expired (no duration or no stacks).</p>
<emclass="property">property </em><codeclass="sig-name descname">visible</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.visible"title="Permalink to this definition">¶</a></dt>
<dd><p>All buffs on this handler that are visible.</p>
<emclass="property">property </em><codeclass="sig-name descname">all</code><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.all"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns dictionary of instanced buffs equivalent to ALL buffs on this handler,
<codeclass="sig-name descname">remove_by_stat</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">stat</span></em>, <emclass="sig-param"><spanclass="n">loud</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">dispel</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">expire</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.remove_by_stat"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.remove_by_stat"title="Permalink to this definition">¶</a></dt>
<dd><p>Removes all buffs modifying the specified stat from this object.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>stat</strong>– The stat string to search for</p></li>
<li><p><strong>loud</strong>– (optional) Calls at_remove when True. (default: True)</p></li>
<li><p><strong>dispel</strong>– (optional) Calls at_dispel when True. (default: False)</p></li>
<li><p><strong>expire</strong>– (optional) Calls at_expire when True. (default: False)</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_remove/at_dispel/at_expire method as kwargs</p></li>
<codeclass="sig-name descname">remove_by_trigger</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">trigger</span></em>, <emclass="sig-param"><spanclass="n">loud</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">dispel</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">expire</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.remove_by_trigger"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.remove_by_trigger"title="Permalink to this definition">¶</a></dt>
<dd><p>Removes all buffs with the specified trigger from this object.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>trigger</strong>– The stat string to search for</p></li>
<li><p><strong>loud</strong>– (optional) Calls at_remove when True. (default: True)</p></li>
<li><p><strong>dispel</strong>– (optional) Calls at_dispel when True. (default: False)</p></li>
<li><p><strong>expire</strong>– (optional) Calls at_expire when True. (default: False)</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_remove/at_dispel/at_expire method as kwargs</p></li>
<codeclass="sig-name descname">remove_by_source</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">source</span></em>, <emclass="sig-param"><spanclass="n">loud</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">dispel</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">expire</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.remove_by_source"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.remove_by_source"title="Permalink to this definition">¶</a></dt>
<dd><p>Removes all buffs from the specified source from this object.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>source</strong>– The source to search for</p></li>
<li><p><strong>loud</strong>– (optional) Calls at_remove when True. (default: True)</p></li>
<li><p><strong>dispel</strong>– (optional) Calls at_dispel when True. (default: False)</p></li>
<li><p><strong>expire</strong>– (optional) Calls at_expire when True. (default: False)</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_remove/at_dispel/at_expire method as kwargs</p></li>
<codeclass="sig-name descname">clear</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">loud</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">dispel</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">expire</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.clear"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.clear"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">key</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.get"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.get"title="Permalink to this definition">¶</a></dt>
<dd><p>If the specified key is on this handler, return the instanced buff. Otherwise return None.
You should delete this when you’re done with it, so that garbage collection doesn’t have to.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>key</strong>– The key for the buff you wish to get</p>
<codeclass="sig-name descname">get_all</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.get_all"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.get_all"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a dictionary of instanced buffs (all of them) on this handler in the format {buffkey: instance}</p>
<codeclass="sig-name descname">get_by_type</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">buff</span><spanclass="p">:</span><spanclass="n"><aclass="reference internal"href="#evennia.contrib.rpg.buffs.buff.BaseBuff"title="evennia.contrib.rpg.buffs.buff.BaseBuff">evennia.contrib.rpg.buffs.buff.BaseBuff</a></span></em>, <emclass="sig-param"><spanclass="n">to_filter</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.get_by_type"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.get_by_type"title="Permalink to this definition">¶</a></dt>
<dd><p>Finds all buffs matching the given type.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>buff</strong>– The buff class to search for</p></li>
<li><p><strong>to_filter</strong>– (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.</p></li>
</ul>
</dd>
</dl>
<p>Returns a dictionary of instanced buffs of the specified type in the format {buffkey: instance}.</p>
<codeclass="sig-name descname">get_by_stat</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">stat</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">to_filter</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.get_by_stat"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.get_by_stat"title="Permalink to this definition">¶</a></dt>
<dd><p>Finds all buffs which contain a Mod object that modifies the specified stat.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>stat</strong>– The string identifier to find relevant mods</p></li>
<li><p><strong>to_filter</strong>– (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.</p></li>
</ul>
</dd>
</dl>
<p>Returns a dictionary of instanced buffs which modify the specified stat in the format {buffkey: instance}.</p>
<codeclass="sig-name descname">get_by_trigger</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">trigger</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">to_filter</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.get_by_trigger"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.get_by_trigger"title="Permalink to this definition">¶</a></dt>
<dd><p>Finds all buffs with the matching string in their triggers.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>trigger</strong>– The string identifier to find relevant buffs</p></li>
<li><p><strong>to_filter</strong>– (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.</p></li>
</ul>
</dd>
</dl>
<p>Returns a dictionary of instanced buffs which fire off the designated trigger, in the format {buffkey: instance}.</p>
<codeclass="sig-name descname">get_by_source</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">source</span></em>, <emclass="sig-param"><spanclass="n">to_filter</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.get_by_source"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.get_by_source"title="Permalink to this definition">¶</a></dt>
<dd><p>Find all buffs with the matching source.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>source</strong>– The source you want to filter buffs by</p></li>
<li><p><strong>to_filter</strong>– (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.</p></li>
</ul>
</dd>
</dl>
<p>Returns a dictionary of instanced buffs which came from the provided source, in the format {buffkey: instance}.</p>
<codeclass="sig-name descname">get_by_cachevalue</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">key</span></em>, <emclass="sig-param"><spanclass="n">value</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">to_filter</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.get_by_cachevalue"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.get_by_cachevalue"title="Permalink to this definition">¶</a></dt>
<dd><p>Find all buffs with a matching {key: value} pair in its cache. Allows you to search buffs by arbitrary cache values</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>key</strong>– The key of the cache value to check</p></li>
<li><p><strong>value</strong>– (optional) The value to match to. If None, merely checks to see if the value exists</p></li>
<li><p><strong>to_filter</strong>– (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.</p></li>
</ul>
</dd>
</dl>
<p>Returns a dictionary of instanced buffs with cache values matching the specified value, in the format {buffkey: instance}.</p>
<codeclass="sig-name descname">has</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">buff</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span>→ bool<aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.has"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.has"title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if the specified buff type or key exists on the handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>buff</strong>– The buff to search for. This can be a string (the key) or a class reference (the buff type)</p>
</dd>
</dl>
<p>Returns a bool. If no buff and no key is specified, returns False.</p>
<codeclass="sig-name descname">trigger</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">trigger</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="p">:</span><spanclass="n">dict</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.trigger"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.trigger"title="Permalink to this definition">¶</a></dt>
<dd><p>Calls the at_trigger method on all buffs with the matching trigger.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>trigger</strong>– The string identifier to find relevant buffs. Passed to the at_trigger method.</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_trigger method as kwargs</p></li>
<codeclass="sig-name descname">pause</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">key</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.pause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.pause"title="Permalink to this definition">¶</a></dt>
<dd><p>Pauses the buff. This excludes it from being checked for mods, triggered, or cleaned up. Used to make buffs ‘playtime’ instead of ‘realtime’.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>key</strong>– The key for the buff you wish to pause</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_pause method as kwargs</p></li>
<codeclass="sig-name descname">unpause</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">key</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.unpause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.unpause"title="Permalink to this definition">¶</a></dt>
<dd><p>Unpauses a buff. This makes it visible to the various buff systems again.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>key</strong>– The key for the buff you wish to pause</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_unpause method as kwargs</p></li>
<codeclass="sig-name descname">view</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">to_filter</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span>→ dict<aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.view"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.view"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a buff flavor text as a dictionary of tuples in the format {key: (name, flavor)}. Common use for this is a buff readout of some kind.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>to_filter</strong>– (optional) The dictionary of buffs to iterate over. If none is provided, returns all buffs (default: None)</p>
<codeclass="sig-name descname">view_modifiers</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">stat</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.view_modifiers"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.view_modifiers"title="Permalink to this definition">¶</a></dt>
<dd><p>Checks all modifiers of the specified stat without actually applying them. Hits the conditional hook for relevant buffs.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>stat</strong>– The mod identifier string to search for</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the conditional hooks as kwargs</p></li>
</ul>
</dd>
</dl>
<p>Returns a nested dictionary. The first layer’s keys represent the type of modifier (‘add’ and ‘mult’),
and the second layer’s keys represent the type of value (‘total’ and ‘strongest’).</p>
<codeclass="sig-name descname">cleanup</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffHandler.cleanup"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffHandler.cleanup"title="Permalink to this definition">¶</a></dt>
<dd><p>Removes expired buffs, ensures pause state is respected.</p>
<codeclass="sig-name descname">at_get</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">value</span></em>, <emclass="sig-param"><spanclass="n">obj</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#BuffableProperty.at_get"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.BuffableProperty.at_get"title="Permalink to this definition">¶</a></dt>
<dd><p>The value returned from the Attribute is passed through this method. It can be used
to react to the retrieval or modify the result in some way.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>value</strong> (<em>any</em>) – Value returned from the Attribute.</p></li>
<li><p><strong>obj</strong> (<em>object</em>) – Object the attribute is attached to</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>any</em>– The value to return to the caller.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.rpg.buffs.buff.</code><codeclass="sig-name descname">CmdBuff</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#CmdBuff"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.CmdBuff"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = 'buff'</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.CmdBuff.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.CmdBuff.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">lock_storage</code><emclass="property"> = 'cmd:all();'</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.CmdBuff.lock_storage"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">search_index_entry</code><emclass="property"> = {'aliases': '', 'category': 'builder', 'key': 'buff', 'no_prefix': ' ', 'tags': '', 'text': '\n Buff a target.\n\n Usage:\n buff <target><buff>\n\n Applies the specified buff to the target. All buffs are defined in the bufflist dictionary on this command.\n '}</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.CmdBuff.search_index_entry"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'builder'</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.CmdBuff.help_category"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">bufflist</code><emclass="property"> = {'foo': <class 'evennia.contrib.rpg.buffs.buff.BaseBuff'>}</em><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.CmdBuff.bufflist"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">parse</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#CmdBuff.parse"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.CmdBuff.parse"title="Permalink to this definition">¶</a></dt>
<dd><p>Once the cmdhandler has identified this as the command we
want, this function is run. If many of your commands have a
similar syntax (for example ‘cmd arg1 = arg2’) you should
simply define this once and just let other commands of the
same form inherit from this. See the docstring of this module
for which object properties are available to use (notably
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#CmdBuff.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.CmdBuff.func"title="Permalink to this definition">¶</a></dt>
<dd><p>This is the actual executing part of the command. It is
called directly after self.parse(). See the docstring of this
module for which object properties are available (beyond those
<codeclass="sig-prename descclassname">evennia.contrib.rpg.buffs.buff.</code><codeclass="sig-name descname">cleanup_buffs</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">handler</span><spanclass="p">:</span><spanclass="n"><aclass="reference internal"href="#evennia.contrib.rpg.buffs.buff.BuffHandler"title="evennia.contrib.rpg.buffs.buff.BuffHandler">evennia.contrib.rpg.buffs.buff.BuffHandler</a></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#cleanup_buffs"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.cleanup_buffs"title="Permalink to this definition">¶</a></dt>
<dd><p>Cleans up all expired buffs from a handler.</p>
</dd></dl>
<dlclass="py function">
<dtid="evennia.contrib.rpg.buffs.buff.tick_buff">
<codeclass="sig-prename descclassname">evennia.contrib.rpg.buffs.buff.</code><codeclass="sig-name descname">tick_buff</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">handler</span><spanclass="p">:</span><spanclass="n"><aclass="reference internal"href="#evennia.contrib.rpg.buffs.buff.BuffHandler"title="evennia.contrib.rpg.buffs.buff.BuffHandler">evennia.contrib.rpg.buffs.buff.BuffHandler</a></span></em>, <emclass="sig-param"><spanclass="n">buffkey</span><spanclass="p">:</span><spanclass="n">str</span></em>, <emclass="sig-param"><spanclass="n">context</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">initial</span><spanclass="o">=</span><spanclass="default_value">True</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/rpg/buffs/buff.html#tick_buff"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.rpg.buffs.buff.tick_buff"title="Permalink to this definition">¶</a></dt>
<dd><p>Ticks a buff. If a buff’s tickrate is 1 or larger, this is called when the buff is applied, and then once per tick cycle.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>handler</strong>– The handler managing the ticking buff</p></li>
<li><p><strong>buffkey</strong>– The key of the ticking buff</p></li>
<li><p><strong>context</strong>– (optional) A dictionary you wish to pass to the at_tick method as kwargs</p></li>
<li><p><strong>initial</strong>– (optional) Whether this tick_buff call is the first one. Starts True, changes to False for future ticks</p></li>