//base squirrel sword script provided by NewDark
class ShSword extends SqRootScript
{

	function OnFrobInvBegin()
	{
		if (message().Abort)
			Weapon.FinishAttack(message().Frobber, message().SrcObjId);
		else
			Weapon.StartAttack(message().Frobber, message().SrcObjId);
	}

	function OnFrobInvEnd()
	{
		Weapon.FinishAttack(message().Frobber, message().SrcObjId);
	}

	function OnFrobToolBegin()
	{
		Weapon.StartAttack(message().Frobber, message().SrcObjId);
	}

	function OnFrobToolEnd()
	{
		Weapon.FinishAttack(message().Frobber, message().SrcObjId);
	}

	function OnInvSelect()
	{
		Weapon.Equip(self, eDarkWeaponType.kDWT_Sword);
		DrkInv.AddSpeedControl("SwordEquip", 0.7, 0.75);
		//Property.Set("Player", "breathconfig", "Recover Rate", 0);
		Property.Set("Player", "breathconfig", "Recover Rate", -3);
		SetData("stimer", SetOneShotTimer("SufTimer", 0.1));
	}

	function OnInvDeSelect()
	{
		Weapon.UnEquip(self);
		DrkInv.RemoveSpeedControl("SwordEquip");
		Property.Set("Player", "breathconfig", "Recover Rate", 5);
		//KillTimer(stimer);
	}
	
	function OnTimer()
	{
		local hitmax = Property.Get("Player", "MAX_HP");
		local diffair;
		if (hitmax==10)
			{
			SetData("diffair", 3000);
			}
		else
			{
			if (hitmax==13)
				{
				SetData("diffair", 3250);
				}
			else
			{
			SetData("diffair", 3500);
			}
			}
		local airsup = Property.Get("Player", "airsupply")
		{
		if (airsup<=0)
			{
			//Property.SetSimple("Player", "airsupply", airsup-3);
			Damage.Damage("Player", "WaterStim", 3, ObjID("WaterStim"));
			Property.SetSimple("Player", "airsupply", GetData("diffair"));
			}
		//else 
		//	{
		//	Damage.Damage("Player", "WaterStim", 3, ObjID("WaterStim"));
		//	Property.SetSimple("Player", "airsupply", 3000);
		//	}
		}
		SetData("stimer", SetOneShotTimer("SufTimer", 0.1));
	}
}

//BREATH DEFAULTS
//Normal 35000 3500 3 5.00  HP 16
//Hard   32500 3250 3 5.00  HP 13
//Expert 30000 3000 3 5.00  HP 10