Moderator
M
Moderator
17:25, 27th Nov 2009
TriggerHappy:
Great description, good coding, and awesome effect.
Approved.
TriggerHappy:
Great description, good coding, and awesome effect.
Approved.
Shadow Shuriken Base

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Shadow Shuriken

Actions


-------- -------------------------If there is currently no running instance of the spell we switch the spell on------------------------- --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




ShSh_IndexSize Equal to 0



Then - Actions




Trigger - Turn on Shadow Shuriken loop <gen>



Else - Actions


-------- Dynamic Index --------


Set ShSh_IndexSize = (ShSh_IndexSize + 1)


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




ShSh_IndexSize Greater than ShSh_Index_MAX



Then - Actions




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




Set ShSh_Index[ShSh_IndexSize] = ShSh_IndexSize




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




Set ShSh_Index_MAX = ShSh_IndexSize




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------



Else - Actions


Set ShSh_TempInt = ShSh_Index[ShSh_IndexSize]


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Spell caster --------


Set ShSh_caster[ShSh_TempInt] = (Triggering unit)


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Level of Shadow Shuriken --------


Set ShSh_Level[ShSh_TempInt] = (Level of Shadow Shuriken for ShSh_caster[ShSh_TempInt])


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Two Locations to determine Spell angle and creating the dummies. --------


Set ShSh_Loc[6] = (Position of ShSh_caster[ShSh_TempInt])


Set ShSh_Loc[7] = (Target point of ability being cast)


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- The direction in which the shurikens head. --------


Set ShSh_Angle[(ShSh_TempInt x 2)] = (Angle from ShSh_Loc[6] to ShSh_Loc[7])


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- The distance the real Shurikens have moved. --------


Set ShSh_Move_Offset[(ShSh_TempInt x 6)] = 0.00


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- This is used to check if the real shurikens had return. --------


Set ShSh_Endboolean[(ShSh_TempInt x 2)] = False


-------- This is used to check if the shadow shurikens had return. We don´t know if they will be created so we set it to true. --------


Set ShSh_Endboolean[((ShSh_TempInt x 2) + 1)] = True


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- There are no shadow shuriken spawned unitl now so we turn it to false. --------


Set ShSh_ShadowingBoolean[ShSh_TempInt] = True


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- --------------------------------------------------------GLOBALS//CHANGEABLE VARIABLES-------------------------------------------------------- --------


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Activating the possibility to spawn shadow shuriken. --------


Set ShSh_AspectBoolean[1] = True


-------- Activating the mod that returning shuriken heal the caster. --------


Set ShSh_AspectBoolean[2] = True


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- This is the speed with which the shurikens move every 0.03 seconds. --------


Set ShSh_Movespeed = 14.00


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- With these two reals values you can change the movement of the shurikens. --------


-------- This is the factor with which you can stretch and bow the sine function. --------


Set ShSh_Sinefactor = 0.75


-------- This is the width the sine function has. --------


Set ShSh_Area[1] = 125.00


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Area in which units get damaged around the missiles. --------


Set ShSh_Area[2] = 120.00


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Distance which the missiles fly before they return. --------


Set ShSh_Distance[ShSh_TempInt] = (600.00 + (200.00 x (Real(ShSh_Level[ShSh_TempInt]))))


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- The chance to create two shadow shurikens which follow the freal ones. --------


Set ShSh_Chance[ShSh_TempInt] = (ShSh_Level[ShSh_TempInt] x 15)


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Damage the real shuriken deal. --------


Set ShSh_Damage[(ShSh_TempInt x 2)] = (0.10 x ((Real(ShSh_Level[ShSh_TempInt])) x (Real((Intelligence of ShSh_caster[ShSh_TempInt] (Include bonuses))))))


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Damage the shadow shuriken deal. --------


Set ShSh_Damage[((ShSh_TempInt x 2) + 1)] = (0.05 x ((Real(ShSh_Level[ShSh_TempInt])) x (Real((Intelligence of ShSh_caster[ShSh_TempInt] (Include bonuses))))))


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- The basic value for the heal when the real shuriken return. Every damage they deal will be added to this value. --------


Set ShSh_LifeAbsorb[(ShSh_TempInt x 2)] = 0.00


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- The basic value for the heal when the shadow shuriken return. Every damage they deal will be added to this value. --------


Set ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] = 0.00


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- With this number the heal value of the real shuriken gets divided before the caster is healed. --------


Set ShSh_SomeValues[1] = 4.00


-------- With this number the heal value of the shadow shuriken gets divided before the caster is healed. --------


Set ShSh_SomeValues[2] = 5.00


-------- The maximal distance before the shuriken stop returning. --------


Set ShSh_SomeValues[3] = 4000.00


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- ----------------------------------EFFECTS---------------------------------- --------


-------- Effect which will be added to all shuriken. --------


Set ShSh_Effects[1] = Abilities\Weapons\SentinelMissile\SentinelMissile.mdl


-------- Effect which will be added to the real shuriken. --------


Set ShSh_Effects[2] = Abilities\Weapons\IllidanMissile\IllidanMissile.mdl


-------- Effect which will be added to the fake shuriken. --------


Set ShSh_Effects[3] = Abilities\Weapons\AvengerMissile\AvengerMissile.mdl


-------- Effect which will be created when the fake missiles spawn. --------


Set ShSh_Effects[4] = Abilities\Spells\NightElf\Blink\BlinkCaster.mdl


-------- Damage effect, added to enemy units. --------


Set ShSh_Effects[5] = Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl


-------- When the missiles return an the caster get healed the effect will be created. --------


Set ShSh_Effects[6] = Abilities\Spells\Undead\VampiricAura\VampiricAuraTarget.mdl


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- --------------------------------------------------------END GLOBALS//CHANGEABLE VARIABLES-------------------------------------------------------- --------


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- This our location dummy for the real missiles. --------


