////////////////////////////////////////////////////////////////////////////////
// Agernis' Talisman of Weather's Fury
////////////////////////////////////////////////////////////////////////////////
void main()
{
   object oPC=GetItemActivator();
   object oMe=GetItemActivated();
   object oTarget=GetItemActivatedTarget();
   object oNeck=GetItemInSlot(INVENTORY_SLOT_NECK,oPC);
   if (oNeck==oMe)
   { // wearing the amulet
     if (oPC!=oTarget)
     { // not target self
       if (oTarget!=OBJECT_INVALID)
       { // !OI
         if (GetWeather(GetArea(oPC))==WEATHER_SNOW)
         { // it is snowing
           AssignCommand(oPC,ClearAllActions(TRUE));
           AssignCommand(oPC,ActionCastSpellAtObject(SPELL_ICE_STORM,oTarget,METAMAGIC_ANY,TRUE,15));
         } // it is snowing
         else if (GetWeather(GetArea(oPC))==WEATHER_RAIN)
         { // it is raining
           AssignCommand(oPC,ClearAllActions(TRUE));
           AssignCommand(oPC,ActionCastSpellAtObject(SPELL_CALL_LIGHTNING,oTarget,METAMAGIC_ANY,TRUE,15));
         } // it is raining
         else
         { SendMessageToPC(oPC,"The current weather is not viable for the talisman to cast hostile magic with."); }
       } // !OI
       else { SendMessageToPC(oPC,"You must target another creature to use the talisman on."); }
     } // not target self
     else { SendMessageToPC(oPC,"You cannot use the talisman on yourself!"); }
   } // wearing the amulet
   else { SendMessageToPC(oPC,"You must be wearing the talisman to use its powers!"); }
}