View Single Post
  #5  
Old 11-05-2010, 07:15 PM
MaroonMaurader MaroonMaurader is offline
Approved Member
 
Join Date: Jan 2010
Posts: 91
Default

In answer to your question about damage bonus from int and duration bonus...short answer is, you want to edit config.txt, specifically the part under "spell_power_config". By default in KB:TL, it will read:
spell_power_config {
int_power=10
int_duration=15
}

That means every point of intelligence boosts power by 10%, and 15 points of intelligence boost duration by 1.

If you want to edit it for just one spell, you can do that too. If you check out spells.lua, it gives you the actual function for each spell. For example, function spell_magic_axe_attack(lvl,dmgts) controls casts of Magic Pole-Axe.

The damage is found by another function call within function spell_magic_axe_attack:
local min_dmg,max_dmg,count = pwr_magic_axe(lvl)
That is, min damage and max damage are being returned by a function called "pwr_magic_axe" which takes the level string as input.

As you might expect, that function is in spells_power.lua. Full text included, edited to include my (painfully thorough and English) comments and remove the developers' (Russian) ones, as well as a little adjustment of white space.

--This is what my comments looks like!
function pwr_magic_axe(level)

--First up, get the basic min and max damage... you can edit this in the spells.txt file.
local min_dmg,max_dmg = text_range_dec(Logic.obj_par("spell_magic_axe","da mage"))

--Then it gets the spell level. That would be 1, 2, or 3 generally.
if tonumber(level)==0 or level==nil then
level=Obj.spell_level()
if level==0 then level=1 end
if Obj.where()==6 and Obj.spell_level()~=0 then level=level+1 end
else
level = tonumber(level)
end

--Figure out the player's bonus to spell damage. Destroyer skill is added to item bonuses.
--Example: With destroyer level 2 in KB:TL, and no items giving bonuses, this is 30.

local destroyer_skill=tonumber(skill_power2("destroyer", 1))+hero_item_count2("sp_spell_attack","count")

--Then figure out bonus to damage from intelligence.
--THIS is what you would edit to change how intelligence affects just one spell.
--Basic formula of the following: damage multiplier is 1 + (Bonus damage per point of int)*(Int).

local int_dmg = 1+tonumber(Game.Config("spell_power_config/int_power"))*HInt()/100
--Example: With default config.txt and intelligence of 15, this becomes:
--int_dmg = 1+10*15/100 = 2.5


--Then for every 7 points of int, you get ANOTHER 10% boost to damage!
int_dmg = int_dmg * (1+math.floor(HInt()/7)/10)
--With 15 int, this would be worth another 20%, so int_damage ends up:
--int_dmg = 2.5 * (1 + .2) = 3


--damages are multiplied by destroyer skill and int bonus, then multiplied by spell level.
--In the examples above (destroyer of 30, int_dmg is 3), at level 2, base damage would be multiplied by 7.8 total.

min_dmg = math.floor(min_dmg*(1+destroyer_skill/100)*int_dmg)*level
max_dmg = math.floor(max_dmg*(1+destroyer_skill/100)*int_dmg)*level

min_dmg=dmg_round(min_dmg)
max_dmg=dmg_round(max_dmg)

return min_dmg,max_dmg,level
end

So how could you change this? Here's an example of a (horrendously, terribly unbalanced) change you could make. If you replaced
local int_dmg = 1+tonumber(Game.Config("spell_power_config/int_power"))*HInt()/100
with
local int_dmg = 1+tonumber(Game.Config("spell_power_config/int_power"))/100
int_dmg = math.pow(int_dmg,HInt())
Now instead of each new point of intelligence adding 10% damage, each new point multiplies damage by another 10%. So at intelligence 1, you do 110% damage. At intelligence 2, you do 121% damage. At intelligence 3, you do 133% damage. By the time you get to intelligence 20, you're doing 672% damage (instead of 300%, as it's set up by default). As I said, it's not a very well-balanced change by itself. But if you had a few weeks to spare you could probably re-balance the whole game to adapt to that sort of change, and it might even be a more interesting mod as a result (who knows).
Reply With Quote