Custom PRPL Superweapon scripts

Started by Eiyatizu, May 13, 2017, 10:48:04 AM

Previous topic - Next topic

Eiyatizu

Was messing around with JoaoPistori's custom maps (506) and adapted scripts from his HowitzerWeapon.prpl to form new scripts. All the scripts below will still need other scripts and images from his map to work.:

# -- GeassWeapon --
once
Self "main" "Custom7" 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 "energyPoint" "Custom3_128" SetImage
Self "energyPoint" "Ships" SetImageLayer
Self "energyPoint" 1 SetImageOrder
Self "energyPoint" -0.10 SetImagePositionZ
Self "energyPoint" 0 0 SetImageScale
Self "ShipModule.prpl" "Ship" GetScriptVar ->Ship
<-Ship.ShipIsEnemy ->IsEnemy
-1 ->target
self "RadiusDisplay.prpl" AddScriptToUnit
self "RadiusDisplay.prpl" "SCRIPT_NAME" "GeassWeapon.prpl" SetScriptVar
self "RadiusDisplay.prpl" "RADIUS_VARNAME" "range" SetScriptVar
self "RadiusDisplay.prpl" "IMAGE" "Custom8_256" SetScriptVar
#Light Blue circle range
0 ->mode
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
self "energyPoint" 0 0 0 0 SetImageColor
self "energyPoint" 0 0 -0.10 SetImagePosition
0 ->recoil
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
270 ->range
else
    <-IsEnemy if
124 ->range
else
135 ->range
endif
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 2 eq if
<-target GetShipPixelCoords ->py ->px
endif
<-mode 3 eq if
<-target GetUnitPixelCoordX ->px
<-target GetUnitPixelCoordY ->py
endif

<-px <-py <-x <-y Distance <-range 2 mul gt if
-1 ->target
@findTarget
else
1 ->validate
<-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
CurrentCoords GetLand eq0 if
0 ->energy_use
<-GemPresent if
15 ->energy_use
else
20 ->energy_use
endif
    <-px 0 gte <-py 0 gte or if
<-Ship GetShipEnergy <-energy_use gte <-IsEnemy or if
<-Ship GetShipEnergy <-energy_use sub ->energy
<-Ship <-energy SetShipEnergy
    <-GemPresent if
    40 ->cooldown
    16 ->recoil
else
    <-IsEnemy if
    35 ->cooldown
15 ->recoil
else
        60 ->cooldown
        18 ->recoil
endif
endif
<-GemPresent if
"PRPLCORE" 0 0 CreateUnit ->beam
<-px ->beam.UnitPixelCoordX
<-py ->beam.UnitPixelCoordY
<-beam "GeassEffect.prpl" AddScriptToUnit
<-beam "GeassEffect.prpl" "Duration" 30 SetScriptVar
<-beam "main" "Custom1" SetImage
<-beam "main" <-x <-y <-px <-py Distance 12 div 7 SetImageScale
<-beam "main" <-targetAngle SetImageRotation
<-beam "main" "Ships" SetImageLayer
<-beam "main" 1 SetImageOrder
<-beam "GeassEffect.prpl" "R" 255 SetScriptVar  # ===============================
<-beam "GeassEffect.prpl" "G" 64 SetScriptVar  # ===============================
<-beam "GeassEffect.prpl" "B" 64 SetScriptVar  # ===============================
<-beam "main" 255 64 64 255 SetImageColor    # ===============================
<-beam "main" <-x <-px sub 2 div <-y <-py sub 2 div -0.025 SetImagePosition
else
"PRPLCORE" 0 0 CreateUnit ->beam
<-px ->beam.UnitPixelCoordX
<-py ->beam.UnitPixelCoordY
<-beam "BeamEffect.prpl" AddScriptToUnit
<-beam "BeamEffect.prpl" "Duration" 30 SetScriptVar
<-beam "main" "Custom1" SetImage
<-beam "main" <-x <-y <-px <-py Distance 12 div 1 SetImageScale
<-beam "main" <-targetAngle SetImageRotation
<-beam "main" "Ships" SetImageLayer
<-beam "main" 1 SetImageOrder
<-beam "BeamEffect.prpl" "R" 255 SetScriptVar  # ===============================
<-beam "BeamEffect.prpl" "G" 64 SetScriptVar  # ===============================
<-beam "BeamEffect.prpl" "B" 64 SetScriptVar  # ===============================
<-beam "main" 255 64 64 255 SetImageColor    # ===============================
<-beam "main" <-x <-px sub 2 div <-y <-py sub 2 div -0.025 SetImagePosition
endif
"Misc7" PlaySound
@Damage
-1 ->target
endif
endif
endif
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
endif

