Skip to content

Commit

Permalink
Balance: Armor: Tooltips: add description for armor & also for buffs/…
Browse files Browse the repository at this point in the history
…effects. Closes #1588
  • Loading branch information
alek13 committed Jul 31, 2024
1 parent 2e96013 commit 3c8cc67
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 3 deletions.
13 changes: 13 additions & 0 deletions mods/lord/Player/Help/lord_tooltips/locale/lord_tooltips.en.tr
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,16 @@ $dmg-item-tpl$ @1: @2 in @3 sec @4=@1: @2 in @3 sec @4
Punch Speed: @1=Punch Speed: @1
fleshy_dmg=fleshy
soulful_dmg=soulful

# Defense:
armor_head=fleshly
armor_torso=fleshly
armor_legs=fleshly
armor_feet=fleshly
armor_shield=fleshly


@1@2% chance to avoid a hit=@1@2% chance to avoid a hit=
@1@2% to speed=@1@2% to speed=
@1@2% to jump=@1@2% to jump=
@1@2% to gravity=@1@2% to gravity=
17 changes: 15 additions & 2 deletions mods/lord/Player/Help/lord_tooltips/locale/lord_tooltips.ru.tr
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@ Damage=Урон
Defense=Защита
Effects=Эффекты

# Properties / Digging
# Properties / Digging:
crumbly=сыпучий
cracky=разламывающийся
snappy=непрочный
choppy=рубящийся
fleshy=живой/прокалываемый
explody=взрывающийся

# Damages
# Damages:
$dmg-item-tpl$ @1: @2 in @3 sec @4=@1: @2 в @3 сек @4
(@1/sec)=(@1/сек)
Punch Speed: @1=Скорость удара: @1
fleshy_dmg=телесный
soulful_dmg=душ

# Defense:
armor_head=телесная
armor_torso=телесная
armor_legs=телесная
armor_feet=телесная
armor_shield=телесная

# Buffs:
@1@2% chance to avoid a hit=@1@2% к шансу отразить удар
@1@2% to speed=@1@2% к скорости
@1@2% to jump=@1@2% к прыжку
@1@2% to gravity=@1@2% к гравитации
13 changes: 13 additions & 0 deletions mods/lord/Player/Help/lord_tooltips/locale/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,16 @@ $dmg-item-tpl$ @1: @2 in @3 sec @4=@1: @2 in @3 sec @4
Punch Speed: @1=
fleshy_dmg=
soulful_dmg=

# Defense:
armor_head=
armor_torso=
armor_legs=
armor_feet=
armor_shield=


@1@2% chance to avoid a hit=
@1@2% to speed=
@1@2% to jump=
@1@2% to gravity=
52 changes: 51 additions & 1 deletion mods/lord/Player/Help/lord_tooltips/src/lord_tooltips.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ local function damage_snippet(item_string)
local interval = tool_capabilities.full_punch_interval or 1
local damage_strings = {}
for type, damage in pairs(tool_capabilities.damage_groups) do
local damage_in_sec = damage / interval
local damage_in_sec = string.format('%.2f', damage / interval)
local list_item = S(
'$dmg-item-tpl$ @1: @2 in @3 sec @4',
colorize('#bbb', S(type..'_dmg')), damage, interval, colorize('#ddd', S('(@1/sec)', damage_in_sec))
Expand All @@ -52,10 +52,60 @@ local function damage_snippet(item_string)
or nil
end

local armor_groups = { 'armor_head', 'armor_torso', 'armor_legs', 'armor_feet', 'armor_shield'}
local function armor_snippet(item_string)
local groups = items[item_string].groups

local defense_strings = {}
for _, armor_group in pairs(armor_groups) do
local defense = groups[armor_group]
if defense then
local list_item = colorize('#bbb', S(armor_group)) .. ': +' .. defense .. '%'
defense_strings[#defense_strings+1] = '' .. list_item
end
end

return #defense_strings ~= 0
and (colorize('#ee8', '\n' .. S('Defense')) .. ':\n' .. table.concat(defense_strings, '\n'))
or nil
end

--- @type table<string,string>
local buffs_groups = {
damage_avoid_chance = '@1@2% chance to avoid a hit',
physics_speed = '@1@2% to speed',
physics_jump = '@1@2% to jump',
physics_gravity = '@1@2% to gravity',
}
--- @param value number
--- @return string
local function sign(value)
return value > 0 and '+' or (value < 0 and '-' or '')
end
local function buffs_snippet(item_string)
local groups = items[item_string].groups

local buffs_strings = {}
for group, template in pairs(buffs_groups) do
if groups[group] then
local value = groups[group]
value = group:starts_with('physics_') and value * 100 or value
buffs_strings[#buffs_strings+1] = '' .. S(template, sign(value), value)
end
end

return #buffs_strings ~= 0
and (colorize('#ee8', '\n' .. S('Effects')) .. ':\n' .. table.concat(buffs_strings, '\n'))
or nil
end

-- Прочность: armor_use/wear

return {
init = function()
tt.register_snippet(properties_snippet)
tt.register_snippet(damage_snippet)
tt.register_snippet(armor_snippet)
tt.register_snippet(buffs_snippet)
end,
}

0 comments on commit 3c8cc67

Please sign in to comment.