actor Terra_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_VA"
Dropitem "SparkChaserWep"
weapon.ammouse 0
weapon.ammogive 112
obituary "$OB_TERRACHASER"
Inventory.Pickupmessage "Power up! Dirt power!"
weapon.ammotype "ChiaPetAmmo"
weapon.ammotype2 "StardustCrusaderAmmo"
inventory.icon "SCHSWI"
States
{
Spawn:
C_0V A 1
loop

Deselect:
T_RR A 0
goto DeselectSwap
Select:
T_RR A 0
goto SelectSwap

Ready:
T_RR A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_TERRA)
//T_RR B 0 A_GiveInventory("ShieldCheck",1)
//T_RR B 0 A_GiveInventory("Terra_SparkBuddyStart_P",1)//Sync isn't good, maybe later [Cel]
Goto Ready1

Ready1:
T_RR A 0 A_JumpIfInventory("ChiaPetAmmo",14,"Ready2")
T_RR A 0 A_JumpIfInventory("StardustCrusaderAmmo",14,"Ready3")
T_RR A 4 A_WeaponReady(12)
T_RR A 0 A_GiveInventory("ChiaPetAmmo",3)
T_RR A 0 A_GiveInventory("StardustCrusaderAmmo",1)
loop
Ready2:
T_RR A 0 A_JumpIfInventory("StardustCrusaderAmmo",14,"Ready4")
T_RR A 4 A_WeaponReady(8)
T_RR A 0 A_GiveInventory("ChiaPetAmmo",3)
T_RR A 0 A_GiveInventory("StardustCrusaderAmmo",1)
loop
Ready3:
T_RR A 0 A_JumpIfInventory("ChiaPetAmmo",14,"Ready4")
T_RR A 4 A_WeaponReady(4)
T_RR A 0 A_GiveInventory("ChiaPetAmmo",3)
T_RR A 0 A_GiveInventory("StardustCrusaderAmmo",1)
loop
Ready4:
T_RR A 4 A_WeaponReady
T_RR A 0 A_GiveInventory("ChiaPetAmmo",3)
T_RR A 0 A_GiveInventory("StardustCrusaderAmmo",1)
loop

Fire:
//T_RR B 0 A_GiveInventory("TerraBuddyFlag",1)
T_RR A 0 A_PlaySoundEX("weapon/TerraChaser","Weapon")
T_RR B 0 A_GiveInventory("Terra_ChaserDawdle",364)
T_RR B 0 A_GiveInventory("TerraCurrentRadius",1)
T_RR BB 1 offset(5,25)A_GiveInventory("Terra_MainfireStart_P")

T_RR BBBBB 1 offset(10,20)A_GiveInventory("Terra_MainfireStart_P")

FireH:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)//ChiaPetAmmo
Goto FireReturn
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,"FireH_IncSnd")
//T_RR B 0 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_ALTATTACK,"FireH_IncSnd")
T_RR B 1 offset(10,20)A_GiveInventory("Terra_MainfireHold_P")
T_RR B 0 A_Refire("FireH")
Goto FireReturn
FireH2:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)
Goto FireReturn
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,"FireH_DecSnd")
//T_RR B 0 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_ALTATTACK,"FireH_DecSnd")
T_RR B 1 offset(10,20)A_GiveInventory("Terra_MainfireHold_P")
T_RR B 0 A_Refire("FireH2")
Goto FireReturn

FireH_IncSnd://E offset(10,20)
T_RR B 0 A_PlaySoundEX("wep/CrysCharge4","Body")
FireH_Inc:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)
Goto FireReturn
T_RR E 1 offset(16,13)A_GiveInventory("Terra_MainfireHoldInc_P")
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,2)
T_RR B 0 A_Refire("FireH2")
Goto FireReturn
T_RR B 0 A_Refire("FireH_Inc2")
Goto FireReturn
FireH_Inc2:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)
Goto FireReturn
T_RR E 1 offset(16,13)A_GiveInventory("Terra_MainfireHoldInc_P")
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,2)
T_RR B 0 A_Refire("FireH2")
Goto FireReturn
T_RR B 0 A_Refire("FireH_Inc3")
Goto FireReturn
FireH_Inc3:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)
Goto FireReturn
T_RR B 1 offset(16,13)A_GiveInventory("Terra_MainfireHoldInc_P")
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,2)
T_RR B 0 A_Refire("FireH2")
Goto FireReturn
T_RR B 0 A_Refire("FireH_Inc5")
Goto FireReturn
FireH_Inc5:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)
Goto FireReturn
T_RR B 1 offset(16,13)A_GiveInventory("Terra_MainfireHoldInc_P")
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,2)
T_RR B 0 A_Refire("FireH2")
Goto FireReturn
T_RR B 0 A_Refire("FireH_Inc")
Goto FireReturn

