• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Spells affected by armour, how?

Status
Not open for further replies.
Level 3
Joined
Jul 15, 2007
Messages
36
Dear all,

I am trying to make spell damage affected by armour. As far as I can tell, the global constant Combat - Damage Bonus Tables - Spells is straight applied to the damage, irregardless of what the actual armour value is.

I.E. AFAIK, a unit with "normal" armour will always take 100% of the damage, and not have it reduced by it's armour value *e.g armour 25 = 50% reduction* if thr damage bonus table is set to 1.00.

Is there a way to make spells not ignore armour? (besides making a dummy unit that has a physical attack)

Cheers,
Lauren
 
Level 15
Joined
Feb 15, 2006
Messages
851
If you do a spell that damage and you want to take into account the armor, you should use this jass function:

native UnitDamageTarget takes unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns boolean

Where:
whichUnit is the unit who deals damage.
target the unit/destructable/item which receives the damage.
amount is the damage dealt.
attack is a boolean that indicate if the damage can be considered as an attack.
ranged is a boolean that indicates if the damage is due to a ranged attack.
attacktype is the type of attack dealt.
damagetype is the damage type that it is dealt.
weapontype indicates the type of weapon that deals the damage.

For the last 3 arguments you can use this constants:
JASS:
constant attacktype         ATTACK_TYPE_NORMAL              = ConvertAttackType(0)
    constant attacktype         ATTACK_TYPE_MELEE               = ConvertAttackType(1)
    constant attacktype         ATTACK_TYPE_PIERCE              = ConvertAttackType(2)
    constant attacktype         ATTACK_TYPE_SIEGE               = ConvertAttackType(3)
    constant attacktype         ATTACK_TYPE_MAGIC               = ConvertAttackType(4)
    constant attacktype         ATTACK_TYPE_CHAOS               = ConvertAttackType(5)
    constant attacktype         ATTACK_TYPE_HERO                = ConvertAttackType(6)

    constant damagetype         DAMAGE_TYPE_UNKNOWN             = ConvertDamageType(0)
    constant damagetype         DAMAGE_TYPE_NORMAL              = ConvertDamageType(4)
    constant damagetype         DAMAGE_TYPE_ENHANCED            = ConvertDamageType(5)
    constant damagetype         DAMAGE_TYPE_FIRE                = ConvertDamageType(8)
    constant damagetype         DAMAGE_TYPE_COLD                = ConvertDamageType(9)
    constant damagetype         DAMAGE_TYPE_LIGHTNING           = ConvertDamageType(10)
    constant damagetype         DAMAGE_TYPE_POISON              = ConvertDamageType(11)
    constant damagetype         DAMAGE_TYPE_DISEASE             = ConvertDamageType(12)
    constant damagetype         DAMAGE_TYPE_DIVINE              = ConvertDamageType(13)
    constant damagetype         DAMAGE_TYPE_MAGIC               = ConvertDamageType(14)
    constant damagetype         DAMAGE_TYPE_SONIC               = ConvertDamageType(15)
    constant damagetype         DAMAGE_TYPE_ACID                = ConvertDamageType(16)
    constant damagetype         DAMAGE_TYPE_FORCE               = ConvertDamageType(17)
    constant damagetype         DAMAGE_TYPE_DEATH               = ConvertDamageType(18)
    constant damagetype         DAMAGE_TYPE_MIND                = ConvertDamageType(19)
    constant damagetype         DAMAGE_TYPE_PLANT               = ConvertDamageType(20)
    constant damagetype         DAMAGE_TYPE_DEFENSIVE           = ConvertDamageType(21)
    constant damagetype         DAMAGE_TYPE_DEMOLITION          = ConvertDamageType(22)
    constant damagetype         DAMAGE_TYPE_SLOW_POISON         = ConvertDamageType(23)
    constant damagetype         DAMAGE_TYPE_SPIRIT_LINK         = ConvertDamageType(24)
    constant damagetype         DAMAGE_TYPE_SHADOW_STRIKE       = ConvertDamageType(25)
    constant damagetype         DAMAGE_TYPE_UNIVERSAL           = ConvertDamageType(26)

    constant weapontype         WEAPON_TYPE_WHOKNOWS            = ConvertWeaponType(0)
    constant weapontype         WEAPON_TYPE_METAL_LIGHT_CHOP    = ConvertWeaponType(1)
    constant weapontype         WEAPON_TYPE_METAL_MEDIUM_CHOP   = ConvertWeaponType(2)
    constant weapontype         WEAPON_TYPE_METAL_HEAVY_CHOP    = ConvertWeaponType(3)
    constant weapontype         WEAPON_TYPE_METAL_LIGHT_SLICE   = ConvertWeaponType(4)
    constant weapontype         WEAPON_TYPE_METAL_MEDIUM_SLICE  = ConvertWeaponType(5)
    constant weapontype         WEAPON_TYPE_METAL_HEAVY_SLICE   = ConvertWeaponType(6)
    constant weapontype         WEAPON_TYPE_METAL_MEDIUM_BASH   = ConvertWeaponType(7)
    constant weapontype         WEAPON_TYPE_METAL_HEAVY_BASH    = ConvertWeaponType(8)
    constant weapontype         WEAPON_TYPE_METAL_MEDIUM_STAB   = ConvertWeaponType(9)
    constant weapontype         WEAPON_TYPE_METAL_HEAVY_STAB    = ConvertWeaponType(10)
    constant weapontype         WEAPON_TYPE_WOOD_LIGHT_SLICE    = ConvertWeaponType(11)
    constant weapontype         WEAPON_TYPE_WOOD_MEDIUM_SLICE   = ConvertWeaponType(12)
    constant weapontype         WEAPON_TYPE_WOOD_HEAVY_SLICE    = ConvertWeaponType(13)
    constant weapontype         WEAPON_TYPE_WOOD_LIGHT_BASH     = ConvertWeaponType(14)
    constant weapontype         WEAPON_TYPE_WOOD_MEDIUM_BASH    = ConvertWeaponType(15)
    constant weapontype         WEAPON_TYPE_WOOD_HEAVY_BASH     = ConvertWeaponType(16)
    constant weapontype         WEAPON_TYPE_WOOD_LIGHT_STAB     = ConvertWeaponType(17)
    constant weapontype         WEAPON_TYPE_WOOD_MEDIUM_STAB    = ConvertWeaponType(18)
    constant weapontype         WEAPON_TYPE_CLAW_LIGHT_SLICE    = ConvertWeaponType(19)
    constant weapontype         WEAPON_TYPE_CLAW_MEDIUM_SLICE   = ConvertWeaponType(20)
    constant weapontype         WEAPON_TYPE_CLAW_HEAVY_SLICE    = ConvertWeaponType(21)
    constant weapontype         WEAPON_TYPE_AXE_MEDIUM_CHOP     = ConvertWeaponType(22)
    constant weapontype         WEAPON_TYPE_ROCK_HEAVY_BASH     = ConvertWeaponType(23)

