# --DecouplerWeapon-- 06/29/2016 20:03:00 once Self "main" "Custom4" SetImage Self "main" "Ships" SetImageLayer Self "main" 1 SetImageOrder Self "main" 1 1 SetImageScale Self "barrel" "Custom3" SetImage Self "barrel" "Ships" SetImageLayer Self "barrel" 1 SetImageOrder Self "barrel" -0.05 SetImagePositionZ Self "barrel" 0.7 0.7 SetImageScale Self "ShipModule.prpl" "Ship" GetScriptVar ->Ship <-Ship.ShipIsEnemy ->IsEnemy -1 ->target endonce Self "ShipModule.prpl" "ShipAngle" GetScriptVar ->ShipAngle Self "ShipModule.prpl" "delta" GetScriptVar ->Delta Self "ShipModule.prpl" "exist" GetScriptVar ->Exist <-Exist eq0 if self "main" 0 0 0 0 SetImageColor self "barrel" 0 0 0 0 SetImageColor self "barrel" 0 0 -0.05 SetImagePosition 0 ->recoil 0 ->cooldown <-target -1 neq if <-mode "Particle" eq if <-target "SNIPER_P" concat 0 ->!* else <-target "SNIPER_U" concat 0 ->!* endif -1 ->target endif return endif self "main" <-ShipAngle SetImageRotation IsPaused if return endif <-Exist 1 eq if self "main" 255 255 255 128 SetImageColor self "barrel" 255 255 255 128 SetImageColor self "barrel" <-ShipAngle SetImageRotation <-ShipAngle ->BarrelAngle else self "main" 255 255 255 255 SetImageColor self "barrel" 255 255 255 255 SetImageColor <-Ship GetShipHasAmp ->GemPresent <-GemPresent if 96 ->range else 80 ->range endif <-BarrelAngle <-Delta add ->BarrelAngle <-recoil if <-recoil 1 sub ->recoil endif <-target -1 eq if <-cooldown if <-cooldown 1 sub ->cooldown else @findTarget endif else CurrentPixelCoords ->y ->x <-mode "Particle" eq if <-target GetParticlePosition ->py ->px else <-target.UnitPixelCoordY ->py <-target.UnitPixelCoordX ->px endif <-px <-py <-x <-y Distance <-range 4 mul gt if <-mode "Particle" eq if <-target "SNIPER_P" concat 0 ->!* else <-target "SNIPER_U" concat 0 ->!* endif -1 ->target @findTarget else 1 ->validate <-mode "Particle" eq if <-target.particleHealth 3 gte ->validate else <-target.UnitIsDestroyed not ->validate endif <-validate eq0 if <-mode "Particle" eq if <-target "SNIPER_P" concat 0 ->!* else <-target "SNIPER_U" concat 0 ->!* endif -1 ->target else <-py <-y sub <-px <-x sub atan2 ->targetAngle <-targetAngle <-BarrelAngle ShortestAngle ->dist <-dist abs 0.08 lt if <-targetAngle ->BarrelAngle CurrentCoords GetLand eq0 if <-Ship.ShipEnergy 3 gte if <-Ship.ShipEnergy 3 sub ->Ship.ShipEnergy <-GemPresent if 45 ->cooldown else 90 ->cooldown endif 8 ->recoil "PRPLCORE" 0 0 CreateUnit ->beam <-px ->beam.UnitPixelCoordX <-py ->beam.UnitPixelCoordY <-beam "BeamEffect.prpl" AddScriptToUnit <-beam "BeamEffect.prpl" "Duration" 15 SetScriptVar <-beam "main" "Custom2" SetImage <-beam "main" <-x <-y <-px <-py Distance 12 div 0.2 SetImageScale <-beam "main" <-targetAngle SetImageRotation <-beam "main" "Ships" SetImageLayer <-beam "main" 1 SetImageOrder <-beam "main" <-x <-px sub 2 div <-y <-py sub 2 div -0.025 SetImagePosition "Weapons19" PlaySound <-mode "Particle" eq if <-target.ParticleHealth 8 gt if <-target.ParticleHealth 8 sub ->ParticleHealth else <-target 0 DestroyParticle endif <-target "SNIPER_P" concat 0 ->!* else <-target.UnitHealth 8 sub ->target.UnitHealth <-target "SNIPER_U" concat 0 ->!* endif -1 ->target endif endif else <-dist 0 gt if <-BarrelAngle 0.08 sub ->BarrelAngle else <-BarrelAngle 0.08 add ->BarrelAngle endif endif endif endif endif Self "barrel" <-BarrelAngle SetImageRotation Self "barrel" <-BarrelAngle cos <-recoil mul -0.5 mul <-BarrelAngle sin <-recoil mul -0.5 mul -0.05 SetImagePosition endif :findTarget CurrentPixelCoords ->y ->x -1 ->target <-*SniperTargets GetListCount if <-range 4 mul ->nearest <-*SniperTargets GetListCount 0 do <-*SniperTargets[I] ->unit <-unit.UnitIsEnemy <-IsEnemy neq if <-unit.UnitPixelCoordX <-unit.UnitPixelCoordY <-x <-y Distance ->r <-r <-nearest lt if <-unit "SNIPER_U" concat <-!* eq0 if <-r ->nearest <-unit ->target endif endif endif loop <-target -1 neq if 1 <-target "SNIPER_U" concat ->!* "Unit" ->mode return endif endif CurrentCoords <-range 0 <-IsEnemy not GetParticlesInRange ->particles 3 ->most <-range 4 mul ->nearest <-particles GetListCount 0 do <-particles[I] ->p <-p GetParticleHealth ->hp <-hp <-most gt if <-p "SNIPER_P" concat <-!* eq0 if #Global refreads are OP, pls nerf <-p GetParticlePosition <-x <-y Distance ->nearest <-hp ->most <-p ->target endif else <-hp <-most eq if <-p GetParticlePosition <-x <-y Distance ->dist <-dist <-nearest lt if <-p "SNIPER_P" concat <-!* eq0 if <-dist ->nearest <-hp ->most <-p ->target endif endif endif endif loop <-target -1 neq if 1 <-target "SNIPER_P" concat ->!* "Particle" ->mode endif :destroyed <-target -1 neq if <-mode "Particle" eq if <-target "SNIPER_P" concat 0 ->!* else <-target "SNIPER_U" concat 0 ->!* endif -1 ->target endif