From 7519ebdd35dbc438b08eaa2e10d1f1982c344d5c Mon Sep 17 00:00:00 2001 From: ProditorMagnus Date: Sat, 10 Jan 2026 12:24:40 +0200 Subject: [PATCH] beta-drain --- changelog.txt | 8 ++++++++ mods/xp_mod.cfg | 4 ++-- mods/xp_mod_beta.cfg | 19 ++++++++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8b7a041..6f11ac2 100755 --- a/changelog.txt +++ b/changelog.txt @@ -51,4 +51,12 @@ When base damage or strike is 1, then upgrade is allowed to reduce the other val Group attacks by name+type+range Sort attacks in log message +2.4.4 + +For attacks with drain, upgrade gives less effect per upgrade, maybe 7% + +2.4.5 + +Format damage and strike numbers to only add + in case of positive numbers + diff --git a/mods/xp_mod.cfg b/mods/xp_mod.cfg index 9ad53cd..8341aa7 100755 --- a/mods/xp_mod.cfg +++ b/mods/xp_mod.cfg @@ -3,7 +3,7 @@ name=_"XP Mod" description=_"Spend XP to upgrade units damage/strikes/health/movement. -version 2.4.3 by Ravana - based on work by vn971, Dovolente, itota and Nosmos +version 2.4.4 by Ravana - based on work by vn971, Dovolente, itota and Nosmos Units with drain ability have higher upgrade cost" require_modification=no @@ -219,7 +219,7 @@ Default settings assumed." wesnoth.set_variable("Rav_XP_amla_only", 0) settings = settings .. "AMLA only: no" end - wesnoth.message("XP Mod version 2.4.3", settings) + wesnoth.message("XP Mod version 2.4.4", settings) end >> [/lua] diff --git a/mods/xp_mod_beta.cfg b/mods/xp_mod_beta.cfg index ffe11b7..44251ee 100755 --- a/mods/xp_mod_beta.cfg +++ b/mods/xp_mod_beta.cfg @@ -1,15 +1,15 @@ [modification] id=Rav_XP_Mod_Beta name=_"XP Mod (Beta)" - description=_"Experiment where damage and strike upgrades are automatically distributed and upgrade amount is 10% of base value instead of constant. Distribution aims to reach 3.5 damage per strike. May be enabled together with regular XP Mod, but disable strike and damage upgrades there then or amounts can be unexpected. Drain and amla-only logic is not implemented yet. + description=_"Experiment where damage and strike upgrades are automatically distributed and upgrade amount is 10% of base value instead of constant. Distribution aims to stay close to original damage per strike, but staying between 2 and 5 damage per strike. May be enabled together with regular XP Mod, but disable strike and damage upgrades there then or amounts can be unexpected. Drain and amla-only logic is not fully implemented yet. When base damage or strike is 1, then upgrade is allowed to reduce the other value by 25% to achieve more evenly distributed damage and strikes. -When unit has multiple attacks with same name, upgrade takes lowest values from all of them. So 40-1 and 4-10 with same name are 4-1 for upgrade purpose. +When unit has multiple attacks with same name+type+range, upgrade takes lowest values from all of them. So 40-1 and 4-10 with same name are 4-1 for upgrade purpose. Attacks that are not from unit type might get upgraded, but not tested. -version 2.4.3 by Ravana" +version 2.4.4 by Ravana" require_modification=no type=hybrid [options] @@ -31,6 +31,13 @@ version 2.4.3 by Ravana" code=<< local T = wml.tag +local function format_number(value) + if value > 0 then + return "+"..tostring(value) + end + return tostring(value) +end + function wesnoth.wml_actions.xp_mod_damage(cfg) local event_context = wesnoth.current.event_context local unit = wesnoth.units.get(event_context.x1, event_context.y1) @@ -83,6 +90,7 @@ function wesnoth.wml_actions.xp_mod_damage(cfg) -- incement power modifier in unit variables local power_percent = unit.variables.Rav_XP_power_percent or 0 power_percent = power_percent + cfg.power_percent + local power_percent_drain = power_percent * 0.7 unit.variables.Rav_XP_power_percent = power_percent -- remove from unit modifications its previous xp mod object @@ -119,6 +127,7 @@ function wesnoth.wml_actions.xp_mod_damage(cfg) goal_rate = math.min(5, original_rate) end + -- TODO calculate power_percent_drain too local goal_power = base_damage * base_strikes * (1 + power_percent / 100) local rate = base_damage / base_strikes --print("Goal: ", goal_power) @@ -187,7 +196,7 @@ function wesnoth.wml_actions.xp_mod_damage(cfg) increase_damage = proposed_damage - base_damage, increase_attacks = proposed_strikes - base_strikes }) - desc = desc .. " | " .. attack_description .. " (+" .. tostring(proposed_damage - base_damage) .. ", +" .. tostring(proposed_strikes - base_strikes) .. ")" + desc = desc .. " | " .. attack_description .. " (" .. format_number(proposed_damage - base_damage) .. ", " .. format_number(proposed_strikes - base_strikes) .. ")" end desc = desc .. " | Power modifer: +" .. tostring(power_percent) .. "%" @@ -233,7 +242,7 @@ end local settings = "" settings = settings .. "Power cost: " .. wesnoth.get_variable "Rav_XP_damage_cost_beta" .. " | " if settings == "" then else - wesnoth.message("XP Mod version 2.4.3 (beta)", settings) + wesnoth.message("XP Mod version 2.4.4 (beta)", settings) end >> [/lua]