Class GHAGWeapon : Weapon
{

	Default
	{
		+BloodSplatter;
		Weapon.SlotPriority 2;
	}
	
	Name pufftype;
	
	override void BeginPlay()
	{
		Super.BeginPlay();
		
		pufftype = 'BulletPuff';
	}
	
	action void A_GHAGLower(int _lowerspeed = 6)
	{
		GHAGGardevoir(invoker.owner).hiding = true;
		A_Lower(_lowerspeed);
	}
	
	action void A_GHAGRaise(int _raisespeed = 6)
	{
		GHAGGardevoir(invoker.owner).hiding = false;
		A_Raise(_raisespeed);
	}
	
	override bool TryPickup (in out Actor toucher)
	{
		bool result;
		State ReadyState = FindState('Ready');
		if (ReadyState != NULL && ReadyState.ValidateSpriteFrame())
		{
			result = Super.TryPickup (toucher);
			GHAGGardevoir(toucher).updateWeapons = true;
			return result;
		}
		
		return false;
	}
	
	int lastRNG;
	
	override bool CheckAmmo(int fireMode, bool autoSwitch, bool requireAmmo, int ammocount)
	{
		bool result = Super.CheckAmmo(fireMode, autoSwitch, requireAmmo, ammocount);
		
		SetBulletPuff(firemode);
		
		return result;
	}
	
	virtual void SetBulletPuff(int firemode)
	{
	
	}
	
	void A_FireFloatGuns(StateLabel _state, bool _altFire = false)
	{
		
	}
	
	int getGunCount()
	{
		return 0;
	}

	mixin GHAGIcePunch;

	States
	{
		Select:
			TNT1 A 1 A_Raise();
			Loop;
		Deselect:
			TNT1 A 1 A_Lower();
			Loop;
		Fire:
			TNT1 A 1;
			TNT1 A 1 A_Refire();
			goto Ready;
		Ready:
			TNT1 A 1;
			stop;
	
		User1:
			#### A 0 A_IcePunchPrecalc();
		IcePunchSwing:
			#### A 1;
			#### A 0
			{
				if (GHAGGardevoir(self).IcePunchTarget && distance3d(GHAGGardevoir(self).IcePunchTarget) > 128 && invoker.IcePunchGetSpeed() > 16.0)
				{
					return resolveState("IcePunchSwing");
				}
				return resolveState(null);
			}
			#### A 0 A_StartSound("fists/ICEPUNCH", CHAN_AUTO);
			#### AAA 2 {
				A_OverlayIcePunch();
			}
			#### AA 2
			{
				A_OverlayIcePunch();
				A_IcePunch();
			}
			#### A 1
			{
				A_ClearOverlays(2, 2);
				GHAGGardevoir(self).IcePunchTarget = null;
			}
			#### A 0 A_Jump(256, "Ready");
			stop;
		IcePunch.Overlay:
			IPUN AB 3 A_SetTics(GHAGGardevoir(self).GetTicModifier(3));
			IPUN C 4;
			IPUN DEF 4 A_SetTics(GHAGGardevoir(self).GetTicModifier(4));
			stop;
	}
}

Class GHAGPokemonMove : GHAGWeapon
{
	Default
	{
		Weapon.SlotPriority 1;
		Inventory.PickupSound "attack/LEARNED";
		+FloatBob;
	}
}

Class GHAGBulletPuff : BulletPuff
{
	Default
	{
		+ExtremeDeath;
	}
}