Self "barrel" <-BarrelAngle SetImageRotation
Self "barrel" <-BarrelAngle cos <-recoil mul -0.5 mul <-BarrelAngle sin <-recoil mul -0.5 mul -0.05 SetImagePosition
<-GemPresent if
40.0 ->cooldownInterval
else
60.0 ->cooldownInterval
endif
<-GemPresent if
40.0 ->cooldownInterval
<-cooldownInterval <-cooldown sub <-cooldownInterval div ->percentReady
Self "energyPoint" 255 64 64 255 <-percentReady mul SetImageColor
Self "energyPoint" 1.66 <-percentReady mul 1.66 <-percentReady mul SetImageScale
Self "energyPoint" dup2 GetImageRotation Pi 2 sqrt div <-percentReady mul add SetImageRotation
Self "energyPoint" 0 0 -0.10 SetImagePosition
else
60.0 ->cooldownInterval
<-cooldownInterval <-cooldown sub <-cooldownInterval div ->percentReady
Self "energyPoint" 255 64 64 255 <-percentReady mul SetImageColor
Self "energyPoint" 1.0 <-percentReady mul 1.0 <-percentReady mul SetImageScale
Self "energyPoint" 20.0 <-BarrelAngle cos mul 20.0 <-BarrelAngle sin mul -0.03 SetImagePosition
Self "energyPoint" dup2 GetImageRotation Pi 2 sqrt div <-percentReady mul add SetImageRotation
endif
endif

:findTarget
0 ->mode
CurrentPixelCoords ->y ->x
-1 ->target
<-range 2 div ->range_2
<-range_2 ->minDist

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 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

:Damage
<-GemPresent if
17 ->initialRadius
else
1  ->initialRadius
endif
# Convert Ships
<-px <-py PixelToCell <-initialRadius 0 GetAllShipsInRange ->Ships
<-Ships GetListCount 0 do
    <-Ships[I] ->targetShip
    <-targetShip GetShipIsEnemy if
    1 ->r
    <-targetShip GetShipPixelCoords PixelToCell ->y0 ->x0
    <-r 1 add 0 <-r sub do
    <-r 1 add 0 <-r sub do
    I <-x0 add J <-y0 add CellToPixel 0 0 2 <-IsEnemy CreateParticle ->instantDeath
    100 ->instantDeath.ParticleHealth
    <-instantDeath 1 SetParticleDestroyAtEdge
            <-instantDeath 0 SetParticleMaxSpeed
            <-instantDeath 2 SetParticleMaxAge
        loop
    loop
    endif
loop
# Convert Units
<-px <-py PixelToCell <-initialRadius 0 GetAllUnitsInRange ->Units
<-Units GetListCount 0 do
    <-Units[I] ->unit
    <-unit GetUnitIsEnemy if
    <-unit @CheckUnit if
    <-unit @CheckUnitLatheProtected if
            <-unit 1 SetUnitLatheTargets
            endif
            <-unit @CheckInstantDeathUnit if
    <-unit.UnitHealth 1.0 sub ->unit.UnitHealth
    else
    <-unit <-IsEnemy SetUnitIsEnemy
    endif
endif
    endif
loop

