//////////////////////////////////////////////////////
//	Author: Drammel									//
//	Date: 3/28/2009									//
//	Title: feat_desert_fire							//
//	Description: If you move at least 10 feet from	//
//	your original position, you deal an extra 1d6	//
//	points of fire damage with any attack you make	//
//	with a Desert Wind weapon.						//
//////////////////////////////////////////////////////

#include "bot9s_inc_variables"

void RunDesertFire()
{
	object oPC = OBJECT_SELF;
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	object oMyWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
	location lPC = GetLocation(oPC);
	location lLast = GetLastLocationOfCreature(oPC);

	SetLocalInt(oToB, "DFActive", 1);

	if ((GetLocalInt(oToB, "DesertWindStrike") == 1) && (GetDistanceBetweenLocations(lPC, lLast) >= FeetToMeters(10.0f)))
	{
		effect eFire = EffectDamageIncrease(DAMAGE_BONUS_1d6, DAMAGE_TYPE_FIRE);
		eFire = SupernaturalEffect(eFire);
		ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFire, oPC, 5.5f);
	}
	DelayCommand(6.0f, RunDesertFire());
}

void main()
{
	object oPC = OBJECT_SELF;
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);

	if (GetLocalInt(oToB, "DFActive") == 1)
	{
		return; // Prevents duplicate checks.
	}
	else if (GetLocalInt(oToB, "DFActive") == 0)
	{
		RunDesertFire();
	}
}