Unit - Create 1 Shadow Shuriken dummy for (Owner of ShSh_caster[ShSh_TempInt]) at ShSh_Loc[6] facing Default building facing (270.0) degrees


Set ShSh_Dummy[(ShSh_TempInt x 6)] = (Last created unit)


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Here we create the two shuriken dummies and add the effects to them. --------


-------- I used 2D-arrays to avoid creating variables for each effect and dummy ( At least i hope so) --------


For each (Integer ShSh_int) from 1 to 2, do (Actions)



Loop - Actions




Unit - Create 1 Shadow Shuriken dummy for (Owner of ShSh_caster[ShSh_TempInt]) at ShSh_Loc[6] facing Default building facing (270.0) degrees




Set ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] = (Last created unit)




Special Effect - Create a special effect attached to the chest of ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] using ShSh_Effects[1]




Set ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int - 1))] = (Last created special effect)




Special Effect - Create a special effect attached to the chest of ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] using ShSh_Effects[2]




Set ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int + 1))] = (Last created special effect)


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Here we roll to check if the shadow shurikens will be created. --------


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Random integer number between 1 and 100) Less than or equal to ShSh_Chance[ShSh_TempInt]




ShSh_AspectBoolean[1] Equal to True



Then - Actions




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




-------- So the shurikens are created and we set the boolean for their return to false. --------




Set ShSh_Endboolean[((ShSh_TempInt x 2) + 1)] = False




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




-------- We reduce the start value for the distance the fake shurikens had moved so we get them in the end to the same point. --------




Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)] = (ShSh_Move_Offset[(ShSh_TempInt x 6)] - 150.00)




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




-------- The location where the shadow shuriken are spawnend. To avoid bugs the offset value should be the same as the value with thich the moved distance got reduced ealier. --------




-------- Here in both cases 150 --------




Set ShSh_Loc[8] = (ShSh_Loc[6] offset by 150.00 towards (ShSh_Angle[(ShSh_TempInt x 2)] + 180.00) degrees)




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




-------- The boolean which shows that the shadow missiles got created, necessary for the loop trigger. --------




Set ShSh_ShadowingBoolean[ShSh_TempInt] = True




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




-------- Our location dummy for the fake missiles. --------




Unit - Create 1 Shadow Shuriken dummy for (Owner of ShSh_caster[ShSh_TempInt]) at ShSh_Loc[8] facing Default building facing (270.0) degrees




Set ShSh_Dummy[((ShSh_TempInt x 6) + 3)] = (Last created unit)




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




-------- Here we create the two fake shuriken dummies and add the effects to them. --------




For each (Integer ShSh_int) from 5 to 6, do (Actions)





Loop - Actions






Unit - Create 1 Shadow Shuriken dummy for (Owner of ShSh_caster[ShSh_TempInt]) at ShSh_Loc[8] facing Default building facing (270.0) degrees






Set ShSh_Dummy[((ShSh_TempInt x 6) + (ShSh_int - 1))] = (Last created unit)






Special Effect - Create a special effect attached to the chest of ShSh_Dummy[((ShSh_TempInt x 6) + (ShSh_int - 1))] using ShSh_Effects[1]






Set ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int - 1))] = (Last created special effect)






Special Effect - Create a special effect attached to the chest of ShSh_Dummy[((ShSh_TempInt x 6) + (ShSh_int - 1))] using ShSh_Effects[3]






Set ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int + 1))] = (Last created special effect)






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- To let them look more lika a shadow we increase their transparency. --------






Animation - Change ShSh_Dummy[((ShSh_TempInt x 6) + (ShSh_int - 1))]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 15.00% transparency




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




-------- The effect which appears when the fake missiles got created. --------




Special Effect - Create a special effect at ShSh_Loc[8] using ShSh_Effects[4]




Special Effect - Destroy (Last created special effect)



Else - Actions


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- Removing the leaks. --------


Custom script: call RemoveLocation(udg_ShSh_Loc[6])


Custom script: call RemoveLocation(udg_ShSh_Loc[7])


Custom script: call RemoveLocation(udg_ShSh_Loc[8])
Shadow Shuriken loop

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


For each (Integer ShSh_loop_int) from 1 to ShSh_IndexSize, do (Actions)



Loop - Actions




Set ShSh_TempInt = ShSh_Index[ShSh_loop_int]




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






ShSh_Move_Offset[(ShSh_TempInt x 6)] Less than ShSh_Distance[ShSh_TempInt]





Then - Actions






Set ShSh_Move_Offset[(ShSh_TempInt x 6)] = (ShSh_Move_Offset[(ShSh_TempInt x 6)] + ShSh_Movespeed)






Set ShSh_SwingOffset = (((Sin(ShSh_Move_Offset[(ShSh_TempInt x 6)])) x ShSh_Sinefactor) x ShSh_Area[1])






Set ShSh_Loc[3] = (Position of ShSh_Dummy[(ShSh_TempInt x 6)])






Set ShSh_Loc[4] = (ShSh_Loc[3] offset by ShSh_Movespeed towards ShSh_Angle[(ShSh_TempInt x 2)] degrees)






Unit - Move ShSh_Dummy[(ShSh_TempInt x 6)] instantly to ShSh_Loc[4]






Set ShSh_Loc[1] = (ShSh_Loc[4] offset by ShSh_SwingOffset towards (ShSh_Angle[(ShSh_TempInt x 2)] - 90.00) degrees)






Set ShSh_Loc[2] = (ShSh_Loc[4] offset by ShSh_SwingOffset towards (ShSh_Angle[(ShSh_TempInt x 2)] + 90.00) degrees)






For each (Integer ShSh_int) from 1 to 2, do (Actions)







Loop - Actions








Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] instantly to ShSh_Loc[ShSh_int]