FireH_DecSnd://F offset(-10,40)//offset(4,26)
T_RR B 0 A_PlaySoundEX("wep/CrysCharge1","Body")
FireH_Dec:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)
Goto FireReturn
T_RR E 1 offset(4,27)A_GiveInventory("Terra_MainfireHoldDec_P")
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,2)
T_RR B 0 A_Refire("FireH")
Goto FireReturn
T_RR B 0 A_Refire("FireH_Dec2")
Goto FireReturn
FireH_Dec2:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)
Goto FireReturn
T_RR E 1 offset(4,27)A_GiveInventory("Terra_MainfireHoldDec_P")
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,2)
T_RR B 0 A_Refire("FireH")
Goto FireReturn
T_RR B 0 A_Refire("FireH_Dec3")
Goto FireReturn
FireH_Dec3:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)
Goto FireReturn
T_RR B 1 offset(4,27)A_GiveInventory("Terra_MainfireHoldDec_P")
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,2)
T_RR B 0 A_Refire("FireH")
Goto FireReturn
T_RR B 0 A_Refire("FireH_Dec4")
Goto FireReturn
FireH_Dec4:
T_RR B 0 A_JumpIfInventory("Terra_ChaserDawdle",1,1)
Goto FireReturn
T_RR B 1 offset(4,27)A_GiveInventory("Terra_MainfireHoldDec_P")
T_RR B 0 A_JumpIfInventory("PressButton_Alt_F",1,2)
T_RR B 0 A_Refire("FireH")
Goto FireReturn
T_RR B 0 A_Refire("FireH_Dec")
Goto FireReturn

FireReturn:
T_RR B 1 offset(10,20)A_GiveInventory("Terra_MainfireEnd_P")
T_RR B 0 A_PlaySoundEX("weapon/TerraChaser2","Weapon")
ReturnWait:
T_RR B 1 offset(10,20)A_GiveInventory("Terra_MainfireEnd_P")
T_RR B 0 A_JumpIfInventory("TerraCurrentRadius",1,"ReturnWait")
//T_RR A 0 A_TakeInventory("TerraBuddyFlag",999)
T_RR A 2 offset(-4,42)A_PlaySoundEX("weapon/AdapterReturn","Body")
T_RR A 4 offset(-12,52)A_TakeInventory("Terra_ChaserDawdle")
T_RR A 2 offset(-7,42)
T_RR A 2 offset(-3,37)
goto Ready1

Altfire:
T_RR A 0 A_GiveInventory("VivifyDelay4")
T_RR A 0 A_ReFire(1)
T_RR A 2 offset(-10,40)A_GiveInventory("Terra_AltBoostCheck_P")
T_RR A 2 offset(-30,60)
T_RR A 8 offset(-40,70)
T_RR A 1 offset(-20,50)
T_RR A 1 offset(-10,40)
Goto Ready1
}
}

