Spell Armor Crush

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
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 = 'AACR'
        // Rawcode of 'Armor Crush' ability
    
        private constant integer DUMMY_ABILITY_ID = 'AACD'
        // Rawcode of 'Armor Crushed' ability
    
        private constant integer BUFF_ID = 'BACR'
        // Rawcode of 'Armor Crush' buff
    
        private constant integer DUMMY_BUFF_ID = 'BACD'
        // Rawcode of 'Armor Crushed' buff
    
        private constant integer DUMMY = 'nACD'
        // 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, 'BTLF', 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, 'BTLF', 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!​

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
 

Attachments

WolfieeifloW

WEHZ Helper
Reaction score
372
It doesn't "give health back to the person"?
I suggest you download the map and take a look :p .

EDIT: Changed the spell to make tooltips more clear.

EDITEDIT: Added v1.1, check the Changelog for more information.
 

Mac Dre

New Member
Reaction score
6
"Gives a 15% chance to deal a portion of your health back at the attacker."

That's what I meant.

"NOTE: This spell was made for my map for an Agility hero that would have around 2500 health.
That's why I chose the % of health to return that I did."

If it's only going to work with a hero with those preferences i'm going to have to say either:
A: Make a version without the health return effect.
B: Make the percentage of health returned easy to edit. (If it's not already, I havn't looked at it sorry)

Because it's not going to be very usefull if people have to edit their entire hero around the spell.
Just my opinion though.
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
WolfieNoCT, I think you should put your code into wc3 tag (replace [.code] with [.wc3] and [./code] with [./wc3] - without the dot . )

this ability is useful for tankers, I guess :D
 

WolfieeifloW

WEHZ Helper
Reaction score
372
"Gives a 15% chance to deal a portion of your health back at the attacker."

That's what I meant.
That means when someone attacks you, you have a chance to deal damage back to them equal to a certain percentage of your current health.

"NOTE: This spell was made for my map for an Agility hero that would have around 2500 health.
That's why I chose the % of health to return that I did."

If it's only going to work with a hero with those preferences i'm going to have to say either:
A: Make a version without the health return effect.
B: Make the percentage of health returned easy to edit. (If it's not already, I havn't looked at it sorry)

Because it's not going to be very usefull if people have to edit their entire hero around the spell.
Just my opinion though.
It is easy to edit.
I've added a "Spell Customization" section that even tells you how to change it.
Read the whole post next time before replying :p ...

WolfieNoCT, I think you should put your code into wc3 tag (replace [.code] with [.wc3] and [./code] with [./wc3] - without the dot . )

this ability is useful for tankers, I guess :D
I don't really like those tags, but I'll change them over.

It's good on heroes that are always getting attacked.
If no one attacks the tank (because they kill the weaker heroes first), it's sort of a useless spell to be on him.
It's better for a DPS hero ;) !
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Instead of me having to reply back asking "what" or "which part" every time, could you just tell me what parts of what triggers and why this isn't MUI :rolleyes: .
 

BRUTAL

I'm working
Reaction score
118
well then you dont know what MUI is or how to do it, i suggest you read some tutorials
 

WolfieeifloW

WEHZ Helper
Reaction score
372
I do know what MUI is, and I just don't see how this isn't.
If you're going to be hard about it, don't respond here.
 

BRUTAL

I'm working
Reaction score
118
can you tell me how it is?
your variables are overwriting
you should take out 'mui' from your 'cons' unless you can change it
 

WolfieeifloW

WEHZ Helper
Reaction score
372
The variables are all supposed to be overwritten?
Why would I want the life of the attacking unit to stay constant?
And the position of him?

EDIT: The spell works perfectly with all my tests.
 

Mac Dre

New Member
Reaction score
6
MUI means that multiply units can cast it at the same time without interupting each other/causing the spell to fail. Enjoy.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Any other comments on this spell guys?
Anything you'd like added?
Suggestions on how to make it better?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • jonas jonas:
    That sounds like fun!
    +1
  • The Helper The Helper:
    it was a blast!
  • The Helper The Helper:
    I am going to post the Youtube of the investigation in the forums when it is ready
    +1
  • jonas jonas:
    cool!
  • vypur85 vypur85:
    Sounds cool TH.
  • tom_mai78101 tom_mai78101:
    I was on a Legend of Zelda marathon...
  • tom_mai78101 tom_mai78101:
    Am still doing it now
    +1
  • jonas jonas:
    which one(s) are you playing?
  • jonas jonas:
    I played a little bit of the switch title two weeks ago and found it quite boring
  • The Helper The Helper:
    just got back from San Antonio this weekend had the best Buffalo Chicken Cheesesteak sandwhich in Universal City, TX - place was called Yous Guys freaking awesome! Hope everyone had a fantastic weekend!
    +1
  • The Helper The Helper:
    Happy Tuesday!
  • The Helper The Helper:
    We have been getting crazy numbers reported by the forum of people online the bots are going crazy on us I think it is AI training bots going at it at least that is what it looks like to me.
  • The Helper The Helper:
    Most legit traffic is tracked on multiple Analytics and we have Cloud Flare setup to block a ton of stuff but still there is large amount of bots that seem to escape detection and show up in the user list of the forum. I have been watching this bullshit for a year and still cannot figure it out it is drving me crazy lol.
    +1
  • Ghan Ghan:
    Beep boop
    +1
  • The Helper The Helper:
    hears robot sounds while 250 bots are on the forum lol
  • The Helper The Helper:
    Happy Saturday!
    +1
  • The Helper The Helper:
    and then it was Thursday...
    +2
  • tom_mai78101 tom_mai78101:
    And then Monday
    +1
  • The Helper The Helper:
    I got the day off today!
    +1
  • tom_mai78101 tom_mai78101:
    How...? (T-T)
  • The Helper The Helper:
    I took the day off. I work for myself so I can do that.
    +1
  • Varine Varine:
    Well I'm already over summer
  • jonas jonas:
    varine! good to see you
  • jonas jonas:
    what's going on, what's got you going
  • The Helper The Helper:
    good to see you varine hope you are well my friend

    The Helper Discord

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top