Difference between revisions of "Template:E"

From Tales of Maj'Eyal
Jump to: navigation, search
(Clarified regeneration)
(Test area seems stable, merging to main)
 
Line 1: Line 1:
−
<!-- Needs a way to reuse the switch type. Currently it's just manual copy-and-paste. -->
+
<includeonly><onlyinclude>{{#ifeq:{{{context|}}}||
−
<includeonly><onlyinclude>{{#switch: {{{1}}}
+
{{#ifeq:{{{value|{{{resolver|{{{scale|{{{context|{{{min|{{{max|{{{base|{{{bonus|{{{display_scale|{{{label|{{{effect|{{{property|0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}|{{{value|{{{resolver|{{{scale|{{{context|{{{min|{{{max|{{{base|{{{bonus|{{{display_scale|{{{label|{{{effect|{{{property|1}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}|<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|
 +
<!-- Positional calls. -->
 +
{{#switch: {{{1}}}
 
| resists = Changes resistances: + ({{{4}}}-{{#expr:{{{4}}}+{{{3}}}}})% {{#switch: {{{2}}}
 
| resists = Changes resistances: + ({{{4}}}-{{#expr:{{{4}}}+{{{3}}}}})% {{#switch: {{{2}}}
 
| all = all
 
| all = all
Line 146: Line 148:
 
| no_breath = The wearer no longer has to breathe.
 
| no_breath = The wearer no longer has to breathe.
 
| charmt = It can be used to activate talent {{t|{{{2}}}}} (level {{{3}}}, costing {{{4}}} power)
 
| charmt = It can be used to activate talent {{t|{{{2}}}}} (level {{{3}}}, costing {{{4}}} power)
−
| ?? }}</onlyinclude></includeonly>
+
| ?? }}}}|
−
[[Category:Templates]]
+
<!-- Explicit inputs: shared checks, wording and amounts. -->
 +
{{#iferror:{{#ifeq:{{{5|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{property|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{effect|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{label|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{display_scale|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{bonus|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{base|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{max|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{min|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{value|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#iferror:{{#expr:{{{scale|__E_ABSENT__}}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|
 +
{{#ifeq:{{{scale|__E_ABSENT__}}}|
 +
{{#expr:{{{scale|__E_ABSENT__}}}}}|
 +
{{#iferror:{{#expr:{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{3|__E_ABSENT__}}}|melee_project={{{3|__E_ABSENT__}}}|#default={{{2|__E_ABSENT__}}}}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|
 +
{{#ifeq:{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{3|__E_ABSENT__}}}|melee_project={{{3|__E_ABSENT__}}}|#default={{{2|__E_ABSENT__}}}}}|
 +
{{#expr:{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{3|__E_ABSENT__}}}|melee_project={{{3|__E_ABSENT__}}}|#default={{{2|__E_ABSENT__}}}}}}}|
 +
{{#iferror:{{#expr:{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|
 +
{{#ifeq:{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}}|
 +
{{#expr:{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}}}}|
 +
{{#ifexpr:{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{3|__E_ABSENT__}}}|melee_project={{{3|__E_ABSENT__}}}|#default={{{2|__E_ABSENT__}}}}} < 0|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|
 +
{{#iferror:{{#if:{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit=1|melee_project=1|disease_immune=1|#default=}}|
 +
{{#ifexpr:(({{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}})*({{{scale|__E_ABSENT__}}})) < 0 or ((({{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}})+({{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{3|__E_ABSENT__}}}|melee_project={{{3|__E_ABSENT__}}}|#default={{{2|__E_ABSENT__}}}}}))*({{{scale|__E_ABSENT__}}})) < 0|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|1}}|1}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|
 +
{{#iferror:{{#expr:{{#expr:({{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}})*({{{scale|__E_ABSENT__}}})*{{#ifeq:{{{1|__E_ABSENT__}}}|disease_immune|100|1}}}}}}{{#expr:{{#expr:(({{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}})+({{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{3|__E_ABSENT__}}}|melee_project={{{3|__E_ABSENT__}}}|#default={{{2|__E_ABSENT__}}}}}))*({{{scale|__E_ABSENT__}}})*{{#ifeq:{{{1|__E_ABSENT__}}}|disease_immune|100|1}}}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|
 +
{{#switch:{{{1|__E_ABSENT__}}}/{{{context|__E_ABSENT__}}}/{{{resolver|__E_ABSENT__}}}|life_regen/wearer/mbonus_material={{#ifeq:{{{4|__E_ABSENT__}}}|__E_ABSENT__|1|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|mana_regen/wearer/mbonus_material={{#ifeq:{{{4|__E_ABSENT__}}}|__E_ABSENT__|1|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|psi_regen/wearer/mbonus_material={{#ifeq:{{{4|__E_ABSENT__}}}|__E_ABSENT__|1|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|stamina_regen/wearer/mbonus_material={{#ifeq:{{{4|__E_ABSENT__}}}|__E_ABSENT__|1|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|disease_immune/wearer/mbonus_material={{#ifeq:{{{4|__E_ABSENT__}}}|__E_ABSENT__|1|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|on_melee_hit/actor/mbonus={{#switch:{{{2|__E_ABSENT__}}}|fire=1|#default=<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|melee_project/actor/mbonus={{#switch:{{{2|__E_ABSENT__}}}|fire=1|blight=1|#default=<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|#default=<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}}}}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}}}|
 +
{{#ifeq:{{{4|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{3|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{scale|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#ifeq:{{{resolver|__E_ABSENT__}}}|__E_ABSENT__|
 +
{{#iferror:{{#expr:{{{value|__E_ABSENT__}}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|
 +
{{#ifeq:{{{value|__E_ABSENT__}}}|
 +
{{#expr:{{{value|__E_ABSENT__}}}}}|
 +
{{#ifexpr:{{{value|__E_ABSENT__}}} < 0|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|
 +
{{#switch:{{{1|__E_ABSENT__}}}/{{{context|__E_ABSENT__}}}/{{{2|__E_ABSENT__}}}|on_melee_hit/actor/fire=1|#default=<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|
 +
<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>}}|<strong class="error">E: invalid explicit inputs; check property, context, values and conversion.</strong>|{{#switch:{{{1|__E_ABSENT__}}}|
 +
| life_regen = Life regen|
 +
| mana_regen = Mana each turn|
 +
| psi_regen = Psi each turn|
 +
| stamina_regen = Stamina each turn|
 +
| disease_immune = Disease immunity|
 +
| on_melee_hit = Damage when hit (Melee)|
 +
| melee_project = Damage (Melee)|
 +
#default=??}}: {{#ifeq:{{{value|__E_ABSENT__}}}|__E_ABSENT__|{{#ifexpr:({{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}}+{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{3|__E_ABSENT__}}}|melee_project={{{3|__E_ABSENT__}}}|#default={{{2|__E_ABSENT__}}}}}*({{{scale|__E_ABSENT__}}}<0))*{{{scale|__E_ABSENT__}}}*{{#ifeq:{{{1|__E_ABSENT__}}}|disease_immune|100|1}}<0||+<nowiki> </nowiki>}}({{#expr:({{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}}+{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{3|__E_ABSENT__}}}|melee_project={{{3|__E_ABSENT__}}}|#default={{{2|__E_ABSENT__}}}}}*({{{scale|__E_ABSENT__}}}<0))*{{{scale|__E_ABSENT__}}}*{{#ifeq:{{{1|__E_ABSENT__}}}|disease_immune|100|1}}}}-{{#expr:({{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{4|__E_ABSENT__}}}|melee_project={{{4|__E_ABSENT__}}}|#default={{{3|__E_ABSENT__}}}}}+{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit={{{3|__E_ABSENT__}}}|melee_project={{{3|__E_ABSENT__}}}|#default={{{2|__E_ABSENT__}}}}}*({{{scale|__E_ABSENT__}}}>=0))*{{{scale|__E_ABSENT__}}}*{{#ifeq:{{{1|__E_ABSENT__}}}|disease_immune|100|1}}}})|+ {{#expr:{{{value|__E_ABSENT__}}}}}}}{{#if:{{#switch:{{{1|__E_ABSENT__}}}|on_melee_hit=1|melee_project=1|#default=}}|<nowiki> </nowiki>{{{{{2|__E_ABSENT__}}}}}|{{#ifeq:{{{1|__E_ABSENT__}}}|disease_immune|%|}}}}}}}}</onlyinclude></includeonly>[[Category:Templates]]
  
 
This template is designed to match item effects descriptions and their lua code, to ensure consistency, intuitive conversion, and keep the wording in line with their in-game description.{{source|game/modules/mod/class/Object.lua}}
 
This template is designed to match item effects descriptions and their lua code, to ensure consistency, intuitive conversion, and keep the wording in line with their in-game description.{{source|game/modules/mod/class/Object.lua}}
 +
Set scale to match the conversion in the Lua code. For example, dividing by 10 uses scale=0.1; no conversion uses scale=1.
  
 
== Damage Types: Increases, Resistances and So Forth ==
 
== Damage Types: Increases, Resistances and So Forth ==
Line 175: Line 250:
 
<pre>{{e|resists|fire|15|15}}</pre>
 
<pre>{{e|resists|fire|15|15}}</pre>
  
−
To produces the following text: {{e|resists|fire|15|15}}
+
Which produces the following text: {{e|resists|fire|15|15}}
  
 
=== Resistance Penetration ===
 
=== Resistance Penetration ===
Line 184: Line 259:
 
<pre>{{e|resists_pen|physical|15|5}}</pre>
 
<pre>{{e|resists_pen|physical|15|5}}</pre>
  
−
To produces the following text: {{e|resists_pen|physical|15|5}}
+
Which produces the following text: {{e|resists_pen|physical|15|5}}
  
  
Line 194: Line 269:
 
<pre>{{e|inc_damage|physical|20|5}}</pre>
 
<pre>{{e|inc_damage|physical|20|5}}</pre>
  
−
To produces the following text: {{e|inc_damage|physical|20|5}}
+
Which produces the following text: {{e|inc_damage|physical|20|5}}
  
 
=== Effects on Hit ===
 
=== Effects on Hit ===
Line 203: Line 278:
 
<pre>{{e|on_melee_hit|physical|10|10}}</pre>
 
<pre>{{e|on_melee_hit|physical|10|10}}</pre>
  
−
To produces the following text: {{e|on_melee_hit|physical|10|10}}
+
Which produces the following text: {{e|on_melee_hit|physical|10|10}}
 +
 
 +
 
 +
The lua code for Draebor's fire damage when hit looks like
 +
<pre>on_melee_hit = {[DamageType.FIRE] = 15}</pre>
 +
{{source|base 1.7.6: data/zones/demon-plane/npcs.lua:49}}
 +
 
 +
Convert it with this template as
 +
<pre>{{e|on_melee_hit|fire|value=15|context=actor}}</pre>
 +
 
 +
Which produces the following text: {{e|on_melee_hit|fire|value=15|context=actor}}
  
 
=== Melee and Ranged Attacks with Extra Flat Damage ===
 
=== Melee and Ranged Attacks with Extra Flat Damage ===
Line 212: Line 297:
 
<pre>{{e|melee_project|fire|15|8}}</pre>
 
<pre>{{e|melee_project|fire|15|8}}</pre>
  
−
To produces the following text: {{e|melee_project|fire|15|8}}
+
Which produces the following text: {{e|melee_project|fire|15|8}}
 +
 
 +
 
 +
The lua code for Khulmanar's additional melee fire damage looks like
 +
<pre>melee_project = {[DamageType.FIRE] = resolvers.mbonus(25, 35)}</pre>
 +
{{source|base 1.7.6: data/general/npcs/major-demon.lua:317}}
 +
 
 +
Convert it with this template as
 +
<pre>{{e|melee_project|fire|25|35|resolver=mbonus|scale=1|context=actor}}</pre>
 +
 
 +
Which produces the following text: {{e|melee_project|fire|25|35|resolver=mbonus|scale=1|context=actor}}
  
 
== Combat Attributes ==
 
== Combat Attributes ==
Line 231: Line 326:
 
<pre>{{e|combat_armor|7|3}}</pre>
 
<pre>{{e|combat_armor|7|3}}</pre>
  
−
To produces the following text: {{e|combat_armor|7|3}}
+
Which produces the following text: {{e|combat_armor|7|3}}
  
 
=== Spell Cooldown ===
 
=== Spell Cooldown ===
Line 240: Line 335:
 
<pre>{{e|spell_cooldown_reduction|0.1}}</pre>
 
<pre>{{e|spell_cooldown_reduction|0.1}}</pre>
  
−
To produces the following text: {{e|spell_cooldown_reduction|0.1}}
+
Which produces the following text: {{e|spell_cooldown_reduction|0.1}}
  
  
Line 251: Line 346:
 
<pre>{{e|fatigue|6|4}}</pre>
 
<pre>{{e|fatigue|6|4}}</pre>
  
−
To produces the following text: {{e|fatigue|6|4}}
+
Which produces the following text: {{e|fatigue|6|4}}
  
 
== Maximum Encumberance ==
 
== Maximum Encumberance ==
Line 259: Line 354:
  
 
Convert it with this template as
 
Convert it with this template as
−
<pre>{{e|max_encumber|40|20}</pre>
+
<pre>{{e|max_encumber|40|20}}</pre>
  
−
To produces the following text: {{e|max_encumber|40|20}}
+
Which produces the following text: {{e|max_encumber|40|20}}
  
  
Line 283: Line 378:
 
<pre>{{e|inc_stats|wil|5|1}}</pre>
 
<pre>{{e|inc_stats|wil|5|1}}</pre>
  
−
To produces the following text:
+
Which produces the following text:
 
{{e|inc_stats|wil|5|1}}
 
{{e|inc_stats|wil|5|1}}
  
Line 292: Line 387:
  
 
Convert it with this template as
 
Convert it with this template as
−
<pre>{{e|resists_actor_type|unnatural|10|5}</pre>
+
<pre>{{e|resists_actor_type|unnatural|10|5}}</pre>
  
−
To produces the following text: {{e|resists_actor_type|unnatural|10|5}}
+
Which produces the following text: {{e|resists_actor_type|unnatural|10|5}}
  
 
== Rouge-ish Utilities ==
 
== Rouge-ish Utilities ==
Line 305: Line 400:
 
<pre>{{e|inc_stealth|10|5}}</pre>
 
<pre>{{e|inc_stealth|10|5}}</pre>
  
−
To produces the following text: {{e|inc_stealth|10|5}}
+
Which produces the following text: {{e|inc_stealth|10|5}}
  
 
=== Trap Disarm ===
 
=== Trap Disarm ===
Line 314: Line 409:
 
<pre>{{e|disarm_bonus|25|5}}</pre>
 
<pre>{{e|disarm_bonus|25|5}}</pre>
  
−
To produces the following text: {{e|disarm_bonus|25|5}}
+
Which produces the following text: {{e|disarm_bonus|25|5}}
  
 
=== Trap Detection ===
 
=== Trap Detection ===
Line 323: Line 418:
 
<pre>{{e|trap_detect_power|25|5}}</pre>
 
<pre>{{e|trap_detect_power|25|5}}</pre>
  
−
To produces the following text: {{e|trap_detect_power|25|5}}
+
Which produces the following text: {{e|trap_detect_power|25|5}}
  
  
Line 338: Line 433:
 
<pre>{{e|combat_physresist|15|10}}</pre>
 
<pre>{{e|combat_physresist|15|10}}</pre>
  
−
To produces the following text: {{e|combat_physresist|15|10}}
+
Which produces the following text: {{e|combat_physresist|15|10}}
  
  
Line 364: Line 459:
 
<pre>{{e|disease_immune|30|20}}</pre>
 
<pre>{{e|disease_immune|30|20}}</pre>
  
−
To produces the following text: {{e|disease_immune|30|20}}
+
Which produces the following text: {{e|disease_immune|30|20}}
 +
 
 +
 
 +
The lua code for the same disease immunity bonus looks like
 +
<pre>disease_immune = resolvers.mbonus_material(30, 20, function(e, v) return 0, v/100 end)</pre>
 +
{{source|base 1.7.6: data/general/objects/egos/amulets.lua:221}}
 +
 
 +
Convert it with this template as
 +
<pre>{{e|disease_immune|30|20|resolver=mbonus_material|scale=0.01|context=wearer}}</pre>
 +
 
 +
Which produces the following text: {{e|disease_immune|30|20|resolver=mbonus_material|scale=0.01|context=wearer}}
 +
 
 +
The callback stores a fraction; the template displays a percentage.{{source|base 1.7.6: mod/class/Object.lua:1775–1797}}
  
 
== Life and Resources ==
 
== Life and Resources ==
Line 389: Line 496:
  
 
This produces: {{e|mana_regen|30|10}}
 
This produces: {{e|mana_regen|30|10}}
 +
 +
 +
The following forms specify the callback conversion directly.
 +
 +
==== Life ====
 +
 +
The lua code for an ego's life regeneration bonus looks like
 +
<pre>life_regen = resolvers.mbonus_material(4, 1, function(e, v) return 0, v end)</pre>
 +
{{source|base 1.7.6: data/general/objects/egos/amulets.lua:236}}
 +
 +
Convert it with this template as
 +
<pre>{{e|life_regen|4|1|resolver=mbonus_material|scale=1|context=wearer}}</pre>
 +
 +
Which produces the following text: {{e|life_regen|4|1|resolver=mbonus_material|scale=1|context=wearer}}
 +
 +
 +
==== Mana ====
 +
 +
The lua code for an ego's mana regeneration bonus looks like
 +
<pre>mana_regen = resolvers.mbonus_material(23, 7, function(e, v) v=v/10 return 0, v end)</pre>
 +
{{source|base 1.7.6: data/general/objects/egos/wizard-hat.lua:90}}
 +
 +
Convert it with this template as
 +
<pre>{{e|mana_regen|23|7|resolver=mbonus_material|scale=0.1|context=wearer}}</pre>
 +
 +
Which produces the following text: {{e|mana_regen|23|7|resolver=mbonus_material|scale=0.1|context=wearer}}
 +
 +
 +
==== Psi ====
 +
 +
The lua code for an ego's psi regeneration bonus looks like
 +
<pre>psi_regen = resolvers.mbonus_material(12, 3, function(e, v) v=v/10 return 0, v end)</pre>
 +
{{source|base 1.7.6: data/general/objects/egos/mindstars.lua:648}}
 +
 +
Convert it with this template as
 +
<pre>{{e|psi_regen|12|3|resolver=mbonus_material|scale=0.1|context=wearer}}</pre>
 +
 +
Which produces the following text: {{e|psi_regen|12|3|resolver=mbonus_material|scale=0.1|context=wearer}}
 +
 +
 +
==== Stamina ====
 +
 +
The lua code for an ego's stamina regeneration bonus looks like
 +
<pre>stamina_regen = resolvers.mbonus_material(10, 2, function(e, v) v=v/10 return 0, v end)</pre>
 +
{{source|base 1.7.6: data/general/objects/egos/amulets.lua:177}}
 +
 +
Convert it with this template as
 +
<pre>{{e|stamina_regen|10|2|resolver=mbonus_material|scale=0.1|context=wearer}}</pre>
 +
 +
Which produces the following text: {{e|stamina_regen|10|2|resolver=mbonus_material|scale=0.1|context=wearer}}
 +
 +
The item tooltip uses the stored regeneration bonus.{{source|base 1.7.6: mod/class/Object.lua:1792–1796}}
  
 
=== Maximum Amount ===
 
=== Maximum Amount ===
Line 398: Line 557:
 
<pre>{{e|max_life|60|40}}</pre>
 
<pre>{{e|max_life|60|40}}</pre>
  
−
To produces the following text: {{e|max_life|60|40}}
+
Which produces the following text: {{e|max_life|60|40}}
  
 
=== Reduces Paradox Anomalies ===
 
=== Reduces Paradox Anomalies ===
Line 406: Line 565:
 
Convert it with this template as
 
Convert it with this template as
 
<pre>{{e|paradox_reduce_anomalies|10|10}}</pre>
 
<pre>{{e|paradox_reduce_anomalies|10|10}}</pre>
−
To produces the following text:
+
Which produces the following text:
 
{{e|paradox_reduce_anomalies|10|10}}
 
{{e|paradox_reduce_anomalies|10|10}}
  
Line 420: Line 579:
 
<pre>{{e|lite|1|2}}</pre>
 
<pre>{{e|lite|1|2}}</pre>
  
−
To produces the following text: {{e|lite|1|2}}
+
Which produces the following text: {{e|lite|1|2}}
  
 
=== Infravision ===
 
=== Infravision ===
Line 430: Line 589:
 
<pre>{{e|infravision|3|2}}</pre>
 
<pre>{{e|infravision|3|2}}</pre>
  
−
To produces the following text: {{e|infravision|3|2}}
+
Which produces the following text: {{e|infravision|3|2}}
  
 
== Speed ==
 
== Speed ==
Line 440: Line 599:
 
<pre>{{e|movement_speed|0.2}}</pre>
 
<pre>{{e|movement_speed|0.2}}</pre>
  
−
To produces the following text: {{e|movement_speed|0.2}}
+
Which produces the following text: {{e|movement_speed|0.2}}
  
  
Line 451: Line 610:
 
<pre>{{e|healing_factor|20|10}}</pre>
 
<pre>{{e|healing_factor|20|10}}</pre>
  
−
To produces the following text: {{e|healing_factor|20|10}}
+
Which produces the following text: {{e|healing_factor|20|10}}
  
 
== Aftere-teleport perks ==
 
== Aftere-teleport perks ==
Line 466: Line 625:
 
<pre>{{e|defense_on_teleport|20|10}}</pre>
 
<pre>{{e|defense_on_teleport|20|10}}</pre>
  
−
To produces the following text: {{e|defense_on_teleport|20|10}}
+
Which produces the following text: {{e|defense_on_teleport|20|10}}
  
 
== Various States Effects ==
 
== Various States Effects ==
Line 478: Line 637:
 
<pre>{{e|size_category}}</pre>
 
<pre>{{e|size_category}}</pre>
  
−
To produces the following text: {{e|size_category}}
+
Which produces the following text: {{e|size_category}}
  
 
=== As Undead ===
 
=== As Undead ===
Line 488: Line 647:
 
<pre>{{e|undead}}</pre>
 
<pre>{{e|undead}}</pre>
  
−
To produces the following text: {{e|undead}}
+
Which produces the following text: {{e|undead}}
  
 
=== Water-breathing ===
 
=== Water-breathing ===
Line 498: Line 657:
 
<pre>{{e|can_breath}}</pre>
 
<pre>{{e|can_breath}}</pre>
  
−
To produces the following text: {{e|can_breath}}
+
Which produces the following text: {{e|can_breath}}
  
 
=== Non-breathing ===
 
=== Non-breathing ===
Line 508: Line 667:
 
<pre>{{e|no_breath}}</pre>
 
<pre>{{e|no_breath}}</pre>
  
−
To produces the following text: {{e|no_breath}}
+
Which produces the following text: {{e|no_breath}}
  
 
== An Object's Usable Power ==
 
== An Object's Usable Power ==
Line 520: Line 679:
 
<pre>{{e|charmt|track|2|30}}</pre>
 
<pre>{{e|charmt|track|2|30}}</pre>
  
−
To produces the following text: {{e|charmt|track|2|30}}
+
Which produces the following text: {{e|charmt|Track|2|30}}

Latest revision as of 11:38, 23 September 2026


This template is designed to match item effects descriptions and their lua code, to ensure consistency, intuitive conversion, and keep the wording in line with their in-game description. Source:game/modules/mod/class/Object.lua

Set scale to match the conversion in the Lua code. For example, dividing by 10 uses scale=0.1; no conversion uses scale=1.

Damage Types: Increases, Resistances and So Forth

Supported damage types:

  • all
  • acid
  • arcane
  • blight
  • cold
  • darkness
  • fire
  • light
  • lightning
  • mind
  • nature
  • physical
  • temporal

Resistances

The lua code specifying an ego's effect on, e.g. fire resistance, looks like

resists={[DamageType.FIRE] = resolvers.mbonus_material(15, 15)}

Convert it with this template as

{{e|resists|fire|15|15}}

Which produces the following text: Changes resistances: + (15-30)% Fire

Resistance Penetration

The lua code specifying an ego that allows you to penetrate the target's , e.g. physical resistance, looks like

resists_pen = {[DamageType.PHYSICAL] = resolvers.mbonus_material(15, 5)}

Convert it with this template as

{{e|resists_pen|physical|15|5}}

Which produces the following text: Changes resistances penetration: + (5-20)% Physical


Increases

The lua code specifying an ego that increases, e.g. physical damage, looks like

inc_damage = {[DamageType.PHYSICAL] = resolvers.mbonus_material(20, 5)}

Convert it with this template as

{{e|inc_damage|physical|20|5}}

Which produces the following text: Changes damage: + (5-25)% Physical

Effects on Hit

The lua code specifying an ego's dealing physical damage when the wearer is hit looks like

on_melee_hit={[DamageType.PHYSICAL] = resolvers.mbonus_material(10, 10)}

Convert it with this template as

{{e|on_melee_hit|physical|10|10}}

Which produces the following text: Damage when hit (Melee): + (10-20) Physical


The lua code for Draebor's fire damage when hit looks like

on_melee_hit = {[DamageType.FIRE] = 15}

Source:base 1.7.6: data/zones/demon-plane/npcs.lua:49


Convert it with this template as

{{e|on_melee_hit|fire|value=15|context=actor}}

Which produces the following text: Damage when hit (Melee): + 15 Fire

Melee and Ranged Attacks with Extra Flat Damage

The lua code specifying an ego's effect on wearer's melee attacks dealing extra fire damage looks like

melee_project={[DamageType.FIRE] = resolvers.mbonus_material(15, 8),}

Convert it with this template as

{{e|melee_project|fire|15|8}}

Which produces the following text: Damage (Melee): + (8-23) Fire


The lua code for Khulmanar's additional melee fire damage looks like

melee_project = {[DamageType.FIRE] = resolvers.mbonus(25, 35)}

Source:base 1.7.6: data/general/npcs/major-demon.lua:317


Convert it with this template as

{{e|melee_project|fire|25|35|resolver=mbonus|scale=1|context=actor}}

Which produces the following text: Damage (Melee): + (35-60) Fire

Combat Attributes

Supported:

  • Armour penetration (combat_apr)
  • Physical, spell and mental critical powers (combat_dam, combat_spellpower, combat_mindpower)
  • Physical, spell and mental critical chances (combat_physcrit, combat_spellcrit, combat_mindcrit)
  • Armour (combat_armor)
  • Defense (combat_def) and ranged defense (combat_def_ranged)
  • Critical multiplier (combat_critical_power)
  • Spell cooldown (spell_cooldown_reduction)

The lua code for an ego increasing armour value looks like

combat_armor = resolvers.mbonus_material(7, 3)

Convert it with this template as

{{e|combat_armor|7|3}}

Which produces the following text: Armour: + (3-10)

Spell Cooldown

The lua code for an ego that reduce spell cooldowns looks like

spell_cooldown_reduction = 0.1

Convert it with this template as

{{e|spell_cooldown_reduction|0.1}}

Which produces the following text: Lowers spell cool-downs by: 10%


Fatigue

The lua code for an ego's effect on wearer's fatigue looks like

fatigue = resolvers.mbonus_material(6, 4, function(e, v) return 0, -v end)

Convert it with this template as

{{e|fatigue|6|4}}

Which produces the following text: Fatigue: - (4-10)%

Maximum Encumberance

The lua code for an ego's that let its wearer carry more weight looks like

max_encumber = resolvers.mbonus_material(40, 20)

Convert it with this template as

{{e|max_encumber|40|20}}

Which produces the following text: Maximum encumbrance: + (20-60)


Stats

Supported:

  • Strength (str)
  • Dexterity (dex)
  • Constitution (con)
  • Magic (mag)
  • Willpower (wil)
  • Cunning (cun)
  • Luck (lck)

The lua code for an ego's effect on increasing willpower looks like

inc_stats = {[Stats.STAT_WIL] = resolvers.mbonus_material(5, 1)}

Convert it with this template as

{{e|inc_stats|wil|5|1}}

Which produces the following text: Changes stats: + (1-6) Willpower

Reduced Damage from Specific Creature Types

The lua code for an ego that protects the wearer from, say unnatural creatures, looks like:

resists_actor_type = {unnatural=resolvers.mbonus_material(10, 5)},

Convert it with this template as

{{e|resists_actor_type|unnatural|10|5}}

Which produces the following text: Reduced damage from unnatural creatures: (5-15)%

Rouge-ish Utilities

Stealth

The lua code for an ego that provides bonus for stealth looks like

inc_stealth = resolvers.mbonus_material(10, 5)

Convert it with this template as

{{e|inc_stealth|10|5}}

Which produces the following text: Stealth bonus: + (5-15)

Trap Disarm

The lua code for an ego that makes it easier to disarm traps looks like

disarm_bonus = resolvers.mbonus_material(25, 5)

Convert it with this template as

{{e|disarm_bonus|25|5}}

Which produces the following text: Trap disarming bonus: + (5-30)

Trap Detection

The lua code for an ego that makes it easier to detect traps looks like

trap_detect_power = resolvers.mbonus_material(25, 5)

Convert it with this template as

{{e|trap_detect_power|25|5}}

Which produces the following text: Trap detection power: + (5-30)


Saving Throws

Supported:

  • physresist (physical save)
  • spellresist (spell save)
  • mentalresist (mental save)

The lua code for an ego's effect on physical save looks like

combat_physresist = resolvers.mbonus_material(15, 10)

Convert it with this template as

{{e|combat_physresist|15|10}}

Which produces the following text: Physical save: + (10-25)


Status Immunities

Supported:

  • blind
  • poison
  • disease
  • cut
  • silence
  • disarm
  • confusion
  • sleep
  • pin
  • stun
  • fear
  • knockback
  • teleport

The lua code for an ego that provides disease immunity looks like

disease_immune = resolvers.mbonus_material(30, 20, function(e, v) return 0, v/100 end)

Convert it with this template as

{{e|disease_immune|30|20}}

Which produces the following text: Disease immunity: + (20-50)%


The lua code for the same disease immunity bonus looks like

disease_immune = resolvers.mbonus_material(30, 20, function(e, v) return 0, v/100 end)

Source:base 1.7.6: data/general/objects/egos/amulets.lua:221


Convert it with this template as

{{e|disease_immune|30|20|resolver=mbonus_material|scale=0.01|context=wearer}}

Which produces the following text: Disease immunity: + (20-50)%

The callback stores a fraction; the template displays a percentage. Source:base 1.7.6: mod/class/Object.lua:1775–1797


Life and Resources

Supported:

  • life (regen & max)
  • mana (regen & max)
  • stamina (regen & max)
  • hate (regen & max)
  • psi (regen & max)
  • vim (max)
  • positive energy (max)
  • negative energy (max)
  • paradox (reduce_anomalies)

Regeneration

This template divides regeneration values by 10 for life, stamina and hate, and by 100 for mana and psi. Use it when the item's code divides by the same number; otherwise, calculate the values and write them directly.

For example, this item's code divides by 100:

mana_regen = resolvers.mbonus_material(30, 10, function(e, v) v=v/100 return 0, v end)

Use:

{{e|mana_regen|30|10}}

This produces: Mana each turn: + (0.1-0.4)


The following forms specify the callback conversion directly.

Life

The lua code for an ego's life regeneration bonus looks like

life_regen = resolvers.mbonus_material(4, 1, function(e, v) return 0, v end)

Source:base 1.7.6: data/general/objects/egos/amulets.lua:236


Convert it with this template as

{{e|life_regen|4|1|resolver=mbonus_material|scale=1|context=wearer}}

Which produces the following text: Life regen: + (1-5)


Mana

The lua code for an ego's mana regeneration bonus looks like

mana_regen = resolvers.mbonus_material(23, 7, function(e, v) v=v/10 return 0, v end)

Source:base 1.7.6: data/general/objects/egos/wizard-hat.lua:90


Convert it with this template as

{{e|mana_regen|23|7|resolver=mbonus_material|scale=0.1|context=wearer}}

Which produces the following text: Mana each turn: + (0.7-3)


Psi

The lua code for an ego's psi regeneration bonus looks like

psi_regen = resolvers.mbonus_material(12, 3, function(e, v) v=v/10 return 0, v end)

Source:base 1.7.6: data/general/objects/egos/mindstars.lua:648


Convert it with this template as

{{e|psi_regen|12|3|resolver=mbonus_material|scale=0.1|context=wearer}}

Which produces the following text: Psi each turn: + (0.3-1.5)


Stamina

The lua code for an ego's stamina regeneration bonus looks like

stamina_regen = resolvers.mbonus_material(10, 2, function(e, v) v=v/10 return 0, v end)

Source:base 1.7.6: data/general/objects/egos/amulets.lua:177


Convert it with this template as

{{e|stamina_regen|10|2|resolver=mbonus_material|scale=0.1|context=wearer}}

Which produces the following text: Stamina each turn: + (0.2-1.2)

The item tooltip uses the stored regeneration bonus. Source:base 1.7.6: mod/class/Object.lua:1792–1796


Maximum Amount

The lua code for an ego's effect on wearer's maximum life looks like

max_life=resolvers.mbonus_material(60, 40)

Convert it with this template as

{{e|max_life|60|40}}

Which produces the following text: Maximum life: + (40-100)

Reduces Paradox Anomalies

The lua code for an ego that reduce paradox anomalies looks like

paradox_reduce_anomalies = resolvers.mbonus_material(10, 10)

Convert it with this template as

{{e|paradox_reduce_anomalies|10|10}}

Which produces the following text: Reduces paradox anomalies (equivalent to willpower): + (10-20)


Vision

Light Radius

The lua code for an ego's effect on light radius looks like

lite = resolvers.mbonus_material(1, 2)

Convert it with this template as

{{e|lite|1|2}}

Which produces the following text: Light radius: + (2-3)

Infravision

The lua code for an ego that grants infravision range looks like

infravision = resolvers.mbonus_material(3, 2)

Convert it with this template as

{{e|infravision|3|2}}

Which produces the following text: Infravision radius: + (2-5)

Speed

The lua code for an ego that increases movement speed looks like

movement_speed = 0.2

Convert it with this template as

{{e|movement_speed|0.2}}

Which produces the following text: Movement speed: + 20%


Healing Mod.

The lua code for an ego's effect on healing efficiency looks like

healing_factor = resolvers.mbonus_material(20, 10, function(e, v) v=v/100 return 0, v end)

Convert it with this template as

{{e|healing_factor|20|10}}

Which produces the following text: Healing modification: + (10-30)%

Aftere-teleport perks

Supported:

  • Defense (defense_on_teleport)
  • Resist all (resist_all_on_teleport)
  • Effects duration (effect_reduction_on_teleport)

The lua code for an ego's that grants defense after teleport looks like

defense_on_teleport = resolvers.mbonus_material(20, 10)

Convert it with this template as

{{e|defense_on_teleport|20|10}}

Which produces the following text: Defense after a teleport: + (10-30)

Various States Effects

Size Category

The lua code for an ego that increases the wearer's body size looks like

size_category = 1

Convert it with this template as

{{e|size_category}}

Which produces the following text: Size category: + 1

As Undead

The lua code for an ego that makes the wearer to be treated as an undead looks like

undead = 1

Convert it with this template as

{{e|undead}}

Which produces the following text: The wearer is treated as an undead.

Water-breathing

The lua code for an ego that allows its wearer breathe in water looks like

can_breath = {water=1}

Convert it with this template as

{{e|can_breath}}

Which produces the following text: Allows you to breathe in: water

Non-breathing

The lua code for an ego that makes the wearer no longer needs to breathe looks like

no_breath = 1

Convert it with this template as

{{e|no_breath}}

Which produces the following text: The wearer no longer has to breathe.

An Object's Usable Power

Talents

The lua code for an ego's that can be used to activate a talent looks like

resolvers.charmt(Talents.T_TRACK, 2, 30)

Convert it with this template as

{{e|charmt|track|2|30}}

Which produces the following text: It can be used to activate talent Track (level 2, costing 30 power)