Set ShSh_TempGroup = (Units within ShSh_Area[1] of ShSh_Loc[ShSh_int] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Unverwundbar) Equal to False)) and (((((Matching unit) belongs to an ally of (Owner of ShSh_caster[ShSh_TempInt])) Equal to F








Unit Group - Pick every unit in ShSh_TempGroup and do (Actions)









Loop - Actions










Unit - Cause ShSh_caster[ShSh_TempInt] to damage (Picked unit), dealing ShSh_Damage[(ShSh_TempInt x 2)] damage of attack type Chaos and damage type Normal










Special Effect - Create a special effect attached to the chest of (Picked unit) using ShSh_Effects[5]










Special Effect - Destroy (Last created special effect)










Set ShSh_LifeAbsorb[(ShSh_TempInt x 2)] = (ShSh_LifeAbsorb[(ShSh_TempInt x 2)] + ShSh_Damage[(ShSh_TempInt x 2)])








Custom script: call DestroyGroup(udg_ShSh_TempGroup)






Custom script: call RemoveLocation(udg_ShSh_Loc[3])






Custom script: call RemoveLocation(udg_ShSh_Loc[4])






Custom script: call RemoveLocation(udg_ShSh_Loc[1])






Custom script: call RemoveLocation(udg_ShSh_Loc[2])






Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 1)] = ShSh_Move_Offset[(ShSh_TempInt x 6)]





Else - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








ShSh_Endboolean[(ShSh_TempInt x 2)] Equal to False







Then - Actions








Set ShSh_Loc[3] = (Position of ShSh_Dummy[(ShSh_TempInt x 6)])








Set ShSh_Loc[4] = (Position of ShSh_caster[ShSh_TempInt])








Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)] = (Distance between ShSh_Loc[3] and ShSh_Loc[4])








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)] Greater than or equal to 30.00










ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)] Less than or equal to ShSh_SomeValues[3]










ShSh_Dummy[(ShSh_TempInt x 6)] Not equal to No unit










ShSh_caster[ShSh_TempInt] Not equal to No unit










(ShSh_caster[ShSh_TempInt] is alive) Equal to True









Then - Actions










Set ShSh_Angle[((ShSh_TempInt x 2) + 1)] = (Angle from ShSh_Loc[3] to ShSh_Loc[4])










Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 1)] = (ShSh_Move_Offset[((ShSh_TempInt x 6) + 1)] - ShSh_Movespeed)










Custom script: call RemoveLocation(udg_ShSh_Loc[4])










Set ShSh_SwingOffset = (((Sin(ShSh_Move_Offset[((ShSh_TempInt x 6) + 1)])) x ShSh_Sinefactor) x ShSh_Area[1])










Set ShSh_Loc[4] = (ShSh_Loc[3] offset by ShSh_Movespeed towards ShSh_Angle[((ShSh_TempInt x 2) + 1)] degrees)










Unit - Move ShSh_Dummy[(ShSh_TempInt x 6)] instantly to ShSh_Loc[4]










Set ShSh_Loc[1] = (ShSh_Loc[4] offset by ShSh_SwingOffset towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] - 90.00) degrees)










Set ShSh_Loc[2] = (ShSh_Loc[4] offset by ShSh_SwingOffset towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] + 90.00) degrees)










For each (Integer ShSh_int) from 1 to 2, do (Actions)











Loop - Actions












Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] instantly to ShSh_Loc[ShSh_int]












Set ShSh_TempGroup = (Units within ShSh_Area[1] of ShSh_Loc[ShSh_int] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Unverwundbar) Equal to False)) and (((((Matching unit) belongs to an ally of (Owner of ShSh_caster[ShSh_TempInt])) Equal to F












Unit Group - Pick every unit in ShSh_TempGroup and do (Actions)













Loop - Actions














Unit - Cause ShSh_caster[ShSh_TempInt] to damage (Picked unit), dealing ShSh_Damage[(ShSh_TempInt x 2)] damage of attack type Chaos and damage type Normal














Special Effect - Create a special effect attached to the chest of (Picked unit) using ShSh_Effects[5]














Special Effect - Destroy (Last created special effect)














Set ShSh_LifeAbsorb[(ShSh_TempInt x 2)] = (ShSh_LifeAbsorb[(ShSh_TempInt x 2)] + ShSh_Damage[(ShSh_TempInt x 2)])












Custom script: call DestroyGroup(udg_ShSh_TempGroup)










Custom script: call RemoveLocation(udg_ShSh_Loc[3])










Custom script: call RemoveLocation(udg_ShSh_Loc[4])










Custom script: call RemoveLocation(udg_ShSh_Loc[1])










Custom script: call RemoveLocation(udg_ShSh_Loc[2])









Else - Actions










If (All Conditions are True) then do (Then Actions) else do (Else Actions)











If - Conditions












ShSh_caster[ShSh_TempInt] Not equal to No unit












(ShSh_caster[ShSh_TempInt] is alive) Equal to True












ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)] Less than 30.00












ShSh_LifeAbsorb[(ShSh_TempInt x 2)] Greater than 0.00












ShSh_AspectBoolean[2] Equal to True











Then - Actions












Unit - Set life of ShSh_caster[ShSh_TempInt] to ((Life of ShSh_caster[ShSh_TempInt]) + (ShSh_LifeAbsorb[(ShSh_TempInt x 2)] / ShSh_SomeValues[1]))












Special Effect - Create a special effect attached to the origin of ShSh_caster[ShSh_TempInt] using ShSh_Effects[6]












Special Effect - Destroy (Last created special effect)











Else - Actions










Custom script: call RemoveLocation(udg_ShSh_Loc[3])










Custom script: call RemoveLocation(udg_ShSh_Loc[4])










Unit - Remove ShSh_Dummy[(ShSh_TempInt x 6)] from the game










For each (Integer ShSh_int) from 1 to 2, do (Actions)











Loop - Actions












Special Effect - Destroy ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int - 1))]












Special Effect - Destroy ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int + 1))]












Unit - Remove ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] from the game










Set ShSh_Endboolean[(ShSh_TempInt x 2)] = True







Else - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






