actor TimeArrowWep_NormalBar : NormalBar { args 32, 239 }
actor TimeArrowWep_ScriptBar : ScriptBar {}

actor TimeArrowWep : BaseMM8BDMWep
{
Weapon.AmmoUse 1
Weapon.AmmoGive 28
Weapon.SlotNumber 2
Inventory.Pickupmessage "$PU_TIMEARROW"
Obituary "$OB_TIMEARROW"
Tag "$TAG_TIMEARROW"
weapon.ammotype "TimeArrowAmmo"
Inventory.Icon "TARRICON"
States
{
SpawnLoop:
TARR Z -1
loop
Ready:
TARR H 0 ACS_NamedExecuteWithResult("core_weaponcolor", COLOR_TIMEARROW)
TARR H 1 A_WeaponReady
goto Ready+1
ReadyC: Goto Ready+1
Deselect:
TARR H 0
goto DeselectSwap
Select:
TARR H 0
goto SelectSwap

Fire:
TARR H 0 A_JumpIfNoAmmo("NoAmmo")
TARR H 1
TARR H 0 A_Refire("Hold")
Goto Fire1
Altfire:
TARR A 0 A_JumpIfInventory("Vile_ClassAltfire", 1, "ClassAltfire")
TARR A 0 A_JumpIf(CallACS("Vile_class_altfire"), "ClassAltfire")
TARR A 1 A_JumpIfInventory("MM8BDMPlayer", 1, 1)
wait
TARR H 0 A_JumpIfNoAmmo("NoAmmo")
TARR H 0 ACS_NamedExecuteWithResult("core_chargecolor",COLOR_TIMEARROW)
TARR H 0 A_PlaySoundEx("weapon/timeshot","Weapon")
TARR H 0 A_FireCustomMissile("TimeArrow",random(-7,-5),1,8,0)
TARR H 0 A_FireCustomMissile("TimeArrow",random(5,7),0,8,0)
TARR H 0 A_TakeInventory("WeaponCharge",999)
TARR IJ 3
TARR H 4
goto Ready+1
ClassAltfire:
TARR A 0 
goto Super::Altfire
Fire1:
TARR H 0 A_JumpIfNoAmmo("NoAmmo")
TARR H 0 ACS_NamedExecuteWithResult("core_chargecolor",COLOR_TIMEARROW)
TARR H 0 A_PlaySoundEx("weapon/timeshot","Weapon")
TARR H 0 A_FireCustomMissile("TimeArrow",random(-7,-5),1,8,0)
TARR H 0 A_FireCustomMissile("TimeArrow",random(5,7),0,8,0)
TARR H 0 A_TakeInventory("WeaponCharge",999)
TARR IJ 3
TARR H 4
TARR H 0 A_Refire
goto Ready+1
BotRefire:
TARR H 0 A_Jump(224, 2)
TARR H 0 A_Refire
TARR H 0 
Goto Ready+1
Hold:
//TARR H 0 A_JumpIfInventory("WeaponCharge",34,"Charge2Start")
TARR H 0 A_JumpIfNoAmmo("NoAmmo")
TARR H 0 A_JumpIfInventory("WeaponCharge",18,"Charge")
TARR H 1 A_GiveInventory("WeaponCharge",1)
TARR H 0 A_Refire
Goto Fire1
Charge:
TARR H 0 A_JumpIfInventory("WeaponCharge",19,"Charge1")
TARR H 0 A_PlaySoundEx("weapon/coilstart","Weapon")
Goto Charge1
BotFire:
TARR H 0 A_Jump(16, "Fire2")
TARR H 0 A_Refire("Charge2")
Goto Fire2
Charge1:
TARR K 0 A_JumpIfInventory("WeaponCharge",35,"Charge2Start")
TARR K 1 ACS_NamedExecuteWithResult("core_chargecolor",COLOR_TIMEARROWCHARGE1)
TARR K 0 A_Refire("Charge1.a")
Goto Fire1
Charge1.a:
TARR H 1 ACS_NamedExecuteWithResult("core_chargecolor",COLOR_TIMEARROW)
TARR H 0 A_GiveInventory("WeaponCharge",1)
TARR H 0 A_Refire("Charge1")
Goto Fire1
Charge2Start:
TARR H 0 A_GunFlash("Sound.BusterCharge", GFF_NOEXTCHANGE)
Goto Charge2
Charge2:
TARR L 1 ACS_NamedExecuteWithResult("core_chargecolor",COLOR_TIMEARROWCHARGE2)
TARR L 0 A_Refire("Charge2.a")
Goto Fire2
Charge2.a:
TARR M 1 ACS_NamedExecuteWithResult("core_chargecolor",COLOR_TIMEARROWCHARGE3)
TARR M 0 A_Refire("Charge2.b")
Goto Fire2
Charge2.b:
TARR H 1 ACS_NamedExecuteWithResult("core_chargecolor",COLOR_TIMEARROW)
TARR H 0 A_JumpIfInventory("IsBot", 1, "BotFire")
TARR H 0 A_JumpIfInventory("WeaponCharge", 35, 2)
TARR H 0 A_GiveInventory("WeaponCharge",1)
TARR H 0 A_Refire("Charge2")
Goto Fire2

Fire2:
TARR A 0 A_JumpIfInventory("TimeArrowAmmo", 7, 1)
Goto Fire1
TARR H 0 A_JumpIfInventory("WeaponCharge", 35, "Fire3")
Goto Fire1
Fire3:
TARR H 0 A_ScaleVelocity(0.5)
TARR H 0 A_TakeInventory("TimeArrowAmmo", 7, TIF_NOTAKEINFINITE)
TARR H 1 Offset(0, 48)
TARR H 0 ACS_NamedExecuteWithResult("core_chargecolor",COLOR_TIMEARROW)
TARR H 1 Offset(0, 64)
TARR H 1 Offset(0, 80)
TNT1 A 1 A_WeaponReady(WRF_NOSWITCH|WRF_NOFIRE)
TNT1 A 0 A_TakeInventory("WeaponCharge", 35)
TNT1 A 0 A_PlaySoundEx("weapon/timeshot","Weapon")
TNT1 A 0 A_FireCustomMissile("TimeArrowDisperse",0,0,8,0)
TNT1 A 0 ACS_NamedExecuteAlways("core_whiteflash",0)
ASLO JK 2
ASLO LM 2
ASLO N 3
TNT1 A 3
TARR H 1 Offset(0, 80)
TARR H 1 Offset(0, 64)
TARR H 1 Offset(0, 48)
TARR H 1 A_WeaponReady(WRF_NOSWITCH|WRF_NOFIRE)
TARR C 0 A_JumpIfInventory("IsBot", 1, "BotClear")
goto Ready+1
BotClear:
TARR C 0 A_ClearRefire
Goto Ready+1
NoAmmo: 
TARR H 1 ACS_NamedExecuteAlways("core_noammo",0)
TARR H 0 A_TakeInventory("WeaponCharge", 35)
goto Ready+1
}
}

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

