Module:InfoboxHero: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Restore mangled comment text (with help from vergir-bot LLM) |
Use shared HeroData helpers for stat, scaling, hero key and tag lookups instead of local copies (with help from vergir-bot LLM) |
||
| Line 30: | Line 30: | ||
local sb_module = require('Module:StreetBrawlAbilities') | local sb_module = require('Module:StreetBrawlAbilities') | ||
local get_stat | -- Shared hero-data lookups, see [[Module:HeroData]]. | ||
local get_stat = hero_module.get_stat | |||
local get_scalings = hero_module.get_scalings | |||
local has_stat = hero_module.has_stat | |||
local has_override_or_stat, stat_number | |||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
| Line 442: | Line 447: | ||
-- Data access | -- Data access | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
has_override_or_stat = function(ctx, param, stat) | has_override_or_stat = function(ctx, param, stat) | ||
| Line 547: | Line 519: | ||
if row.stat and row.scaling ~= false then | if row.stat and row.scaling ~= false then | ||
local parts = {} | local parts = {} | ||
for _, scaling in ipairs( | for _, scaling in ipairs(get_scalings(ctx.hero, row.stat)) do | ||
parts[#parts + 1] = hero_module.write_scalar_str(scaling.value, scaling.type) | parts[#parts + 1] = hero_module.write_scalar_str(scaling.value, scaling.type) | ||
end | end | ||
| Line 684: | Line 656: | ||
local tags = {} | local tags = {} | ||
for i = 1, 3 do | for i = 1, 3 do | ||
local tag = hero_module. | local tag = hero_module.hero_tag(ctx.hero_en, i) | ||
if | if tag ~= '' then | ||
tags[#tags + 1] = tag | tags[#tags + 1] = tag | ||
end | end | ||
| Line 720: | Line 692: | ||
-- Entry point | -- Entry point | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
function p.render(frame) | function p.render(frame) | ||
| Line 745: | Line 705: | ||
end }) | end }) | ||
local hero_key = | -- |key= accepts a hero_* key or the hero's English name; unknown values fall | ||
-- back to the target dummy, the default character in Sandbox mode. | |||
local hero_key = hero_module.find_hero_key(args.key) or DEFAULT_HERO_KEY | |||
local hero = hero_data_all[hero_key] | local hero = hero_data_all[hero_key] | ||