ShSh_ShadowingBoolean[ShSh_TempInt] Equal to True






ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)] Less than ShSh_Distance[ShSh_TempInt]





Then - Actions






Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)] = (ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)] + ShSh_Movespeed)






Set ShSh_SwingOffset = (((Sin(ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)])) x ShSh_Sinefactor) x ShSh_Area[1])






Set ShSh_Loc[1] = (Position of ShSh_Dummy[((ShSh_TempInt x 6) + 3)])






Set ShSh_Loc[2] = (ShSh_Loc[1] offset by ShSh_Movespeed towards ShSh_Angle[(ShSh_TempInt x 2)] degrees)






Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + 3)] instantly to ShSh_Loc[2]






Set ShSh_Loc[4] = (ShSh_Loc[2] offset by ShSh_SwingOffset towards (ShSh_Angle[(ShSh_TempInt x 2)] - 90.00) degrees)






Set ShSh_Loc[5] = (ShSh_Loc[2] offset by ShSh_SwingOffset towards (ShSh_Angle[(ShSh_TempInt x 2)] + 90.00) degrees)






For each (Integer ShSh_int) from 4 to 5, do (Actions)







Loop - Actions








Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] instantly to ShSh_Loc[ShSh_int]








Set ShSh_TempGroup = (Units within ShSh_Area[1] of ShSh_Loc[ShSh_int] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Unverwundbar) Equal to False)) and (((((Matching unit) belongs to an ally of (Owner of ShSh_caster[ShSh_TempInt])) Equal to F








Unit Group - Pick every unit in ShSh_TempGroup and do (Actions)









Loop - Actions










Unit - Cause ShSh_caster[ShSh_TempInt] to damage (Picked unit), dealing ShSh_Damage[((ShSh_TempInt x 2) + 1)] damage of attack type Chaos and damage type Normal










Special Effect - Create a special effect attached to the chest of (Picked unit) using ShSh_Effects[5]










Special Effect - Destroy (Last created special effect)










Set ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] = (ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] + ShSh_Damage[((ShSh_TempInt x 2) + 1)])








Custom script: call DestroyGroup(udg_ShSh_TempGroup)






Custom script: call RemoveLocation(udg_ShSh_Loc[1])






Custom script: call RemoveLocation(udg_ShSh_Loc[2])






Custom script: call RemoveLocation(udg_ShSh_Loc[4])






Custom script: call RemoveLocation(udg_ShSh_Loc[5])






Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 4)] = ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)]





Else - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








ShSh_ShadowingBoolean[ShSh_TempInt] Equal to True








ShSh_Endboolean[((ShSh_TempInt x 2) + 1)] Equal to False







Then - Actions








Set ShSh_Loc[1] = (Position of ShSh_Dummy[((ShSh_TempInt x 6) + 3)])








Set ShSh_Loc[2] = (Position of ShSh_caster[ShSh_TempInt])








Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] = (Distance between ShSh_Loc[1] and ShSh_Loc[2])








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] Less than or equal to ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)]










ShSh_Endboolean[(ShSh_TempInt x 2)] Equal to False









Then - Actions










Custom script: call RemoveLocation(udg_ShSh_Loc[1])










Set ShSh_Loc[3] = (Position of ShSh_Dummy[(ShSh_TempInt x 6)])










Set ShSh_Loc[4] = (ShSh_Loc[3] offset by 150.00 towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] + 180.00) degrees)










Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + 3)] instantly to ShSh_Loc[4]










Set ShSh_Loc[1] = (Position of ShSh_Dummy[((ShSh_TempInt x 6) + 3)])










Custom script: call RemoveLocation(udg_ShSh_Loc[3])










Custom script: call RemoveLocation(udg_ShSh_Loc[4])









Else - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










ShSh_caster[ShSh_TempInt] Not equal to No unit










(ShSh_caster[ShSh_TempInt] is alive) Equal to True










ShSh_Dummy[((ShSh_TempInt x 6) + 3)] Not equal to No unit










ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] Greater than or equal to 30.00










ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] Less than or equal to ShSh_SomeValues[3]









Then - Actions










Set ShSh_Angle[((ShSh_TempInt x 2) + 1)] = (Angle from ShSh_Loc[1] to ShSh_Loc[2])










Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 4)] = (ShSh_Move_Offset[((ShSh_TempInt x 6) + 4)] - ShSh_Movespeed)










Custom script: call RemoveLocation(udg_ShSh_Loc[2])










Set ShSh_SwingOffset = (((Sin(ShSh_Move_Offset[((ShSh_TempInt x 6) + 4)])) x ShSh_Sinefactor) x ShSh_Area[1])










Set ShSh_Loc[2] = (ShSh_Loc[1] offset by ShSh_Movespeed towards ShSh_Angle[((ShSh_TempInt x 2) + 1)] degrees)










Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + 3)] instantly to ShSh_Loc[2]










Set ShSh_Loc[4] = (ShSh_Loc[2] offset by ShSh_SwingOffset towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] - 90.00) degrees)










Set ShSh_Loc[5] = (ShSh_Loc[2] offset by ShSh_SwingOffset towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] + 90.00) degrees)










For each (Integer ShSh_int) from 4 to 5, do (Actions)











Loop - Actions












Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] instantly to ShSh_Loc[ShSh_int]












Set ShSh_TempGroup = (Units within ShSh_Area[1] of ShSh_Loc[ShSh_int] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Unverwundbar) Equal to False)) and (((((Matching unit) belongs to an ally of (Owner of ShSh_caster[ShSh_TempInt])) Equal to F












Unit Group - Pick every unit in ShSh_TempGroup and do (Actions)













Loop - Actions














Unit - Cause ShSh_caster[ShSh_TempInt] to damage (Picked unit), dealing ShSh_Damage[((ShSh_TempInt x 2) + 1)] damage of attack type Chaos and damage type Normal














Special Effect - Create a special effect attached to the chest of (Picked unit) using ShSh_Effects[5]














Special Effect - Destroy (Last created special effect)














Set ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] = (ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] + ShSh_Damage[((ShSh_TempInt x 2) + 1)])












Custom script: call DestroyGroup(udg_ShSh_TempGroup)










Custom script: call RemoveLocation(udg_ShSh_Loc[1])










Custom script: call RemoveLocation(udg_ShSh_Loc[2])










Custom script: call RemoveLocation(udg_ShSh_Loc[4])










Custom script: call RemoveLocation(udg_ShSh_Loc[5])









Else - Actions










If (All Conditions are True) then do (Then Actions) else do (Else Actions)











If - Conditions












ShSh_caster[ShSh_TempInt] Not equal to No unit












ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] Less than 30.00












