1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Blood Frenzy v1.5d

Submitted by JC Helas
This bundle is marked as pending. It has not been reviewed by a staff member yet.

BLOOD FRENZY



Credits


Requires


Changelogs


Code

Code (vJASS):

scope BloodFrenzy
        /*************************************************************************************************************
        *   v1.5d
        *       by JC Helas
        *
        *   Description:
        *       Execute a series of lightening-fast at attack on a single target.
        *
        *   Requires:
        *       CTL and WorldBounds - Nestharus
        *       RegisterPlayerUnit - Magtheridon96
        *       SpelEffectEvent - Bribe
        *
        *   How to Import:
        *       - Open File\Preferences and enable "Automatically creates unknown variables while pasting trigger data".
        *       - Copy This Folder.
        *       - And dont forget to copy the objects.
        *       - Then Done!!!
        *    
        ************************************************************************************************************/

    globals
        /********************************************************/
        /*                                                      */
        /*                  CONFIGURES                          */
        /*                                                      */
        /********************************************************/
        /* Determine the ability ID of spell.                   */
        /* In getting the data of an ability at object editor   */
        /* you have to press CTRL+D and simply click back to    */
        /* return on normal view.                               */
        private constant integer    ABILITY_ID           = 'A000'
        /********************************************************/
        /* Determine the base amount of slash.                  */
        /* Each slash has random angle also but if the target   */
        /* caster will change target if an enemy is near        */
        /* but if no one, then the series will stop.            */
        private constant integer    SLASH_BASE           = 3
        /********************************************************/
        /* Determine the additional amount of slash per level.  */
        /* Each level of ability will increase the slash amount */
        /* by this integer. BASE + ( THIS * Level of Ability )  */
        private constant integer    SLASH_LVL            = 2
        /********************************************************/
        /* Determine the base amount of damage.                 */
        /* Damage happens when in each slash ends.              */
        private constant real       DAMAGE_BASE          = 25.0
        /********************************************************/
        /* Determine the additional amount damage per level.    */
        /* Each level of ability will increase the amount of    */
        /* damage by this real. BASE + ( THIS * LEVEL )         */
        private constant real       DAMAGE_LVL           = 25.0
        /********************************************************/
        /* Determine the forward speed of caster.               */
        /* This must lower than DISTANCE_START or else the spell*/
        /* will play unpleasing, im very sorry if im not able   */
        /* to change this into matrix.                          */
        private constant real       SPEED_FORWARD        = 50.0
        /********************************************************/
        /* Determine the starting distance of caster to target  */
        /* per slash.                                           */
        private constant real       DISTANCE_START       = 300.0
        /********************************************************/
        /* Determine the distance search of enemy when target   */
        /* is dead.                                             */
        private constant real       NEXT_TARGET_SEARCH   = 600.0
        /********************************************************/
        /* Determine the default alpha of caster.               */
        /* This will be the alpha vertex of caster after        */
        /* finishing a series.                                  */
        private constant integer    CASTER_APLHA_DEFAULT = 255
        /********************************************************/
        /* Determine the starting alpha of caster               */
        /* in each slash.                                       */
        private constant integer    CASTER_APLHA_START   = 255
        /********************************************************/
        /* Determine the ending alpha of caster in each slash.  */
        private constant integer    CASTER_APLHA_END     = 0
        /********************************************************/
        /* Determine the animation of caster in each slash.     */
        /* In order to get the unit index move you have         */
        /* test them with the native function which is          */
        /* SetUnitAnimationByIndex(WhichUnit,Index of Animation)*/
        private constant integer    SLASH_ANIMATION_INDEX= 6
        /********************************************************/
        /* Determine the animation speed of caster              */
        /* in each slash.                                       */
        private constant real       SLASH_ANIMATION_SPEED= 2.5
        /********************************************************/
        /* Determine the attack type of damaging                */
        /* in all slash.                                        */
        private constant attacktype ATTACK_TYPE          = ATTACK_TYPE_NORMAL
        /********************************************************/
        /* Determine the damage type of damaging                */
        /* in all slash.                                        */
        private constant damagetype DAMAGE_TYPE          = DAMAGE_TYPE_NORMAL
        /********************************************************/
        /* Determine the weapon type of damaging                */
        /* in all slash.                                        */
        private constant weapontype WEAPON_TYPE          = null
        /********************************************************/
        /* Determine the hit effect for target                  */
        /* in each slash.                                       */
        private constant string     HIT_EFFECT           = "Abilities\\Weapons\\Bolt\\BoltImpact.mdl"
        /********************************************************/
        /* Determine the HIT_EFFECT attachment location         */
        /* for target.                                          */
        private constant string     TARGET_ATTACH        = "origin"
        /********************************************************/
        /* Determine the effect for caster                      */
        /* in each slash.                                       */
        private constant string     CASTER_EFFECT        = "Abilities\\Weapons\\Bolt\\BoltImpact.mdl"
        /********************************************************/
        /* Determine the CASTER_EFFECT attachement location     */
        /* for caster.                                          */
        private constant string     CASTER_ATTACH        = "origin"
        /********************************************************/
        /* Determine the type of lightning.                     */
        private constant string     LIGHTNIG_TYPE        = "CLPB"
        /*                                                      */
        /*             END OF CONFIGURES                        */
        /*                                                      */
        /********************************************************/
    endglobals
   
    native UnitAlive takes unit u returns boolean
   
    private function Slash takes integer lvl returns integer
        return SLASH_BASE+(SLASH_LVL*lvl)
    endfunction
   
    private function Damage takes integer lvl returns real
        return DAMAGE_BASE+(DAMAGE_LVL*lvl)
    endfunction
   
    private function Filter takes unit t,player p returns boolean
        return UnitAlive(t) and not(IsUnitType(t,UNIT_TYPE_MAGIC_IMMUNE)) and not(IsUnitType(t,UNIT_TYPE_STRUCTURE)) and not(IsUnitAlly(t,p))
    endfunction
   
    private function Fly takes unit u returns boolean
        return UnitAddAbility(u,'Amrf') and UnitRemoveAbility(u,'Amrf')
    endfunction
   
    private function CheckXY takes real x,real y returns boolean
        return x<WorldBounds.maxX and x>WorldBounds.minX and y<WorldBounds.maxY and y>WorldBounds.minY
    endfunction
   
    private struct spell
        integer count
        player owner
        lightning l
        unit caster
        unit target
        real angle
        real dist
        real dmg
        real xs
        real ys
        real zs
       
        static constant real pendist=DISTANCE_START*2
        static constant group grp=CreateGroup()
        static integer ix=0
        static integer array ic
        implement CTL
            local integer i=1
            local real rate
            local real xc
            local real yc
            local real xt
            local real yt
            local real z
        implement CTLExpire
            loop
                exitwhen i>ix
                set this=ic[i]
                if count>0 and UnitAlive(caster) and target!=null then
                    set xt=GetUnitX(target)
                    set yt=GetUnitY(target)
                    if dist<pendist then
                        set dist=dist+SPEED_FORWARD
                        set rate=(1.0/pendist)*dist
                        set xc=xt-DISTANCE_START*Cos(angle*bj_DEGTORAD)
                        set yc=yt-DISTANCE_START*Sin(angle*bj_DEGTORAD)
                        set xc=xc+dist*Cos(angle*bj_DEGTORAD)
                        set yc=yc+dist*Sin(angle*bj_DEGTORAD)
                        set z=GetUnitFlyHeight(target)
                        if CheckXY(xc,yc) then
                            call SetUnitX(caster,xc)
                            call SetUnitY(caster,yc)
                        endif
                        call SetUnitFacing(caster,angle)
                        call SetUnitFlyHeight(caster,z,0.0)
                        call SetUnitVertexColor(caster,255,255,255,R2I(CASTER_APLHA_START*(1.0-rate))+CASTER_APLHA_END)
                        if dist<=DISTANCE_START then
                            call MoveLightningEx(l,false,xc,yc,z,xt,yt,z)
                            call SetLightningColor(l,1,1,1,1-(rate*2.0))
                        endif
                    else
                        call UnitDamageTarget(caster,target,dmg,true,true,ATTACK_TYPE,DAMAGE_TYPE,WEAPON_TYPE)
                        call DestroyEffect(AddSpecialEffectTarget(CASTER_EFFECT,caster,CASTER_ATTACH))
                        call DestroyEffect(AddSpecialEffectTarget(HIT_EFFECT,target,TARGET_ATTACH))
                        call SetUnitAnimationByIndex(caster,SLASH_ANIMATION_INDEX)
                        set angle=angle+GetRandomReal(-180.0,180.0)
                        if angle<0 then
                            set angle=angle+360.0
                        endif
                        set dist=0.0
                        set count=count-1
                        if count>0 and not(UnitAlive(target)) then
                            call GroupEnumUnitsInRange(grp,xt,yt,NEXT_TARGET_SEARCH,null)
                            loop
                                set target=FirstOfGroup(grp)
                                exitwhen target==null or Filter(target,owner)
                                call GroupRemoveUnit(grp,target)
                            endloop
                            call GroupClear(grp)
                            if target==null then
                                set count=0
                            elseif GetUnitFlyHeight(target)>0.0 and Fly(caster) then
                            endif
                        endif
                    endif
                else
                    call SetUnitVertexColor(caster,255,255,255,CASTER_APLHA_DEFAULT)
                    call SetUnitPosition(caster,xs,ys)
                    call SetUnitFlyHeight(caster,zs,0)
                    call SetUnitTimeScale(caster,1.0)
                    call SetUnitPathing(caster,true)
                    call DestroyLightning(l)
                    set i=DeIndex(i)
                endif
                set i=i+1
            endloop
        implement CTLEnd
       
        private static method DeIndex takes integer i returns integer
            local spell this=ic[i]
            call destroy()
            set ic[i]=ic[ix]
            set ix=ix-1
            return i-1
        endmethod
       
        private static method Index takes nothing returns spell
            local spell this=create()
            set ix=ix+1
            set ic[ix]=this
            return this
        endmethod
       
        private static method onCast takes nothing returns nothing
            local spell this
            local unit t=GetSpellTargetUnit()
            local unit c=GetTriggerUnit()
            local player p=GetOwningPlayer(c)
            local integer lvl
            local real z
            if Filter(t,p) then
                set lvl=GetUnitAbilityLevel(c,ABILITY_ID)
                set this=Index()
                set caster=c
                set target=t
                set owner=p
                set angle=GetRandomReal(0.0,360.0)
                set dist=0.0
                set xs=GetUnitX(c)
                set ys=GetUnitY(c)
                set zs=GetUnitFlyHeight(c)
                set z=GetUnitFlyHeight(t)
                set count=Slash(lvl)
                set dmg=Damage(lvl)
                set l=AddLightningEx(LIGHTNIG_TYPE,false,xs,ys,zs,GetUnitX(target),GetUnitY(target),z)
                call DestroyEffect(AddSpecialEffectTarget(CASTER_EFFECT,caster,CASTER_ATTACH))
                call SetUnitAnimationByIndex(caster,SLASH_ANIMATION_INDEX)
                call SetUnitTimeScale(caster,SLASH_ANIMATION_SPEED)
                call SetUnitPathing(caster,false)
                if z>0.0 and Fly(c) then
                endif
            endif
        endmethod
       
        private static method onInit takes nothing returns nothing
            call RegisterSpellEffectEvent(ABILITY_ID,function thistype.onCast)
        endmethod
    endstruct
endscope
 

Previews
Contents

Blood Frenzy v1.5d (Map)