Quote:
Originally Posted by Fatt_Shade
Not working
Code:
Attack.act_apply_dmgmin_spell( "magic", 0, 0, power, duration, false)
Attack.act_apply_dmgmax_spell( "magic", 0, 0, power, duration, false)
Attack.act_apply_par_spell( "defense", 0, 0, -penalty, duration, false)
I try it already when checked ogre`s rage skill. Maybe because mage`s dmg is melee physical, and magic on range , or ... i have on idea. Same problem is with -50% for his defense during battle trance, no matter how much defense unit have 24 basic and stone skin, and magic spring and all bonuses form items, when in trance he`ll lose only 12 (half of his basic) which is wrong i think. If right bonus is 100% on current dmg and crit% , then -50% of current defense should be OK.
|
Sounds like a bug, you know, I was never really sure why they didn't just use dmg:
So change dmgmin and dmgmax to just one line:
Code:
Attack.act_apply_dmg_spell( "magic", 0, 0, power, duration, false)
See what that does. If that doesn't work, there's another way to do it - look at what I did in my TL HOMM3 Babies mod in ARENA.LUA lines 549 - 574:
Code:
for i = 1, table.getn( resistances ) do
local min_damage_current, min_damage_base = Attack.act_get_dmg_min( target, resistances[ i ] )
if min_damage_base > 0 then
local max_damage_current, max_damage_base = Attack.act_get_dmg_max( target, resistances[ i ] )
local min_damage_inc = math.max( math.floor( math.abs( min_damage_base * diff_k ) ), min_stat_inc ) * sign_diff_k
local max_damage_inc = math.max( math.floor( math.abs( max_damage_base * diff_k ) ), min_stat_inc ) * sign_diff_k
local new_min_damage = min_damage_current + min_damage_inc
local new_max_damage = max_damage_current + max_damage_inc
if new_min_damage < 1 then
new_min_damage = min_damage_current
end
if new_max_damage < 1 then
new_max_damage = max_damage_current
end
if new_min_damage ~= min_damage_current then
Attack.act_apply_dmgmin_spell( resistances[ i ], min_damage_inc, 0, 0, -100, false )
end
if new_max_damage ~= max_damage_current then
Attack.act_apply_dmgmax_spell( resistances[ i ], max_damage_inc, 0, 0, -100, false )
end
end
end
Let me explain this code:
Code:
for i = 1, table.getn( resistances ) do
.
.
.
end
The for loop just loops through all the damage types (i.e. fire, magic, etc.)
Code:
.
.
.
local min_damage_current, min_damage_base = Attack.act_get_dmg_min( target, resistances[ i ] )
if min_damage_base > 0 then
.
.
.
end
Next I get the current and base damages for that damage type and if the base damage is greater than 0 then I do something if not then there is nothing to do.
Code:
.
.
.
local max_damage_current, max_damage_base = Attack.act_get_dmg_max( target, resistances[ i ] )
local min_damage_inc = math.max( math.floor( math.abs( min_damage_base * diff_k ) ), min_stat_inc ) * sign_diff_k
local max_damage_inc = math.max( math.floor( math.abs( max_damage_base * diff_k ) ), min_stat_inc ) * sign_diff_k
local new_min_damage = min_damage_current + min_damage_inc
local new_max_damage = max_damage_current + max_damage_inc
.
.
.
If min_damage_base is > 0 then I go and do some more stuff: 1) I get the max damage current and base to go along with the mins I got earlier and 2) I compute the min and max damage increase based off the difficulty level and pick the max between the min stat increase and the computed increase. The sign_diff_k is used for decreasing stats if you play Easy level. I then compute the new min and max damage.
Code:
.
.
.
if new_min_damage < 1 then
new_min_damage = min_damage_current
end
if new_max_damage < 1 then
new_max_damage = max_damage_current
end
.
.
.
These next two checks are just making sure if the damage is reduced that it doesn't go below 1. I guess I should set those damages to 1 instead of current so that they are at least reduced instead of staying the same.
Code:
.
.
.
if new_min_damage ~= min_damage_current then
Attack.act_apply_dmgmin_spell( resistances[ i ], min_damage_inc, 0, 0, -100, false )
end
if new_max_damage ~= max_damage_current then
Attack.act_apply_dmgmax_spell( resistances[ i ], max_damage_inc, 0, 0, -100, false )
end
.
.
.
Lastly, If there is an actual change in the damage, then I go do something, note how I just change the absolute value of the damage. I checked the Ogre's Rage ability and that's how they did their attack. You know, I'm trying to think if I had problems like you're having and then implemented it this way instead. There certainly is a lot of trial and error when making changes like this. You probably don't need to be so thorough for the Archmage, just look in his ATOM and confirm his damage types and work with them directly, no need to cycle through like I did (but this was for all units so that's why I did it the way I did it).
Good luck!
/C\/C\