Template:Damage/doc: Difference between revisions

m
no edit summary
mNo edit summary
 
(47 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Lua|Damage}}
== Overview ==
== Overview ==
This template is used for '''Total Damage''' section on skill pages in order to avoid hardcoding mathematical formulas and not pollute the page's code that much with long variables. It simply generates the most generic variables you need based on the arguments provided. Should you need something extra, you can always export it to an external variable.
This template is used for the '''Total Damage''' section on skill pages in order to avoid hardcoding mathematical formulas and make variables shorter, simply composing them based on the arguments provided. You can also easily edit the generated variables afterwards.
If wanted, it can also generate the whole table, depending on how complicated the skill's structure is.


== Parameters ==
== Parameters ==
*'''dmg''', '''pvp_dmg''' - specifies damage values
{{InfoBanner|text=<br/>
*'''awk_dmg''', '''pvp_awk_dmg''' - in [[Awakening Mode]]
*For damage and hit count values, prefix the parameter with "pvp_".
**You can also generate [[Ara]]'s cancel skills by prefixing them with "cancel_" (for PvP, its prefix comes first, e.g. ''pvp_cancel_avg_hits'').
*For min/max values of damage and hits, suffix the parameter with "_min" or "_max" (e.g. ''avg_hits_max'').|imagesize=30}}
*'''dmg''' - specifies damage values
*'''awk_dmg''' - in [[Awakening Mode]]
*'''hits''' - specifies maximum hit counts. If not provided, defaults to 1 for all damage effects.
*'''hits''' - specifies maximum hit counts. If not provided, defaults to 1 for all damage effects.
*'''awk_hits''' - in [[Awakening Mode]]
*'''awk_hits''' - in [[Awakening Mode]]
Line 20: Line 26:
*'''format''' - enables pretty-printing of the numbers (applies % sign and ''<nowiki>{{formatnum:}}</nowiki>''). Enabled by default, you can provide '''false''' to disable it. In order to tamper with single variables, I recommend using [[Template:Num]] that converts them back to numbers.
*'''format''' - enables pretty-printing of the numbers (applies % sign and ''<nowiki>{{formatnum:}}</nowiki>''). Enabled by default, you can provide '''false''' to disable it. In order to tamper with single variables, I recommend using [[Template:Num]] that converts them back to numbers.
*'''dump''' - if '''true''', write out the generated variables. Useful when debugging, off by default. ''Warning'': disables the variables from generating.
*'''dump''' - if '''true''', write out the generated variables. Useful when debugging, off by default. ''Warning'': disables the variables from generating.
*'''prefix''' - if specified, appends the provided string to every output variable. Useful when dealing with skills like [[Heaven's Fist - Pressure#Total Damage|Heaven's Fist - Pressure]] or [[Ex-S Viper#Total_Damage|Ex-S Viper]].
*'''prefix''' - if specified, appends the provided string to every output variable. Useful when dealing with skills like [[Heaven's Fist - Pressure#Total Damage|Heaven's Fist - Pressure]] or [[EX-S Viper#Total_Damage|EX-S Viper]].
*'''range_min''', '''range_max''' - applies a damage increase to all values and moves them to separate variables. If the value is different between PvE and PvP, provide the PvP value after a comma. If '''range_min''' not specified, the minimum value will be the base total damage.
**Variables created:
***''range_''total_damage[...] - displays both minimum and maximum total damage separated with a "~", ex. 17,342% ~ 23,234%
**Can behave in two different ways.
***By default, it's considered that only numbers are provided. This will work exactly as expected (damage value multiplied by min/max damage increase).
***With '''range_min_count''' or '''range_max_count''' specified. Value provided for this parameter is the damage increase per stage. This is intended for things like [[Sentimental Point System]], where the character increases their damage depending on points consumed.
****The helping parameters specify how many available points should be used.
**This argument is separated to min/max due to some skills being able to recover points on cast, and then consume them immediately, making some of the damage buff unavoidable.
 
=== I18n ===
*'''lang''' - is used for multi-language support. The following changes will apply if this is set.
**Passive names are collected from translated pages' '''<nowiki>{{DISPLAYTITLE}}</nowiki>''' if exists. This acts like ''alias'' but can still be overwriten by ''alias''.
**Links will be linked to ''[page]/[lang]'' instead of ''[page]''.
**Translations will be fetched from ''Template:Damage/[lang]'' (i.e. ''Template:Damage/zh-hans'') and applied to table. Text will be unchanged if no translated text found.
**To define your translation, you should add the following to ''Template:Damage/[lang]''. <syntaxhighlight>
{{#arraydefine:$t|
original text 1 (key1)=translated text 1(value1),
original text 2 (key2)=translated text 2(value2),
...,
}}
</syntaxhighlight>
**Notable information in translations:
***''PvP'' and ''PvE'' are templates ''<nowiki>{{PvE}}</nowiki>'' and ''<nowiki>{{PvP}}</nowiki>'', translate them with key ''PvP'' and ''PvE'' and values with corresponding template title.
***Some translations do not act entirely. They are formatted with some words replaced. In such cases, translations for pattern and static words should be given. Use ''{n}'' in pattern to indicate where to substitute words. ''{n}'' starts from 1.
****''Per Group'' and ''Per {count_name}'' → Translations ''Per {1}'' and ''Group'' needed.
****''({dmp} DMP)'' → Translation ''({1} DMP)'' needed.


=== Extra ===
=== Extra ===
*The generated variables always follow this order in their names: damage type → awk if awakening (empty if not) → trait → passives → game mode (empty if dungeon), e.g. ''<nowiki>{{#var: total_damage_awk_empowered_passive1_passive2_pvp}}</nowiki>''
*The generated variables always follow this order in their names: prefix → range → damage type → awk if awakening (empty if not) → trait → passives → game mode (empty if dungeon), e.g. ''<nowiki>{{#var: range_total_damage_awk_empowered_passive1_passive2_pvp}}</nowiki>''
*When providing ''Useful'' trait and Awakening values, the values that don't change in relation to the '''hits''' or '''avg_hits''' parameter can be provided as empty, i.e. ''<nowiki>|hits=3, 10, 2|awk_hits=5,, 3</nowiki>'', results in the same output as typing ''<nowiki>|hits=3, 10, 2|awk_hits=5, 10, 3</nowiki>''.
<br/>
<br/>


== What works and what doesn't ==
== Tips ==
*You can provide however many damage parts you want. The ''<nowiki>{{#var: total_damage}}</nowiki>'' and ''<nowiki>{{#var: total_damage_pvp}}</nowiki>'' variables will be composed automatically.
*You can provide however many damage parts you want. The ''<nowiki>{{#var: total_damage}}</nowiki>'' and ''<nowiki>{{#var: total_damage_pvp}}</nowiki>'' variables will be composed automatically.
**However, you can't specify separate hit counts for PvP. This is a thing for too small amount of skills (e.g. [[Lightning Shower]]) and wasn't worth implementing, so in that case, please use external variables for PvP.
**Using ranges stops regular variables from generating.
*No range implemented. Whenever you need to add in some inner skill mechanics with the use of bonus points like [[Sentimental Point System|Sentimental Points]], do it yourself.
**Check '''[[Phoenix Wings#Total Damage|this page]]''' for hints.
*This template automatically rounds values to the second decimal place, so no need to worry about it.
*This template automatically rounds values to the second decimal place, so no need to worry about it.
*Certain values are inherited, either when they are empty or contain "i" in them (handy when you want to perform math operations on the numbers). ''Dev tip: to see the exact order, check DAMAGE_CONFIG each damage_numbers and hit_counts fields. The first value in each is the one that inherits from the rest if they exist.''
<br/>
<br/>


Line 59: Line 89:
<div class="mw-collapsible mw-collapsed"><div class="collapsible-header">Code</div><div class="mw-collapsible-content"><pre><nowiki>
<div class="mw-collapsible mw-collapsed"><div class="collapsible-header">Code</div><div class="mw-collapsible-content"><pre><nowiki>
{{Damage
{{Damage
|true
|Rose
|dmg=845, 232
|dmg=845, 232
|pvp_dmg=272, 74
|pvp_dmg=272, 74
|hits=1, 25
|hits=1, 25
|heavy=true
|heavy=true
|passive1=ECP System
|passive1=Musket Master
}}
}}
{| cellpadding="5" border="1" style="border-collapse: collapse; text-align: center"
|- style="background:{{ColorSel|CharLight|Rose}}"
! rowspan=3 | Mode !! colspan=4 | Regular
|- style="background:{{ColorSel|CharLight|Rose}}"
! colspan=2 | Normal !! colspan=2 | [[ECP System|Over Strike]]
|- style="background:{{ColorSel|CharLight|Rose}}"
! Normal !! Heavy !! Normal !! Heavy
|-
! {{PvE}}
| {{#var: total_damage}}
| {{#var: total_damage_heavy}}
| {{#var: total_damage_passive1}}
| {{#var: total_damage_heavy_passive1}}
|-
! {{PvP}}
| {{#var: total_damage_pvp}}
| {{#var: total_damage_heavy_pvp}}
| {{#var: total_damage_passive1_pvp}}
| {{#var: total_damage_heavy_passive1_pvp}}
|}
</nowiki></pre></div></div>
</nowiki></pre></div></div>
Result:
Result:
{{Damage
{{Damage
|true
|Rose
|dmg=845, 232
|dmg=845, 232
|pvp_dmg=272, 74
|pvp_dmg=272, 74
|hits=1, 25
|hits=1, 25
|heavy=true
|heavy=true
|passive1=ECP System
|passive1=Musket Master
}}
}}
{| cellpadding="5" border="1" style="border-collapse: collapse; text-align: center"
<templatedata>
|- style="background:{{ColorSel|CharLight|Rose}}"
{
! rowspan=3 | Mode !! colspan=4 | Regular
"params": {
|- style="background:{{ColorSel|CharLight|Rose}}"
"1": {
! colspan=2 | Normal !! colspan=2 | [[ECP System|Over Strike]]
"label": "Generate Table",
|- style="background:{{ColorSel|CharLight|Rose}}"
"description": "If true, attemps to generate a table out of the variables automatically.",
! Normal !! Heavy !! Normal !! Heavy
"type": "boolean",
|-  
"default": "true",
! {{PvE}}  
"autovalue": "true",
| {{#var: total_damage}}
"suggested": true
| {{#var: total_damage_heavy}}
},
| {{#var: total_damage_passive1}}
"2": {
| {{#var: total_damage_heavy_passive1}}
"aliases": [
|-
"char"
! {{PvP}}  
],
| {{#var: total_damage_pvp}}
"label": "Character",
| {{#var: total_damage_heavy_pvp}}
"description": "If generating a table, provide the character's name so that the template knows which color to use for the headers.",
| {{#var: total_damage_passive1_pvp}}
"example": "Laby",
| {{#var: total_damage_heavy_passive1_pvp}}
"type": "string",
|}
"default": "Elsword",
"suggested": true
},
"dmg": {
"label": "Damage (PvE)",
"description": "Specifies damage values, separated by commas.",
"example": "50, 125",
"type": "string",
"autovalue": "0",
"required": true,
"suggested": true
},
"pvp_dmg": {
"label": "Damage (PvP)",
"description": "Specifies damage values, separated by commas.",
"example": "50, 125",
"type": "string",
"autovalue": "0",
"required": true,
"suggested": true
},
"awk_dmg": {
"label": "Damage in Awakening (PvE)",
"type": "string",
"default": "inherited from 'dmg'"
},
"pvp_awk_dmg": {
"label": "Damage in Awakening (PvP)",
"type": "string",
"default": "inherited from 'pvp_dmg'"
},
"hits": {
"label": "Hits (PvE)",
"description": "Hit counts for each damage effect, separated by commas. If not provided, it will equal to 1 for all values provided with 'dmg'.",
"example": "13, 23",
"type": "string",
"default": "1",
"autovalue": "0",
"suggested": true
},
"count": {
"label": "Count of Instances",
"description": "Used for skills like Clementine or Enough Mineral that spawn multiple instances of the same object. Generates 2 variable types: each_damage and total_damage.",
"example": "5",
"type": "number"
},
"awk_hits": {
"label": "Hits in Awakening",
"type": "string",
"default": "inherited from 'hits'"
},
"avg_hits": {
"label": "Average Hits",
"description": "Hit counts achievable on average-sized targets, such as Free Training Dummies.",
"example": "7, 13, 5",
"type": "string",
"default": "1 (for all damage effects)",
"autovalue": ""
},
"avg_awk_hits": {
"label": "Average Hits in Awakening",
"type": "string",
"default": "inherited from 'avg_hits'"
},
"hits_useful": {
"label": "Hits (Useful trait)",
"description": "Hit counts with the Useful trait. Requires 'useful_penalty' to make it work.",
"type": "string"
},
"awk_hits_useful": {
"label": "Hits (Useful trait) in Awakening",
"type": "string"
},
"avg_hits_useful": {
"label": "Average Hits (Useful trait)",
"type": "string"
},
"avg_awk_hits_useful": {
"label": "Average Hits (Useful trait) in Awakening",
"type": "string"
},
"useful_penalty": {
"label": "Damage decrease from Useful trait",
"description": "Provided as a fraction lower than 1.",
"example": "0.75",
"type": "number",
"aliases": [
"useful"
]
},
"heavy": {
"label": "Heavy trait",
"description": "If 'true', applies the Heavy trait.",
"example": "true",
"type": "boolean",
"default": "false"
},
"enhanced": {
"label": "Enhanced trait",
"description": "If 'true', applies the standard damage decrease from the Enhanced trait. Can provide a custom number lower than 1.",
"example": "true (or) 0.6",
"type": "string"
},
"empowered": {
"label": "Empowered trait",
"description": "If 'true', applies the standard damage increase from the Empowered trait. Can provide a custom number.",
"example": "1.3",
"type": "number"
},
"passive1": {
"label": "Passive 1",
"description": "Generates additional variables with passive values imbued into them. Uses arrays included in passive skill pages. Exact page name required. The documentation only mentions 3 passives, but more also works.",
"example": "Hawk Eye",
"type": "wiki-page-name"
},
"passive2": {
"label": "Passive 2",
"type": "wiki-page-name"
},
"format": {
"label": "Pretty-print",
"description": "Wraps the variable output in the formatnum parser function and appends the % sign.",
"example": "true",
"type": "boolean",
"default": "true"
},
"dump": {
"label": "Print all variables",
"description": "Dumps a <pre> with all damage numbers.",
"example": "true",
"type": "boolean",
"default": "false"
},
"prefix": {
"label": "Prefix",
"description": "Adds a string to every generated variable's name.",
"example": "sometext",
"type": "string"
},
"range_max": {
"label": "Range (Max)",
"description": "The maximum damage of a skill, after applying a certain multiplier. PvP value comes after a comma.",
"example": "2.5",
"type": "number"
},
"range_min": {
"label": "Range (Min)",
"description": "Minimal damage of the skill. Only specify if there is an effect that increases damage conditionally, and a part of it cannot be avoided. PvP value comes after a comma.",
"example": "1.1",
"type": "string"
},
"range_min_count": {
"label": "Range (Min) Stage Version",
"description": "If this parameter is used, it will multiply itself by range_min. Intended for mechanics like Sentimental Points with even stages of damage increase. Use when casting the skill with no points/gauge that increases damage per stage is impossible.",
"type": "number"
},
"range_max_count": {
"label": "Range (Max) Stage Version",
"description": "If this parameter is used, it will multiply itself by range_max. Intended for mechanics like Sentimental Points with even stages of damage increase.",
"type": "number"
},
"count_name": {
"label": "Instance Name",
"description": "When generating a table and 'count' is used, specify the damage part that the skill is divided to.",
"example": "Orb",
"type": "string",
"default": "Instance"
},
"append": {
"label": "System Effect",
"description": "When generating a table, specify a passive/system effect that will consider everything in two cases - no effect and effect present. The first part is the passive's number provided with 'passive[number]' beforehand. The second part is optional, and is used to give it an alternate name.",
"example": "1, Over Strike",
"type": "string"
},
"combine": {
"label": "Combined Passives",
"description": "A comma-separated list of passives defined via 'passive[number]' to merge when generating a table. For example, providing 'Key of Proof' as passive 1, 'Musket Master' as passive2 and 'combine' as '1, 2' will output 'Key of Proof/Musket Master' to the header, and correctly mix-match the damage values.",
"example": "2, 3",
"type": "string"
},
"combine_suffix": {
"label": "Suffix after combination",
"description": "When generating a table and using 'combine', you can add a piece of extra text at the end of the header. The value is automatically preceded by a space.",
"example": "Used midair",
"type": "string"
},
"no_max": {
"label": "No Max Damage",
"description": "When generating a table, tell the template not to generate the 'Maximum' fields at all. It will also try to make it look as good as possible.",
"example": "true",
"type": "boolean"
},
"use_avg": {
"label": "Use Average For Instances",
"description": "When generating a table, ignores 'each_damage' fields, and instead generates the regular 'avg_damage' fields. The 'total_damage' fields are still calculated using the 'count' argument.",
"example": "true",
"type": "boolean"
},
"alias1": {
"label": "First Passive Alt. Name",
"type": "string"
},
"suffix1": {
"label": "First Passive Suffix",
"type": "string"
},
"alias2": {
"label": "Second Passive Alt. Name",
"type": "string"
},
"suffix2": {
"label": "Second Passive Suffix",
"type": "string"
},
"alias3": {
"label": "Third Passive Alt. Name",
"type": "string"
},
"suffix3": {
"label": "Third Passive Suffix",
"type": "string"
},
"perm_buff": {
"label": "Permanent Effect",
"description": "A buff effect for the whole skill.",
"example": "1.5"
},
"pvp_perm_buff": {
"label": "Permanent Effect (PvP)",
"description": "A buff effect for the whole skill.",
"example": "1.25"
},
"pvp_hits": {
"label": "Hits (PvP)"
},
"pvp_awk_hits": {
"label": "Hits in Awakening (PvP)"
},
"pvp_avg_hits": {
"label": "Average Hits (PvP)"
},
"pvp_avg_awk_hits": {
"label": "Average Hits in Awakening (PvP)"
},
"pvp_hits_useful": {
"label": "Hits (Useful trait, PvP)"
},
"pvp_awk_hits_useful": {
"label": "Hits in Awakening (Useful trait, PvP)"
},
"pvp_avg_awk_hits_useful": {
"label": "Average Hits in Awakening (Useful trait, PvP)"
},
"passive3": {
"label": "Passive 3",
"type": "wiki-page-name"
},
"dump_names": {
"label": "Dump Names",
"description": "Replace numbers with variable names on the generated table for debugging purposes.",
"example": "true",
"type": "boolean"
},
"dmp": {
"label": "Dynamo Configuration Mode",
"description": "If 'true', displays 'Dynamo Configuration (3 DMP)' instead of 'Awakening Mode' on the generated table. Provide a number if you want to modify the default amount of DMP. 'false' disables DMP notice.",
"example": "4",
"type": "unknown"
},
"awk_alias": {
"label": "Awakening Text Alias",
"description": "Replace the phrase \"Awakening Mode\" with something else. After a comma, one can insert the display text. If not provided, it will fallback to the first part.",
"example": "Moonlight System, Blood Moon",
"type": "string"
},
"bug": {
"label": "Free Training Hit Count Bug",
"description": "Generates a short notice above the table that this skill may report wrong on damage in Free Training areas.",
"example": "true",
"type": "boolean"
},
"dump_table_data": {
"label": "Dump Table Data",
"description": "(Advanced) Dumps the generated table structure contained in a LUA table. Useful for debugging the structure.",
"example": "true",
"type": "boolean"
},
"display_separated": {
"label": "Display separated passives when combined",
"description": "Combining removes the actual single passive from being generated in the table, but you can just this behavior with this argument. Takes a comma-separated list of passive indexes that you want displayed on their own.",
"example": "2,3",
"type": "string"
},
"passive_define1": {
"label": "Custom Passive 1",
"description": "Able to define a custom passive in the following format: [pve value, pvp value, name]. The name will be made into a link, and the display text can be changed using alias[number], just like for normal passives.",
"example": "1.4, 1.2, Blood Hit",
"type": "string"
},
"passive_define2": {
"label": "Custom Passive 2",
"type": "string"
},
"passive_define3": {
"label": "Custom Passive 3",
"type": "string"
},
"lang": {
"label": "Language Suffix",
"description": "A language suffix for multi-language variants.",
"example": "zh-hans"
}
},
"description": "This template is used for the Total Damage section on skill pages to avoid hardcoding mathematical formulas. It can generate a table for you in generic cases, or make defining variables easier, simply composing them based on the arguments provided. You can also easily edit the generated variables afterwards. Please check the template's page for detailed information.",
"paramOrder": [
"1",
"2",
"lang",
"dmg",
"pvp_dmg",
"awk_dmg",
"pvp_awk_dmg",
"hits",
"pvp_hits",
"count",
"awk_hits",
"avg_hits",
"avg_awk_hits",
"hits_useful",
"awk_hits_useful",
"avg_hits_useful",
"avg_awk_hits_useful",
"useful_penalty",
"heavy",
"enhanced",
"empowered",
"passive1",
"passive2",
"passive3",
"format",
"dump",
"prefix",
"range_max",
"range_min",
"range_min_count",
"range_max_count",
"count_name",
"append",
"combine",
"combine_suffix",
"no_max",
"use_avg",
"alias1",
"alias2",
"alias3",
"suffix1",
"suffix2",
"suffix3",
"perm_buff",
"pvp_perm_buff",
"pvp_awk_hits",
"pvp_avg_hits",
"pvp_avg_awk_hits",
"pvp_hits_useful",
"pvp_awk_hits_useful",
"pvp_avg_awk_hits_useful",
"dump_names",
"dmp",
"awk_alias",
"display_separated",
"bug",
"dump_table_data",
"passive_define1",
"passive_define2",
"passive_define3"
],
"format": "block"
}
</templatedata>