# -- Kamehameha -- once Self "main" "Custom5" SetImage # OR Custom 7 Self "main" "Ships" SetImageLayer Self "main" 1 SetImageOrder Self "main" 2.25 2.25 SetImageScale Self "barrel" "Custom6" SetImage Self "barrel" "Ships" SetImageLayer Self "barrel" 1 SetImageOrder Self "barrel" -0.05 SetImagePositionZ Self "barrel" 3.15 4.33 SetImageScale Self "ShipModule.prpl" "Ship" GetScriptVar ->Ship <-Ship.ShipIsEnemy ->IsEnemy -1 ->target self "RadiusDisplay.prpl" AddScriptToUnit self "RadiusDisplay.prpl" "SCRIPT_NAME" "Kamehameha.prpl" SetScriptVar self "RadiusDisplay.prpl" "RADIUS_VARNAME" "range" SetScriptVar self "RadiusDisplay.prpl" "IMAGE" "Custom6_256" SetScriptVar #Light Blue circle range CreateList ->laserParticles 0 ->numParticles 0 ->mode <-Ship GetShipPixelCoords ->y_ship ->x_ship 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 ->cooldown return endif self "main" <-ShipAngle SetImageRotation IsPaused GetUpdateCount eq0 and 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 <-GemPresent if self "barrel" "Custom1_128" SetImage self "barrel" 255 255 255 255 SetImageColor self "barrel" 3.0 3.0 SetImageScale else self "barrel" "Custom6" SetImage self "barrel" 3.15 4.33 SetImageScale self "barrel" 255 255 255 255 SetImageColor endif <-Ship GetShipHasAmp ->GemPresent <-GemPresent if 500 ->range # Was 108 ->range else <-IsEnemy if 124 ->range else 250 ->range # Was 92 ->range endif endif <-BarrelAngle <-Delta add ->BarrelAngle <-GemPresent if 1 ->energy_use 2 ->r 0 ->barrel_len else 2 ->energy_use 1 ->r 5 ->barrel_len endif 3 ->multiplier <-Ship GetShipPixelCoords <-y_ship sub ->y_ship_delta <-x_ship sub ->x_ship_delta <-x_ship_delta <-y_ship_delta 0 0 Distance ->ship_speed <-y_ship_delta <-x_ship_delta atan2 <-BarrelAngle ShortestAngle ->ship_rot 4 <-multiplier mul <-ship_speed <-ship_rot cos mul add ->particle_speed <-Ship GetShipPixelCoords ->y_ship ->x_ship <-cooldown 0 gt if <-cooldown 1 sub ->cooldown else @findTarget 30 ->cooldown endif <-target -1 neq if CurrentPixelCoords ->y ->x <-mode 1 eq if <-target GetParticlePosition ->py ->px endif <-mode 2 eq if <-target GetShipPixelCoords ->py ->px endif <-mode 3 eq if <-target GetUnitPixelCoordX ->px <-target GetUnitPixelCoordY ->py endif 1 ->validate <-mode 1 eq if <-target.particleHealth 0 gte ->validate #was 3 ========================================= endif <-mode 2 eq if <-target GetShipIsDestroyed not ->validate endif <-mode 3 eq if <-target.UnitIsDestroyed not ->validate endif <-validate eq0 if -1 ->target else <-py <-y sub <-px <-x sub atan2 ->targetAngle <-targetAngle <-BarrelAngle ShortestAngle ->dist <-px 0 gte <-py 0 gte or not if @findTarget endif <-GemPresent if 0.05 ->value else <-IsEnemy if 0.04 ->value else 0.1 ->value endif endif <-dist abs <-value lt if <-targetAngle ->BarrelAngle @Fire else <-dist 0 gt if <-GemPresent if <-BarrelAngle 0.05 sub ->BarrelAngle #was 0.025 else <-IsEnemy if <-BarrelAngle 0.04 sub ->BarrelAngle #was 0.035 else <-BarrelAngle 0.10 sub ->BarrelAngle #was 0.015 endif endif else <-GemPresent if <-BarrelAngle 0.05 add ->BarrelAngle #was 0.025 else <-IsEnemy if <-BarrelAngle 0.04 add ->BarrelAngle #was 0.035 else <-BarrelAngle 0.10 add ->BarrelAngle #was 0.015 endif endif endif endif endif endif # Add plasma and remove dead particles 0 ->index while <-index <-numParticles lt repeat <-laserParticles[<-index] IsParticle if <-laserParticles[<-index] ->p <-p GetParticlePosition PixelToCell ->py ->px <-index 1 add ->index <-mode 3 eq if <-target ->unit <-unit @CheckUnit 0 gt if <-unit @CheckUnitLatheProtected if <-unit 1 SetUnitLatheTargets endif <-unit GetUnitCoordX <-unit GetUnitCoordY <-px <-py Distance <-r 1 add lte if <-unit.UnitHealth <-unit @CheckUnit <-p.particleHealth mul sub ->unit.UnitHealth <-p 0 0 SetParticleMotion 0 ->p.particleHealth endif endif endif <-p GetParticleMotion atan2 <-BarrelAngle ShortestAngle abs 0.1 gte if <-p dup GetParticleMaxAge <-p.particleHealth 1 add sub SetParticleMaxAge endif <-p.particleHealth 0 gt if <-px <-py <-IsEnemy 0 SetPlasma endif else <-laserParticles[<-numParticles 1 sub] ->laserParticles[<-index] <-numParticles 1 sub ->numParticles endif endwhile Self "barrel" <-BarrelAngle SetImageRotation endif :findTarget 0 ->mode CurrentPixelCoords ->y ->x -1 ->target <-range 2 div ->range_2 <-range_2 ->minDist CurrentCoords <-range_2 <-IsEnemy not 0 1 0 0 GetNearestTarget ->target <-target -1 neq if <-target GetParticlePosition PixelToCell <-x <-y PixelToCell Distance ->minDist 1 ->mode endif CurrentCoords <-range_2 0 GetAllShipsInRange ->Ships <-Ships GetListCount 0 do <-Ships[I] ->TargetableShip <-TargetableShip GetShipIsEnemy if <-TargetableShip GetShipPixelCoords PixelToCell <-x <-y PixelToCell Distance <-minDist lte if <-TargetableShip ->target <-TargetableShip GetShipPixelCoords PixelToCell <-x <-y PixelToCell Distance ->minDist 2 ->mode endif endif loop CurrentCoords <-range_2 0 GetAllUnitsInRange ->Units <-Units GetListCount 0 do <-Units[I] ->unit <-unit GetUnitIsEnemy if <-unit @CheckUnit 0 gt if <-unit GetUnitCoordX <-unit GetUnitCoordY <-x <-y PixelToCell Distance <-minDist lte if <-unit ->target <-unit GetUnitCoordX <-unit GetUnitCoordY <-x <-y PixelToCell Distance ->minDist 3 ->mode endif endif endif loop <-target -1 neq if <-minDist 2 div ->minDist endif CurrentCoords <-range 0 <-IsEnemy not GetParticlesInRange ->particles <-particles GetListCount 0 do <-particles[I] ->p <-p GetParticlePosition PixelToCell <-x <-y PixelToCell Distance <-minDist lte if <-p ->target <-p GetParticlePosition PixelToCell <-x <-y PixelToCell Distance ->minDist 1 ->mode endif loop :Fire <-range 2 mul <-particle_speed div ->particle_age <-Ship GetShipEnergy <-energy_use gte <-IsEnemy or if <-Ship GetShipEnergy <-energy_use sub ->energy <-Ship <-energy SetShipEnergy CurrentPixelCoords ->y_pixel ->x_pixel <-BarrelAngle cos 4 mul <-BarrelAngle sin 4 mul ->y_vec1 ->x_vec1 <-BarrelAngle sin 4 mul <-BarrelAngle cos -4 mul ->y_vec2 ->x_vec2 <-x_pixel <-x_vec1 <-barrel_len mul add ->x0 <-y_pixel <-y_vec1 <-barrel_len mul add ->y0 <-multiplier 0 do <-r 1 add 0 <-r sub do <-x0 <-x_vec2 I mul add ->px <-y0 <-y_vec2 I mul add ->py <-px <-py <-BarrelAngle <-particle_speed 0 <-IsEnemy CreateParticle ->NewParticle <-NewParticle <-particle_speed SetParticleMaxSpeed <-NewParticle I abs 2 mul 1 add SetParticleHealth <-NewParticle 1 SetParticleDestroyAtEdge <-NewParticle <-particle_age SetParticleMaxAge <-laserParticles GetListCount <-numParticles eq if <-laserParticles <-NewParticle AppendToList <-numParticles 1 add ->numParticles else <-NewParticle ->laserParticles[<-numParticles] <-numParticles 1 add ->numParticles endif <-NewParticle 3 SetParticleMass loop <-x0 <-x_vec1 add ->x0 <-y0 <-y_vec1 add ->y0 loop endif :CheckUnit GetUnitType ->type 0 ->value <-type "Emitter" eq if 0.001 ->value endif <-type "Emitter(Clone)" eq if 0.001 ->value endif <-type "MireSpawner" eq if 0.001 ->value endif <-type "DoppelSpawner" eq if 0.001 ->value endif <-type "ShipSpawner" eq if 0.001 ->value endif <-type "StunnerSpawner" eq if 0.001 ->value endif <-type "PhalanxGun" eq if 0.001 ->value endif <-type "PhalanxGun(Clone)" eq if 0.001 ->value endif <-type "Stunner" eq if 0.01 ->value endif <-type "Stunner(Clone)" eq if 0.01 ->value endif <-type "Doppel" eq if 0.01 ->value endif <-type "Doppel(Clone)" eq if 0.01 ->value endif <-type "Omni" eq if 0.01 ->value endif <-type "EnergyMine" eq if 0.01 ->value endif <-type "EnergyMine(Clone)" eq if 0.01 ->value endif <-type "Fighter" eq if 0.01 ->value endif <-type "Fighter(Clone)" eq if 0.01 ->value endif <-value :CheckUnitLatheProtected GetUnitType ->type 0 ->value <-type "Emitter" eq if 1 ->value endif <-type "MireSpawner" eq if 1 ->value endif <-type "DoppelSpawner" eq if 1 ->value endif <-type "ShipSpawner" eq if 1 ->value endif <-type "StunnerSpawner" eq if 1 ->value endif <-value :destroyed ClearLocals