actor Terra_W2 : BaseMM8BDMWep_CBM
{
tag "$TAGC_VA2"
Dropitem "SparkChaserWep"
weapon.ammouse 0
weapon.ammogive 112
obituary "$OB_TERRACHASER"
Inventory.Pickupmessage "Power up! Soil power!"
weapon.ammotype "ChiaPetAmmo"
weapon.ammotype2 "StardustCrusaderAmmo"
inventory.icon "TERRA_I2"
States
{
Spawn:
C_0V A 1
loop

Deselect:
T_RR C 0
goto DeselectSwap
Select:
T_RR C 0
goto SelectSwap

Ready:
T_RR C 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_TERRA)
//T_RR C 0 A_TakeInventory("ShieldCheck",999)
Goto Ready1

Ready1:
T_RR C 0 A_JumpIfInventory("ChiaPetAmmo",112,"Ready2")
T_RR C 0 A_JumpIfInventory("StardustCrusaderAmmo",14,"Ready3")
T_RR C 4 A_WeaponReady(12)
T_RR C 0 A_GiveInventory("ChiaPetAmmo",3)
T_RR C 0 A_GiveInventory("StardustCrusaderAmmo",1)
loop
Ready2:
T_RR C 0 A_JumpIfInventory("StardustCrusaderAmmo",14,"Ready4")
T_RR C 4 A_WeaponReady(8)
T_RR C 0 A_GiveInventory("ChiaPetAmmo",3)
T_RR C 0 A_GiveInventory("StardustCrusaderAmmo",1)
loop
Ready3:
T_RR C 0 A_JumpIfInventory("ChiaPetAmmo",112,"Ready4")
T_RR C 4 A_WeaponReady(4)
T_RR C 0 A_GiveInventory("ChiaPetAmmo",3)
T_RR C 0 A_GiveInventory("StardustCrusaderAmmo",1)
loop
Ready4:
T_RR C 4 A_WeaponReady
T_RR C 0 A_GiveInventory("ChiaPetAmmo",3)
T_RR C 0 A_GiveInventory("StardustCrusaderAmmo",1)
loop

Fire:
T_RR D 0 A_GiveInventory("ShieldCheck",1)
T_RR D 0 A_GiveInventory("TerraChargeFlag",1)
T_RR D 0 A_ReFire(1)
//T_RR D 0 A_GiveInventory("ShieldCheck",1)
//T_RR D 0 A_SpawnItemEX("TerraNullOrbiterWarper",48,16,32,0,0,0,0,1)//TerraNullOrbiter_P
T_RR D 2 offset(10,40)A_GiveInventory("TerraNullOrbiter_P",1)//A_PlaySoundEX("weapon/TerraOrbiterCast","Weapon")
T_RR D 2 offset(20,50)
T_RR D 2 offset(30,60)
T_RR D 0 A_GiveInventory("TerraChargeFlag",8)
T_RR D 2 A_GunFlash("Flash",1)
//T_RR D 0 A_ReFire(1)
T_RR DDD 2 A_GiveInventory("TerraChargeFlag",8)
//T_RR D 0 A_ReFire(1)
T_RR DDD 2 A_GiveInventory("TerraChargeFlag",8)
ShieldHold:
T_RR D 0 A_JumpIfInventory("TerraChargeFlag",1,1)
Goto ShieldFire
T_RR D 1 A_TakeInventory("TerraChargeFlag",1)
T_RR D 0 A_Refire("ShieldHold")
ShieldFire:
T_RR D 0 A_GiveInventory("VivifyDelay3",1)
T_RR D 0 A_TakeInventory("TerraChargeFlag",999)
T_RR D 0 A_ReFire(1)
T_RR D 1 offset(17,44)
T_RR D 1 offset(2,27)A_GunFlash("NoFlash",1)
T_RR D 0 A_PlaySoundEx("weapon/TerraOrbiter","SoundSlot7")
T_RR D 0 A_TakeInventory("ShieldCheck",999)
T_RR D 5 offset(-10,10)A_GiveInventory("Terra_Fire2_P")
T_RR D 2 offset(-2,21)
goto Ready1


Altfire:
T_RR C 0 A_GiveInventory("VivifyDelay4")
T_RR C 0 A_ReFire(1)
T_RR C 2 offset(10,40)A_GiveInventory("Terra_AltBoostCheck_P")
T_RR C 2 offset(30,60)
T_RR C 8 offset(40,70)
T_RR C 1 offset(20,50)
T_RR C 1 offset(10,40)
Goto Ready1

Flash:
TNT1 A 1 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_ALTATTACK,2)
TNT1 A 0 A_JumpIfInventory("TerraChargeFlag",1,"Flash")
stop
TNT1 A 1 A_JumpIfInventory("StardustCrusaderAmmo",14,1)
loop
TNT1 A 2 A_GiveInventory("Terra_AltBoostCheck_P")
TNT1 A 2
TNT1 A 8
TNT1 A 1
TNT1 A 1
loop
}
} 

