Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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


4 changes: 2 additions & 2 deletions mods/xp_mod.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
19 changes: 14 additions & 5 deletions mods/xp_mod_beta.cfg
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) .. "%"

Expand Down Expand Up @@ -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]
Expand Down