I hope this helps.
 
Level 11
Joined
Aug 15, 2004
Messages
710
This might be a bad example but I swear spell damage is affected by armor, you see it a lot in games like dota when your target has just about the same amount of health as your nuke does damage but your nuke does not kill him.
 
Level 3
Joined
Jul 15, 2007
Messages
36
in regards to the dota example - this is "damage reduction", similar to "Heavy armour takes less damage from piercing and more damage from siege". Hero armour just takes 10% less damage (depending on the constant) from spell damage.


Moyack;
Thanks for your reply and work; however, this is not quite what I'm looking for; I think i can only use that if the spell is JASS enhanced.

I suppose the other thing to consider - is a spell resist ability?
 
Level 15
Joined
Feb 15, 2006
Messages
851
Is there a way to make spells not ignore armour? (besides making a dummy unit that has a physical attack)

Cheers,
Lauren
If you apply this function, automatically the damage with be set according to the armor, so if you say to the command to deal 100 damage, it would deal that value plus or minus the reduction, according to the type of armor.

Moyack;
Thanks for your reply and work; however, this is not quite what I'm looking for; I think i can only use that if the spell is JASS enhanced.
I've put this on JASS because I don't use GUI anymore :p

But this function is in GUI, in the unit section, one of the last functions.
 
Level 3
Joined
Jul 15, 2007
Messages
36
Sorry for being slow...

JASS:
constant damagetype DAMAGE_TYPE_MAGIC = ConvertDamageType(14)

hm... if i change that to;

JASS:
constant damagetype DAMAGE_TYPE_MAGIC = ConvertDamageType(4)
(i.e. normal damagetype)
will that affect all magic (i.e. spell) damage in the game? (This would be good) Thus all "magic" damage actually does "Normal" damage, being affected by armour?
 
Status
Not open for further replies.
Top