Jesus4Lyf
Good Idea™
- Reaction score
- 397
JASS:
if Damage_IsPhysical() then
set Data(id2).lastphydmg = amount
endif
if Damage_IsSpell() then
set Data(id2).lastspldmg = amount
endif
if Damage_IsAttack() then
set Data(id2).lastatkdmg = amount
endif
if Damage_IsPure() then
set Data(id2).lastpuredmg = amount
endif
-->
JASS:
if Damage_IsPhysical() then
set Data(id2).lastphydmg = amount
elseif Damage_IsSpell() then
set Data(id2).lastspldmg = amount
elseif Damage_IsPure() then
set Data(id2).lastpuredmg = amount
endif
if Damage_IsAttack() then
set Data(id2).lastatkdmg = amount
endif
IsAttack is special. The others are type comparison wraps for Damage_GetType(), so they are mutually exclusive. :thup:
Reflected in the code above.
PS. I'd change [LJASS]id[/LJASS] and [LJASS]id2[/LJASS] to the [LJASS]Data[/LJASS] type, and set them to Data[unit] instead of GetUnitId(unit). It is exactly the same in the compiled JASS, I admit, but it is nicer syntax and readability - you don't need to keep saying Data(id).