# Rocket.crpl # Created on: 2/3/2018 8:01:21 PM # ------------------------------------------ once $Target:-1 $LongRange:0 Self CONST_CREATEPZ 0 SetUnitAttribute Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute Self CONST_BEAMTARGET 1 SetUnitAttribute Self CONST_DESTROYONDAMAGE 0 SetUnitAttribute Self CONST_HEALRATE 0 SetUnitAttribute Self "shadow" "Custom0_256" SetImage Self "shadow" 0 0 0 120 SetImageColor Self "shadow" 15 -15 -0.5 SetImagePosition #SHowtracelog <-LongRange eq0 if Self CONST_MAXHEALTH 7.5 SetUnitAttribute Self CONST_HEALTH 7.5 SetUnitAttribute 5 ->SizeOuter 3 ->SizeInner Self "shadow" 0.8 0.8 SetImageScale else Self CONST_MAXHEALTH 50 SetUnitAttribute Self CONST_HEALTH 50 SetUnitAttribute 13 ->SizeOuter 8 ->SizeInner Self "main" 1.5 1.5 SetImageScale Self "main" 255 255 255 255 SetImageColor Self "shadow" 0.8 0.8 SetImageScale <-Target CONST_COORDX GetUnitAttribute ->TravelX <-Target CONST_COORDY GetUnitAttribute ->TravelY <-TravelX <-TravelY 2.2 QueueMove endif endonce #Cleartracelog #Self CONST_HEALTH GetUnitAttribute trace Self CONST_HEALTH GetUnitAttribute 0 lte if 1 CurrentPixelCoords -1 2 2 0.2 CreateEffect <-LongRange 1 eq if CreateList ->List CurrentCoords 45 0 GetAllUnitsInRange 0 do ->Unit <-Unit GetUnitType ->Type <-Type "PULSECANNON" eq <-Type "MORTAR" eq or <-Type "GUPPYAIR" eq or <-Type "STRAFER" eq or <-Type "STRAFERAIR" eq or <-Type "BOMBER" eq or <-Type "BOMBERAIR" eq or <-Type "SPRAYER" eq or <-Type "BEAM" eq or <-Type "SNIPER" eq or if <-List <-Unit AppendtoList endif loop 10 0 do <-List GetListCount 1 gte if <-List RANDINT(0 <-List GetListCount) GetListElement ->Unit "CRPLCORE" CurrentCoords CreateUnit ->Core <-Core "main" "Custom0_256" SetImage <-Core "Rocket.crpl" AddScriptToUnit <-Core "Rocket.crpl" "Target" <-Unit SetScriptVar <-List <-List <-Unit GetListElement RemoveListElement endif loop endif Self 2 Destroy endif <-TravelX CurrentX sub ->DeltaX <-TravelY CurrentY sub neg ->DeltaY <-DeltaY <-DeltaX atan2 ->TargetRotation Self "main" <-TargetRotation SetImageRotation Self "shadow" <-TargetRotation SetImageRotation <-LongRange eq0 if <-TravelX -1 eq <-TravelY -1 eq or if CurrentCoords 7 GetUnitsInRange 0 do ->unit <-unit CONST_HEALTH <-unit CONST_HEALTH GetUnitAttribute 1 sub SetUnitAttribute loop Self 2 Destroy endif GetGameTimeFrames 5 mod eq0 if <-Target CONST_COORDX GetUnitAttribute ->TravelX <-Target CONST_COORDY GetUnitAttribute ->TravelY abortmove <-TravelX <-TravelY 1.75 QueueMove endif CurrentCoords 1 0 GetAllUnitsInRange 0 do ->Unit <-Unit <-Target eq if <-Target 2 Destroy 1 CurrentPixelCoords -1 5 5 0.15 CreateEffect CurrentCoords 7 GetUnitsInRange 0 do ->unit <-unit CONST_HEALTH <-unit CONST_HEALTH GetUnitAttribute 1 sub SetUnitAttribute <-unit CONST_HEALTH GetUnitAttribute 0 lte if <-unit 2 Destroy endif loop @Crater 3 -2 do 3 -2 do CurrentX I add CurrentY J add 0 SetCreeper loop loop Self 2 Destroy endif loop else Self CONST_COORDX GetUnitAttribute <-TravelX eq Self CONST_COORDY GetUnitAttribute <-TravelY eq and if 1 CurrentPixelCoords -1 12 12 0.15 CreateEffect CurrentCoords 20 GetUnitsInRange 0 do ->unit2 @RangeUnit <-unit2 CONST_HEALTH <-unit2 CONST_HEALTH GetUnitAttribute <-DAMAGE sub SetUnitAttribute <-unit2 CONST_HEALTH GetUnitAttribute 0 lte if <-unit2 2 Destroy endif <-unit2 CONST_AMMO 0 SetUnitAttribute <-unit2 CONST_AMMOAC 0 SetUnitAttribute loop @Crater 11 -10 do 11 -10 do CurrentX I add CurrentY J add 0 SetCreeper loop loop Self 2 Destroy endif endif :RangeUnit <-unit2 CONST_COORDX GetUnitAttribute ->tarX <-unit2 CONST_COORDY GetUnitAttribute ->tarY CurrentX <-tarX sub abs ->deltaX CurrentY <-tarY sub abs ->deltaY <-deltaX dup mul <-deltaY dup mul add sqrt ->distant 20 <-distant sub ->deltadistance <-deltadistance 10 div 3 pow 5 mul ->DAMAGE :Crater <-SizeOuter dup mul ->RSqOut #precalculate <-SizeInner dup mul ->RSqInn <-SizeOuter 1 add <-SizeOuter neg do <-SizeOuter 1 add <-SizeOuter neg do CurrentX I add CurrentY J add GetTerrain 0 lte if pop else I dup mul J dup mul add dup <-RSqOut gt if pop else I CurrentX add swap J CurrentY add swap <-RSqInn gt if RandInt(0 5) eq0 8 mul 1 add RandInt(0 1) eq0 add else 1 endif SetTerrain endif endif loop loop