• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

About preprocessing damage and "Whosyourdaddy" cheat

Status
Not open for further replies.
If you're not interested in reading this, then it's okay.

If you're interested in reading this, then read on.

I investigated the behavior of the "whosyourdaddy" cheat, and found out that it preprocesses damage before it is detected by the damage event such that if you're the only player in the game, you could be flagged as the god-like player in that map. The other instances of preprocessing damage can be found in hardcoded spells such as hardened skin, defend, magic shield, Bracers, Elune's magic (something), etc.

This could only mean one thing; we cannot truly get the base damage of the attack before reductions. This could be one of the requests to Blizzard, to get the base damage of the attack before reductions are made.

Now, evasion is something else. It does not preprocess the damage, rather I would guess that it does not set the flag for a damage instance. Testing it at 100% evasion, I found out that no damage was preprocessed and so, to my conclusion, the base damage would be introduced after a damage instance would have been flagged.

For a short recap of the last paragraph:

damage flag -> base damage -> calculation -> native GetEventDamage

I'm still studying the nature of spells and physical damage as of now and how to differentiate them without consulting the object editor...

24th of March, 2017


I noticed something odd with the behavior of damage being reduced to something below 1. Using my own damage detection system, I found out that whenever a damage instance is less than 1, it will be rounded up to 1. However, I haven't checked the repercussions of casting a spell with the bracer's ability set to block 200% of damage. I'll update the thread after finding out.
 
Last edited:
There's many ways of getting a units base damage however it would be nice for it to become a one liner. Interesting findings so far, thanks for sharing.

Thanks for replying to the thread.

I would like to thank @leandrotp for the read-only memory library and for its' utilities.

Since I'm not (yet) that good in understanding memory addresses, I would have quite some difficulty in discovering new things that require it.

Anyway, about the memhack thread, there was a library that allows the scripter to get the base armor of a unit using memory hacking. This could be used to get more/less the unreduced damage of the unit. (Note that unreduced damage may not be equal to base damage.) If I can recall, there was another thread that talked about the calculation of the reduction in damage. This is for preprocessing the base damage. That is why when we call GetEventDamage(), it is already reduced. The formula for finding the reduction is something like this: (link)

"Ghan" said:
Reduction = (Armor * Const) / (1 + Armor * Const)

where Const is our reduction multiplier, found in Gameplay Constants and Armor is our armor value.

Now, we can plug in the equation:

Code:
Unreduced Damage * Reduction = GetEventDamage()

Solving for Unreduced Damage, we get:

Code:
Unreduced Damage = GetEventDamage()/Reduction

// Plugging in the formula specified above...

Unreduced Damage = GetEventDamage()/[(Armor * Const)/(i + (Armor*Const))]

Looking at the code above, this could be computationally expensive (not really).
 
Last edited:
Level 23
Joined
Oct 18, 2008
Messages
937
Now, evasion is something else. It does not preprocess the damage, rather I would guess that it does not set the flag for a damage instance. Testing it at 100% evasion, I found out that no damage was preprocessed and so, to my conclusion, the base damage would be introduced after a damage instance would have been flagged.

on ranged units missing is visible from the projectile behavior, so yeah.

I noticed something odd with the behavior of damage being reduced to something below 1. Using my own damage detection system, I found out that whenever a damage instance is less than 1, it will be rounded up to 1. However, I haven't checked the repercussions of casting a spell with the bracer's ability set to block 200% of damage. I'll update the thread after finding out.

lots of weird stuff happens with this. IIRC crits can reduce it below 1, as can demolish and maybe elune's grace, but not armor.
 
Last edited:
on ranged units missing is visible from the projectile behavior, so yeah.



lots of weird stuff happens with this. IIRC crits can reduce it below 1, as can demolish and maybe elune's grace, but not armor.

Ah, so that would explain why the bracers bug works. To my guess, anything that is somehow physical cannot be reduced below 1.00 if the damage is positive. If it is somehow negative, the damage would not be applied at all, like the UnitDamageTarget native. In almost all aspects, the damage event somehow calls a private and internal UnitDamageTarget native.

The damage detection I used can also be found in the Lab:
Dead Link
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
you misunderstand damage handling process. There's common function which represent "unit damaged" action, and it has all the data - the damage, type, attack type, ranged/melee, etc. Then it goes through tons of modifiers, one of which is whosyourdaddy, and finally unit's hp goes down by some amount. You can always know base damage and it's properties.

evasion completely "blocks" the attack for melee unit (means it doesn't even try to deal the damage), for ranged - makes missile to have "missed" property, nothing more. can't say for rest types for sure as Im not interested in them at all.
also, evasion being calculated at the attack proj/attack finish (melee) moment.
to simplify it for u:
Code:
if(isMeele){
  if(GetMiss()){
   missTexttag()
  }else{
   damageWrapper()
  }
}else{
  v=createProjectile();// where v.missed == 0 by default
  if(GetMiss()){
   v.missed=1;
  }
}
 
Status
Not open for further replies.
Top