PDA

View Full Version : Mana Regeneration Mod


hasim
11-12-2010, 07:38 AM
Anyone cares to re-make the mod for AP:Crossworlds that you hovered your mouse over the time of day and it passed the time till your mana bar was filled?

It can be found here for KB:AP
http://forum.1cpublishing.eu/showthread.php?t=11383

Alamei
11-15-2010, 05:57 PM
Sure thing; it only required a couple changes to be orcs-compatible. You probably know the installation drill: unzip the file into your \sessions\orcs\mods folder.

hasim
11-16-2010, 09:46 AM
Thank you very much!

hasim
08-21-2011, 05:21 AM
Since the release of 1.31 patch the mana regen mod is not working any more - would someone please be so kind as to rectify that please?

Hasim.

Moxxy
07-30-2020, 08:57 PM
All other mana regen mods on the forum that I could find suffer from the +30 mana glitch. This is caused when the game returns 30 for both mana and max_mana, so when the mod sets mana to 30 when it isn't really the max, it adds 30 to the max. Also, in AP and CW, the mods don't take into account Bloodlust skill. The below code is my current fix.

Sometimes the mod will appear not to work. In these cases you can wait a bit and try again, or try saving the game and reloading. I have found that activating this right after a battle almost always works.


function accelerate_manaregen()
Game.ClearEffect("mana")
local max_mana = Logic.cur_lu_item("mana","limit")
local mana = Logic.cur_lu_item("mana","count")
if mana < max_mana then
Game.ClearEffect("rage")
local max_rage = Logic.cur_lu_item("rage","limit")
local rage = Logic.cur_lu_item( "rage", "count" )
local min_rage = 0
local sk_level = Logic.hero_lu_skill("blood_lust")
if sk_level > 0 then min_rage = math.floor(skill_power("blood_lust",1,sk_level-1)*max_rage/100) end
local mana_str = string.gsub(Game.Config("difficulty_k/manarage"),"|",",")
local rage_str = string.gsub(Game.Config("difficulty_k/manarage"),"|",",")
local diff = Game.HSP_difficulty()
local k_mana_diff = tonumber(text_dec(mana_str,diff+1))
local k_rage_diff = tonumber(text_dec(rage_str,diff+1))
local wiz_bonus = skill_power("meditation",1)+Logic.hero_lu_item("sp_mana_map_prc","count")
local mana_per_tick = math.max(1,max_mana/20*(1+wiz_bonus/100)*k_mana_diff)
local rage_per_tick = math.max(1,max_rage/20*(1-Logic.hero_lu_item("sp_rage_map","count")/100)/k_rage_diff)
local ticks = math.ceil((max_mana-mana)/mana_per_tick)
rage = rage - rage_per_tick * ticks
Logic.cur_lu_item("mana", "count", max_mana)
Game.ClearEffect("mana")
Logic.cur_lu_item("rage", "count", math.max(min_rage, rage))
Game.ClearEffect("rage")
end
end

Moxxy
01-24-2023, 09:45 PM
I saw a post on steam asking how to use the above code. Here is how to install:

Steps to install this mod:
1) open the \sessions\orcs\orcs.kfs file with winrar or another archiver program
2) extract the textgen.lua file somewhere
3) open textgen.lua and search for the `time_gen()` function
4) add the following line before the return statement:

accelerate_manaregen()

5) add the function in my prior comment to the end of the textgen.lua file
6) place the edited file into the \sessions\orcs\mods directory

For anyone interested, the normal game logic for rage to mana conversion is in the `change_manarage()` function in the file `logic_hero.lua`.