Class GHAGSwift : GHAGPokemonMove
{
	Default
	{
		Weapon.slotNumber 2;
		+Weapon.No_Auto_Switch;
		Weapon.SelectionOrder 3000;
	}
	
	Action bool A_CheckRageAmmo() 
	{
		if (GHAGGardevoir(self).RageValue <= 0) return false;
		return true;
	}
	
	override void DoEffect()
	{
		players[consoleplayer].WeaponState |= WF_WEAPONBOBBING;
		super.DoEffect();
	}
	
	states 
	{
		Select :
			SWFT A 1 A_Raise();
			Loop;
		Deselect :
			SWFT A 1 A_Lower();
			Loop;
		Ready :
			SWFT ABCD 3 Bright {
				A_WeaponReady();
			}
			Loop;
		Fire :
			TNT1 A 0 
			{
				int count = Int(Min(50, 10 * GHAGGardevoir(self).getRageModifier()));
				
				A_StartSound("attack/SWFTATTK", CHAN_WEAPON);
				A_FireProjectile("GHAGSwiftProjectile");
				while (count >= 1) {
					A_FireProjectile("GHAGSwiftProjectileSeeker", random(-10, 10), false, random(-10, 10), random(-10, 10), 0, random(-10, 10));
					--count;
				}
				
				GHAGGardevoir(self).subtractAnger(10);
				
			}
			SWFT FGHIJKL 4 A_SetTics(GHAGGardevoir(self).GetTicModifier(4));
			TNT1 A 0 A_Refire();
			Goto Ready;
	}
}

Class GHAGSwiftProjectile : Actor
{
	
	default
	{
		Radius 10;
		Height 10;
		Speed 40;
		Projectile;
		Scale 0.75;
		+NoExtremeDeath;
		+Randomize;
		DeathSound "attack/SWFTDEAT";
	}
	
	override void BeginPlay()
	{
		super.BeginPlay();
		
		Self.setDamage(10 + Int(40 * GHAGGardevoir(players[consoleplayer].mo).getRageModifier()));
	}
	
	States 
	{
		Spawn:
			SWFP ABCDEFGH 2 Bright
			{
				A_Weave(1, 1, 2, 2);
			}
			Loop;
		Death:
			SWFP A 1 {
				A_SpawnItemEx("GHAGSwiftDrop", 0, 0, 0, random(-5, 5), random(-5, 5), random(-5, 5), random(0, 360));
				A_SpawnItemEx("GHAGSwiftDrop", 0, 0, 0, random(-5, 5), random(-5, 5), random(-5, 5), random(0, 360));
				A_SpawnItemEx("GHAGSwiftDrop", 0, 0, 0, random(-5, 5), random(-5, 5), random(-5, 5), random(0, 360));
			}
			stop;
	}

}

Class GHAGSwiftProjectileSeeker : GHAGSwiftProjectile
{
	
	States 
	{
		Spawn:
			SWFP ABCDEFGH 2 Bright
			{
				A_Weave(1, 1, 2, 2);
				A_SeekerMissile(1, 45, SMF_LOOK | SMF_PRECISE, 256, 10);
			}
			Loop;
	}

}

Class GHAGSwiftDrop : Actor
{
	Default
	{
		Damage 0;
		Speed 5;
		-NoGravity;
		Scale 0.5;
	}
	States 
	{
		Spawn:
			SWFD ABCDABCDABCD 1 Bright;
		Death:
			Stop;
	}
}