#include "x2_inc_itemprop"
#include "x3_inc_skin"
#include "x3_inc_string"


void fnBlindness()
{ // PURPOSE: Handle Drow Blindness
    object oMe=OBJECT_SELF;
    object oArea=GetArea(oMe);
    int bDay=GetIsDay();
    int bBlindOn=GetLocalInt(oMe,"bBlindOn");
    effect eE;
    if (bBlindOn)
    { // currently blind
        if (bDay)
        { // possible to remain blind
            if (!GetLocalInt(oArea,"bOP")&&GetIsAreaAboveGround(oArea)&&!GetIsAreaInterior(oArea))
            { // remain blind
                eE=EffectAttackDecrease(2);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eE,oMe,2.1);
            } // remain blind
            else
            { // blind off
                DeleteLocalInt(oMe,"bBlindOn");
            } // blind off
        } // possible to remain blind
        else
        { // no more blindness
            DeleteLocalInt(oMe,"bBlindOn");
        } // no more blindness
    } // currently blind
    else
    { // not currently blind
        if (bDay)
        { // possible to be blinded
            if (!GetLocalInt(oArea,"bOP")&&GetIsAreaAboveGround(oArea)&&!GetIsAreaInterior(oArea))
            { // blind time
                SetLocalInt(oMe,"bBlindOn",TRUE);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectBlindness(),oMe,6.0);
                SendMessageToPC(oMe,StringToRGBString("The change in light intensity momentarily blinds you.  It continues to be painful to your eyes.","777"));
                eE=EffectAttackDecrease(2);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eE,oMe,2.1);
            } // blind time
        } // possible to be blinded
    } // not currently blind
    DelayCommand(2.0,fnBlindness());
} // fnBlindness()



void main()
{
/*     object oPC=OBJECT_SELF;
    itemproperty iProp;
    object oSkin=GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
    SetSkinInt(oPC,"bSetDrowProperties",TRUE);
    // set properties
    iProp=ItemPropertyAbilityBonus(ABILITY_INTELLIGENCE,2);
    IPSafeAddItemProperty(oSkin,iProp);
    iProp=ItemPropertyAbilityBonus(ABILITY_CHARISMA,1);
    IPSafeAddItemProperty(oSkin,iProp);
    DelayCommand(6.0,fnBlindness());
    SendMessageToPC(oPC,"Drow Properties have been applied to your character."); */
}