Template:Damage/doc

From Elwiki
Information: This template is using a Scribunto Module: Module:Damage.

Overview

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

Information:
  • 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).
  • dmg - specifies damage values
  • awk_dmg - in Awakening Mode
  • hits - specifies maximum hit counts. If not provided, defaults to 1 for all damage effects.
  • awk_hits - in Awakening Mode
  • avg_hits - specifies average hit counts
  • avg_awk_hits - in Awakening Mode
  • hits_useful - specifies maximum hit counts with the Useful trait
  • awk_hits_useful - in Awakening Mode
  • avg_hits_useful - specifies average hit counts with the Useful trait
  • avg_awk_hits_useful - in Awakening Mode
  • useful_penalty - specifies damage decrease from the Useful trait in 0.value format, e.g. 0.75
  • heavy - if provided with a value, enables Heavy trait
  • enhanced - if provided with a value, enables Enhanced trait
  • empowered - if true, enables Empowered trait with the standard 1.2x damage increase. It can also take another value that replaces the standard one
  • passive[n] - enables the nth passive variables, please specify with the exact passive skill's name. If more than one provided, combined variables will also be created, i.e. passive1_passive2 (max 3).
  • format - enables pretty-printing of the numbers (applies % sign and {{formatnum:}}). 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.
  • prefix - if specified, appends the provided string to every output variable. Useful when dealing with skills like Heaven's Fist - Pressure or 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' {{DISPLAYTITLE}} 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].
      {{#arraydefine:$t|
      original text 1 (key1)=translated text 1(value1),
      original text 2 (key2)=translated text 2(value2),
      ...,
      }}
    • Notable information in translations:
      • PvP and PvE are templates {{PvE}} and {{PvP}}, 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

  • 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. {{#var: range_total_damage_awk_empowered_passive1_passive2_pvp}}


Tips

  • You can provide however many damage parts you want. The {{#var: total_damage}} and {{#var: total_damage_pvp}} variables will be composed automatically.
    • Using ranges stops regular variables from generating.
  • 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.


Example usage

Code
{{Damage
|true
|Rose
|dmg=845, 232
|pvp_dmg=272, 74
|hits=1, 25
|heavy=true
|passive1=Musket Master
}}

Result:

ModeBaseMusket Master
NormalHeavyNormalHeavy
PvE6,645%9,568.8%7,974%11,482.56%
PvP2,122%3,055.68%2,334.2%3,361.25%

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.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Generate Table1

If true, attemps to generate a table out of the variables automatically.

Default
true
Auto value
true
Booleansuggested
Character2 char

If generating a table, provide the character's name so that the template knows which color to use for the headers.

Default
Elsword
Example
Laby
Stringsuggested
Language Suffixlang

A language suffix for multi-language variants.

Example
zh-hans
Unknownoptional
Damage (PvE)dmg

Specifies damage values, separated by commas.

Example
50, 125
Auto value
0
Stringrequired
Damage (PvP)pvp_dmg

Specifies damage values, separated by commas.

Example
50, 125
Auto value
0
Stringrequired
Damage in Awakening (PvE)awk_dmg

no description

Default
inherited from 'dmg'
Stringoptional
Damage in Awakening (PvP)pvp_awk_dmg

no description

Default
inherited from 'pvp_dmg'
Stringoptional
Hits (PvE)hits

Hit counts for each damage effect, separated by commas. If not provided, it will equal to 1 for all values provided with 'dmg'.

Default
1
Example
13, 23
Auto value
0
Stringsuggested
Hits (PvP)pvp_hits

no description

Unknownoptional
Count of Instancescount

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
Numberoptional
Hits in Awakeningawk_hits

no description

Default
inherited from 'hits'
Stringoptional
Average Hitsavg_hits

Hit counts achievable on average-sized targets, such as Free Training Dummies.

Default
1 (for all damage effects)
Example
7, 13, 5
Auto value
Stringoptional
Average Hits in Awakeningavg_awk_hits

no description

Default
inherited from 'avg_hits'
Stringoptional
Hits (Useful trait)hits_useful

Hit counts with the Useful trait. Requires 'useful_penalty' to make it work.

Stringoptional
Hits (Useful trait) in Awakeningawk_hits_useful

no description

Stringoptional
Average Hits (Useful trait)avg_hits_useful

no description

Stringoptional
Average Hits (Useful trait) in Awakeningavg_awk_hits_useful

no description

Stringoptional
Damage decrease from Useful traituseful_penalty useful

Provided as a fraction lower than 1.

Example
0.75
Numberoptional
Heavy traitheavy

If 'true', applies the Heavy trait.

Default
false
Example
true
Booleanoptional
Enhanced traitenhanced

If 'true', applies the standard damage decrease from the Enhanced trait. Can provide a custom number lower than 1.

Example
true (or) 0.6
Stringoptional
Empowered traitempowered

If 'true', applies the standard damage increase from the Empowered trait. Can provide a custom number.

Example
1.3
Numberoptional
Passive 1passive1

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
Page nameoptional
Passive 2passive2

no description

Page nameoptional
Passive 3passive3

no description

Page nameoptional
Pretty-printformat

Wraps the variable output in the formatnum parser function and appends the % sign.

Default
true
Example
true
Booleanoptional
Print all variablesdump

Dumps a <pre> with all damage numbers.

Default
false
Example
true
Booleanoptional
Prefixprefix

Adds a string to every generated variable's name.

Example
sometext
Stringoptional
Range (Max)range_max

The maximum damage of a skill, after applying a certain multiplier. PvP value comes after a comma.

Example
2.5
Numberoptional
Range (Min)range_min

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
Stringoptional
Range (Min) Stage Versionrange_min_count

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.

Numberoptional
Range (Max) Stage Versionrange_max_count

If this parameter is used, it will multiply itself by range_max. Intended for mechanics like Sentimental Points with even stages of damage increase.

Numberoptional
Instance Namecount_name

When generating a table and 'count' is used, specify the damage part that the skill is divided to.

Default
Instance
Example
Orb
Stringoptional
System Effectappend

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
Stringoptional
Combined Passivescombine

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
Stringoptional
Suffix after combinationcombine_suffix

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
Stringoptional
No Max Damageno_max

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
Booleanoptional
Use Average For Instancesuse_avg

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
Booleanoptional
First Passive Alt. Namealias1

no description

Stringoptional
Second Passive Alt. Namealias2

no description

Stringoptional
Third Passive Alt. Namealias3

no description

Stringoptional
First Passive Suffixsuffix1

no description

Stringoptional
Second Passive Suffixsuffix2

no description

Stringoptional
Third Passive Suffixsuffix3

no description

Stringoptional
Permanent Effectperm_buff

A buff effect for the whole skill.

Example
1.5
Unknownoptional
Permanent Effect (PvP)pvp_perm_buff

A buff effect for the whole skill.

Example
1.25
Unknownoptional
Hits in Awakening (PvP)pvp_awk_hits

no description

Unknownoptional
Average Hits (PvP)pvp_avg_hits

no description

Unknownoptional
Average Hits in Awakening (PvP)pvp_avg_awk_hits

no description

Unknownoptional
Hits (Useful trait, PvP)pvp_hits_useful

no description

Unknownoptional
Hits in Awakening (Useful trait, PvP)pvp_awk_hits_useful

no description

Unknownoptional
Average Hits in Awakening (Useful trait, PvP)pvp_avg_awk_hits_useful

no description

Unknownoptional
Dump Namesdump_names

Replace numbers with variable names on the generated table for debugging purposes.

Example
true
Booleanoptional
Dynamo Configuration Modedmp

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
Unknownoptional
Awakening Text Aliasawk_alias

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
Stringoptional
Display separated passives when combineddisplay_separated

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
Stringoptional
Free Training Hit Count Bugbug

Generates a short notice above the table that this skill may report wrong on damage in Free Training areas.

Example
true
Booleanoptional
Dump Table Datadump_table_data

(Advanced) Dumps the generated table structure contained in a LUA table. Useful for debugging the structure.

Example
true
Booleanoptional
Custom Passive 1passive_define1

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
Stringoptional
Custom Passive 2passive_define2

no description

Stringoptional
Custom Passive 3passive_define3

no description

Stringoptional