actor ChiaPetAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 112
+INVENTORY.IGNORESKILL
}

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

actor Terra_ChaserDawdle : Inventory
{
inventory.amount 1
inventory.maxamount 364
}

actor TerraChargeFlag : Inventory
{
inventory.amount 1
inventory.maxamount 56
}

actor TerraBuddyFlag : OnceC{}

actor Terra_ChaserVivify : Inventory
{
inventory.amount 1
inventory.maxamount 100
}
actor TerraCurrentRadius : Inventory
{
inventory.amount 1
inventory.maxamount 16
}


actor Terra_Fire2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("ChiaPetAmmo",56)
TNT1 A 0 A_TakeInventory("ChiaPetAmmo",56,1)
TNT1 A 0 A_PlaySoundEx("weapon/TerraOrbiter","SoundSlot7")
TNT1 A 0 A_TakeInventory("ShieldCheck",999)
TNT1 A 5 offset(-10,10)A_FireCustomMissile("Terra_NullOrbiter",0,0,0,8)
stop
}
}
actor Terra_MainfireBase_P : CustomInventory
{
States
{
P_End:
//TNT1 A 0 A_TakeInventory("ChiaPetAmmo",1,1)
TNT1 A 0 A_TakeInventory("Terra_ChaserDawdle",2)//1
TNT1 A 0 A_GiveInventory("Terra_MainfireSpawn_P")
stop
P_CheckAlt:
TNT1 A 0 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_ALTATTACK,2)
TNT1 A 0 A_TakeInventory("PressButton_Alt_F")
goto P_End
TNT1 A 0 A_GiveInventory("PressButton_Alt_F",1)
goto P_End
}
}
actor Terra_MainfireStart_P : Terra_MainfireBase_P
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("TerraCurrentRadius",1)
TNT1 A 0 A_TakeInventory("ChiaPetAmmo",2,1)
goto P_End
}
}
actor Terra_MainfireHold_P : Terra_MainfireBase_P
{
States
{
Pickup:
goto P_CheckAlt
}
}
actor Terra_MainfireEnd_P : Terra_MainfireBase_P
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("Terra_ChaserVivify",45)
TNT1 A 0 A_TakeInventory("Terra_ChaserDawdle",45)
TNT1 A 0 A_TakeInventory("TerraCurrentRadius",1)
TNT1 A 0 A_TakeInventory("PressButton_Alt_F")
goto P_End
}
}

actor Terra_MainfireHoldInc_P : Terra_MainfireBase_P
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("TerraCurrentRadius",16,"P_CheckAlt")//TERRA_MAXRAD
TNT1 A 0 A_GiveInventory("TerraCurrentRadius",1)
goto P_CheckAlt
}
}
actor Terra_MainfireHoldDec_P : Terra_MainfireBase_P
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("TerraCurrentRadius",3,2)
TNT1 A 0 A_JumpIfInventory("TerraCurrentRadius",2,"P_CheckAlt")//TERRA_MINRAD
TNT1 A 0 A_TakeInventory("TerraCurrentRadius",1)
goto P_CheckAlt
}
}

actor Terra_MainfireSpawn_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("TerraCurrentRadius",1,1)
stop
TNT1 A 0 A_GiveInventory("Terra_ChaserVivify",1)
TNT1 A 0 A_JumpIfInventory("Terra_ChaserVivify",32,"Pickup3")
TNT1 A 0 A_JumpIfInventory("Terra_ChaserVivify",29,"Pickup2")

TNT1 A 0 A_JumpIfInventory("Terra_ChaserVivify",25,"Pickup1")
TNT1 A 0 A_JumpIfInventory("Terra_ChaserVivify",21,"Pickup2")

TNT1 A 0 A_JumpIfInventory("Terra_ChaserVivify",17,"Pickup1")
TNT1 A 0 A_JumpIfInventory("Terra_ChaserVivify",13,"Pickup2")

