JASS/GUI: JASS
MUI: Yes
Leaks: No one i thing
Frozen Desire
Note: I wanted to do this in a spiral, but it with look like the Frost Spiral spell that -Thanatos- did.
Note: I don't really put all things like:
because i have put all these things in the Readme. Only aclared those that weren't in the readme
MUI: Yes
Leaks: No one i thing
Ice Ball
Code:
Throws a Iceball from your position to a certain distance. All units in the way of the IceBall are carried with the ball or pushed back from it.
JASS:
scope IceBall
globals
private integer IceBallId=039;A002039;
private integer IceballDummy=039;h000039;
private real MaxDistance=600 //Max Distance of the Ball
private real MaxPickRange=250 //The Pick range of all units in the way
private real DamagePerIntervalPlusDistance=10 //Damage per level and per .1 seconds that the ball is moved
private boolean AffectImmunes=false// Will this move immunes ? <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />
endglobals
private function Trig_Ice_Ball_Conditions takes nothing returns boolean
return GetSpellAbilityId() == IceBallId
endfunction
private function ICBMove takes nothing returns nothing
local timer t=GetExpiredTimer()
local string ttable=GetAttachmentTable(t)
local unit Hero=GetTableUnit(ttable,"ICBCaster")
local unit IceBall=GetTableUnit(ttable,"ICBall")
local real x=GetUnitX(IceBall)
local real y=GetUnitY(IceBall)
local real angle=GetTableReal(ttable,"angle")
local group g=CreateGroup()
local trigger t2
local unit w
local real newx
local real newy
local real Distance=GetTableReal(ttable,"Distance")
local real Damage=(DamagePerIntervalPlusDistance*GetUnitAbilityLevel(Hero,IceBallId))+Distance
if Distance<MaxDistance and GetWidgetLife(IceBall)>0.465 then
call SetUnitScale(IceBall,(100*GetUnitAbilityLevel(Hero,IceBallId)+Distance)*0.01,(100*GetUnitAbilityLevel(Hero,IceBallId)+Distance)*0.01,(100*GetUnitAbilityLevel(Hero,IceBallId)+Distance)*0.01)
set newx=x+Distance*Cos(angle*bj_DEGTORAD)
set newy=y+Distance*Sin(angle*bj_DEGTORAD)
call SetUnitPosition(IceBall,newx,newy)
call GroupEnumUnitsInRange(g,newx,newy,MaxPickRange,null)
loop
set w=FirstOfGroup(g)
exitwhen w==null
call GroupRemoveUnit(g,w)
if IsUnitEnemy(w,GetOwningPlayer(Hero))==true and IsUnitType(w,UNIT_TYPE_STRUCTURE)==false then
if IsUnitType(w,UNIT_TYPE_MAGIC_IMMUNE)==true and AffectImmunes==true and GetWidgetLife(w)>0.465 then
call SetUnitPosition(w,newx,newy)
call UnitDamageTarget(Hero,w,Damage,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,null)
elseif IsUnitType(w,UNIT_TYPE_MAGIC_IMMUNE)==true and AffectImmunes==false and GetWidgetLife(w)>0.465 then
elseif GetWidgetLife(w)>0.465 then
call SetUnitPosition(w,newx,newy)
call UnitDamageTarget(Hero,w,Damage,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,null)
endif
endif
endloop
call DestroyGroup(g)
set Distance=Distance+50
call SetTableReal(ttable,"Distance",Distance)
else
set t2=GetTableTrigger(ttable,"Trigger")
call DestroyTrigger(t2)
call KillUnit(IceBall)
call RemoveUnit(IceBall)
call DestroyGroup(g)
call CleanAttachedVars(t)
call DestroyTimer(t)
set t=null
set w=null
set IceBall=null
set Hero=null
endif
set Hero=null
set IceBall=null
set w=null
endfunction
private function KillIfOutOfMap takes nothing returns boolean
return GetUnitTypeId(GetLeavingUnit())==IceballDummy
endfunction
private function KillIB takes nothing returns nothing
call KillUnit(GetTriggerUnit())
call TriggerSleepAction(1.1)
call RemoveUnit(GetTriggerUnit())
call DestroyTrigger(GetTriggeringTrigger())
endfunction
private function Trig_Ice_Ball_Actions takes nothing returns nothing
local trigger t2=CreateTrigger()
local unit Hero=GetSpellAbilityUnit()
local timer t=CreateTimer()
local string ttable=GetAttachmentTable(t)
local location l=GetSpellTargetLoc()
local real x=GetLocationX(l)
local real y=GetLocationY(l)
local boolexpr Boolexpr=Condition(function KillIfOutOfMap)
local real Angle=bj_RADTODEG*Atan2(y-GetUnitY(Hero),x-GetUnitX(Hero))
local region rectRegion = CreateRegion()
call RegionAddRect(rectRegion,bj_mapInitialPlayableArea)
call RemoveLocation(l)
call TriggerRegisterLeaveRegion(t2,rectRegion,null)
call TriggerAddCondition(t2,Boolexpr)
call TriggerAddAction(t2,function KillIB)
set bj_lastCreatedUnit=CreateUnit(GetOwningPlayer(Hero),IceballDummy,x,y,Angle)
call SetTableObject(ttable,"ICBall",bj_lastCreatedUnit)
call SetTableReal(ttable,"angle",Angle)
call SetTableObject(ttable,"ICBCaster",Hero)
call SetTableObject(ttable,"Trigger",t2)
call TimerStart(t,0.1,true,function ICBMove)
set Hero=null
call DestroyBoolExpr(Boolexpr)
endfunction
//===========================================================================
function InitTrig_Ice_Ball takes nothing returns nothing
set gg_trg_Ice_Ball = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ice_Ball, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ice_Ball, Condition( function Trig_Ice_Ball_Conditions ) )
call TriggerAddAction( gg_trg_Ice_Ball, function Trig_Ice_Ball_Actions )
call PreloadUnit(IceballDummy)
call PreloadSpell(IceBallId)
endfunction
endscope
Freezing Soul
Code:
With every attack you have a chance to steal part of the Soul of the enemy, damaging it. Also when you steal the part of the soul, you transfer it to your hands giving you more attack speed.
JASS:
scope FreezingSoul
globals
private integer IBS_ID=039;A000039;
private integer IBS_SpellDummyLife=039;A005039;
private integer IBS_SpellSpeedGain=039;A001039;
private real IBS_ChancesPerLevel=10 //Chances per level 10*level
private real IBS_DamagePerLevel=30//Damage per level 30*level
private real DurationPerLevel=5//Duration per level 5*level
private string SoulHeroEffect="Abilities\\Weapons\\FrostWyrmMissile\\FrostWyrmMissile.mdl"
private string SoulStealEffect="Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl"
endglobals
private function IBS_Stop takes nothing returns nothing
local timer t=GetExpiredTimer()
local string shtable=GetAttachmentTable(t)
local unit SoulHero=GetTableUnit(shtable,"SH")
local unit Target=GetTableUnit(shtable,"SHT")
local effect array Effect
local integer i=0
set Effect[1]=GetTableEffect(shtable,"effect1")
set Effect[2]=GetTableEffect(shtable,"effect2")
set Effect[3]=GetTableEffect(shtable,"effect3")
set Effect[4]=GetTableEffect(shtable,"effect4")
loop
exitwhen i>4
call DestroyEffect(Effect<i>)
set i=i+1
endloop
call UnitRemoveAbility(SoulHero,IBS_SpellSpeedGain)
call UnitRemoveAbility(Target,IBS_SpellDummyLife)
call CleanAttachedVars(SoulHero)
set SoulHero=null
call CleanAttachedVars(t)
call DestroyTimer(t)
set t=null
endfunction
private function Trig_Freezing_Soul_Actions takes nothing returns nothing
local unit SoulHero=GetEventDamageSource()
local unit Target=GetTriggerUnit()
local timer t=CreateTimer()
local string shtable=GetAttachmentTable(t)
local string HeroTable=GetAttachmentTable(SoulHero)
local real Chances=IBS_ChancesPerLevel*GetUnitAbilityLevel(SoulHero,IBS_ID)
local boolean Bool=GetTableBoolean(HeroTable,"Bool")
local effect Effect
local effect Attach
local effect Attach2
local effect Attach3
if GetRandomReal(1,100)<=Chances and Bool==null and GetUnitAbilityLevel(SoulHero,IBS_ID)>0 then
call UnitAddAbility(SoulHero,IBS_SpellSpeedGain)
call SetUnitAbilityLevel(SoulHero,IBS_SpellSpeedGain,GetUnitAbilityLevel(SoulHero,IBS_ID))
call UnitAddAbility(Target,IBS_SpellDummyLife)
call SetUnitAbilityLevel(Target,IBS_SpellDummyLife,GetUnitAbilityLevel(SoulHero,IBS_ID))
call UnitDamageTarget(SoulHero,Target,IBS_DamagePerLevel*GetUnitAbilityLevel(SoulHero,IBS_ID),true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,null)
call SetTableBoolean(HeroTable,"Bool",true)
set Effect=AddSpecialEffectTarget(SoulStealEffect,Target,"chest")
set Attach=AddSpecialEffectTarget(SoulHeroEffect,SoulHero,"hand,left")
set Attach2=AddSpecialEffectTarget(SoulHeroEffect,SoulHero,"hand,right")
set Attach3=AddSpecialEffectTarget(SoulHeroEffect,SoulHero,"weapon")
call SetTableObject(shtable,"SH",SoulHero)
call SetTableObject(shtable,"SHT",Target)
call SetTableObject(shtable,"effect1",Effect)
call SetTableObject(shtable,"effect2",Attach)
call SetTableObject(shtable,"effect3",Attach2)
call SetTableObject(shtable,"effect4",Attach3)
call TimerStart(t,DurationPerLevel*GetUnitAbilityLevel(SoulHero,IBS_ID),false,function IBS_Stop)
endif
set SoulHero=null
set Target=null
endfunction
//===========================================================================
function InitTrig_Freezing_Soul takes nothing returns nothing
call DamDetect_Init()
call DamDetect_Attacks(SCOPE_PRIVATE+"Trig_Freezing_Soul_Actions")
call PreloadSpell(IBS_ID)
call PreloadSpell(IBS_SpellSpeedGain)
call PreloadSpell(IBS_SpellDummyLife)
call Preload(SoulHeroEffect)
call Preload(SoulStealEffect)
endfunction
endscope
</i>
Frozen Desire
Code:
Cast upon a mystical ice shard. Hits all units within a 500 range with full ice force.
Note: I wanted to do this in a spiral, but it with look like the Frost Spiral spell that -Thanatos- did.
JASS:
scope FrozenDesire
globals
private integer FS_ID=039;A004039;
private integer FS_DummyID=039;h001039;
private integer FS_DummyAb=039;A003039;
private integer FS_FlyingDummy=039;h002039;
private integer SpellDurationPerLevel=3//Spell duration per level
private real RangeForCreation=500.00 //Range of the circle
private real DamageIntermediate=0.40//Nova -Wait this global- Nova
private real RangeForDummycast=500.00 //Range of the units that are going to be affected by ice
endglobals
private function Trig_Frozen_Desire_Conditions takes nothing returns boolean
return GetSpellAbilityId() == FS_ID
endfunction
private function Damage takes nothing returns nothing
local timer t=GetExpiredTimer()
local string ttable=GetAttachmentTable(t)
local unit dummy=GetTableUnit(ttable,"dummy")
local group g=CreateGroup()
local unit w
call GroupEnumUnitsInRange(g,GetUnitX(dummy),GetUnitY(dummy),RangeForDummycast,null)
loop
set w=FirstOfGroup(g)
exitwhen w==null
call GroupRemoveUnit(g,w)
if IsUnitEnemy(w,GetOwningPlayer(dummy))==true then
call IssueTargetOrder(dummy,"frostnova",w)
endif
endloop
set dummy=null
call DestroyGroup(g)
endfunction
private function FS_Stop takes nothing returns nothing
local unit Hero=GetTriggerUnit()
local string htable=GetAttachmentTable(Hero)
local unit dummy=GetTableUnit(htable,"Dummy")
local unit Dummys
local string ttable=GetTableString(htable,"ttable")
local timer t=GetTableTimer(htable,"Timer")
local integer i=0
loop
exitwhen i>180
set Dummys=GetTableUnit(htable,"Dummy"+I2S(i))
call KillUnit(Dummys)
set i=i+1
endloop
call RemoveUnit(dummy)
call CleanAttachedVars(t)
call CleanAttachedVars(Hero)
call DestroyTimer(t)
set Hero=null
set t=null
set Dummys=null
set dummy=null
call DestroyTrigger(GetTriggeringTrigger())
endfunction
private function Trig_Frozen_Desire_Actions takes nothing returns nothing
local timer t=CreateTimer()
local trigger t2=CreateTrigger()
local string ttable=GetAttachmentTable(t)
local unit Hero=GetSpellAbilityUnit()
local string t2table=GetAttachmentTable(Hero)
local real x=GetUnitX(Hero)
local real y=GetUnitY(Hero)
local unit Dummys
local unit dummy=CreateUnit(GetOwningPlayer(Hero),FS_DummyID,x,y,GetUnitFacing(Hero))
local real angle=0
local integer i=0
local real newx
local real newy
local real dur=SpellDurationPerLevel*GetUnitAbilityLevel(Hero,FS_ID)
call SetUnitAnimation(Hero,"channel")
call UnitAddAbility(dummy,FS_DummyAb)
call SetUnitAbilityLevel(dummy,FS_DummyAb,GetUnitAbilityLevel(Hero,FS_ID))
call SetUnitScale(dummy,(150+I2R(GetUnitAbilityLevel(Hero,FS_ID)))*0.01,(150+I2R(GetUnitAbilityLevel(Hero,FS_ID)))*0.01,(150+I2R(GetUnitAbilityLevel(Hero,FS_ID)))*0.01)
loop
exitwhen i>180
set newx=x+RangeForCreation*Cos(angle)
set newy=y+RangeForCreation*Sin(angle)
set Dummys=CreateUnit(GetOwningPlayer(Hero),FS_FlyingDummy,newx,newy,270.00)
call SetTableObject(t2table,"Dummy"+I2S(i),Dummys)
set i=i+1
set angle=angle+10
if angle>360 then
set angle=0
endif
endloop
call SetTableObject(ttable,"dummy",dummy)
call SetTableObject(t2table,"Dummy",dummy)
call SetTableString(t2table,"ttable",ttable)
call SetTableObject(t2table,"Timer",t)
call TimerStart(t,DamageIntermediate,true,function Damage)
call TriggerRegisterUnitEvent(t2,Hero,EVENT_UNIT_SPELL_ENDCAST)
call TriggerAddCondition(t2,Condition(function Trig_Frozen_Desire_Conditions))
call TriggerAddAction(t2,function FS_Stop)
set t=null
set dummy=null
set Hero=null
set Dummys=null
endfunction
//===========================================================================
function InitTrig_Frozen_Desire takes nothing returns nothing
set gg_trg_Frozen_Desire = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frozen_Desire, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Frozen_Desire, Condition( function Trig_Frozen_Desire_Conditions ) )
call TriggerAddAction( gg_trg_Frozen_Desire, function Trig_Frozen_Desire_Actions )
call PreloadUnit(FS_DummyID)
call PreloadUnit(FS_FlyingDummy)
call PreloadSpell(FS_ID)
call PreloadSpell(FS_DummyAb)
endfunction
endscope
Note: I don't really put all things like:
JASS:
//Replace this with your rawcode bla bla bla
because i have put all these things in the Readme. Only aclared those that weren't in the readme