![]() |
|
King`s Bounty: Warriors of the North Next game in the award-winning King’s Bounty series |
![]() |
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
![]()
Hi guys,
I was reading my units and I don't quite understand how mixed damage types work. My soothsayer says he does 10-20 damage and it lists the type as physical/magic.
What if I use a spell or song to add a new damage type on top of those two? Song of Muspell puts a buff on me that says "minimum 28% of damage is fire damage."
Basically I am wondering if mixed damage types has diminishing returns or if it's stronger than that and just favors whatever loop holes you can exploit in enemy resistances. Is it worth adding another damage type when you already have two? Etc. Has anybody tested this or looked into the code? |
#2
|
|||
|
|||
![]()
The damage is handled individually.
So if you look in ARENA.LUA the "apply_damage" function handles the calculation (for tips) and actual damage done when attacking other units whether it is an attack, spell, ability, rage skill, etc. A little ways into that function there is a for i = 0, dcnt - 1 do loop that cycles through all the resistance types returned from dcnt = AU.rescount(). The damage is returned from AU.minresdmg( attacker, i ) and AU.max... From here the appropriate resistance of the defender (receiver) is gathered and then the damage (res_damage) for that attack resistance type calculated. It then cycles through and the total damage is sdmg = sdmg + res_damage. Here is a code snippet from TL (should be the same, pretty much, for all KB's): Code:
local uc = math.max( 1, AU.unitcount( attacker ) ); -- max íà ñëó÷àé, êîãäà àòàêóåò ìåðòâûé þíèò (count = 0) local dcnt = AU.rescount(); local i local max_damage = 0 for i = 0, dcnt - 1 do local min_ = uc * AU.minresdmg( attacker, i ) local max_ = uc * AU.maxresdmg( attacker, i ) if Attack.is_base_attack() then -- âñå èçìåíåíèÿ óðîíà ðàñïðîñòðàíÿþòñÿ òîëüêî íà áàçîâûå àòàêè min_, max_ = correct_damage_minmax( attacker, min_, max_ ) end local dmg if ( minmax == 1 ) then dmg = min_ elseif ( minmax == 2 ) then dmg = max_ elseif ( minmax == 3 ) then dmg = ( min_ + max_ ) / 2 else dmg = Game.Random( min_ , max_ ) end -- ÂÍÈÌÀÍÈÅ! Êðèò áåðåòñÿ íå èç äèàïàçîíà à ïî ìàêñèìóìó! if iskrit then dmg = max_ end local resi = AU.resistance( receiver, i ) + res_inc if resi > 95 then resi = 95 end local res_damage = dmg * ( 1 - resi / 100 ) sdmg = sdmg + res_damage if res_damage > max_damage then max_damage = res_damage Attack.val_store( attacker, "damage_type_index", i ) end end sdmg = sdmg * kdmg * dfactor So there you are - feel free to ask more questions! ![]() ***EDIT*** Oh by the way, I forgot to mention that you need to look in the unit's ATOM to see what the actual damage split is because the damage type and range are specified individually for each damage type. Here is an example of the Ent's throw ability from TL (ENT.ATOM): Code:
throw1 { reload=3 class=throw picture=BA1_Wasp_ picture_small=BA1_Wasp_small.png hinthead=special_swarm_head hint=special_swarm_hint ad_factor=1 distance=5 mindist=1 penalty=1 animation=cast/throw/thtarget throw=ent_wasps framekey=x damage { poison=12,15 physical=12,15 } /C\/C\ Last edited by MattCaspermeyer; 01-31-2014 at 11:36 PM. Reason: Forgot to mention look at damage in the unit's ATOM |
#3
|
||||
|
||||
![]()
Thanks. The expansion has added damage types and resistances everywhere so it was it was on my mind. So units with a single damage type have bigger peaks and valleys in damage output, while mixers see less of a boost but also less of penalty.
There's a lot going on with the constantly changing attack and defense modifiers as it is, so I'm glad the tooltip (usually) indicates whether the target I have highlighted is a good target for my attack or not. |
![]() |
|
|