(ShSh_caster[ShSh_TempInt] is alive) Equal to True












ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] Greater than 0.00












ShSh_AspectBoolean[2] Equal to True











Then - Actions












Unit - Set life of ShSh_caster[ShSh_TempInt] to ((Life of ShSh_caster[ShSh_TempInt]) + (ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] / ShSh_SomeValues[2]))












Special Effect - Create a special effect attached to the origin of ShSh_caster[ShSh_TempInt] using ShSh_Effects[6]












Special Effect - Destroy (Last created special effect)











Else - Actions










Custom script: call RemoveLocation(udg_ShSh_Loc[1])










Custom script: call RemoveLocation(udg_ShSh_Loc[2])










Unit - Remove ShSh_Dummy[((ShSh_TempInt x 6) + 3)] from the game










For each (Integer ShSh_int) from 5 to 6, do (Actions)











Loop - Actions












Special Effect - Destroy ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int - 1))]












Special Effect - Destroy ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int + 1))]












Unit - Remove ShSh_Dummy[((ShSh_TempInt x 6) + (ShSh_int - 1))] from the game










Set ShSh_Endboolean[((ShSh_TempInt x 2) + 1)] = True







Else - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






ShSh_Endboolean[(ShSh_TempInt x 2)] Equal to True






ShSh_Endboolean[((ShSh_TempInt x 2) + 1)] Equal to True





Then - Actions






Set ShSh_Index[ShSh_loop_int] = ShSh_Index[ShSh_IndexSize]






Set ShSh_Index[ShSh_IndexSize] = ShSh_TempInt






Set ShSh_IndexSize = (ShSh_IndexSize - 1)






Set ShSh_loop_int = (ShSh_loop_int - 1)






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








ShSh_IndexSize Equal to 0







Then - Actions








Trigger - Turn off (This trigger)







Else - Actions





Else - Actions
Shadow Shuriken loop Documented

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


-------- The loop which goes through all running instances of the spell. --------


-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------


For each (Integer ShSh_loop_int) from 1 to ShSh_IndexSize, do (Actions)



Loop - Actions




-------- The integer we use in the loop. --------




Set ShSh_TempInt = ShSh_Index[ShSh_loop_int]




-------- First we concentra on the real shuriken. --------




-------- If the Maximum distance had not reached we move them further. Otherwise we order them to return. --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






ShSh_Move_Offset[(ShSh_TempInt x 6)] Less than ShSh_Distance[ShSh_TempInt]





Then - Actions






-------- We increase the moved distance. --------






Set ShSh_Move_Offset[(ShSh_TempInt x 6)] = (ShSh_Move_Offset[(ShSh_TempInt x 6)] + ShSh_Movespeed)






-------- The formula which gives the offset value for the shuriken. --------






Set ShSh_SwingOffset = (((Sin(ShSh_Move_Offset[(ShSh_TempInt x 6)])) x ShSh_Sinefactor) x ShSh_Area[1])






-------- Position of our location dummy. --------






Set ShSh_Loc[3] = (Position of ShSh_Dummy[(ShSh_TempInt x 6)])






-------- The new position for the location dummy. --------






Set ShSh_Loc[4] = (ShSh_Loc[3] offset by ShSh_Movespeed towards ShSh_Angle[(ShSh_TempInt x 2)] degrees)






Unit - Move ShSh_Dummy[(ShSh_TempInt x 6)] instantly to ShSh_Loc[4]






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- Now the shu.. get moved so we create the new locations for them. Based on the point of the location dummy. --------






Set ShSh_Loc[1] = (ShSh_Loc[4] offset by ShSh_SwingOffset towards (ShSh_Angle[(ShSh_TempInt x 2)] - 90.00) degrees)






Set ShSh_Loc[2] = (ShSh_Loc[4] offset by ShSh_SwingOffset towards (ShSh_Angle[(ShSh_TempInt x 2)] + 90.00) degrees)






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- Looping through both dummies. --------






For each (Integer ShSh_int) from 1 to 2, do (Actions)







Loop - Actions








Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] instantly to ShSh_Loc[ShSh_int]








-------- Units around the missiles. --------








Set ShSh_TempGroup = (Units within ShSh_Area[1] of ShSh_Loc[ShSh_int] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Unverwundbar) Equal to False)) and (((((Matching unit) belongs to an ally of (Owner of ShSh_caster[ShSh_TempInt])) Equal to F








Unit Group - Pick every unit in ShSh_TempGroup and do (Actions)









Loop - Actions










Unit - Cause ShSh_caster[ShSh_TempInt] to damage (Picked unit), dealing ShSh_Damage[(ShSh_TempInt x 2)] damage of attack type Chaos and damage type Normal










Special Effect - Create a special effect attached to the chest of (Picked unit) using ShSh_Effects[5]










Special Effect - Destroy (Last created special effect)










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- For each unit damaged we increase the value the shu.. will heal the caster on their return. --------










Set ShSh_LifeAbsorb[(ShSh_TempInt x 2)] = (ShSh_LifeAbsorb[(ShSh_TempInt x 2)] + ShSh_Damage[(ShSh_TempInt x 2)])








-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------








-------- Destroying the unit group. --------








Custom script: call DestroyGroup(udg_ShSh_TempGroup)








-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- Removing the leaks. --------






Custom script: call RemoveLocation(udg_ShSh_Loc[3])






Custom script: call RemoveLocation(udg_ShSh_Loc[4])






Custom script: call RemoveLocation(udg_ShSh_Loc[1])






Custom script: call RemoveLocation(udg_ShSh_Loc[2])






-------- Here we transfer the moved distance in to an other variable because if we later reduce the first one it will bug. --------






Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 1)] = ShSh_Move_Offset[(ShSh_TempInt x 6)]





Else - Actions






-------- Now the shu are on their way back to the caster, if the endboolean is still false they had´nt reached him until now. --------






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








ShSh_Endboolean[(ShSh_TempInt x 2)] Equal to False







Then - Actions








-------- Using the location of the caster and the dummy to check the distance between them. If its to high the spell will end, if its to low, too but on purpose. --------








Set ShSh_Loc[3] = (Position of ShSh_Dummy[(ShSh_TempInt x 6)])








Set ShSh_Loc[4] = (Position of ShSh_caster[ShSh_TempInt])








Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)] = (Distance between ShSh_Loc[3] and ShSh_Loc[4])