:CheckInstantDeathUnit
GetUnitType ->type
    0 ->value
<-type "Stunner" eq if
1 ->value
endif
<-type "Stunner(Clone)" eq if
1 ->value
endif
<-type "Omni" eq if
1 ->value
endif
<-type "Fighter" eq if
            1  ->value
        endif
        <-type "Fighter(Clone)" eq if
            1  ->value
        endif
<-value

:CheckUnit
    GetUnitType ->type
    0 ->value
<-type "Emitter" eq if
1 ->value
endif
<-type "Emitter(Clone)" 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
<-type "PhalanxGun" eq if
1 ->value
endif
<-type "PhalanxGun(Clone)" eq if
1 ->value
endif
<-type "TiconGun" eq if
1 ->value
endif
<-type "TiconGun(Clone)" eq if
1 ->value
endif
<-type "Stunner" eq if
1 ->value
endif
<-type "Stunner(Clone)" eq if
1 ->value
endif
<-type "Fighter" eq if
            1  ->value
        endif
        <-type "Fighter(Clone)" eq if
            1  ->value
        endif
<-type "Doppel" eq if
1 ->value
endif
<-type "Doppel(Clone)" eq if
1 ->value
endif
<-type "EnergyMine" eq if
1 ->value
endif
<-type "EnergyMine(Clone)" eq if
1 ->value
endif
<-type "Omni" eq if
1 ->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


# -- 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


# --GeassEffect--

$Duration:30
$R:255
$G:255
$B:255

once
255 <-Duration div ->decrement
<-Duration SetTimer0
endonce

Self "main" <-R <-G <-B GetTimer0 <-decrement mul SetImageColor
Self "main" dup2 GetImageScale 1 add SetImageScale
GetTimer0 eq0 if
Self 0 DestroyUnit
endif

:awake
Self 0 SetUnitTakeMapSpace
0 OperateWhilePaused



# -- Particle Shield --
once
    self "main" "Custom8" SetImage
    self "main" "Ships" SetImageLayer
    self "main" 1 SetImageOrder
    self "main" 2.25 2.25 SetImageScale
    self "ShipModule.prpl" "Ship" GetScriptVar ->Ship
    <-Ship.ShipIsEnemy ->IsEnemy
    CreateList ->shieldParticles
    CreateList ->shieldParticlesX
    CreateList ->shieldParticlesY
    0 ->nextIndex
    CurrentPixelCoords ->y_pixel ->x_pixel
    0 ->GemPresent
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
    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