actor TimeArrowSlowish : BasicExplosion
{
-SOLID
+NOGRAVITY
+DONTBLAST
PROJECTILE
+BRIGHT
damage 0
radius 1
height 1
damagetype "TimeSlow"
Obituary "$OB_TIMEARROW"
Scale 3.34
+FORCEXYBILLBOARD
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("TimeArrowVisualFX", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
TNT1 A 1 A_Explode(CallACS("vile_cbm_damage",10), 256,0, 0, 256)
SLOD EFGHIJKLMNEFGHIJKLMN 1
stop
}
}

actor TimeArrowDisperse : BasicProjectile
{
+HEXENBOUNCE
damagetype "TimeSlow"
Obituary "$OB_NEONFLASH"
+NOTARGETSWITCH
Speed 50
+RIPPER
Damage (0)
radius 24
height 24
scale 2.5
States
{
Spawn:
TARO A 0
TARO CDEFGHIJI 2 A_ScaleVelocity(0.7)
TARO KL 2 A_SpawnItemEx("TimeArrowVisualFX", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
goto XDeath
XDeath:
TNT1 A 0 A_SpawnItemEx("TimeArrowSlowish",0,0,32)
TNT1 A 0 A_PlaySoundEx("weapon/slow","Weapon")
STOP
Death:
TNT1 A 0
stop
}
}

actor TimeArrow : BasicProjectile
{
PROJECTILE
Damage (CallACS("vile_cbm_damage",14))
Height 7
Radius 6
+FORCEXYBILLBOARD
//+RIPPER
Scale 2.5
speed 32
Obituary "$OB_TIMEARROW"
damagetype "TimeArrow"
States
{
Spawn:
TARO AAB 3 //ACS_Execute(979,0)
TARO A 0 A_SpawnItemEx("TimeSlowArrowFX", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
loop
}
}

actor TimeSlowArrowFX : TimeSlowGFX
{
Alpha 0.5
States
{
Spawn:
SLOD DCBA 4 A_Fadeout(0.1)
loop
}
}

actor TimeArrowVisualFX : BasicGraphicEffect
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	+FORCEXYBILLBOARD
	-SOLID
	scale 2.5
	height 1
	radius 1
	reactiontime 60
	var int user_angle;
	States
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 A_SetUserVar("user_angle", random(0, 6))
		SpawnLoop:
		TNT1 A 0 A_SpawnItemEx("TimeSlowArrowFX", 256, 0, 0, 0, 0, Random(-2, 2), user_angle, SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION|SXF_TRANSFERTRANSLATION)
		TNT1 A 0 A_SetUserVar("user_angle", user_angle + 6)
		TNT1 A 0 A_Countdown
		loop
		Death:
		TNT1 A 0
		stop
	}
}