TNT1 A 0 A_JumpIfInventory("Terra_ChaserVivify",9,"Pickup1")
TNT1 A 0 A_JumpIfInventory("Terra_ChaserVivify",5,"Pickup2")

Pickup1:
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaser1",cos(-pitch)*30*CallACS("cbm_countinv_acs",500),0,32+sin(-pitch)*30*CallACS("cbm_countinv_acs",500),0,0,0,0,33)
TNT1 A 0 A_JumpIfInventory("PlayerPropertySpread",1,1)
stop
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaser1",cos(-pitch)*30*CallACS("cbm_countinv_acs",500),0,32+sin(-pitch)*30*CallACS("cbm_countinv_acs",500),0,0,0,15,33)
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaser1",cos(-pitch)*30*CallACS("cbm_countinv_acs",500),0,32+sin(-pitch)*30*CallACS("cbm_countinv_acs",500),0,0,0,-15,33)
stop
Pickup3:
TNT1 A 0 A_GiveInventory("StardustCrusaderAmmo",1)
TNT1 A 0 A_TakeInventory("Terra_ChaserVivify")
Pickup2:
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaser2",cos(-pitch)*30*CallACS("cbm_countinv_acs",500),0,32+sin(-pitch)*30*CallACS("cbm_countinv_acs",500),0,0,0,0,33)
TNT1 A 0 A_JumpIfInventory("PlayerPropertySpread",1,1)
stop
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaser2",cos(-pitch)*30*CallACS("cbm_countinv_acs",500),0,32+sin(-pitch)*30*CallACS("cbm_countinv_acs",500),0,0,0,15,33)
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaser2",cos(-pitch)*30*CallACS("cbm_countinv_acs",500),0,32+sin(-pitch)*30*CallACS("cbm_countinv_acs",500),0,0,0,-15,33)
stop
}
}

actor Terra_SparkChaserProtect : PowerProtection
{
Powerup.Duration 5
DamageFactor "Terra_SparkChaser", 0.0
}

actor Terra_SparkChaser1 : BasicExplosion
{
Obituary "$OB_TERRACHASER"
DamageType "Terra_SparkChaser"
RenderStyle None
//+FORCEXYBILLBOARD
//+BRIGHT
//+EXPLODEONDEATH
//reactiontime 10
//scale 3.5
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaserFXA",0,0,0,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaserFX_H1",0,0,0,0,0,0,0,1)
Spawn0:
TNT1 A 0 A_Explode(0,38,0,0,38)//Do not remove
TNT1 AAA 2 A_Explode(43*(CallACS("core_checkrune",RUNE_RAGE,2)*2+1),38,0,0,38)
stop
}
}
actor Terra_SparkChaser2 : Terra_SparkChaser1
{
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaserFXB",0,0,0,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("Terra_SparkChaserFX_H2",0,0,0,0,0,0,0,1)
goto Spawn0
}
}


actor Terra_SparkChaserFX_H1 : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
ReactionTime 3
States
{
SpawnFrame:
TNT1 A 0
//TNT1 A 0 A_SpawnItemEx("Terra_SparkChaserFX1",0,0,0,0,0,0,0,1)

TNT1 A 1 A_SpawnItemEx("Terra_SparkChaserFX2",random(1,5),0,random(-4,4),random(4,5),0,random(-5,5),random(0,359),1,32)
T_RR TTTT 2 A_SpawnItemEx("Terra_SparkChaserFX2",random(1,5),0,random(-4,4),random(4,5),0,random(-5,5),random(0,359),1,96)
stop

SpawnOld://?
TNT1 A 1 A_SpawnItemEx("Terra_SparkChaserFX2",random(1,5),0,random(-4,4),random(4,5),0,random(-5,5),random(0,359),1,32)
Q_VA C 2 A_SpawnItemEx("Terra_SparkChaserFX2",random(3,6),0,random(-3,3),random(5,6),0,random(-5,5),random(0,359),1,32)
Q_VA C 0 A_SetScale(ScaleX, ScaleY - 0.5)
Q_VA C 2 A_SpawnItemEx("Terra_SparkChaserFX2",random(5,7),0,random(-2,2),random(6,7),0,random(-5,5),random(0,359),1,64)
Q_VA C 0 A_SetScale(ScaleX, ScaleY - 0.5)
Q_VA C 2 A_SpawnItemEx("Terra_SparkChaserFX2",random(7,8),0,random(-1,1),random(7,8),0,random(-5,5),random(0,359),1,96)
Q_VA C 0 A_SetScale(ScaleX, ScaleY - 0.5)
Q_VA C 2 A_SpawnItemEx("Terra_SparkChaserFX2",random(9,9),0,random(-0,0),random(8,9),0,random(-5,5),random(0,359),1,128)
stop
}
}
actor Terra_SparkChaserFX_H2 : Terra_SparkChaserFX_H1
{
//Scale 2.5
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 1 A_SpawnItemEx("Terra_SparkChaserFX3",random(1,5),0,random(-4,4),random(4,5),0,random(-5,5),random(0,359),1,32)
T_RR UUUU 2 A_SpawnItemEx("Terra_SparkChaserFX3",random(1,5),0,random(-4,4),random(4,5),0,random(-5,5),random(0,359),1,96)
stop
}
}

