actor JusticeMeteorWep_NormalBar : NormalBar{args 4, 192}
actor JusticeMeteorWep : BaseMM8BDMWep
{
Weapon.AmmoUse 7
Weapon.AmmoGive 28
Weapon.SlotNumber 5
Inventory.Pickupmessage "$PU_JUSTICEMETEOR"
Obituary "$OB_JUSTICEMETEOR"
Tag "$TAG_JUSTICEMETEOR"
weapon.ammotype "JusticeMeteorAmmo"
inventory.icon "JSMTICON"
States
{
SpawnLoop:
JSMT Z 1
loop
Ready:
JSMT A 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_JUSTICEMETEOR)
JSMT A 1 A_WeaponReady
Goto Ready+1
ReadyC: Goto Ready+1
Deselect:
JSMT A 0 
goto DeselectSwap
Select:
JSMT A 0 
goto SelectSwap
Fire:
JSMT B 0 A_JumpIfNoAmmo("NoAmmo")
JSMT B 0 A_TakeInventory("JusticeMeteorAmmo",7)
JSMT B 0 A_GiveInventory("JusticeMeteorArmor",1)
JSMT B 0 A_GiveInventory("WeaponCharge",10)
JSMT B 0 SetPlayerProperty(0,1,0)//A_GiveInventory("SelfTotallyFrozen",1)
JSMT B 0 ACS_NamedExecuteAlways("core_unsolidplayer",0,0,USP_TOGGLEON)
JSMT B 0 A_ChangeFlag("SOLID",0)
LIBO B 0 ACS_NamedExecuteAlways("core_nogravityplayer",0,0,2,1)
JSMT B 0 A_ChangeVelocity(22.5,0,0.35,3)
JSMT B 1 A_GunFlash("Flash.MeteorFire")
JSMT C 1
JSMT DDDDDDDDDDDDDDDDDDDD 1 
JSMT D 1 A_SpawnItemEx("JusticeMeteorDamage",0,0,28,momx,momy,momz,0,9)
JSMT D 1 A_SpawnItemEx("JusticeMeteorDamage2",0,0,28,momx,momy,momz,0,9)
TNT1 A 0 A_PlaySoundEx("misc/mm3explosion","Body")
JSMT D 1 A_FireCustomMissile("JusticeMeteorThrow",0,0,0,-28)
LIBO B 0 ACS_NamedExecuteAlways("core_nogravityplayer",0,0,0,1)
JSMT C 0 SetPlayerProperty(0,0,0)//A_GiveInventory("SelfTotallyUnfrozen",1)
JSMT C 1 A_TakeInventory("JusticeMeteorArmor",9999)
JSMT B 2 A_TakeInventory("WeaponCharge",999)
JSMT A 1
JSMT A 0 ACS_NamedExecuteAlways("core_unsolidplayer",0,0,USP_TOGGLEOFF_DAMAGE,ACS_NamedExecuteWithResult("core_getmaxhealth")/10)
JSMT A 45 A_WeaponReady(14)
goto Ready+1

Flash.MeteorFire:
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0 A_PlaySoundEx("weapon/JusticeMeteor","Weapon")
TNT1 A 0 A_GiveInventory("JusticeMeteorThrust_P",1)
TNT1 A 0 A_TakeInventory("WeaponCharge",1)
TNT1 A 0 ACS_NamedExecute("vile_statechange",0,2)
TNT1 A 1 A_SpawnItemEx("JusticeMeteorDamage",0,0,28,momx,momy,momz,0,9)
TNT1 A 1 A_SpawnItemEx("JusticeMeteorDamage",0,0,28,momx,momy,momz,0,9)
TNT1 A 0 A_JumpIfInventory("WeaponCharge",1,"Flash.MeteorFire")
stop

NoAmmo:
JSMT A 1 ACS_NamedExecuteAlways("core_noammo",0)
Goto Ready+1
}
}

actor JusticeMeteorAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor JusticeMeteorArmor : PowerProtection
{
Powerup.Duration -5
damagefactor "JusticeMeteor", 0.15
}

