HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Making damage not consider reduction

07-30-2009, 10:23 AM#1
Themerion
Yes! I know! I know it has been up like a thousand times, but there are no tutorials on it in the scripts section and there are multiple pages contradicting each others when searching...

Is there a combination of (Attack Type, Damage Type) which completely ignore both armor and spell resistance? I've tried with (null,UNIVERSAL) but heroes still take 25% reduced damage (spell resistance from armor type).
07-30-2009, 10:26 AM#2
Captain Griffen
Tried null,null?
07-30-2009, 10:29 AM#3
Themerion
*Testing*

(null,null) is the same as (null,UNIVERSAL). Counts as spell damage (reduces on heroes, 66% extra on ehtereal).
07-30-2009, 10:47 AM#4
moyack
ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL ?
07-30-2009, 10:49 AM#5
Themerion
(CHAOS,UNIVERSAL) does not harm ethereal units.

EDIT: Right, and Chaos also considers armor type reduction (if specified in game play constants).
07-30-2009, 11:21 AM#6
Sophismata
No, there is no combination of attack and damage that will ignore both spell resistance, armour, magic immunity and ethereal status with the game's default constants.

Armour Type (Large, Fortified, Unarmoured, etc) reduction will be present regardless of damage type, because it is set by the attack type. Armour Value (the %damage reduction) is only respected by DAMAGE_TYPE_NORMAL.

DAMAGE_TYPE_UNIVERSAL will ignore everything but invulnerability, the problem lies in the attack type and damage (and targeting) tables.

Fortunately, you can now change the damage constants for ethereal units and have them work for physical attack types, so the simplest thing to do is make chaos affect ethereal units with a 1.00 damage constant.

This will not work in public libraries, sadly, since you cannot rely on an individual user's gameplay constants.


Failing that, ATTACK_TYPE_NORMAL (Spells in the World Editor) and DAMAGE_TYPE_UNIVERSAL (can be called with null, null) is the only way to guarantee damage against any target in the game using the game's default armour tables, barring magic resistance values 100% or over.

The ethereal damage table is off, by the way - the values in the world editor do not match the values used in-game. I'm preparing a write-up for this whole damage thing at Antiarf's request, and I've been surprised to see that people still reference my old damagetype post.

I've just moved house, and my 'net has been sketchy, but I hope the above has helped.
07-30-2009, 11:41 AM#7
rulerofiron99
Set Unit Health?
07-30-2009, 11:52 AM#8
Themerion
SetUnitHealt is not optimal, because it will not trigger Damage-events.

I think I've found a solution to this (and I've also found a bug with xedamage's GetDamageTypeFactor, posted in the xe-thread). xedamage comes with the sweet function GetDamageTypeFactor. So If I just do like this:

Collapse JASS:
function DealPureDamage takes unit damager, unit target, integer amount returns nothing
    local real r=xedamage.getDamageTypeFactor(target,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL)
    
    call UnitDamageTarget(damager,target,amount/r,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,null)
endfunction

Everything will work as I want it to work :)
07-30-2009, 12:20 PM#9
Sophismata
True, but if it's your map, you can set a non-spell attack type to 1.00 against all targets and go to town.

I'm not sure if getDamageTypeFactor can return 0, but if so, there's a problem there, too.
07-30-2009, 01:54 PM#10
Themerion
Using a non-spell attack type will not hurt ethereal units.

It cannot return 0 with (NORMAL,UNIVERSAL) or (null,null) if you will.
07-30-2009, 09:43 PM#11
Pyrogasm
Collapse JASS:
function DealAbsoluteDamage takes unit Source, unit Target, real Damage returns nothing
    local real L = GetWidgetLife(Target)

    if L < Damage then
        call UnitDamageTarget(Source, Target, 999999999.00, false, false, null, null, null)
        return
    endif

    call SetWidgetLife(Target, L-Damage)
endfunction
Yes?
07-30-2009, 09:58 PM#12
Themerion
There is this slight issue with Damage Event Responses. But what the heck, I think this is the best way to do it anyway (or banning mana shield :P).

Quote:
Originally Posted by me 3 posts up
SetUnitHealt is not optimal, because it will not trigger Damage-events.
07-30-2009, 10:15 PM#13
DioD
check my invul detect function.

it detect everything including ethereal and manashell
07-30-2009, 10:28 PM#14
Dreadnought
DAMAGE_TYPE_SPIRIT_LINK

I think that doesn't get reduced.
07-30-2009, 11:47 PM#15
Pyrogasm
Oh, whoops. I thought you only meant triggering kill events, not actual onDamage events.

However, you could always just run all your onDamage events every time you call that script, though.