actor Terra_SparkChaserFX1 : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
Scale 1.0
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 1
Q_VA S 1
Q_VA SSSSS 1 A_SetScale(ScaleX - 0.15)
stop
}
}
actor Terra_SparkChaserFX2 : Terra_SparkChaserFX1
{
States
{
SpawnFrame:
Q_VA W 0
Q_VA WXV random(1,2)
stop
}
}
actor Terra_SparkChaserFX3 : Terra_SparkChaserFX1
{
States
{
SpawnFrame:
Q_VA N 0
Q_VA NOP random(1,2)
stop
}
}
actor Terra_SparkChaserFXA : Terra_SparkChaserFX1
{
Scale 3.5
States
{
SpawnFrame:
Q_VA A 0
Q_VA A 1
stop
}
}
actor Terra_SparkChaserFXB : Terra_SparkChaserFXA
{
States
{
SpawnFrame:
Q_VA B 0
Q_VA B 1
stop
}
}

actor TerraNullOrbiter_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_GiveInventory("ShieldCheck",1)
TNT1 A 0 A_SpawnItemEX("TerraNullOrbiterWarper",48,16,32,0,0,0,0,1)
TNT1 A 0 A_PlaySoundEX("weapon/TerraOrbiterCast","Weapon")
stop
}
}

actor TerraNullOrbiterWarper : ShieldWarper_CBM
{
-MISSILE
renderstyle none
states
{
Shield:
TNT1 A 0 A_SpawnItemEx("TerraNullOrbiterWarperFX",32,0,0,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("TerraNullOrbiterWarperFX",32,0,0,0,0,0,120,1)
TNT1 A 0 A_SpawnItemEx("TerraNullOrbiterWarperFX",32,0,0,0,0,0,240,1)
TNT1 A 0 A_ChangeFlag("MISSILE",1)
Shield2:
PLY1 A 1 A_Warp(2,48,16,32,0,8|64)
Loop
}
}

actor TerraNullOrbiterWarperFX : BasicGraphicEffect
{
states
{
SpawnFrame:
T_RR M 0
T_RR M 1
T_RR M 0 A_Warp(2,32,0,0,12,4|8|16,"SpawnFrame")
//TNT1 A 0 A_CheckFlag("NOGRAVITY","SpawnFrame",2)
stop
}
}

actor Terra_StopperProtect : PowerProtection
{
Powerup.Duration 120
DamageFactor "Terra_Stopper", 0.0
}

actor Terra_NullOrbiter : ProjSpawnFuncActor
{
var int user_angle;
PROJECTILE
translation "204:204=204:204","195:195=206:206"
Obituary "$OB_TERRASTUN"
DamageType "Terra_Stopper"
+THRUACTORS
+DONTREFLECT
RenderStyle None
damage (0)
Radius 8
Height 8
speed 40
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("Terra_NullOrbiterFX",32,0,0,0,0,momz*0.5,0+user_angle,1)
TNT1 A 0 A_SpawnItemEx("Terra_NullOrbiterFX",32,0,0,0,0,momz*0.5,120+user_angle,1)
TNT1 A 0 A_SpawnItemEx("Terra_NullOrbiterFX",32,0,0,0,0,momz*0.5,240+user_angle,1)

TNT1 A 1 A_SetUserVar("user_angle",user_angle+12)
TNT1 A 0 A_Explode(25,48,0,0,48)
loop
}
}