actor JusticeMeteorProtect : PowerProtection
{
Powerup.Duration 30
damagefactor "JusticeMeteor", 0.0//0.09
}
actor JusticeMeteor2Protect : PowerProtection
{
Powerup.Duration 30
damagefactor "JusticeMeteor2", 0.0//0.09
}

actor JusticeMeteorDamage : BasicExplosion
{
Damagetype "JusticeMeteor"
Obituary "$OB_JUSTICEMETEOR"

States
{
Spawn:
TNT1 A 0
TNT1 AAAA 0 A_SpawnItemEx("JusticeMeteorDamageFX1",random(-80,80),random(-80,80),random(-80,80),momx*0.5,momy*0.5,momz*0.5,0,9)
TNT1 AAA 0 A_SpawnItemEx("JusticeMeteorDamageFX3",random(-80,80),random(-80,80),random(-80,80),random(-1,1),random(-1,1),random(-1,1),0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,0,16,-1,0,4,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,0,-16,-1,0,-4,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,8,8,-1,2,2,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,8,-8,-1,2,-2,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-8,8,-1,-2,2,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-8,-8,-1,-2,-2,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,16,0,-1,4,0,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-16,0,-1,-4,0,0,1)
TNT1 A 2 A_Explode(CallACS("vile_cbm_damage",30),96,0,0,96)
stop
}
}

actor JusticeMeteorDamage2 : JusticeMeteorDamage
{
States
{
Spawn:
TNT1 A 0
TNT1 AAAA 0 A_SpawnItemEx("JusticeMeteorDamageFX1",random(-80,80),random(-80,80),random(-80,80),momx*0.5,momy*0.5,momz*0.5,0,9)
TNT1 AAA 0 A_SpawnItemEx("JusticeMeteorDamageFX3",random(-80,80),random(-80,80),random(-80,80),random(-1,1),random(-1,1),random(-1,1),0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,4,12,-1,1,3,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-4,12,-1,-1,3,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,12,4,-1,3,1,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,12,-4,-1,3,-1,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,4,-12,-1,1,-3,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-4,-12,-1,-1,-3,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-12,4,-1,-3,1,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-12,-4,-1,-3,-1,0,1)
TNT1 A 2 A_Explode(CallACS("vile_cbm_damage",30),96,0,0,96)
stop
}
}

actor JusticeMeteorDamageFX1 : BasicGraphicEffect
{
+BRIGHT
Translation "192:192=4:4", "198:198=192:192", "199:199=198:198"
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1)
Spawn1:
JTM2 M 5
JTM2 N 10
JTM2 N 1 A_Fadeout(0.15)
wait
}
}

actor JusticeMeteorDamageFX2 : BasicGraphicEffect
{
+BRIGHT
Translation "192:192=4:4", "198:198=192:192", "199:199=198:198"
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,4)
Spawn1:
JTM2 O 6
JTM2 P 2 A_ScaleVelocity(1.05)
JTM2 P 1 A_Fadeout
goto Spawn1+1
Spawn2:
JTM2 O 6
JTM2 Q 2 A_ScaleVelocity(1.05)
JTM2 Q 1 A_Fadeout
goto Spawn2+1
}
}

actor JusticeMeteorDamageFX3 : BasicGraphicEffect
{
+BRIGHT
Translation "192:192=4:4", "198:198=192:192", "199:199=198:198"
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,"Spawn1","Spawn2")
Spawn1:
JTM2 RS 3
JTM2 T 3 A_Fadeout(0.2)
goto Spawn1+1
Spawn2:
JTM2 UV 3
JTM2 W 3 A_Fadeout(0.2)
goto Spawn2+1
}
}

