PDA

View Full Version : mixed damage type clarification


camelotcrusade
01-31-2014, 06:51 PM
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.


Does this mean he does 5-10 physical and 5-10 magic damage to an enemy? So if the enemy had 25% physical resistance I would do 4-8 + 5-10 (assuming round up fractions)? Damage would be 9-18.
Or, does it mean he favors the type they aren't resistant to, and he'd do 10-20 magic damage? Too bad for the enemy he has no magic resistance.


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."


For example my gorgon shoots a skeleton, and his eye beam does 11-16 damage of types physical and poison, plus Muspell fire buff. The skelly has 10% fire vulnerability and 50% poison resistance.
If it's the split method, it would be (5.5 round up) 6-8 physical and (2.25 round down) 2-4 poison for a range of 8-12 damage. Then I guess he rolls damage (say he gets a 10) and 3 points become fire damage. Since 10% of 3 (i.e., 3.3) due to vulnerability won't affect rounding the Muspell was pointless. If that's how it works, anyway.


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?

MattCaspermeyer
01-31-2014, 11:28 PM
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):

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

The last line factors in the Attack / Defense limit (kdmg) and dfactor is the "Defense Factor" - another scaler on the damage (usually this is always 1, but you'll see it in unit ATOM's).

So there you are - feel free to ask more questions!

:grin:

***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):

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
}

See how the damage is poison=12,15 and physical=12,15? That is a 50% split, but it doesn't have to be split evenly, it could have just as easily been poison=16,20 and physical=8,10 for a total of 24-30 (2/3's poison damage, and 1/3 physical).

/C\/C\

camelotcrusade
01-31-2014, 11:44 PM
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.