-------- Additional if the caster had died or is removed from the game the spell will also end. --------








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)] Greater than or equal to 30.00










ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)] Less than or equal to 5000.00










ShSh_Dummy[(ShSh_TempInt x 6)] Not equal to No unit










ShSh_caster[ShSh_TempInt] Not equal to No unit










(ShSh_caster[ShSh_TempInt] is alive) Equal to True









Then - Actions










-------- Angle from shu.. location dummy to caster. --------










Set ShSh_Angle[((ShSh_TempInt x 2) + 1)] = (Angle from ShSh_Loc[3] to ShSh_Loc[4])










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- We use this offset value to let the shu.. move allways in the defined way. If we use the distance between caster and location dummy and the caster runs away the movement will be stretched, --------










Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 1)] = (ShSh_Move_Offset[((ShSh_TempInt x 6) + 1)] - ShSh_Movespeed)










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- Clearing up the leak from above. --------










Custom script: call RemoveLocation(udg_ShSh_Loc[4])










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- The formula which gives the offset value for the shuriken. --------










Set ShSh_SwingOffset = (((Sin(ShSh_Move_Offset[((ShSh_TempInt x 6) + 1)])) x ShSh_Sinefactor) x ShSh_Area[1])










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- The new position for the location dummy. --------










Set ShSh_Loc[4] = (ShSh_Loc[3] offset by ShSh_Movespeed towards ShSh_Angle[((ShSh_TempInt x 2) + 1)] degrees)










Unit - Move ShSh_Dummy[(ShSh_TempInt x 6)] instantly to ShSh_Loc[4]










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- Now the shu.. get moved so we create the new locations for them. Based on the point of the location dummy. --------










Set ShSh_Loc[1] = (ShSh_Loc[4] offset by ShSh_SwingOffset towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] - 90.00) degrees)










Set ShSh_Loc[2] = (ShSh_Loc[4] offset by ShSh_SwingOffset towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] + 90.00) degrees)










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- Looping through both dummies. --------










For each (Integer ShSh_int) from 1 to 2, do (Actions)











Loop - Actions












Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] instantly to ShSh_Loc[ShSh_int]












Set ShSh_TempGroup = (Units within ShSh_Area[1] of ShSh_Loc[ShSh_int] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Unverwundbar) Equal to False)) and (((((Matching unit) belongs to an ally of (Owner of ShSh_caster[ShSh_TempInt])) Equal to F












Unit Group - Pick every unit in ShSh_TempGroup and do (Actions)













Loop - Actions














Unit - Cause ShSh_caster[ShSh_TempInt] to damage (Picked unit), dealing ShSh_Damage[(ShSh_TempInt x 2)] damage of attack type Chaos and damage type Normal














Special Effect - Create a special effect attached to the chest of (Picked unit) using ShSh_Effects[5]














Special Effect - Destroy (Last created special effect)














-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------














-------- For each unit damaged we increase the value the shu.. will heal the caster on their return. --------














Set ShSh_LifeAbsorb[(ShSh_TempInt x 2)] = (ShSh_LifeAbsorb[(ShSh_TempInt x 2)] + ShSh_Damage[(ShSh_TempInt x 2)])












-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------












-------- Destroying the unit group. --------












Custom script: call DestroyGroup(udg_ShSh_TempGroup)












-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- Removing the leaks. --------










Custom script: call RemoveLocation(udg_ShSh_Loc[3])










Custom script: call RemoveLocation(udg_ShSh_Loc[4])










Custom script: call RemoveLocation(udg_ShSh_Loc[1])










Custom script: call RemoveLocation(udg_ShSh_Loc[2])









Else - Actions










-------- The dummies had return so we can heal the caster. --------










If (All Conditions are True) then do (Then Actions) else do (Else Actions)











If - Conditions












ShSh_caster[ShSh_TempInt] Not equal to No unit












(ShSh_caster[ShSh_TempInt] is alive) Equal to True












ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)] Less than 30.00












ShSh_LifeAbsorb[(ShSh_TempInt x 2)] Greater than 0.00












ShSh_AspectBoolean[2] Equal to True











Then - Actions












Unit - Set life of ShSh_caster[ShSh_TempInt] to ((Life of ShSh_caster[ShSh_TempInt]) + (ShSh_LifeAbsorb[(ShSh_TempInt x 2)] / 4.00))












Special Effect - Create a special effect attached to the origin of ShSh_caster[ShSh_TempInt] using ShSh_Effects[6]












Special Effect - Destroy (Last created special effect)











Else - Actions










-------- Removing the used locations. --------










Custom script: call RemoveLocation(udg_ShSh_Loc[3])










Custom script: call RemoveLocation(udg_ShSh_Loc[4])










-------- Destroying effects and removing dummies. --------










Unit - Remove ShSh_Dummy[(ShSh_TempInt x 6)] from the game










For each (Integer ShSh_int) from 1 to 2, do (Actions)











Loop - Actions












Special Effect - Destroy ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int - 1))]