else
    self "main" 255 255 255 255 SetImageColor
    <-Ship GetShipHasAmp ->GemPresent

    # Pixel Change
    CurrentPixelCoords ->y_pixel ->x_pixel

    # Params
    <-Ship GetShipHullWidth <-Ship GetShipHullHeight max ->maxDimension
    <-maxDimension 2 sqrt div ->innerRadius
    <-innerRadius 2 add ->outerRadius
    <-GemPresent if
        100 ->particleHealth
        10  ->genInterval
        1   ->energy_use
    else
        25  ->particleHealth
        30  ->genInterval
        2   ->energy_use
    endif

    <-shieldParticles GetListCount eq0 if
        # Create a new shield from scratch
        <-outerRadius dup mul ->outerRadiusSq
        <-innerRadius dup mul ->innerRadiusSq
        <-outerRadius 1 add 0 <-outerRadius sub do
            <-outerRadius 1 add 0 <-outerRadius sub do
                I dup mul J dup mul add ->dist
                <-dist <-outerRadiusSq lte <-dist <-innerRadiusSq gt and if
                    <-shieldParticles -1 AppendToList
                    <-shieldParticlesX I AppendToList
                    <-shieldParticlesY J AppendToList
                endif
            loop
        loop
    else
        # Move the shield
        <-shieldParticles GetListCount 0 do
            <-shieldParticles[I] IsParticle if
                <-shieldParticlesX[I] <-shieldParticlesY[I] CellToPixel ->ry ->rx
                <-shieldParticles[I] <-rx <-x_pixel add <-ry <-y_pixel add SetParticlePosition
                <-shieldParticles[I] GetParticlePosition PixelToCell <-IsEnemy 0 SetPlasma
            endif
        loop
    endif

    <-shieldParticles GetListCount ->numParticles
    <-cooldown 0 lte if
        <-genInterval ->cooldown
        <-Ship GetShipEnergy ->shipEnergy
        <-numParticles 0 do
            <-shieldParticles[<-nextIndex] IsParticle if
                # Increase power of current shield
                <-shieldParticles[<-nextIndex] ->F_particle
                <-F_particle.particleHealth <-particleHealth lt if
                    <-shipEnergy <-energy_use gte if
                        <-shipEnergy <-energy_use sub ->shipEnergy
                        <-F_particle.particleHealth 1 add ->F_particle.particleHealth
                    else
                        break
                    endif
                endif
            else
                <-shipEnergy <-energy_use gte if
                    <-shipEnergy <-energy_use sub ->shipEnergy
                    # Create new particles in current shield
                    <-shieldParticlesX[<-nextIndex] <-shieldParticlesY[<-nextIndex] CellToPixel ->ry ->rx
                    <-rx <-x_pixel add <-ry <-y_pixel add 0 0 0 <-IsEnemy CreateParticle ->F_particle
                    1 ->F_particle.ParticleHealth
                    <-F_particle 1 SetParticleDestroyAtEdge
                    <-F_particle 0 SetParticleMaxSpeed
                    <-F_particle GetParticlePosition PixelToCell <-IsEnemy 0 SetPlasma
                    <-F_particle ->shieldParticles[<-nextIndex]
                    <-F_particle 0.01 SetParticleMass
                else
                    break
                endif
            endif
            <-nextIndex 1 add ->nextIndex
            <-nextIndex <-numParticles gte if
                <-nextIndex <-numParticles sub ->nextIndex
            endif
        loop
        <-Ship <-shipEnergy SetShipEnergy
    else
        <-cooldown 1 sub ->cooldown
    endif
endif

:destroyed
    ClearLocals


# -- SuperlaserWeapon --
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 "energyPoint" "Custom3_128" SetImage
Self "energyPoint" "Ships" SetImageLayer
Self "energyPoint" 1 SetImageOrder
Self "energyPoint" -0.10 SetImagePositionZ
Self "energyPoint" 0 0 SetImageScale
Self "ShipModule.prpl" "Ship" GetScriptVar ->Ship
<-Ship.ShipIsEnemy ->IsEnemy
-1 ->target
self "RadiusDisplay.prpl" AddScriptToUnit
self "RadiusDisplay.prpl" "SCRIPT_NAME" "SuperlaserWeapon.prpl" SetScriptVar
self "RadiusDisplay.prpl" "RADIUS_VARNAME" "range" SetScriptVar
self "RadiusDisplay.prpl" "IMAGE" "Custom6_256" SetScriptVar
#Light Blue circle range
CreateList ->laserParticles
0 ->mode
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
self "energyPoint" 0 0 0 0 SetImageColor
self "energyPoint" 0 0 -0.10 SetImagePosition
0 ->recoil
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
<-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 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

<-px <-py <-x <-y Distance <-range 2 mul gt if
-1 ->target
@findTarget
else
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
CurrentCoords GetLand eq0 if
0 ->energy_use
<-GemPresent if
15 ->energy_use
else
20 ->energy_use
endif
    <-px 0 gte <-py 0 gte or if
<-Ship GetShipEnergy <-energy_use gte <-IsEnemy or if
<-Ship GetShipEnergy <-energy_use sub ->energy
<-Ship <-energy SetShipEnergy
    <-GemPresent if
    40 ->cooldown
    16 ->recoil
else
    <-IsEnemy if
    35 ->cooldown
