- Reaction score
- 888
JASS - Yes - vJASS REQUIRED
MUI - Yes
Works - Yes
Fun - In Soviet Russia, spell casts YOU!!
Leaks - I am not an old pipe!
Ice Mirage
This spell creates a number of dark magicians around the target, who cause a spell to be cast that does massive damage to the target and surrounding units.
Code:
I created this spell a while back for someone in a spell request thread. Just figured I'd submit it now. I don't know if the person who requested it ever got it, actually.
MUI - Yes
Works - Yes
Fun - In Soviet Russia, spell casts YOU!!
Leaks - I am not an old pipe!
Ice Mirage
This spell creates a number of dark magicians around the target, who cause a spell to be cast that does massive damage to the target and surrounding units.
Code:
JASS:
//**************************ICE MIRAGE by GHAN_04***********************
//******************************DESCRIPTION*****************************
//**Creates a number of dark magicians around the target, who cause a
//**spell to be cast that does massive damage to the target and
//**surrounding units.**************************************************
//**********************************************************************
scope IceMirage initializer Init //When the map starts up, run the "Init" function.
globals //Declaring some globals for our ability.
//********************CONFIGURATION CONSTANTS - YOU MAY EDIT***********************************
private constant integer ICE_MIRAGE_CODE = 039;A000039; //Raw Code of the hero ability.
private constant integer ICE_MIRAGE_EFFECT_CODE = 039;A001039; //Raw Code of the Effect ability that the Dummy has.
private constant integer DUMMY_UNIT_CODE = 039;u000039; //Raw Code of the Dummy unit.
private constant integer IMAGE_UNIT_CODE = 039;u001039; //Raw Code of the Image units.
private constant integer NUMBER_OF_IMAGES = 5 //Number of images that appear around the target.
private constant real IMAGE_RADIUS = 300.0 //Distance from target the images will appear.
//*********************PLEASE DO NOT EDIT BELOW THIS LINE***************************************
private trigger t = CreateTrigger() //Makes a new trigger for us to use.
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ICE_MIRAGE_CODE //Checks to make sure the ability being cast = Ice Mirage.
endfunction
private function Actions takes nothing returns nothing
//Begin by creating some variables for our spell.
local unit target = GetSpellTargetUnit()
local unit caster = GetTriggerUnit()
local real casterX = GetUnitX(caster)
local real casterY = GetUnitY(caster)
local real targetX = GetUnitX(target)
local real targetY = GetUnitY(target)
local real offsetX
local real offsetY
local unit dummy = CreateUnit(GetOwningPlayer(caster), DUMMY_UNIT_CODE, targetX, targetY, bj_UNIT_FACING) //Create the dummy that casts the spell.
local integer count = 0
local integer abilitylevel = GetUnitAbilityLevel(caster, ICE_MIRAGE_CODE)
local unit imageunit
call PauseUnit(target, true) //Pause the target while the ability is being cast.
loop
exitwhen count > NUMBER_OF_IMAGES - 1
set offsetX = targetX + IMAGE_RADIUS * Cos(((360/NUMBER_OF_IMAGES) * count) * bj_DEGTORAD) //These two actions get the location where we will create the image.
set offsetY = targetY + IMAGE_RADIUS * Sin(((360/NUMBER_OF_IMAGES) * count) * bj_DEGTORAD)
set imageunit = CreateUnit(GetOwningPlayer(caster), IMAGE_UNIT_CODE, offsetX, offsetY, bj_RADTODEG * Atan2(targetY - offsetY, targetX - offsetX)) //Now that we know the location, create the unit.
call SetUnitAnimation(imageunit, "attack") //Play the attack animation.
set imageunit = null //Clear the potential leak. Though, I'm not sure it needs to be cleared every time....
set count = count + 1 //No infinte loops allowed.
endloop
call UnitAddAbility(dummy, ICE_MIRAGE_EFFECT_CODE) //Give the dummy the ability to cast.
call SetUnitAbilityLevel(dummy, ICE_MIRAGE_EFFECT_CODE, abilitylevel) //Set the level of the ability to the same as the Hero's ability level.
call IssueTargetOrder(dummy, "frostnova", target) //Cast the nova ability.
call TriggerSleepAction(0.5) //Wait to unpause the unit.
call PauseUnit(target, false) //Now unpause the unit.
set dummy = null //Clear leaks.
set target = null
set caster = null
endfunction
private function Init takes nothing returns nothing
local integer index = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
endfunction
endscope
I created this spell a while back for someone in a spell request thread. Just figured I'd submit it now. I don't know if the person who requested it ever got it, actually.