Site News
Warning: This wiki contains spoilers. Read at your own risk!

Social media: If you would like, please join our Discord server, and/or follow us on Twitter (X) or Tumblr!

Module:Heroes BoonBane

From Fire Emblem Wiki, your source on Fire Emblem information. By fans, for fans.
Revision as of 02:56, 15 December 2021 by Thecornerman (talk | contribs) (Generalized level 40 stats into an equation, and changed from growth points to growth rates)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

For use on the stat templates of Fire Emblem Heroes playable characters.

level1

Outputs a hero's level 1 stats, adjusted for boon and bane.

{{#invoke:Heroes BoonBane|level1|<base stat>}}

Enter the hero's base stat in the first parameter.

Example: Tana's base Speed at 5★ is 10, so the entry is as follows:

{{#invoke:Heroes BoonBane|level1|10}}

This outputs: 9/10/11

level40

Outputs a hero's level 40 stats, adjusted for boon and bane.

{{#invoke:Heroes BoonBane|level40|<base stat>|<growth points>|<rarity>}}

Enter the hero's base stat in the first parameter. Enter their growth points in the second, and their rarity (as a number) in the third.

Example: Leon: True of Heart's base defense at 5★ is 8 and he has a 50% growth rate in defense, so the entry is as follows:

{{#invoke:Heroes BoonBane|level40|8|50|5}}

This outputs: 26/30/33


local p = {}

--[[
Level 1 stats. Input the neutral stat, and output the neutral, boon,
and bane (which are literally just the neutral stat +1 or -1).
]]

function p.level1(frame)
    boon = frame.args[1] + 1
    bane = frame.args[1] - 1
    return string.format("%s/%s/%s", bane, frame.args[1], boon)
end

--[[
Level 40 stats. Input as follows:
{{#invoke:Heroes BoonBane|level40|base|gp|star}}
base = Base stat
gp = Growth points in this stat
star = rarity

Growth value details from:
https://feheroes.gamepedia.com/index.php?title=Stat_growth&oldid=162275
]]

function p.level40(frame)
	
    -- For a bane, the base gets lowered by 1 and the growth rate by 5%
    final_bane = calc40(frame.args[1] - 1, tonumber(frame.args[2] - 5), frame.args[3])

    final_neutral = calc40(frame.args[1], frame.args[2], frame.args[3])

    -- For a boon, the base gets raised by 1 and the growth rate by 5%
    final_boon = calc40(frame.args[1] + 1, tonumber(frame.args[2] + 5), frame.args[3])

    return string.format("%s/%s/%s", final_bane, final_neutral, final_boon)
end

function calc40(base, growth, rarity)
	 return base + math.floor(.39 * math.floor(growth * (.79 + .07 * rarity)))
end

return p