15 ->recoil
else
        60 ->cooldown
        18 ->recoil
endif
endif
<-GemPresent if
"PRPLCORE" 0 0 CreateUnit ->beam
<-px ->beam.UnitPixelCoordX
<-py ->beam.UnitPixelCoordY
<-beam "GeassEffect.prpl" AddScriptToUnit
<-beam "GeassEffect.prpl" "Duration" 30 SetScriptVar
<-beam "main" "Custom1" SetImage
<-beam "main" <-x <-y <-px <-py Distance 12 div 1 SetImageScale
<-beam "main" <-targetAngle SetImageRotation
<-beam "main" "Ships" SetImageLayer
<-beam "main" 1 SetImageOrder
<-beam "GeassEffect.prpl" "R" 128 SetScriptVar  # ===============================
<-beam "GeassEffect.prpl" "G" 192 SetScriptVar  # ===============================
<-beam "GeassEffect.prpl" "B" 255 SetScriptVar  # ===============================
<-beam "main" 128 192 255 255 SetImageColor    # ===============================
<-beam "main" <-x <-px sub 2 div <-y <-py sub 2 div -0.025 SetImagePosition
else
"PRPLCORE" 0 0 CreateUnit ->beam
<-px ->beam.UnitPixelCoordX
<-py ->beam.UnitPixelCoordY
<-beam "BeamEffect.prpl" AddScriptToUnit
<-beam "BeamEffect.prpl" "Duration" 30 SetScriptVar
<-beam "main" "Custom1" SetImage
<-beam "main" <-x <-y <-px <-py Distance 12 div 1 SetImageScale
<-beam "main" <-targetAngle SetImageRotation
<-beam "main" "Ships" SetImageLayer
<-beam "main" 1 SetImageOrder
<-beam "BeamEffect.prpl" "R" 128 SetScriptVar  # ===============================
<-beam "BeamEffect.prpl" "G" 192 SetScriptVar  # ===============================
<-beam "BeamEffect.prpl" "B" 255 SetScriptVar  # ===============================
<-beam "main" 128 192 255 255 SetImageColor    # ===============================
<-beam "main" <-x <-px sub 2 div <-y <-py sub 2 div -0.025 SetImagePosition
endif
"Weapons4" PlaySound
@Damage
-1 ->target
endif
endif
endif
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
endif

# Add Blue Plasma
0 ->countParticles
<-laserParticles GetListCount 0 do
<-laserParticles[I] IsParticle if
<-countParticles 1 add ->countParticles
<-laserParticles[I] GetParticlePosition PixelToCell <-IsEnemy 0 SetPlasma
endif
loop
<-countParticles eq0 if
--laserParticles
CreateList ->laserParticles
endif

Self "barrel" <-BarrelAngle SetImageRotation
Self "barrel" <-BarrelAngle cos <-recoil mul -0.5 mul <-BarrelAngle sin <-recoil mul -0.5 mul -0.05 SetImagePosition
<-GemPresent if
40.0 ->cooldownInterval
<-cooldownInterval <-cooldown sub <-cooldownInterval div ->percentReady
Self "energyPoint" 255 255 255 255 <-percentReady mul SetImageColor
Self "energyPoint" 1.66 <-percentReady mul 1.66 <-percentReady mul SetImageScale
Self "energyPoint" dup2 GetImageRotation Pi 2 sqrt div <-percentReady mul add SetImageRotation
Self "energyPoint" 0 0 -0.10 SetImagePosition
else
60.0 ->cooldownInterval
<-cooldownInterval <-cooldown sub <-cooldownInterval div ->percentReady
Self "energyPoint" 255 255 255 255 <-percentReady mul SetImageColor
Self "energyPoint" 1.0 <-percentReady mul 1.0 <-percentReady mul SetImageScale
Self "energyPoint" 20.0 <-BarrelAngle cos mul 20.0 <-BarrelAngle sin mul -0.03 SetImagePosition
Self "energyPoint" dup2 GetImageRotation Pi 2 sqrt div <-percentReady mul add SetImageRotation
endif
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 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