actor Terra_NullOrbiterFX : BasicGraphicEffect
{
+BRIGHT
states
{
SpawnFrame:
T_RR M 0
T_RR M 1 A_SpawnItemEX("Terra_NullOrbiterFX2",0,0,0,0,0,0,0,1)
stop
}
}

actor Terra_NullOrbiterFX2 : BasicGraphicEffect
{
+BRIGHT
alpha 0.5
renderstyle translucent
states
{
SpawnFrame:
TNT1 A 0
TNT1 A 1
//Q_VA AAAA 2 A_SetScale(scalex-0.5)
T_RR M 2 A_SetScale(scalex-0.5)
T_RR M 2 A_SetScale(scalex-0.5)
T_RR N 2
T_RR N 2 A_SetScale(scalex-0.5)
stop
}
}


actor Terra_AltBoostCheck_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(z-floorz==0,1)
goto PickupCheck
TNT1 A 0 ThrustThingZ(0,16,0,0)
goto PickupCheck
PickupCheck:
TNT1 A 0 A_JumpIf(CallACS("cbm_IsInputingMovement"),"Booster")
goto NoBoost
Booster:
TNT1 A 0 A_ChangeVelocity(sin(CallACS("cbm_FetchInputDir",0))*35,sin(CallACS("cbm_FetchInputDir",1))*-35,momz,3)
goto End
NoBoost:
TNT1 A 0 ThrustThingZ(0,26,0,1)
goto End

End:
TNT1 A 0 ThrustThingZ(0,12,0,1)

TNT1 A 0 A_SpawnItemEX("TerraDashFX_H",0,0,0,0,0,0,0,1)

TNT1 A 0 A_PlaySound("weapon/TerraQuickDash",4,0.875)//weapon/BurnerDive
TNT1 A 0 A_GiveInventory("ChiaPetAmmo",8)
TNT1 A 0 A_TakeInventory("StardustCrusaderAmmo",3)
TNT1 A 0 A_TakeInventory("StardustCrusaderAmmo",11,1)
stop
}
}

actor TerraDashFX_H : BasicHelper
{
//translation "192:192=117:117"
reactiontime 5
States
{
Spawn:
TNT1 A 0
TNT1 A 1
TNT1 A 1 A_GiveToTarget("TerraDashFX_P")
TNT1 A 1 A_CountDown
Loop
}
}

actor TerraDashFX_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TerraDashFX",0,0,0,0,0,0,0,1)
stop
}
}

actor TerraDashFX : BasicGraphicEffect
{
+NOBLOCKMAP
+BRIGHT
Alpha 0.99
Speed 50
States
{
SpawnFrame:
T_RR W 0
T_RR W 2
T_RR W 2 A_FadeOut(0.2)
wait
}
}

actor Terra_SparkBuddyStart_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEX("Terra_SparkBuddy",-16,-32,32,0,0,0,0,1)
stop
}
}

actor Terra_SparkBuddy : ShieldWarper_CBM
{
States
{
Shield:
Q_VA A 0 A_JumpIfInTargetInventory("TerraBuddyFlag",1,"Hidden")
Q_VA AAA 1 A_Warp(2,-16,-32,32,0,24)
Q_VA B 0 A_JumpIfInTargetInventory("TerraBuddyFlag",1,"Hidden")
Q_VA BBB 1 A_Warp(2,-16,-32,32,0,24)
Goto Shield
Hidden:
TNT1 A 1 A_Warp(2,-16,-32,32,0,24)
goto Shield
}
}

actor Terra_W_NormalBar : NormalBar {Args 104,198}//117,74
actor Terra_W_SecondBar : SecondBar {Args 4,117}
actor Terra_W_ScriptBar : ScriptBar {}
actor Terra_W2_NormalBar : NormalBar {Args 104,198}
actor Terra_W2_SecondBar : SecondBar {Args 4,117}
actor Terra_W2_ScriptBar : ScriptBar {}