BRUTAL
I'm working
- Reaction score
- 118
Blade Fury
Requires AIDS, Damage, Event, GTrigger, Key Timers 2; all included in the map.
Spell Description: Baraka repeatedly swings his arms in an up-and-down motion 10 times, slashing his opponent.
Levels 1-10, damage is (50+(10*n))+str [n is the level of the spell]
Screen shot:
Code:
Nothing too special really, its mostly eye-candy, but im sure someone would find this useful in a map like footmen frenzy or something like that
Feedback is welcomed, if you see any bugs or mistakes let me know.
DL the map.
Requires AIDS, Damage, Event, GTrigger, Key Timers 2; all included in the map.
Spell Description: Baraka repeatedly swings his arms in an up-and-down motion 10 times, slashing his opponent.
Levels 1-10, damage is (50+(10*n))+str [n is the level of the spell]
Screen shot:
Code:
JASS:
// Blade Fury by BRUTAL.
// Requires AIDS, Damage, Event, GTrigger, and KT2.
// Credits are welcome but not necessary.
// November 4th 2009.
scope bladefury initializer init
globals
private constant integer ID=039;A000039; // ID of the blade fury spell.
private constant integer ID2=039;A002039; // ID of the stun spell to stun the hero.
private constant integer BUFF=039;B001039; // ID of the stun spell buff.
private constant integer DUMMY_ID=039;h000039; // ID of the transparent dummy units.
private constant integer DUMMY_ID2=039;h001039; // ID of DUMMY to cast stun.
private constant integer MAX_HITS=20 // Maximum number of hits.
private constant real PERIOD=.02 // Period of the KT2 timer.
private constant real ALPHA_PERCENT=79. // How transparent the dummies will be.
private constant real AOE=250. // Area of effect of possible targets.
private constant string SFX="Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
// Path of the sfx created on slashed enemies.
private constant attacktype ATK_TYPE=ATTACK_TYPE_HERO // Attack type.
private unit DUMMY // The global dummy unit.
// Setting the values for the below strings can be found in the init function.
private string array HIT_SOUND // The slice sounds played when an enemy is hit.
private string array MISS_SOUND // The miss sounds played when there are no enemies.
private group BFgroup=CreateGroup()
private integer filter
endglobals
private function DAMAGE takes integer level, unit u returns real
return 50.+10.*level+I2R(GetHeroStr(u,true))
endfunction
private function Sound takes unit u, string s returns nothing
if u!=null then
set bj_lastPlayedSound=CreateSound(s,false,false,false,10,10,"")
call StartSound(bj_lastPlayedSound)
call SetSoundVolume(bj_lastPlayedSound,50)
call AttachSoundToUnit(bj_lastPlayedSound,u)
call KillSoundWhenDone(bj_lastPlayedSound)
endif
endfunction
private function Text takes unit u, real damage returns nothing
local texttag tt=CreateTextTag() // This creates floating text.
if u!=null then
call SetTextTagText(tt,I2S(R2I(damage)),.023)
call SetTextTagPosUnit(tt,u,-125)
call SetTextTagColor(tt,255,0,0,255)
call SetTextTagPermanent(tt,false)
call SetTextTagVelocity(tt,0,.044)
call SetTextTagLifespan(tt,3)
call SetTextTagFadepoint(tt,2)
else
call DestroyTextTag(tt)
endif
set tt=null
endfunction
private struct Data
unit caster
unit target
unit randomu
real x
real y
real attacktimer
integer i
integer hitcount=0
integer ticks=17*MAX_HITS
group dummy=CreateGroup()
static method create takes unit u, unit t returns Data
local Data data=Data.allocate()
local integer i=0
local unit d
set data.caster=u
set data.x=GetUnitX(u)
set data.y=GetUnitY(u)
set data.target=t
call SetUnitTimeScale(u,3)
call IssueTargetOrder(DUMMY,"thunderbolt",u)
loop
exitwhen i==2
set d=CreateUnit(GetOwningPlayer(u),DUMMY_ID,data.x,data.y,GetUnitFacing(u))
call SetUnitTimeScale(d,1.5)
call SetUnitVertexColor(d,255,255,255,R2I(2.55*(100.-ALPHA_PERCENT)))
call GroupAddUnit(data.dummy,d)
set i=i+1
endloop
set d=null
return data
endmethod
static method check takes nothing returns boolean
local Data d=Data(filter)
if IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(d.caster)) and GetWidgetLife(GetFilterUnit())>.405 then
set d.i=d.i+1
if(GetRandomInt(0,d.i)==1) then
set d.randomu=GetFilterUnit()
endif
endif
return false
endmethod
static method group takes nothing returns nothing
local real x=GetUnitX(Data(filter).caster)
local real y=GetUnitY(Data(filter).caster)
call SetUnitAnimationByIndex(GetEnumUnit(),GetRandomInt(4,6))
call SetUnitX(GetEnumUnit(),x)
call SetUnitY(GetEnumUnit(),y)
// The x/y parts are only necessary if there is a possibility that the hero could be
// knocked back or pushed while in effect. You can get rid of them if this will not
// happen, but leave the animation part.
endmethod
method attack takes nothing returns nothing
local real dmg=DAMAGE(GetUnitAbilityLevel(.caster,ID),.caster)
local real x=GetUnitX(.caster)
local real y=GetUnitY(.caster)
local real tx=GetUnitX(.target)
local real ty=GetUnitY(.target)
set filter=this
if GetWidgetLife(.caster)>.405 and .hitcount<=MAX_HITS then
if .attacktimer==.32 then
set .hitcount=.hitcount+1
call SetUnitAnimationByIndex(.caster,GetRandomInt(4,6))
call ForGroup(.dummy,function Data.group)
if GetWidgetLife(.target)>.405 and tx-x*tx-x+ty-y*ty-y<=AOE*AOE then
call DestroyEffect(AddSpecialEffectTarget(SFX,.target,"origin"))
call Damage_Physical(.caster,.target,dmg,ATK_TYPE,true,false)
call Text(.target,dmg)
call Sound(.target,HIT_SOUND[GetRandomInt(0,2)])
else
set .i=0
set .randomu=null
call GroupEnumUnitsInRange(BFgroup,x,y,AOE,Condition(function Data.check))
if .randomu==null then
call Sound(.caster,MISS_SOUND[GetRandomInt(0,1)])
else
call Sound(.randomu,HIT_SOUND[GetRandomInt(0,2)])
call DestroyEffect(AddSpecialEffectTarget(SFX,.randomu,"origin"))
call Damage_Physical(.caster,.randomu,dmg,ATK_TYPE,true,false)
call Text(.randomu,dmg)
endif
endif
set .attacktimer=0
endif
set .attacktimer=.attacktimer+PERIOD
else
set .ticks=0
endif
endmethod
method end takes nothing returns nothing
local unit u
call SetUnitTimeScale(.caster,1)
if GetWidgetLife(.caster)<.405 then
call SetUnitAnimationByIndex(.caster,3)
else
call SetUnitAnimationByIndex(.caster,0)
endif
call UnitRemoveAbility(.caster,BUFF)
loop
set u=FirstOfGroup(.dummy)
exitwhen u==null
call GroupRemoveUnit(.dummy,u)
call RemoveUnit(u)
endloop
call DestroyGroup(.dummy)
set u=null
endmethod
endstruct
private function PeriodicFunc takes nothing returns boolean
local Data data=KT_GetData()
set data.ticks=data.ticks-1
if data.ticks<=0 then
call data.end()
return true
else
call data.attack()
return false
endif
endfunction
private function actions takes nothing returns nothing
call KT_Add(function PeriodicFunc,Data.create(GetTriggerUnit(),GetSpellTargetUnit()) ,PERIOD)
endfunction
private function init takes nothing returns nothing
call TriggerAddAction(GT_RegisterStartsEffectEvent(CreateTrigger(),ID),function actions)
set DUMMY=CreateUnit(Player(13),DUMMY_ID2,0,0,0)
call UnitAddAbility(DUMMY,ID2)
set HIT_SOUND[0]="Sound\\Units\\Combat\\MetalMediumSliceFlesh1.wav"
set HIT_SOUND[1]="Sound\\Units\\Combat\\MetalMediumSliceFlesh2.wav"
set HIT_SOUND[2]="Sound\\Units\\Combat\\MetalMediumSliceFlesh3.wav"
set MISS_SOUND[0]="Units\\Orc\\HeroBladeMaster\\HeroBladeMasterAttack1.wav"
set MISS_SOUND[1]="Units\\Orc\\HeroBladeMaster\\HeroBladeMasterAttack2.wav"
endfunction
endscope
Nothing too special really, its mostly eye-candy, but im sure someone would find this useful in a map like footmen frenzy or something like that
Feedback is welcomed, if you see any bugs or mistakes let me know.
DL the map.