:Damage
--laserParticles
CreateList ->laserParticles
<-GemPresent if
64   ->numPtsOnCircle
20   ->numCircles
100  ->maxDist
30   ->particleHealth
7 ->initialRadius
1.0 ->damageUnit
else
32   ->numPtsOnCircle
10   ->numCircles
50   ->maxDist
10   ->particleHealth
1 ->initialRadius
0.25 ->damageUnit
endif

# Fire Grenade
Pi <-numPtsOnCircle 2 div div ->angleInterval
<-numCircles 0 do
<-numPtsOnCircle 0 do
J 1 mul 1 add ->particleSpeed
<-angleInterval I mul ->angle
<-angle cos <-initialRadius mul <-px add <-angle sin <-initialRadius mul <-py add <-angle <-particleSpeed 2.0 div 2 <-IsEnemy CreateParticle ->NewParticle
<-NewParticle <-particleSpeed 2.0 div SetParticleMaxSpeed
<-NewParticle <-particleHealth SetParticleHealth
<-NewParticle 1 SetParticleDestroyAtEdge
<-NewParticle <-maxDist <-particleSpeed sqrt div SetParticleMaxAge
<-laserParticles <-NewParticle AppendToList
loop
loop

# Damage
<-px <-py PixelToCell <-initialRadius 0 GetAllUnitsInRange ->Units
<-Units GetListCount 0 do
    <-Units[I] ->unit
    <-unit GetUnitIsEnemy if
    <-unit @CheckUnit if
            <-unit @CheckUnitLatheProtected if
            <-unit 1 SetUnitLatheTargets
            endif
            <-unit @InstantKillUnit if
            <-unit.UnitHealth 1.0 sub ->unit.UnitHealth
            else
            <-unit.UnitHealth <-damageUnit sub ->unit.UnitHealth
            endif
endif
    endif
loop

:InstantKillUnit
GetUnitType ->type
    0 ->value
<-type "Stunner" eq if
1 ->value
endif
<-type "Stunner(Clone)" eq if
1 ->value
endif
<-type "Omni" eq if
1 ->value
endif
<-type "Fighter" eq if
            1  ->value
        endif
        <-type "Fighter(Clone)" eq if
            1  ->value
        endif
    <-value

:CheckUnit
    GetUnitType ->type
    0 ->value
<-type "Emitter" eq if
1 ->value
endif
<-type "Emitter(Clone)" 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
<-type "PhalanxGun" eq if
1 ->value
endif
<-type "PhalanxGun(Clone)" eq if
1 ->value
endif
<-type "TiconGun" eq if
1 ->value
endif
<-type "TiconGun(Clone)" eq if
1 ->value
endif
<-type "Stunner" eq if
1 ->value
endif
<-type "Stunner(Clone)" eq if
1 ->value
endif
<-type "Fighter" eq if
            1  ->value
        endif
        <-type "Fighter(Clone)" eq if
            1  ->value
        endif
<-type "Doppel" eq if
1 ->value
endif
<-type "Doppel(Clone)" eq if
1 ->value
endif
<-type "Omni" eq if
1 ->value
endif
<-type "EnergyMine" eq if
1 ->value
endif
<-type "EnergyMine(Clone)" eq if
1 ->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

Eiyatizu

All these modules depends on heavy energy consumption.

Geass:
Lelouch's Geass on a ship. Cause enemy ships to suicide. Convert certain enemy units and instantly kill others.

Kamehameha:
Goku's Kamehameha on a ship. Target ships, units and particles in a kamehameha fashion.

Shield:
A particle shield that moves with the custom PRPL module, keep growing through time.

Superlaser:
Adapted from ideas from Death Star and Shinkiro's Prism laser weapon. Attack with an exploding energy explosion.

Eiyatizu

Adapted from JoaoPistori's Custom Map with the above scripts embedded.