Special Effect - Destroy ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int + 1))]












Unit - Remove ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] from the game










-------- Setting the value for their return to true. --------










Set ShSh_Endboolean[(ShSh_TempInt x 2)] = True







Else - Actions




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




-------- Now we move the shadow shuriken if they exist. --------




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






ShSh_ShadowingBoolean[ShSh_TempInt] Equal to True






ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)] Less than ShSh_Distance[ShSh_TempInt]





Then - Actions






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- Same as above, we increase the distance the shu.. had moved. --------






Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)] = (ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)] + ShSh_Movespeed)






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- The formula which gives the offset value for the shuriken. --------






Set ShSh_SwingOffset = (((Sin(ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)])) x ShSh_Sinefactor) x ShSh_Area[1])






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- Old position of the shadow shuriken location dummy. --------






Set ShSh_Loc[1] = (Position of ShSh_Dummy[((ShSh_TempInt x 6) + 3)])






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- New position. --------






Set ShSh_Loc[2] = (ShSh_Loc[1] offset by ShSh_Movespeed towards ShSh_Angle[(ShSh_TempInt x 2)] degrees)






Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + 3)] instantly to ShSh_Loc[2]






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- Now the shu.. get moved so we create the new locations for them. Based on the point of the location dummy. --------






Set ShSh_Loc[4] = (ShSh_Loc[2] offset by ShSh_SwingOffset towards (ShSh_Angle[(ShSh_TempInt x 2)] - 90.00) degrees)






Set ShSh_Loc[5] = (ShSh_Loc[2] offset by ShSh_SwingOffset towards (ShSh_Angle[(ShSh_TempInt x 2)] + 90.00) degrees)






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- We loop through both shadow shuriken. --------






For each (Integer ShSh_int) from 4 to 5, do (Actions)







Loop - Actions








Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] instantly to ShSh_Loc[ShSh_int]








Set ShSh_TempGroup = (Units within ShSh_Area[1] of ShSh_Loc[ShSh_int] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Unverwundbar) Equal to False)) and (((((Matching unit) belongs to an ally of (Owner of ShSh_caster[ShSh_TempInt])) Equal to F








Unit Group - Pick every unit in ShSh_TempGroup and do (Actions)









Loop - Actions










Unit - Cause ShSh_caster[ShSh_TempInt] to damage (Picked unit), dealing ShSh_Damage[((ShSh_TempInt x 2) + 1)] damage of attack type Chaos and damage type Normal










Special Effect - Create a special effect attached to the chest of (Picked unit) using ShSh_Effects[5]










Special Effect - Destroy (Last created special effect)










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- The damage the shadow shu.. had inflicted. --------










Set ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] = (ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] + ShSh_Damage[((ShSh_TempInt x 2) + 1)])








-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------








-------- Destroying the unit group. --------








Custom script: call DestroyGroup(udg_ShSh_TempGroup)








-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- Removing the used locations. --------






Custom script: call RemoveLocation(udg_ShSh_Loc[1])






Custom script: call RemoveLocation(udg_ShSh_Loc[2])






Custom script: call RemoveLocation(udg_ShSh_Loc[4])






Custom script: call RemoveLocation(udg_ShSh_Loc[5])






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- Here we transfer the moved distance in to an other variable because if we later reduce the first one it will bug. --------






Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 4)] = ShSh_Move_Offset[((ShSh_TempInt x 6) + 3)]





Else - Actions






-------- Now the FAKE shu are on their way back to the caster, if the endboolean is still false they had´nt reached him until now. --------






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








ShSh_ShadowingBoolean[ShSh_TempInt] Equal to True








ShSh_Endboolean[((ShSh_TempInt x 2) + 1)] Equal to False







Then - Actions








-------- Using the location of the caster and the dummy to check the distance between them. If its to high the spell will end, if its to low, too but on purpose. --------








Set ShSh_Loc[1] = (Position of ShSh_Dummy[((ShSh_TempInt x 6) + 3)])








Set ShSh_Loc[2] = (Position of ShSh_caster[ShSh_TempInt])








Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] = (Distance between ShSh_Loc[1] and ShSh_Loc[2])








-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------








-------- If Blink spells are used or the caster otherwise changes his position to a place behind the shuriken on their return we switch the position of the shadow shuriken to leave them behind the real ones. --------








-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------








-------- So we check which shurikens are closer to the caster. --------








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] Less than or equal to ShSh_Move_Offset[((ShSh_TempInt x 6) + 2)]










ShSh_Endboolean[(ShSh_TempInt x 2)] Equal to False









Then - Actions










-------- If the shadow ones are closer we remove the old location and set up the position of the real location dummy. --------










Custom script: call RemoveLocation(udg_ShSh_Loc[1])










Set ShSh_Loc[3] = (Position of ShSh_Dummy[(ShSh_TempInt x 6)])










-------- Now we move the shadow shuriken behind them using the angle. --------










Set ShSh_Loc[4] = (ShSh_Loc[3] offset by 150.00 towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] + 180.00) degrees)










Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + 3)] instantly to ShSh_Loc[4]










-------- Our new location dummy position --------










Set ShSh_Loc[1] = (Position of ShSh_Dummy[((ShSh_TempInt x 6) + 3)])










Custom script: call RemoveLocation(udg_ShSh_Loc[3])










Custom script: call RemoveLocation(udg_ShSh_Loc[4])









Else - Actions








-------- Additional if the caster had died or is removed from the game the spell will also end. --------








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










ShSh_caster[ShSh_TempInt] Not equal to No unit










(ShSh_caster[ShSh_TempInt] is alive) Equal to True










ShSh_Dummy[((ShSh_TempInt x 6) + 3)] Not equal to No unit










ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] Greater than or equal to 30.00










ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] Less than or equal to 5000.00









Then - Actions










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- Angle to the caster. --------










