• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Is there a function that gets a unit's attack damage bonuses?

Status
Not open for further replies.
Level 9
Joined
Jul 6, 2012
Messages
65
There are functions for base damage, number of dice, sides per dice, and for total attributes, so it is possible to get a hero's min-max attack damage (without bonuses) without relying on damage detection systems.

Is there a function available that spits out a unit's attack damage bonuses (e.g. the raw bonues of Blades of Attack, Command Aura, etc.), or are damage detection systems still the only way to get total attack damage of a unit?


Using the latest version of WC3.
 
I'm not sure if it's the best way, but I think you could achieve it by tracking the damage upgrades of the units.

For example if your unit has trueshot aura level 3 then the damage bonus would be 30% higher, or if you use a flat value it would be easier. Save all the bonuses to a real or similar and then add them together to calculate total bonus.
 
That is far too much effort and wouldn’t account for the unit being affected by some effect that it isn’t the source of. Getting around that requires a different buff for every level of every ability that alters damage.
It would be a lot of effort yeah, but if you make one big trigger and call it whenever needed he would only have to make it once.

I'm sure there are better ways though, just throwing suggestions out there.

Maybe with the new damage detection natives he can first calculate damage before bonuses are applied and then calculate the difference between the damage pre-bonus and post-bonus? I don't know how the new damage natives works so just a thought, not sure if it's possible.
 
Level 10
Joined
Dec 11, 2009
Messages
234
In theory, you could somehow cycle through abilities (including ones from items from the inventory) and do some checks using this (but seems like way too much work):
JASS:
native BlzGetAbilityIntegerLevelField              takes ability whichAbility, abilityintegerlevelfield whichField, integer level returns integer
native BlzGetAbilityRealLevelField                 takes ability whichAbility, abilityreallevelfield whichField, integer level returns real

    constant abilityintegerlevelfield ABILITY_ILF_ATTACK_BONUS                      = ConvertAbilityIntegerLevelField('Iatt')
    constant abilityintegerlevelfield ABILITY_ILF_DAMAGE_BONUS_DICE                 = ConvertAbilityIntegerLevelField('Idic')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_OCR3                                 = ConvertAbilityRealLevelField('Ocr3')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_HFA1                                 = ConvertAbilityRealLevelField('Hfa1')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_PERCENT                              = ConvertAbilityRealLevelField('Ear1')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_HAV3                                 = ConvertAbilityRealLevelField('Hav3')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_HBH3                                 = ConvertAbilityRealLevelField('Hbh3')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_IDAM                                 = ConvertAbilityRealLevelField('Idam')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_NBA1                                 = ConvertAbilityRealLevelField('Nba1')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_FAK1                                 = ConvertAbilityRealLevelField('fak1')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_ISR1                                 = ConvertAbilityRealLevelField('isr1')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_IPV1                                 = ConvertAbilityRealLevelField('ipv1')
    constant abilityreallevelfield ABILITY_RLF_DAMAGE_BONUS_NEG2                                 = ConvertAbilityRealLevelField('Neg2')
    constant abilityreallevelfield ABILITY_RLF_BONUS_DAMAGE_MULTIPLIER                           = ConvertAbilityRealLevelField('Nic1')
// most of them are probably not needed
// and I probably missed some other, too

// oh, and also, for example, for Agility heroes, stuff like this may be needed too:
    constant abilityintegerlevelfield ABILITY_ILF_AGILITY_BONUS                     = ConvertAbilityIntegerLevelField('Iagi')
 
Status
Not open for further replies.
Top