//::///////////////////////////////////////////////
//:: Requirement check for Wild Mage
//::///////////////////////////////////////////////
/*
This script is fired when the level up screen is closed after a delay.

It checks that the character is only a level 2 wizard and a 16 int.
*/
//::///////////////////////////////////////////////
//:: Created By: 2DruNk2Frag
//:: Created On: 06-19-2008
//:: Last Update: 06-19-2008
//::///////////////////////////////////////////////

#include "2d2f_includes"

void main()
{
	object oPC = OBJECT_SELF;
	int nLvl = GetLevelByClass(10,oPC); //wizard
	int nInt = GetAbilityScore(oPC, ABILITY_INTELLIGENCE, TRUE);
	int nSubRace = GetSubRace(oPC);
		
	if(nSubRace == RACIAL_SUBTYPE_DROW ||
	nSubRace == RACIAL_SUBTYPE_SUN_ELF ||
	nSubRace == RACIAL_SUBTYPE_TIEFLING ||
	nSubRace == RACIAL_SUBTYPE_AIR_GENASI ||
	nSubRace == RACIAL_SUBTYPE_FIRE_GENASI)
	{
	   nInt = nInt + 2;
	}	
	
	if(nLvl == 2 && nInt >= 16 && GetHasFeat(FEAT_GENERALIST_WIZARD, oPC) == TRUE)
	{
    	//SendMessageToPC(oPC, "Wild Mage Requirements Met");
       	FeatAdd(oPC, FEAT_WILDMAGE_REQUIREMENTS, FALSE);
    	DelayCommand(1.0,FeatRemove(oPC, FEAT_GENERALIST_WIZARD));
	}
	else if(nLvl > 2 && GetHasFeat(FEAT_WILDMAGE_REQUIREMENTS, oPC) == TRUE)
	{
    	//SendMessageToPC(oPC, "Wild Mage Requirements Feat Removed");
    	FeatRemove(oPC, FEAT_WILDMAGE_REQUIREMENTS);
    	FeatAdd(oPC, FEAT_GENERALIST_WIZARD, FALSE);
	}
    		
	return;
}