Actor JusticeMeteorThrow : BasicProjectile
{
+BRIGHT
Translation "198:198=192:192", "192:192=4:4"
PROJECTILE
damagetype "JusticeMeteor2"
Obituary "$OB_JUSTICEMETEOR"
+DONTSPLASH
+HEXENBOUNCE
+SKYEXPLODE
+THRUGHOST
//+THRUACTORS
BounceFactor 1.0
WallBounceFactor 1.0
ReactionTime 10
Damage (CallACS("vile_cbm_damage",50))
Radius 36
Height 56
Speed 33
Scale 2.5
States 
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveInventory("MeteorShotFlag",1)
JMTR P 0 A_CountDown
JMTR P 1 A_SpawnItemEx("JusticeMeteorThrowHitter",0,0,0,momx,momy,momz,0,SXF_ABSOLUTEVELOCITY)
TNT1 A 0 A_SpawnItemEx("TheJusticeMeteorFXPlayer",-20,0,29,0,0,0,0,1)
JMTR PQQ 1 A_SpawnItemEx("JusticeMeteorThrowHitter",0,0,0,momx,momy,momz,0,SXF_ABSOLUTEVELOCITY)
loop
Death:
TNT1 A 1
stop
Crash:
XDeath:
TNT1 A 1
stop
}
}

actor TheJusticeMeteorFXPlayer : BasicGraphicEffect
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_SpawnItemEx("TheJusticeMeteorFX",0,0,0,0,0,0,0,1)
stop
}
}


actor TheJusticeMeteorFX : BasicGraphicEffect
{
States
{
SpawnFrame:
TNT1 A 1
JMTR I 4
JMTR H 5
Goto Death
Death:
JMTR H 1 A_FadeOut(0.2)
Loop
}
}

actor MeteorShotFlag : Once {}

actor JusticeMeteorThrowHitter
{
Translation "198:198=192:192", "192:192=4:4", "199:199=194:194", "202:202=193:193"
Projectile
Damage (CallACS("vile_cbm_damage",25))
radius 64
height 64
damagetype "JusticeMeteor2"
Obituary "$OB_JUSTICEMETEOR"
+THRUGHOST
+NOINTERACTION
+SERVERSIDEONLY
+HITTRACER
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("MeteorShotFlag",1,"Spawn2")
stop
Spawn2:
TNT1 A 0 A_RearrangePointers(AAPTR_DEFAULT,AAPTR_TARGET,AAPTR_DEFAULT) //save target to master
TNT1 A 0 A_TransferPointer(AAPTR_MASTER,AAPTR_DEFAULT,AAPTR_MASTER,AAPTR_TARGET) //Master's master -> this thing's target
TNT1 A 0 A_ChangeFlag("NOINTERACTION",0)
TNT1 A 1
stop
XDeath:
Crash:
TNT1 AAAA 0 A_SpawnItemEx("JusticeMeteorDamageFX1",random(-80,80),random(-80,80),random(-80,80),momx*0.5,momy*0.5,momz*0.5,0,19)
TNT1 AAA 0 A_SpawnItemEx("JusticeMeteorDamageFX3",random(-80,80),random(-80,80),random(-80,80),random(-1,1),random(-1,1),random(-1,1),0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,4,12,-1,1,3,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-4,12,-1,-1,3,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,12,4,-1,3,1,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,12,-4,-1,3,-1,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,4,-12,-1,1,-3,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-4,-12,-1,-1,-3,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-12,4,-1,-3,1,0,1)
TNT1 A 0 A_SpawnItemEx("JusticeMeteorDamageFX2",0,-12,-4,-1,-3,-1,0,1)
TNT1 A 1 //A_PlaySoundEx("weapon/blizzstrike","Weapon")
TNT1 A 0 A_RemoveMaster
Death:
TNT1 A 1
stop
}
}

actor JusticeMeteorThrust_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(975,0)==2,"LMS")
TNT1 A 0 A_ChangeVelocity(4.25,0,0.55,1)//CVF_RELATIVE
stop
LMS:
TNT1 A 0 A_ChangeVelocity(3.125,0,0.55,1)//CVF_RELATIVE
stop
}
}


actor JusticeMeteorKnockback_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(975,0)==2,"LMS")
TNT1 A 0 A_SpawnItemEx("JusticeMeteorKnockback")
stop
LMS:
TNT1 A 0 A_SpawnItemEx("JusticeMeteorKnockback2")
stop
}
}

actor JusticeMeteorKnockback : Vile_KnockbackHelper
{
Mass 25
Accuracy 0
}

actor JusticeMeteorKnockback2 : Vile_KnockbackHelper
{
Mass 12
Accuracy 0
}

actor JusticeMeteorKnockbackKill : Vile_KnockbackHelper
{
Mass 40
Accuracy 0
}