WolfieeifloW
WEHZ Helper
- Reaction score
- 372
Armor Crush
Created By: WolfieeifloW
Requires NewGen and AIDS
Version: 1.5
Credits:
Spell editing, revised idea, and triggers were created by WolfieeifloW.
Original spell idea was created by Dirac.
If you take the time to download / look at these, please at least leave a comment.
Don't forget to rate also (using the stars
) !
Screenshots serve no justice, try the spell out ingame.
NOTE: This percentages I have used are based off a 2500 health hero.
With this much health and a level 4 Armor Crush, the skill returns 200 damage.
That's why I chose the % of health to return that I did.
Features:
-Insanely customizable
-Leakless
-Lagless
-Eye/Ear-candy
-MUI
-vJASS
Spell Description
Gives a 15% chance to deal a portion of your health back at the attacker. This blow is so shocking it also reduces the attackers armor.
Level 1 - Deals 2% of your current health and -1 armor (Stacks up to -3)
Level 2 - Deals 4% of your current health and -2 armor (Stacks up to -6)
Level 3 - Deals 6% of your current health and -3 armor (Stacks up to -9)
Level 4 - Deals 8% of your current health and -4 armor (Stacks up to -12)
Spell Code
Created By: WolfieeifloW
Requires NewGen and AIDS
Version: 1.5
Credits:
Spell editing, revised idea, and triggers were created by WolfieeifloW.
Original spell idea was created by Dirac.
If you take the time to download / look at these, please at least leave a comment.
Don't forget to rate also (using the stars
Screenshots serve no justice, try the spell out ingame.
NOTE: This percentages I have used are based off a 2500 health hero.
With this much health and a level 4 Armor Crush, the skill returns 200 damage.
That's why I chose the % of health to return that I did.
Features:
-Insanely customizable
-Leakless
-Lagless
-Eye/Ear-candy
-MUI
-vJASS
Spell Description
Gives a 15% chance to deal a portion of your health back at the attacker. This blow is so shocking it also reduces the attackers armor.
Level 1 - Deals 2% of your current health and -1 armor (Stacks up to -3)
Level 2 - Deals 4% of your current health and -2 armor (Stacks up to -6)
Level 3 - Deals 6% of your current health and -3 armor (Stacks up to -9)
Level 4 - Deals 8% of your current health and -4 armor (Stacks up to -12)
Spell Code
JASS:
// +------------------------------------------------------------+
// | |
// | -=-=- Armor Crush [v1.5] -=-=- |
// | -=-=- By WolfieeifloW -=-=- |
// | Requires JASS NewGen and AIDS |
// | |
// +------------------------------------------------------------+
// | |
// | Gives a 15% chance to deal a portion of your health |
// | back at the attacker. This blow is so shocking it |
// | also reduces the attackers armor. |
// | |
// +------------------------------------------------------------+
// | |
// | -=-=- How To Implement -=-=- |
// | 1. Copy this trigger into your map |
// | 2. Copy AIDS into your map |
// | b. Implement AIDS (Follow the script instructions) |
// | 3. Copy the buffs into your map |
// | 4. Copy the abilities into your map |
// | 5. Copy the dummies into your map |
// | 6. Make sure the 'Rawcodes' in the trigger match |
// | your buffs/abilities/units in Object Editor |
// | 7. Customize the spell |
// | 8. Enjoy! |
// | |
// +------------------------------------------------------------+
// | |
// | -=-=- Credits -=-=- |
// | Credits are not needed, but appreciated |
// | Just don't claim this as yours |
// | |
// +------------------------------------------------------------+
// | -=-=- Version History -=-=- |
// | |
// | Version 1.5 |
// | - Changed PUI to AIDS |
// | - Fixed some coding issues |
// | - Added some test map features |
// | - Touched up coding conventions |
// | |
// | Version 1.4 |
// | - Fixed a FirstOfGroup to ForGroup |
// | - Fixed a sound leak |
// | - Fixed texttag leak |
// | - Made floating text more efficient |
// | Credits to Artificial |
// | |
// | Version 1.3 |
// | - Fixed a major bug with Armor Crush not stacking |
// | - Made Armor Crush based off an aura |
// | Prevents the buff from being removed |
// | - Implemented PUI to save GetUnitUserData() |
// | - Fixed some BJ's |
// | - Made Armor Crush sound effect customizable |
// | - Various minor changes |
// | |
// | Older versions... |
// | Read changelog in thread |
// | |
// +------------------------------------------------------------+
scope ArmorCrush initializer Init
// +-------------------------------------+
// | -=-=- MODIFY HERE -=-=- |
// | -=-=- MODIFY HERE -=-=- |
// | -=-=- MODIFY HERE -=-=- |
// +-------------------------------------+
globals
private constant integer ABILITY_ID = 039;AACR039;
// Rawcode of 'Armor Crush' ability
private constant integer DUMMY_ABILITY_ID = 039;AACD039;
// Rawcode of 'Armor Crushed' ability
private constant integer BUFF_ID = 039;BACR039;
// Rawcode of 'Armor Crush' buff
private constant integer DUMMY_BUFF_ID = 039;BACD039;
// Rawcode of 'Armor Crushed' buff
private constant integer DUMMY = 039;nACD039;
// Rawcode of 'DummyCaster' unit
private constant integer VOLUME = 100
// Volume of the played sound
private constant string EFFECT = "Abilities\\Spells\\Items\\ResourceItems\\ResourceEffectTarget.mdl"
// Path for Armor Crush special effect
private constant string ATTACH = "overhead"
// Attachment point of Armor Crush special effect
private constant string SOUND = "Abilities\\Spells\\Human\\Feedback\\Feedback.wav"
// Path for Armor Crush sound effect
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_HERO
// Attack type Armor Crush deals
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_FIRE
// Damage type Armor Crush deals
private constant real TEXT_OFFSET = 0
// Floating text offset
private constant real TEXT_SIZE = 10
// Floating text font size
private constant integer TEXT_RED = 0
// Floating text red color amount (0-100)
private constant integer TEXT_GREEN = 0
// Floating text green color amount (0-100)
private constant integer TEXT_BLUE = 100
// Floating text blue color amount (0-100)
private constant integer TEXT_ALPHA = 0
// Floating text transparency (0-100)
private constant real TEXT_LIFE = 3
// Floating text life
private constant real TEXT_AGE = 2
// Floating text age
private constant real TEXT_SPEED = 75
// Floating text speed
private constant real TEXT_ANGLE = 90
// Floating text angle
private constant string DUMMY_STRING = "innerfire"
// 'Order String Use/Turn On' for 'Armor Crushed' ability
// Don't change the following three(3) variables
private sound CrushSound = null // Don't change this!
private constant group CRUSHED_GROUP = CreateGroup() // Don't change this!
private integer array UnitCustom // Don't change this!
// Don't change the above three(3) variables
endglobals
// +------------------------------------------------+
// | -=-=- CONFIGURABLE FUNCTIONS -=-=- |
// | -=-=- CONFIGURABLE FUNCTIONS -=-=- |
// | -=-=- CONFIGURABLE FUNCTIONS -=-=- |
// +------------------------------------------------+
// Chance to cast Armor Crush
private function Chance takes integer level returns integer
return 15
endfunction
// How many times Armor Crush stacks
private function Stack takes integer level returns integer
return 3
endfunction
// Percentage of health Armor Crush returns
// Each 0.01 is equal to 1% (So 0.05 would be 5%, 0.25 would be 25%, and so on)
private function Return takes integer level returns real
return level * 0.02
endfunction
// +----------------------------------------------+
// | -=-=- NO TOUCHIE PAST HERE -=-=- |
// | -=-=- NO TOUCHIE PAST HERE -=-=- |
// | -=-=- NO TOUCHIE PAST HERE -=-=- |
// +----------------------------------------------+
private function ACConditions takes nothing returns boolean
return GetRandomInt(1, 100) <= Chance(GetUnitAbilityLevel(GetTriggerUnit(), ABILITY_ID)) and GetUnitAbilityLevel(GetTriggerUnit(), BUFF_ID) > 0
endfunction
private function ACActions takes nothing returns nothing
local unit ar = GetAttacker()
local real x = GetUnitX(ar)
local real y = GetUnitY(ar)
local unit ad = GetTriggerUnit()
local integer damageAttacker
local texttag tt = CreateTextTag()
local unit u
local integer QT = GetUnitAbilityLevel(ad, ABILITY_ID)
if CrushSound == null then
set CrushSound = CreateSound(SOUND, false, true, true, 10, 10, "SpellsEAX")
endif
call AttachSoundToUnit(CrushSound, ar)
call SetSoundVolume(CrushSound, VOLUME)
call StartSound(CrushSound)
call KillSoundWhenDone(CrushSound)
set CrushSound = null
call DestroyEffect(AddSpecialEffectTarget(EFFECT, ar, ATTACH))
set damageAttacker = R2I(GetWidgetLife(ar))
call UnitDamageTarget(ad, ar, (GetUnitState(ad, UNIT_STATE_LIFE) * (Return(QT))), true, true, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE_WHOKNOWS)
set damageAttacker = damageAttacker - R2I(GetWidgetLife(ar))
set u = CreateUnit(GetOwningPlayer(ad), DUMMY, x, y, GetUnitFacing(ar))
call SetUnitAbilityLevel(u, DUMMY_ABILITY_ID, (UnitCustom[GetUnitIndex(ar)] * QT))
call IssueTargetOrder(u, DUMMY_STRING, ar)
call UnitApplyTimedLife(u, 039;BTLF039;, 2.00)
set tt = CreateTextTagUnitBJ((I2S(damageAttacker) + "!" ), ar, TEXT_OFFSET, TEXT_SIZE, TEXT_RED, TEXT_GREEN, TEXT_BLUE, TEXT_ALPHA)
call SetTextTagPermanent(tt, false)
call SetTextTagLifespan(tt, TEXT_LIFE)
call SetTextTagFadepoint(tt, TEXT_AGE)
call SetTextTagVelocityBJ(tt, TEXT_SPEED, TEXT_ANGLE)
set tt = null
if UnitCustom[GetUnitIndex(ar)] < Stack(QT) then
set UnitCustom[GetUnitIndex(ar)] = UnitCustom[GetUnitIndex(ar)] + 1
set u = CreateUnit(GetOwningPlayer(ad), DUMMY, x, y, GetUnitFacing(ar))
call SetUnitAbilityLevel(u, DUMMY_ABILITY_ID, (UnitCustom[GetUnitIndex(ar)] * QT))
call IssueTargetOrder(u, DUMMY_STRING, ar)
call UnitApplyTimedLife(u, 039;BTLF039;, 2.00)
if (IsUnitInGroup(ar, CRUSHED_GROUP) == false) then
call GroupAddUnit(CRUSHED_GROUP, ar)
endif
endif
set ar = null
set ad = null
set u = null
endfunction
private function CGRConditions takes nothing returns boolean
return FirstOfGroup(CRUSHED_GROUP) != null
endfunction
private function RemoveU takes nothing returns nothing
if GetUnitAbilityLevel(GetEnumUnit(), DUMMY_BUFF_ID) < 1 then
call GroupRemoveUnit(CRUSHED_GROUP, GetEnumUnit())
set UnitCustom[GetUnitIndex(GetEnumUnit())] = 0
endif
endfunction
private function CGRActions takes nothing returns nothing
call ForGroup(CRUSHED_GROUP, function RemoveU)
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger trig = CreateTrigger()
local integer index = 0
loop
call TriggerRegisterPlayerUnitEvent(trig, Player(index), EVENT_PLAYER_UNIT_ATTACKED, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(trig, Condition(function ACConditions))
call TriggerAddAction(trig, function ACActions)
set trig = CreateTrigger()
call TriggerRegisterTimerEvent(trig, 1.50, true)
call TriggerAddCondition(trig, Condition(function CGRConditions))
call TriggerAddAction(trig, function CGRActions)
set trig = null
endfunction
endscope
Test map included.
Constructive criticism is welcomed, flaming is not.
This spell will only be submitted to TH.net.
Do not redistribute or modify without permission.
Credits are not needed but are appreciated.
Just don't claim the spell as yours.
If you plan to use this spell, it would be nice if you could PM me so I know.
Hope you enjoy it!
Constructive criticism is welcomed, flaming is not.
This spell will only be submitted to TH.net.
Do not redistribute or modify without permission.
Credits are not needed but are appreciated.
Just don't claim the spell as yours.
If you plan to use this spell, it would be nice if you could PM me so I know.
Hope you enjoy it!
Changelog
v1.5
- Changed PUI to AIDS
- Fixed some coding issues
- Added some test map features
- Touched up coding conventions
v1.4
- Fixed a FirstOfGroup to ForGroup
- Fixed a sound leak
- Fixed texttag leak
- Made floating text more efficient
Credits to Artificial
v1.3
- Fixed a major bug with Armor Crush not stacking
- Made Armor Crush based off an aura
Prevents the buff from being removed
- Implemented PUI to save GetUnitUserData()
- Fixed some BJ's
- Made Armor Crush sound effect customizable
- Various minor changes
v1.2
- Code layout touchup
- Fixed sound BJ's
- Added formula configurable options
- Added an extra implementation step
- Removed a couple useless configurables
- Removed GUI version from map
Download v1.1 if you want GUI
Note I'm not updating the GUI version anymore
v1.1
- Fixed "Feedback" sound not sounding, although now it's unconfigurable
- Greatly optimized code
v1.0
- Initial release
- Changed PUI to AIDS
- Fixed some coding issues
- Added some test map features
- Touched up coding conventions
v1.4
- Fixed a FirstOfGroup to ForGroup
- Fixed a sound leak
- Fixed texttag leak
- Made floating text more efficient
Credits to Artificial
v1.3
- Fixed a major bug with Armor Crush not stacking
- Made Armor Crush based off an aura
Prevents the buff from being removed
- Implemented PUI to save GetUnitUserData()
- Fixed some BJ's
- Made Armor Crush sound effect customizable
- Various minor changes
v1.2
- Code layout touchup
- Fixed sound BJ's
- Added formula configurable options
- Added an extra implementation step
- Removed a couple useless configurables
- Removed GUI version from map
Download v1.1 if you want GUI
Note I'm not updating the GUI version anymore
v1.1
- Fixed "Feedback" sound not sounding, although now it's unconfigurable
- Greatly optimized code
v1.0
- Initial release