Set ShSh_Angle[((ShSh_TempInt x 2) + 1)] = (Angle from ShSh_Loc[1] to ShSh_Loc[2])










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- We use this offset value to let the shu.. move allways in the defined way. If we use the distance between caster and location dummy and the caster runs away the movement will be stretched, --------










Set ShSh_Move_Offset[((ShSh_TempInt x 6) + 4)] = (ShSh_Move_Offset[((ShSh_TempInt x 6) + 4)] - ShSh_Movespeed)










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- Removing created leak. --------










Custom script: call RemoveLocation(udg_ShSh_Loc[2])










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- The formula which gives the offset value for the shuriken. --------










Set ShSh_SwingOffset = (((Sin(ShSh_Move_Offset[((ShSh_TempInt x 6) + 4)])) x ShSh_Sinefactor) x ShSh_Area[1])










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- New position for the location dummy. --------










Set ShSh_Loc[2] = (ShSh_Loc[1] offset by ShSh_Movespeed towards ShSh_Angle[((ShSh_TempInt x 2) + 1)] degrees)










Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + 3)] instantly to ShSh_Loc[2]










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- Now the shu.. get moved so we create the new locations for them. Based on the point of the location dummy. --------










Set ShSh_Loc[4] = (ShSh_Loc[2] offset by ShSh_SwingOffset towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] - 90.00) degrees)










Set ShSh_Loc[5] = (ShSh_Loc[2] offset by ShSh_SwingOffset towards (ShSh_Angle[((ShSh_TempInt x 2) + 1)] + 90.00) degrees)










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- We loop through both shadow shuriken. --------










For each (Integer ShSh_int) from 4 to 5, do (Actions)











Loop - Actions












Unit - Move ShSh_Dummy[((ShSh_TempInt x 6) + ShSh_int)] instantly to ShSh_Loc[ShSh_int]












Set ShSh_TempGroup = (Units within ShSh_Area[1] of ShSh_Loc[ShSh_int] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Unverwundbar) Equal to False)) and (((((Matching unit) belongs to an ally of (Owner of ShSh_caster[ShSh_TempInt])) Equal to F












Unit Group - Pick every unit in ShSh_TempGroup and do (Actions)













Loop - Actions














Unit - Cause ShSh_caster[ShSh_TempInt] to damage (Picked unit), dealing ShSh_Damage[((ShSh_TempInt x 2) + 1)] damage of attack type Chaos and damage type Normal














Special Effect - Create a special effect attached to the chest of (Picked unit) using ShSh_Effects[5]














Special Effect - Destroy (Last created special effect)














-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------














-------- The damage the shadow shu.. had inflicted. --------














Set ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] = (ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] + ShSh_Damage[((ShSh_TempInt x 2) + 1)])












-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------












-------- Destroying the unit group. --------












Custom script: call DestroyGroup(udg_ShSh_TempGroup)












-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------










-------- Removing leaks. --------










Custom script: call RemoveLocation(udg_ShSh_Loc[1])










Custom script: call RemoveLocation(udg_ShSh_Loc[2])










Custom script: call RemoveLocation(udg_ShSh_Loc[4])










Custom script: call RemoveLocation(udg_ShSh_Loc[5])









Else - Actions










-------- The shadow dummies had return so we can heal the caster. --------










If (All Conditions are True) then do (Then Actions) else do (Else Actions)











If - Conditions












ShSh_caster[ShSh_TempInt] Not equal to No unit












ShSh_Move_Offset[((ShSh_TempInt x 6) + 5)] Less than 30.00












(ShSh_caster[ShSh_TempInt] is alive) Equal to True












ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] Greater than 0.00












ShSh_AspectBoolean[2] Equal to True











Then - Actions












Unit - Set life of ShSh_caster[ShSh_TempInt] to ((Life of ShSh_caster[ShSh_TempInt]) + (ShSh_LifeAbsorb[((ShSh_TempInt x 2) + 1)] / 5.00))












Special Effect - Create a special effect attached to the origin of ShSh_caster[ShSh_TempInt] using ShSh_Effects[6]












Special Effect - Destroy (Last created special effect)











Else - Actions










-------- Removing the used locations. --------










Custom script: call RemoveLocation(udg_ShSh_Loc[1])










Custom script: call RemoveLocation(udg_ShSh_Loc[2])










-------- Destryoing special effects and removing the dummies. --------










Unit - Remove ShSh_Dummy[((ShSh_TempInt x 6) + 3)] from the game










For each (Integer ShSh_int) from 5 to 6, do (Actions)











Loop - Actions












Special Effect - Destroy ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int - 1))]












Special Effect - Destroy ShSh_ShurikenEffect[((ShSh_TempInt x 8) + (ShSh_int + 1))]












Unit - Remove ShSh_Dummy[((ShSh_TempInt x 6) + (ShSh_int - 1))] from the game










-------- Setting the endboolean for the shadow shu.. to true. --------










Set ShSh_Endboolean[((ShSh_TempInt x 2) + 1)] = True







Else - Actions




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




-------- If the real shu.. had returned or are to far away or the caster is dead... and the shadow shuriken if they had existed we reduce the index. --------




-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






ShSh_Endboolean[(ShSh_TempInt x 2)] Equal to True






ShSh_Endboolean[((ShSh_TempInt x 2) + 1)] Equal to True





Then - Actions






Set ShSh_Index[ShSh_loop_int] = ShSh_Index[ShSh_IndexSize]






Set ShSh_Index[ShSh_IndexSize] = ShSh_TempInt






Set ShSh_IndexSize = (ShSh_IndexSize - 1)






Set ShSh_loop_int = (ShSh_loop_int - 1)






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






-------- If this has been the last running instance we turn the trigger of. --------






-------- --------------------------------------------------------------------------------------------------------------------------------------------- --------






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








ShSh_IndexSize Equal to 0







Then - Actions








Trigger - Turn off (This trigger)







Else - Actions





Else - Actions