// Special Abilities database file
// The line above **must** be the first line of the special abilities file!!!
// Sample:
// \(BEGIN)
// name = Bless
// [Activation Script] = $PUBLIC $FUNC SA_Bless  // Script names in []
// -{   //  Continuations start with hyphen
// -  $RETURN $SET_CHAR_BLESS($IndexOf($Target()),true)
// -} SA_Bless;
// (parameterA) = 5    // parameter names in ()
// \(END)

\(BEGIN)
name = $EVENT_WhoTries_Attempt
[Ability] = $VAR abLevel;
-$VAR abName;
-$VAR me; // character who is trying
-$VAR abNeed;
-$VAR abDie;
-abName = $GET_HOOK_PARAM(5);
-abNeed = $GET_HOOK_PARAM(6);
-me = $IndexOf($Myself());
-$DEBUG ("Ability name = " + abName);
-$IF (abName == "Strength"){abLevel = $GET_CHAR_LIMITED_STR(me);}
-$ELSE
-	{
-		$IF (abName == "Intelligence"){abLevel = $GET_CHAR_LIMITED_INT(me);}
-		$ELSE
-			{
-				$IF (abName == "Wisdom"){abLevel = $GET_CHAR_LIMITED_WIS(me);}
-				$ELSE
-					{
-						$IF (abName == "Dexterity"){abLevel = $GET_CHAR_LIMITED_DEX(me);}
-						$ELSE
-							{
-								$IF (abName == "Constitution"){abLevel = $GET_CHAR_LIMITED_CON(me);}
-								$ELSE
-									{
-										$IF (abName == "Charisma"){abLevel = $GET_CHAR_LIMITED_CHA(me);}
-										$ELSE {$RETURN "N";};
-									};
-							};
-					};
-			};
-	};
-$IF (abNeed <# 0)
-	{
-		abDie = $RANDOM (0 -# abNeed);
-$DEBUG ($SA_NAME()+" abDie = "+abDie);
-		$IF (abLevel <# abDie){$RETURN "N";};
-	};
-$DEBUG ($SA_NAME()+"/Ability, Ability = "+abName+", value = "+abNeed+", actual value = "+abLevel);
-$IF (abLevel <# abNeed){$RETURN "N";};
[Experience] = $VAR me;
-$VAR cls; // class
-$VAR lvl; // level
-$VAR par0;
-$VAR par5;
-$VAR par6;
-me = $MyIndex();
-cls = $GetHighestLevelBaseclass(me);
-lvl = $GetBaseclassLevel(me,cls);
-par0 = $GET_HOOK_PARAM(0);
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$DEBUG ($SA_NAME()+"/Experience, par0 = "+par0+", name = "+par5+", level needed = "+par6+", level = "+lvl);
-$IF (lvl <# par6){$RETURN "N";};
[NightSkill] = $VAR time;
-$VAR par0;
-$VAR skillName;
-$VAR skillLevel;
-$VAR skillNeed;
-$VAR skillDie;
-time = $GET_PARTY_HOURS();
-par0 = $GET_HOOK_PARAM(0);
-skillName = $GET_HOOK_PARAM(5);
-skillLevel = $SkillAdj($CharacterContext(),skillName,"","F",0);
-skillNeed = $GET_HOOK_PARAM(6);
-$IF (skillNeed <# 0)
-	{
-		skillDie = $RANDOM (0 -# skillNeed);
-$DEBUG ($SA_NAME()+" skillDie = "+skillDie);
-		$IF (skillLevel <# skillDie){$RETURN "N";};
-	};
-$DEBUG ($SA_NAME()+"/NightSkill, par0 = "+par0+", skillName = "+skillName+", skillNeed = "+skillNeed+", skillLevel = "+skillLevel);
-$DEBUG ($SA_NAME()+"/NightSkill, time = " + time);
-$IF (time ># 6 && time <# 18){$RETURN "N";};
-$IF (skillLevel <# skillNeed){$RETURN "N";};
[Skill] = $VAR skillLevel;
-$VAR skillName;
-$VAR skillNeed;
-$VAR skillDie;
-skillName = $GET_HOOK_PARAM(5);
-skillNeed = $GET_HOOK_PARAM(6);
-skillLevel = $SkillAdj($CharacterContext(),skillName , "", "F", 0 );
-$IF (skillNeed <# 0)
-	{
-		skillDie = $RANDOM (0 -# skillNeed);
-$DEBUG ($SA_NAME()+" skillDie = "+skillDie);
-		$IF (skillLevel <# skillDie){$RETURN "N";};
-	};
-$DEBUG ($SA_NAME()+"/Skill, skill = "+skillName+", value = "+skillNeed+", actual value = "+skillLevel);
-$IF (skillLevel <# skillNeed){$RETURN "N";};
\(END)

\(BEGIN)
name = AbilityAdjustments
<DexInit> = 3
-2
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
--1
--2
--3
--3
--3
--4
--4
--4
--5
--5
<IntSpellsMax> = 6
-7
-7
-7
-9
-9
-11
-11
-14
-18
-255
-255
-255
-255
-255
-255
-255
<IntSpellsMin> = 4
-5
-5
-5
-6
-6
-7
-7
-8
-9
-10
-12
-13
-14
-15
-16
-17
<IntSpellsSuccess> = 35
-45
-45
-45
-55
-55
-65
-65
-75
-85
-95
-96
-97
-98
-99
-100
-100
\(END)

\(BEGIN)
name = baseclass_NameSuppress
[DisplayCharacterBaseclass] = $VAR par;
-par = $SA_PARAM_GET();
-$IF (par != "-?-?-")
-	{
-		$SET_HOOK_PARAM(5,"Level/XP");
-		$RETURN;
-	};
\(END)

\(BEGIN)
name = casterLevel
[SpellCasterLevel] = $VAR atk; // attacker
-$VAR name;
-$VAR list;
-$VAR cls; // class of spell caster
-$VAR adj; // level modifier
-$VAR lvl; // level
-atk = $IndexOf($AttackerContext());
-name = $GET_CHAR_NAME(atk);
-list = $SA_PARAM_GET();
-cls = $DelimitedStringSubstring(list,0);
-adj = $DelimitedStringSubstring(list,1);
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$IF (cls == "monster"){$RETURN $GET_MONSTERTYPE_SA(name,"monsterLevel");};
-$IF (cls == "item"){$RETURN adj;}
-$ELSE {$RETURN lvl;};
\(END)

\(BEGIN)
name = class_Assassin
\(END)

\(BEGIN)
name = class_baseName
[PostCreateCharacter] = $SET_CHARACTER_SA($CharacterContext(), "class_baseName", $SA_PARAM_GET());
\(END)

\(BEGIN)
name = class_ClassSuppress
[SelectCharacterClass] = $RETURN "Y";
\(END)

\(BEGIN)
name = class_MageScribe
[CanScribeOrWhatever] = $SET_HOOK_PARAM(5,"SCRIBE");
-$SET_HOOK_PARAM(6,0);
[KnowableSpells] = $RETURN "100";
[KnowableSpellsMinMax] = $SET_HOOK_PARAM(7,"999999");
-$SET_HOOK_PARAM(8,"999999");
-$SET_HOOK_PARAM(9,"999999");
[AD&DKnowableSpellsMinMax] = $VAR param;
-$VAR par4;
-$VAR par5;
-$VAR par6;
-$VAR intMin;
-$VAR intMax;
-$VAR char;
-$VAR muLvl;
-param = $SA_PARAM_GET();
-par4 = $GET_HOOK_PARAM(4);
-par4 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-intMin = $IntegerTable("AbilityAdjustments","IntSpellsMin",par5 -# 9,"Index");
-intMax = $IntegerTable("AbilityAdjustments","IntSpellsMax",par5 -# 9,"Index");
-char = $IndexOf($CharacterContext());
-muLvl = $GET_CHAR_Lvl(char,param);
-$IF (par4 == "I")
-	{
-		$IF (par6 !=# 1)
-			{
-				$SET_HOOK_PARAM(7, intMin);
-				$SET_HOOK_PARAM(8, intMax);
-				$SET_HOOK_PARAM(9, "999999");
-				$RETURN "2";
-			}
-		$ELSE
-			{
-				$SET_HOOK_PARAM(7, intMin -# 2);
-				$SET_HOOK_PARAM(8, intMax -# 2);
-				$SET_HOOK_PARAM(9, "999999");
-				$RETURN "1";
-			};
-	};
-$IF (par4 == "L")
-	{
-		$IF (muLvl ># 18){muLvl = 19;};
-		$IF (par6 !=# $IntegerTable("class_Spells","magicUserTrain",muLvl -# 1,"Index"))
-			{
-				$SET_HOOK_PARAM(7, 0);
-				$SET_HOOK_PARAM(8, 0);
-				$SET_HOOK_PARAM(9, "999999");
-				$RETURN "0";
-			}
-		$ELSE
-			{
-				$SET_HOOK_PARAM(7, intMin);
-				$SET_HOOK_PARAM(8, intMax);
-				$SET_HOOK_PARAM(9, "999999");
-				$RETURN "0";
-			};
-	};
[LearnSpells] = $RETURN "100";
[LearnSpellsNum] = $VAR char;
-$VAR param;
-$VAR muLvl;
-$VAR canKnow;
-$VAR lvl;
-$VAR spl;
-$VAR sLvl;
-$VAR par4;
-$VAR par6;
-char = $IndexOf($CharacterContext());
-param = $SA_PARAM_GET();
-muLvl = $GET_CHAR_Lvl(char,param);
-canKnow = "#$2$0$0$0$0$0$0$0$0#$3$0$0$0$0$0$0$0$0#$3$2$0$0$0$0$0$0$0#$4$3$0$0$0$0$0$0$0#$4$3$2$0$0$0$0$0$0#$5$3$3$0$0$0$0$0$0#$5$4$3$2$0$0$0$0$0#$5$4$4$3$0$0$0$0$0#$5$5$4$3$2$0$0$0$0#$6$5$4$3$3$0$0$0$0#$6$6$5$4$4$0$0$0$0#$6$6$5$5$5$2$0$0$0#$7$6$6$5$5$3$0$0$0#$7$7$6$5$5$3$2$0$0#$7$7$6$6$6$4$2$0$0#$7$8$6$6$6$4$3$2$0#$7$8$6$6$6$4$4$3$0#$7$8$6$6$6$4$4$3$2#$7$8$7$6$6$4$4$4$2#$7$8$7$6$6$5$4$4$3#$7$8$7$6$6$5$5$5$3#$7$8$7$6$6$6$5$5$4#$7$8$7$6$6$6$6$6$4#$7$8$7$6$6$6$6$6$5#$7$9$7$6$6$6$6$6$6#$8$9$8$7$6$6$6$6$6#$8$9$8$7$7$7$7$6$6#$8$9$8$7$7$7$7$7$7#$9$10$9$8$7$7$7$7$7#$9$10$9$8$8$8$8$7$7#$9$10$9$8$8$8$8$8$8#$10$11$10$9$8$8$8$8$8#$10$11$10$9$9$9$9$8$8#$11$12$11$10$9$9$9$9$9#$11$12$12$11$9$9$9$9$9#$11$12$12$11$10$10$10$9$9#$11$12$12$11$10$10$10$10$10#$12$13$12$11$10$10$10$10$10#$12$13$12$11$11$11$11$10$10#$12$13$12$11$11$11$11$11$11";
-lvl = $DelimitedStringSubstring(canKnow,muLvl -# 1);
-sLvl = $IntegerTable("class_Spells","magicUserLvl",muLvl -# 1,"Index");
-par4 = $GET_HOOK_PARAM(4);
-par6 = $GET_HOOK_PARAM(6);
-$IF (par6 ==# 0) {$SET_HOOK_PARAM(8, 0); $RETURN;};
-spl = $DelimitedStringSubstring(lvl,par6 -# 1);
-$IF (par4 == "I")
-	{
-		$SET_HOOK_PARAM(8,spl);
-		$SET_HOOK_PARAM(9,1);
-		$RETURN "1";
-	};
-$IF (par4 == "L")
-	{
-		$IF (par6 <=# sLvl)
-			{
-				$SET_HOOK_PARAM(8,1);
-				$SET_HOOK_PARAM(9,1);
-			}
-		$ELSE
-			{
-				$SET_HOOK_PARAM(8,0);
-			};
-		$RETURN "1";
-	};
[ScribeOrWhatever] = $SET_HOOK_PARAM(5, "Scribe");
\(END)

\(BEGIN)
name = class_NoSpells
[CanCastSpells] = $IF ($SpellContext() == "WandMagicMissile")
-	{
-		$DEBUG ( "spell name = " + $SpellContext());
-		$RETURN;
-	}
-$ELSE {$RETURN "N";};
[CanMemorizeSpells] = $RETURN "N";
\(END)

\(BEGIN)
name = class_Paladin
[CanCureOrWhatever] = $VAR tgt;
-$VAR prevTime; // hours
-$VAR curTime;
-$VAR elapsedTime;
-$VAR waitTime;
-$VAR paladinLvl;
-$VAR paladinDiv;
-tgt = $IndexOf($CharacterContext());
-prevTime = $GET_CHARACTER_SA($Myself(),"paladinCureTime");
-curTime = $GET_PARTY_TIME();
-$IF(prevTime != "-?-?-"){elapsedTime = curTime -# prevTime;}
-$ELSE{elapsedTime = 999;};
-paladinLvl = $GET_CHAR_Lvl(tgt,"paladin");
-paladinDiv = (paladinLvl +#4) /# 5;
-$IF (paladinDiv <# 1){paladinDiv = 1;};
-$IF (paladinDiv ># 8){paladinDiv = 8;};
-waitTime = 168 /# paladinDiv;
-$IF ((elapsedTime >= 0) && (elapsedTime <# waitTime)) {$RETURN;};
-$SET_HOOK_PARAM( 5, "CURE DISEASE" );
-$SET_HOOK_PARAM( 6, "0");
[CanLayOrWhatever] = $VAR prevTime;
-$VAR curTime;
-$VAR elapsedTime;
-prevTime = $GET_CHARACTER_SA($Myself(),"paladinLayTime");
-curTime = $GET_PARTY_TIME();
-$IF(prevTime)  // First time fudge.
-{elapsedTime = curTime -# prevTime;}
-$ELSE{elapsedTime = 999;};
-$IF ((elapsedTime >= 0) && (elapsedTime <# 24)) {$RETURN;};
-$SET_HOOK_PARAM( 5, "LAY ON HANDS" );
-$SET_HOOK_PARAM( 6, "0");
[CreateMonsterCombatant] = $VAR char; // character being created
-$VAR cls;
-char = $IndexOf($CharacterContext());
-cls = $GET_CHAR_Lvl(char,"paladin");
-$IF (cls ># 0)
-	{
-		$SET_CHARACTER_SA($CharacterContext(),"IsPaladinImmuneDisease","paladin");
-		$SET_CHARACTER_SA($CharacterContext(),"IsPaladinProtectedFromEvil","paladin");
-	};
[CureOrWhatever] = $VAR curTime;
-curTime = $GET_PARTY_TIME();
-$SET_CHARACTER_SA($CharacterContext(),"paladinCureTime",curTime);
-$SET_HOOK_PARAM(1,"paladinCureDisease");
-$RETURN "CastSpell";
[LayOrWhatever] = $VAR curTime;
-curTime = $GET_PARTY_TIME();
-$SET_CHARACTER_SA($Myself(),"paladinLayTime",curTime);
-$SET_HOOK_PARAM(1,"paladinLayOnHands");
-$RETURN "CastSpell";
[PostCreateCharacter] = $SET_CHARACTER_SA($CharacterContext(),"IsPaladinImmuneDisease","paladin");
-$SET_CHARACTER_SA($CharacterContext(),"IsPaladinProtectedFromEvil","paladin");
[SpellCasterLevel] = $VAR atk; // attacker
-$VAR cls;
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-cls = $GetHighestLevelBaseclass(atk);
-lvl = $GetBaseclassLevel(atk,cls);
-$RETURN lvl;
\(END)

\(BEGIN)
name = class_Spells
<magicUserLvl> = 1
-1
-2
-2
-3
-3
-4
-4
-5
-5
-5
-6
-6
-7
-7
-8
-8
-9
-9
<magicUserTrain> = 1
-0
-2
-0
-3
-0
-4
-0
-5
-0
-0
-6
-0
-7
-0
-8
-0
-9
-0
\(END)

\(BEGIN)
name = class_Thief
\(END)

\(BEGIN)
name = CombatPlacement
[PlaceMonsterClose] = $IF($GET_PARTY_FACING() >=#2){$MonsterPlacement("FbPV500E");}
-$ELSE{$MonsterPlacement("bPV500E");};
[PlaceMonsterFar] = $IF($GET_PARTY_FACING() >=#2){$MonsterPlacement("17FbPV500E");}
-$ELSE{$MonsterPlacement("16FbPV500E");};
[PlaceMonsterNear] = $IF($GET_PARTY_FACING() >=#2){$MonsterPlacement("10FbPV500E");}
-$ELSE{$MonsterPlacement("9FbPV500E");};
\(END)

\(BEGIN)
name = CombatRoundStart
[StartCombatRound] = $SA_PARAM_SET("0");
\(END)

\(BEGIN)
name = CombatRoundStart1
[StartCombatRound] = $SA_PARAM_SET("-?-?-");
\(END)

\(BEGIN)
name = Competing
[AdjustInitiative] = $VAR me;
-$VAR dex;
-$VAR p5;
-$VAR list;
-$VAR adj;
-$VAR redo;
-me = $IndexOf($CombatantContext());
-dex = $GET_CHAR_LIMITED_DEX(me);
-p5 = $GET_HOOK_PARAM(5);
-list = "$3$3$3$3$2$1$0$0$0$0$0$0$0$0$0$0$-1$-2$-3$-3$-3$-4$-4$-4$-5$-5";
-adj = $DelimitedStringSubstring(list,dex);
-$IF ($NOT($GetCombatRound()))//Past round 1
-	{$RETURN adj;};
-$IF (p5 != 18)// adjustment for unsurprised
-	{$RETURN adj;};
-$IF (adj <# "-1"||adj ==# "-1" && $GET_CHAR_Exp(me,"Ranger") ># 0)// negate surprise for -2 or better
-	{redo = 1;};
-$IF ($GET_CHAR_Exp(me,"Ranger") ># 0 || dex == 16)// 50% negate surprise for -1 or ranger
-	{redo = $RANDOM(2);};
-$IF (redo ==# 1)// set new random initiative if not surprised
-	{$RETURN $RANDOM(10) +# 9 +# adj -# 18;}
-$ELSE {$RETURN 5;}; // set to surprised
[AutoAction] = $RETURN $GET_COMBATANT_SA($CombatantContext(),"playerControl");
[CombatMainMenu] = $VAR adjCombatant;
-$VAR count;
-$VAR t;
-$VAR target;
-$VAR lvl;
-lvl = $GET_CHAR_Lvl($MyIndex(),"fighter") +# $GET_CHAR_Lvl($MyIndex(),"paladin") +# $GET_CHAR_Lvl($MyIndex(),"ranger") ;
-$IF (lvl ># 1)
-	{
-		adjCombatant = $ListAdjacentCombatants($MyIndex());
-		t = 0;
-		count = $DelimitedStringCount(adjCombatant);
-		$WHILE (count >=# 0)
-			{
-				target = $DelimitedStringSubstring(adjCombatant,count);
-				$IF ($GET_MONSTERTYPE_SA($GET_CHAR_NAME(target),"monster_Swept") != "-?-?-" && $GET_CHAR_STATUS(target) ==# 0){t = t +# 1;};
-				count = count -# 1;
-			};
-		$IF (t ># 1)
-			{
-				$SET_HOOK_PARAM(6, "SWEEP");
-				$SET_HOOK_PARAM(7, 0);
-				$SET_COMBATANT_SA($CombatantContext(),"IsSweeping",lvl);
-			};
-	};
[FreeAttack-AttackOver] = $SET_HOOK_PARAM(7,"0");
-$RETURN;
[FreeAttack-CanFreeAttack] = $VAR rangeWpn;
-$VAR par8;
-rangeWpn = $GET_ITEM_SA($GET_CHAR_Ready($AttackerContext(), "WEAPON", 0),"item_CombatAim");
-par8 = $GET_HOOK_PARAM(8);
-$IF (rangeWpn != "-?-?-"){$RETURN "N";};
-$RETURN par8;
[GetNumberOfAttacks] = $VAR com; // combatant
-$VAR fighterLvl;
-$VAR paladinLvl;
-$VAR rangerLvl;
-$VAR name;
-com = $IndexOf($CombatantContext());
-fighterLvl = $GET_CHAR_Lvl(com,"fighter");
-paladinLvl = $GET_CHAR_Lvl(com,"paladin");
-rangerLvl = $GET_CHAR_Lvl(com,"ranger");
-name = $GET_CHAR_NAME(com);
-$IF ($GET_MONSTERTYPE_SA(name,"monsterLevel") != "-?-?-"){$RETURN;};
-$IF ((fighterLvl >=# 13) || (paladinLvl >=# 13) || (rangerLvl >=# 15)){$RETURN 2;};
-$IF ((fighterLvl >=# 7) || (paladinLvl >=# 7) || (rangerLvl >=# 8)){$RETURN (($GetCombatRound() +# 1) %# 2) +# 1;};
[Guarding-AttackOver] = $RETURN;
[Guarding-BeginCombat] = $RETURN "N";
[Guarding-CanGuard] = $VAR rangeWpn;
-rangeWpn = $GET_ITEM_SA($GET_CHAR_Ready($CombatantContext(), "WEAPON",0),"item_CombatAim");
-$IF (rangeWpn != "-?-?-"){$RETURN "N";};
-$IF($GET_HOOK_PARAM(5) ==# 2){$RETURN "Y";};
[Guarding-CanGuardAttack] = $VAR par5;
-par5 = $GET_HOOK_PARAM(5);
-$IF ($GetCombatantState($AttackerContext()) != "ICS_Guarding"){$RETURN "N";};
-$IF (par5 ># 0){$RETURN "Y";};
[Guarding-Guard] = $RETURN;
[Guarding-StartOfRound] = $VAR par5;
-$VAR par6;
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$IF (par5 ==# 3){$SET_HOOK_PARAM(6,"G");};
[IsCombatReady] = $RETURN;
[OnStartCombat] = $VAR name;
-$VAR name1;
-$VAR me;
-$VAR lvl;
-$VAR controlNPC;
-$VAR idx1;
-$VAR idx4;
-$VAR modCha;
-me = $IndexOf($CharacterContext());
-name = $GET_CHAR_NAME(me);
-idx1 = $NextCreatureIndex("", 1);
-idx4 = $NextCreatureIndex("", 4);
-$SET_COMBATANT_SA($CharacterContext(  ),"turnUndead","");
-$IF ($NextCreatureIndex(me -# 1, 4) == me)
-	{
-		$SET_COMBATANT_SA($CharacterContext(),"side",1);
-		$SET_CHAR_ASL(me,"side",1);
-	}
-$ELSE
-	{
-		$SET_COMBATANT_SA($CharacterContext(),"side",2);
-		$SET_CHAR_ASL(me,"side",2);
-	};
-name1 = $GET_CHAR_NAME(idx1);
-$IF (name != name1 && $GET_MONSTERTYPE_SA(name1,"range") != "-?-?-")
-	{
-		$SET_CHARACTER_SA($CharacterContext(),"range" + name1,1);
-	};
-$RUN_CHAR_SCRIPTS(me,"spawn");
-$IF ($GetCombatRound() ># 0) {$SET_COMBATANT_SA($CharacterContext(),"Summoned","spell");};
-// Paladin Leadership
-controlNPC = 0;
-$SET_COMBATANT_SA($CharacterContext(),"endControl", 1);
-lvl = $GET_CHAR_Lvl(me,"paladin");
-$IF ($InParty($CharacterContext()) != "" && lvl ># 0)
-	{
-		modCha = ($GET_CHAR_LIMITED_CHA(me) -# 13) *# 5;
-		$IF (lvl >=# 3){controlNPC = modCha +# 79;};
-		$IF (lvl ==# 2){controlNPC = modCha +# 39;};
-		$IF (lvl ==# 1){controlNPC = modCha +# 19;};
-		$SET_PARTY_ASL("controlNPC",controlNPC);
-	};
-$IF ($GET_COMBATANT_SA($CharacterContext(),"side") == 1 && $RANDOM(100) <# $GET_PARTY_ASL("controlNPC"))
-	{
-		$SET_COMBATANT_SA($CharacterContext(),"playerControl","CP");
-	};
[OnStep] = $VAR me;
-$VAR it;
-me = $IndexOf($CombatantContext());
-it = $NextCreatureIndex("", 1);
-$IF (it != me)
-	{
-		$SET_HOOK_PARAM(5, it);
-		$SET_HOOK_PARAM(6, me);
-		$RUN_CHAR_SCRIPTS(it,"CheckProximity");
-		$RUN_CHAR_SCRIPTS(me,"CheckProximity");
-	};
[PreStartCombat] = $VAR par5;
-$VAR char;
-$VAR class;
-par5 = $GET_HOOK_PARAM(5);
-char = $IndexOf($CharacterContext());
-class = $GET_CHAR_CLASS(char);
-$IF (class == "Paladin") {$RETURN par5 +# 10000;};
[StartCombatRound] = $RETURN;
\(END)

\(BEGIN)
name = DamageMagical
[DoesSpellAttackSucceed] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR targetMR;
-$VAR caster;
-$VAR caster1;
-$VAR caster2;
-$VAR level;
-$VAR base;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-targetMR = $GET_CHAR_MAGICRESIST(tgt);
-$IF (targetMR ==# 0) {$RETURN;};
-caster = $SA_SPELL_GET("casterLevel");
-caster1 = $DelimitedStringSubstring(caster,0);
-caster2 = $DelimitedStringSubstring(caster,1);
-$IF (caster1 == "monster")
-	{
-		level =  $GET_MONSTERTYPE_SA($GET_CHAR_NAME(atk),"monsterLevel");
-		base = 11;
-	}
-$ELSE
-	{
-		$IF (caster1 == "item")
-			{
-				level = caster2;
-				base = 11;
-			}
-		$ELSE
-			{
-				level = $GET_CHAR_Lvl(atk,caster1);
-				base = caster2;
-			};
-	};
Parameters = "acid, charm, cold, electricity, fear, fire, mind, paralysis, petrification, poison, spell";
\(END)

\(BEGIN)
name = DamageNonMagical
Parameters = "blunt, crushing, piercing, poison, psionic, slashing, venom";
\(END)

\(BEGIN)
name = elemental_GrowthElectricity
[DoesSpellAttackSucceed] = $VAR tgt; // target
-$VAR hp;
-$VAR name;
-$VAR item;
-$VAR spell;
-item = $SA_ITEM_GET("DamageMagical");
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (item == "electricity" || spell == "electricity")
-	{
-		tgt = $IndexOf($TargetContext());
-		hp = $RANDOM(8) +# 1;
-		name = $GET_CHAR_NAME(tgt);
-		$SET_CHAR_MAXHITPOINTS(tgt,$GET_CHAR_MAXHITPOINTS(tgt) +# hp);
-		$SET_CHAR_HITPOINTS(tgt,$GET_CHAR_HITPOINTS(tgt) +# hp);
-		$SET_CHAR_THAC0(tgt,$GET_CHAR_THAC0(tgt) -# 1);
-		$SET_COMBATANT_SA($TargetContext(),"monsterLevel", $GET_MONSTERTYPE_SA(name,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,name +" grows ");
-		$RETURN "N";
-	};
\(END)

\(BEGIN)
name = elemental_GrowthFire
[DoesSpellAttackSucceed] = $VAR tgt; // target
-$VAR hp;
-$VAR name;
-$VAR item;
-$VAR spell;
-item = $SA_ITEM_GET("DamageMagical");
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (item == "fire" || spell == "fire")
-	{
-		tgt = $IndexOf($TargetContext());
-		hp = $RANDOM(8) +# 1;
-		name = $GET_CHAR_NAME(tgt);
-		$SET_CHAR_MAXHITPOINTS(tgt,$GET_CHAR_MAXHITPOINTS(tgt) +# hp);
-		$SET_CHAR_HITPOINTS(tgt,$GET_CHAR_HITPOINTS(tgt) +# hp);
-		$SET_CHAR_THAC0(tgt,$GET_CHAR_THAC0(tgt) -# 1);
-		$SET_COMBATANT_SA($TargetContext(),"monsterLevel", $GET_MONSTERTYPE_SA(name,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,name +" grows ");
-		$RETURN "N";
-	};
\(END)

\(BEGIN)
name = elemental_ImmuneAcid
[ComputeDamage] = $VAR item;
-item = $SA_ITEM_GET("DamageMagical");
-$IF (item == "acid"){$RETURN "0";};
[ComputeSpellDamage] = $VAR spell;
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (spell == "acid"){$RETURN "0";};
\(END)

\(BEGIN)
name = elemental_ImmuneCold
[ComputeDamage] = $VAR item;
-item = $SA_ITEM_GET("DamageMagical");
-$IF (item == "cold"){$RETURN "0";};
[ComputeSpellDamage] = $VAR spell;
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (spell == "cold"){$RETURN "0";};
\(END)

\(BEGIN)
name = elemental_ImmuneElectricity
[ComputeDamage] = $VAR item;
-item = $SA_ITEM_GET("DamageMagical");
-$IF (item == "electricity"){$RETURN "0";};
[ComputeSpellDamage] = $VAR spell;
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (spell == "electricity"){$RETURN "0";};
\(END)

\(BEGIN)
name = elemental_ImmuneFire
[ComputeDamage] = $VAR item;
-item = $SA_ITEM_GET("DamageMagical");
-$IF (item == "fire"){$RETURN "0";};
[ComputeSpellDamage] = $VAR spell;
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (spell == "fire"){$RETURN "0";};
\(END)

\(BEGIN)
name = elemental_ResistantCold
[ComputeDamage] = $VAR item;
-item = $SA_ITEM_GET("DamageMagical");
-$IF (item == "cold"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[ComputeSpellDamage] = $VAR spell;
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (spell == "cold"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_ResistantElectricity
[ComputeDamage] = $VAR item;
-item = $SA_ITEM_GET("DamageMagical");
-$IF (item == "electricity"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[ComputeSpellDamage] = $VAR spell;
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (spell == "electricity"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_ResistantFire
[ComputeDamage] = $VAR item;
-item = $SA_ITEM_GET("DamageMagical");
-$IF (item == "fire"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[ComputeSpellDamage] = $VAR spell;
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (spell == "fire"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_SlowingCold
[GetAdjMaxMovement] = $VAR item;
-$VAR spell;
-item = $SA_ITEM_GET("DamageMagical");
-spell = $SA_SPELL_GET("DamageMagical");
-$IF ((item == "cold") || (spell == "cold")){$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_SlowingElectricity
[GetAdjMaxMovement] = $VAR item;
-$VAR spell;
-item = $SA_ITEM_GET("DamageMagical");
-spell = $SA_SPELL_GET("DamageMagical");
-$IF ((item == "electricity") || (spell == "electricity")){$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_SlowingFire
[GetAdjMaxMovement] = $VAR item;
-$VAR spell;
-item = $SA_ITEM_GET("DamageMagical");
-spell = $SA_SPELL_GET("DamageMagical");
-$IF ((item == "fire") || (spell == "fire")){$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_VulnerableCold
[ComputeDamage] = $VAR item;
-item = $SA_ITEM_GET("DamageMagical");
-$IF (item == "cold"){$RETURN $GET_HOOK_PARAM(5) *# 2;};
[ComputeSpellDamage] = $VAR spell;
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (spell == "cold"){$RETURN $GET_HOOK_PARAM(5) *# 2;};
\(END)

\(BEGIN)
name = elemental_VulnerableFire
[ComputeDamage] = $VAR item;
-item = $SA_ITEM_GET("DamageMagical");
-$IF (item == "fire"){$RETURN $GET_HOOK_PARAM(5) *# 2;};
[ComputeSpellDamage] = $VAR spell;
-spell = $SA_SPELL_GET("DamageMagical");
-$IF (spell == "fire"){$RETURN $GET_HOOK_PARAM(5) *# 2;};
\(END)

\(BEGIN)
name = Global_Combat
[PartyArrangement] = $IF ($GET_HOOK_PARAM(5) == "I")
-  {
-    $RETURN " ";
-  }
-$ELSE
-  {
-    $RETURN " ";
-  };
[PartyOriginEast] = $SET_HOOK_PARAM(5,"-1");
[PartyOriginNorth] = $SET_HOOK_PARAM(5,"-1");
[PartyOriginSouth] = $SET_HOOK_PARAM(5,"-1");
[PartyOriginWest] = $SET_HOOK_PARAM(5,"-1");
\(END)

\(BEGIN)
name = Global_CreateCharacter
[PostCreateCharacter] = $VAR char;
-char = $IndexOf($CharacterContext());
-$SET_CHARACTER_SA($CharacterContext(), "pcSTR", $GET_CHAR_PERM_STR(char));
-$SET_CHARACTER_SA($CharacterContext(), "pcSTRMOD", $GET_CHAR_PERM_STRMOD(char));
-$SET_CHARACTER_SA($CharacterContext(), "pcINT", $GET_CHAR_PERM_INT(char));
-$SET_CHARACTER_SA($CharacterContext(), "pcWIS", $GET_CHAR_PERM_WIS(char));
-$SET_CHARACTER_SA($CharacterContext(), "pcDEX", $GET_CHAR_PERM_DEX(char));
-$SET_CHARACTER_SA($CharacterContext(), "pcCON", $GET_CHAR_PERM_CON(char));
-$SET_CHARACTER_SA($CharacterContext(), "pcCHA", $GET_CHAR_PERM_CHA(char));
\(END)

\(BEGIN)
name = Global_CreateMonsterCombatant
[CreateMonsterCombatant] = $VAR tbl;
-$VAR levelTbl;
-$VAR i;
-$VAR monster;
-$VAR level;
-$VAR monRace;
-tbl = "/$17$3$4$5$4$6/$15$4$5$6$4$7/$13$5$6$7$5$8/$11$7$8$9$8$10/$9$8$9$10$9$11/$7$10$11$12$12$13/$5$11$12$13$13$14/$3$13$14$15$16$16/$1$14$15$16$17$17/$0$16$17$18$20$19";
-monster = $IndexOf($CharacterContext());
-level = $SA_MONSTERTYPE_GET("monsterLevel");
-$SET_CHARACTER_SA($CharacterContext(), "class_baseName", $SA_MONSTERTYPE_GET("class_baseName"));
-$SET_CHAR_Lvl(monster,$GetHighestLevelBaseclass(monster),level);
-i = 0;
-$WHILE (1)
-	{
-		levelTbl = $DelimitedStringSubstring(tbl, i);
-		$IF (levelTbl == "") {$RETURN;}; // Protects us from bad Special Saves
-		$IF (level >=# $DelimitedStringSubstring(levelTbl, 0))
-			{
-				$SkillAdj($CharacterContext(), "Save Vs BR", "", "F", $DelimitedStringSubstring(levelTbl, 1));
-				$SkillAdj($CharacterContext(), "Save Vs PP", "", "F", $DelimitedStringSubstring(levelTbl, 2));
-				$SkillAdj($CharacterContext(), "Save Vs PPDM", "", "F", $DelimitedStringSubstring(levelTbl, 4));
-				$SkillAdj($CharacterContext(), "Save Vs RSW", "", "F", $DelimitedStringSubstring(levelTbl, 3));
-				$SkillAdj($CharacterContext(), "Save Vs SP", "", "F", $DelimitedStringSubstring(levelTbl, 5));
-				$RETURN;
-			};
-		i = i +# 1;
-	};
\(END)

\(BEGIN)
name = Global_Display
[CharacterViewScreen] = $VAR char; // character
-$VAR name;
-$VAR age;
-$VAR sex;
-$VAR align;
-$VAR alignList;
-$VAR alignName;
-$VAR class;
-$VAR cbnList; // class_baseName parameter
-$VAR cbnCount; // number of baseclasses
-$VAR cbn; // first baseclass
-$VAR cbn2; // second baseclass
-$VAR cbn3; // third baseclass
-$VAR hbl; // highest baseclass level
-$VAR hbn; // highest baseclass name
-$VAR lvl;
-$VAR lvl2;
-$VAR lvl3;
-$VAR xp;
-$VAR xp2;
-$VAR xp3;
-$VAR status;
-$VAR hp;
-$VAR maxHp;
-$VAR race;
-$VAR ac;
-$VAR acEff;
-$VAR acAdj;
-$VAR thac0;
-$VAR thac0Adj;
-$VAR str;
-$VAR strMod;
-$VAR int;
-$VAR wis;
-$VAR dex;
-$VAR con;
-$VAR cha;
-$VAR dmgList; // weapon
-$VAR dmg1;
-$VAR dmg2;
-$VAR dmg3;
-$VAR dmgPlus; // weapon plus if applicable
-$VAR dmgBns; // damage bonus
-$VAR enc;	// encumbrance
-$VAR mvmt;
-$VAR weight;
-$VAR height;
-$VAR wpn;
-$VAR shield;
-$VAR armor;
-$VAR sWidth; // screen width
-$VAR psnd; // Poisoned
-char = $IndexOf($CharacterContext());
-name = $GET_CHAR_NAME(char);
-age = $GET_CHAR_AGE(char);
-sex = $GET_CHAR_SEX(char);
-align = $GET_CHAR_ALIGNMENT(char);
-alignList = "$LAWFUL GOOD$NEUTRAL GOOD$CHAOTIC GOOD$LAWFUL NEUTRAL$TRUE NEUTRAL$CHAOTIC NEUTRAL$LAWFUL EVIL$NEUTRAL EVIL$CHAOTIC EVIL";
-alignName = $DelimitedStringSubstring(alignList,align);		
-class = $GET_CHAR_CLASS(char);
-cbnList = $DAT_Class_Baseclasses(class);
-cbnCount = $DelimitedStringCount(cbnList);
-cbn = $DelimitedStringSubstring(cbnList,0);
-cbn2 = $DelimitedStringSubstring(cbnList,1);
-cbn3 = $DelimitedStringSubstring(cbnList,2);
-hbn = $GetHighestLevelBaseclass(char);
-hbl = $GetBaseclassLevel(char,hbn);
-xp = $GET_CHAR_Exp(char,cbn);
-xp2 = $GET_CHAR_Exp(char,cbn2);
-xp3 = $GET_CHAR_Exp(char,cbn3);
-lvl = $GetBaseclassLevel(char,cbn);
-lvl2 = $GetBaseclassLevel(char,cbn2);
-lvl3 = $GetBaseclassLevel(char,cbn3);
-status = $GET_CHAR_STATUS(char);
-hp = $GET_CHAR_HITPOINTS(char);
-maxHp = $GET_CHAR_MAXHITPOINTS(char);
-race = $GET_CHAR_RACE(char);
-ac = $GET_CHAR_AC(char);
-acEff = $GET_CHAR_EFFAC(char);
-acAdj = $GET_CHAR_ADJAC (char);
-thac0 = $GET_CHAR_THAC0(char);
-thac0Adj = $GET_CHAR_ADJTHAC0(char);
-str = $GET_CHAR_LIMITED_STR(char);
-strMod = $GET_CHAR_LIMITED_STRMOD(char);
-int = $GET_CHAR_LIMITED_INT(char);
-wis = $GET_CHAR_LIMITED_WIS(char);
-dex = $GET_CHAR_LIMITED_DEX(char);
-con = $GET_CHAR_LIMITED_CON(char);
-cha = $GET_CHAR_LIMITED_CHA(char);
-wpn = $GET_CHAR_Ready($CharacterContext(),"WEAPON",0);
-shield = $GET_CHAR_Ready($CharacterContext(),"SHIELD",0);
-armor = $GET_CHAR_Ready($CharacterContext(),"ARMOR",0);
-sWidth = $GET_CONFIG("Screen_Width");
-psnd = $GET_CHARACTER_SA($CharacterContext(),"IsPoisoned");
-dmgList = $DAT_Item_DamageSmall(wpn);
-dmg1 = $DelimitedStringSubstring(dmgList,0);
-dmg2 = $DelimitedStringSubstring(dmgList,1);
-dmg3 = $DelimitedStringSubstring(dmgList,2);
-dmgPlus = $DAT_Item_AttackBonus(wpn);
-dmgBns = $GET_CHAR_DAMAGEBONUS(char);
-enc = $GET_CHAR_ENC(char);
-mvmt = $GET_CHAR_MAXMOVE(char);
-weight = $GET_CHAR_ASL(char,"charWeight");
-height = $GET_CHAR_ASL(char,"charHeight");
-$IF (weight == "")
-	{
-		$SET_CHAR_ASL(char,"charWeight",$DAT_Race_Weight($CharacterContext()));
-		weight = $GET_CHAR_ASL(char,"charWeight");
-	};
-$IF (height == "")
-	{
-		$SET_CHAR_ASL(char,"charHeight",$DAT_Race_Height($CharacterContext()));
-		height = $GET_CHAR_ASL(char,"charHeight");
-	};
-
-$IF (sWidth ==# 640)
-	{
-		$GrSet("LeftCol",18, 18);
-		$GrSet("RightCol", 220, 18);
-		$GrSet("Skills", 417, 270);
-		$GrSet("Ability", 50, 0);
-		$GrSet("StatusTab", 105, 0);
-		$GrSet("SkillsTab", 125, 0);
-		$GrSet("EncumbTab",125, 0);
-		$GrSet("TextHeight", 0, 18);
-		$GrSetLinefeed("TextHeight");
-	};
-$IF (sWidth ==# 800)
-	{
-		$GrSet("LeftCol",20,20);
-		$GrSet("RightCol",260,20);
-		$GrSet("Skills", 450, 380);
-		$GrSet("Ability",75,0);
-		$GrSet("StatusTab",130,0);
-		$GrSet("SkillsTab", 150, 0);
-		$GrSet("EncumbTab",150,0);
-		$GrSet("TextHeight",0,20);
-		$GrSetLinefeed("TextHeight");
-	};
-$IF (sWidth ==# 1024)
-	{
-		$GrSet("LeftCol",20,20);
-		$GrSet("RightCol", 300,20);
-		$GrSet("Skills", 608, 490);
-		$GrSet("Ability", 75, 0);
-		$GrSet("StatusTab", 150, 0);
-		$GrSet("SkillsTab", 175, 0);
-		$GrSet("EncumbTab",175, 0);
-		$GrSet("TextHeight",0,20);
-		$GrSetLinefeed("TextHeight");
-	};
-
-$IF ($GET_CHAR_TYPE(char) != "@PC@" && $GET_CHAR_TYPE(char) != "@NPC@")
-	{
-		$GrMoveTo("LeftCol");
-		$GrFormat("SL");
-		$GrColor("YELLOW");
-		$GrPrtLF($UpCase(name));
-		$GrMark("Level");
-		$GrMoveTo("RightCol");
-		$GrColor("WHITE");
-		$GrPrint("STATUS");
-		$IF (status >=# 9) {$GrColor("RED"); $GrTab("StatusTab"); $GrPrtLF("DYING");};
-		$IF (status ==# 8) {$GrColor("RED"); $GrTab("StatusTab"); $GrPrtLF("RUNNING");};
-		$IF (status ==# 7) {$GrColor("RED"); $GrTab("StatusTab"); $GrPrtLF("TEMPGONE");};
-		$IF (status ==# 6) {$GrColor("RED"); $GrTab("StatusTab"); $GrPrtLF("ANIMATED");};
-		$IF (status ==# 5) {$GrColor("RED"); $GrTab("StatusTab"); $GrPrtLF("GONE");};
-		$IF (status ==# 4) {$GrColor("RED"); $GrTab("StatusTab"); $GrPrtLF("PETRIFIED");};
-		$IF (status ==# 3) {$GrColor("RED"); $GrTab("StatusTab"); $GrPrtLF("FLED");};
-		$IF (status ==# 2) {$GrColor("RED"); $GrTab("StatusTab"); $GrPrtLF("DEAD");};
-		$IF (status ==# 1) {$GrColor("ORANGE"); $GrTab("StatusTab"); $GrPrtLF("UNCONSCIOUS");};
-		$IF (status ==# 0) {$GrColor("GREEN"); $GrTab("StatusTab"); $GrPrtLF("OKAY");};
-		$GrColor("WHITE");
-		$GrPrint("HIT POINTS");
-		$IF (hp <=# 0) {$GrColor("RED"); $GrTab("StatusTab"); $GrPrint(hp);};
-		$IF ((hp >=# 1) && (hp <# maxHp)) {$GrColor("ORANGE"); $GrTab("StatusTab"); $GrPrint(hp);};
-		$IF (hp ==# maxHp) {$GrColor("GREEN"); $GrTab("StatusTab"); $GrPrint(hp);};
-		$GrColor("GREEN");
-		$GrPrtLF("/" + maxHp);
-		$GrColor("WHITE");
-		$GrPrtLF($UpCase(race));
-		$GrMoveTo("Level");
-		$GrMove("TextHeight"); 
-		$GrMove("TextHeight"); 
-		$GrMove("TextHeight"); 
-		$GrMove("TextHeight"); 
-		$GrColor("WHITE");
-		$GrMark("Strength");
-		$GrPrtLF(" ");
-		$GrPrtLF("INT");
-		$GrPrtLF(" ");
-		$GrPrtLF(" ");
-		$GrPrtLF(" ");
-		$GrPrtLF(" ");
-		$GrMark("Armor");
-		$GrMoveTo("Strength");
-		$GrMove("Ability");
-		$GrColor("GREEN");
-		$GrPrtLF(" ");
-		$GrPrtLF(int);
-		$GrPrtLF(" ");
-		$GrPrtLF(" ");
-		$GrPrtLF(" ");
-		$GrPrtLF(" ");
-		$GrMoveTo("Armor");
-		$GrMove("TextHeight"); 
-		$GrColor("WHITE");
-		$GrPrint("ARMOR CLASS");
-		$IF (ac !=# acEff) {$GrColor("ORANGE"); $GrTab("StatusTab"); $GrPrtLF(acEff);};
-		$IF (ac ==# acEff) {$GrColor("GREEN"); $GrTab("StatusTab"); $GrPrtLF(ac);};
-		$GrColor("WHITE");
-		$GrPrint("THAC0");
-		$IF (thac0 !=# thac0Adj) {$GrColor("ORANGE"); $GrTab("StatusTab"); $GrPrtLF(thac0Adj);};
-		$IF (thac0 ==# thac0Adj) {$GrColor("GREEN"); $GrTab("StatusTab"); $GrPrtLF(thac0);};
-		$RETURN;
-	};
-
-$GrMoveTo("LeftCol");
-$GrFormat("SL");
-$GrColor("YELLOW");
-$GrPrtLF($UpCase(name));
-$GrColor("WHITE");
-$GrPrint($UpCase(sex));
-$GrTab("StatusTab");
-$GrColor("GREEN");
-$GrPrint(age);
-$GrColor("WHITE");
-$GrPrtLF(" YEARS");
-$GrPrtLF(alignName);
-$GrPrtLF($UpCase(class));
-$IF (cbnCount ==# 3)
-	{
-		$GrPrint("LEVEL/XP " + lvl + "/" + xp);
-		$GrPrint(" " + lvl2 + "/" + xp2);
-		$GrPrtLF(" " + lvl3 + "/" + xp3);
-	};
-$IF (cbnCount ==# 2 && cbnList != "-?-?-")
-	{
-		$GrPrint("LEVEL/XP " + lvl + "/" + xp);
-		$GrPrtLF(" " + lvl2 + "/" + xp2);
-	};
-$IF (cbnCount ==# 1)
-	{
-		$GrPrtLF("LEVEL/XP " + lvl + "/" + xp);
-	};
-$GrMark("Level");
-
-$GrMoveTo("RightCol");
-$GrColor("WHITE");
-$GrPrint("STATUS");
-$IF (status >=# 2)
-	{
-		$GrColor("RED");
-		$GrTab("StatusTab");
-		$GrPrtLF("DEAD");
-	};
-$IF (status ==# 1)
-	{
-		$GrColor("ORANGE");
-		$GrTab("StatusTab");
-		$IF (psnd != "-?-?-")
-			{
-				$GrPrtLF("POISONED");
-			}
-		$ELSE
-			{
-				$GrPrtLF("UNCONSCIOUS");
-			};
-	};
-$IF (status ==# 0)
-	{
-		$GrColor("GREEN");
-		$GrTab("StatusTab");
-		$GrPrtLF("OKAY");
-	};
-$GrColor("WHITE");
-$GrPrint("HIT POINTS");
-$IF (hp <=# 0)
-	{
-		$GrColor("RED");
-		$GrTab("StatusTab");
-		$GrPrint(hp);
-	};
-$IF ((hp >=# 1) && (hp <# maxHp))
-	{
-		$GrColor("ORANGE");
-		$GrTab("StatusTab");
-		$GrPrint(hp);
-	};
-$IF (hp ==# maxHp)
-	{
-		$GrColor("GREEN");
-		$GrTab("StatusTab");
-		$GrPrint(hp);
-	};
-$GrColor("GREEN");
-$GrPrtLF("/" + maxHp);
-$GrColor("WHITE");
-$GrPrtLF($UpCase(race));
-$GrColor("GREEN");
-$GrPrint(weight);
-$GrColor("WHITE");
-$GrPrint(" LBS");
-$GrColor("GREEN");
-$GrTab("StatusTab");
-$GrPrint(height /# 12);
-$GrColor("WHITE");
-$GrPrint("'");
-$GrColor("GREEN");
-$GrPrint(height %# 12);
-$GrColor("WHITE");
-$GrPrtLF("\"");
-$GrMoveTo("Level");
-$GrMove("TextHeight"); 
-$GrColor("WHITE");
-$GrMark("Strength");
-$GrPrtLF("STR");
-$GrPrtLF("INT");
-$GrPrtLF("WIS");
-$GrPrtLF("DEX");
-$GrPrtLF("CON");
-$GrPrtLF("CHA");
-$GrMark("Armor");
-$GrMoveTo("Strength");
-$GrMove("Ability");
-$GrColor("GREEN");
-$IF (strMod >=# 1){$GrPrtLF(str + "(" + strMod + ")");}
-$ELSE{$GrPrtLF(str);};
-$GrPrtLF(int);
-$GrPrtLF(wis);
-$GrPrtLF(dex);
-$GrPrtLF(con);
-$GrPrtLF(cha);
-
-$GrMoveTo("Armor");
-$GrMove("TextHeight"); 
-$GrColor("WHITE");
-$GrPrint("ARMOR CLASS");
-$IF (ac !=# acEff)
-	{
-		$GrColor("ORANGE");
-		$GrTab("StatusTab");
-		$GrPrtLF(acEff);
-	}
-$ELSE
-	{
-		$GrColor("GREEN");
-		$GrTab("StatusTab");
-		$GrPrtLF(ac);
-	};
-$GrColor("WHITE");
-$GrPrint("THAC0");
-$IF (thac0 !=# thac0Adj)
-	{
-		$GrColor("ORANGE");
-		$GrTab("StatusTab");
-		$GrPrtLF(thac0Adj);
-	}
-$ELSE
-	{
-		$GrColor("GREEN");
-		$GrTab("StatusTab");
-		$GrPrtLF(thac0);
-	};
-$GrColor("WHITE");
-$GrPrint("DAMAGE");
-$GrColor("GREEN");
-$GrTab("StatusTab");
-$IF (wpn == ""){$GrPrtLF("1D2+" + dmgBns);};
-$IF (wpn != "") {$GrPrtLF(dmg1 + "d" + dmg2 + "+" + (dmgBns +# dmgPlus +# dmg3));};
-$GrColor("WHITE");
-$GrMove("TextHeight"); 
-
-$IF ((wpn == "") && (shield == "") && (armor == "")){$GrPrtLF("NONE");};
-$IF (wpn != ""){$GrPrtLF($UpCase($DAT_Item_IDName(wpn)));};
-$IF (shield != ""){$GrPrtLF($UpCase($DAT_Item_IDName(shield)));};
-$IF (armor != ""){$GrPrtLF($UpCase($DAT_Item_IDName(armor)));};
-$GrSet("Encumbrance", "RightCol", "Armor");
-$GrMoveTo("Encumbrance");
-$GrMove("TextHeight");
-$GrColor("WHITE");
-$GrPrint("ENCUMBRANCE");
-$GrColor("GREEN");
-$GrTab("EncumbTab");
-$GrPrtLF(enc);
-$GrColor("WHITE");
-$GrPrint("MOVEMENT");
-$GrColor("GREEN");
-$GrTab("EncumbTab");
-$GrPrtLF(mvmt);
-
-$IF (class == "Assassin" || class == "Thief")
-	{
-		$GrMoveTo("Skills");
-		$GrColor("WHITE");
-		$GrPrtLF("SKILLS");
-		$GrMark("Pick");
-		$GrPrtLF("Pick Pockets");
-		$GrPrtLF("Open Locks");
-		$GrPrtLF("Find Traps");
-		$GrPrtLF("Move Silently");
-		$GrPrtLF("Hide in Shadows");
-		$GrPrtLF("Hear Noise");
-		$GrPrtLF("Climb Walls");
-		$GrPrtLF("Read Languages");
-		$GrMoveTo("Pick");
-		$GrMove("SkillsTab");
-		$GrColor("GREEN");
-		$GrPrtLF($SkillAdj($CharacterContext(),"PickPockets","","F",""));
-		$GrPrtLF($SkillAdj($CharacterContext(),"OpenLocks","","F",""));
-		$GrPrtLF($SkillAdj($CharacterContext(),"FindTraps","","F",""));
-		$GrPrtLF($SkillAdj($CharacterContext(),"MoveSilent","","F",""));
-		$GrPrtLF($SkillAdj($CharacterContext(),"HideInShadows","","F",""));
-		$GrPrtLF($SkillAdj($CharacterContext(),"HearNoise","","F",""));
-		$GrPrtLF($SkillAdj($CharacterContext(),"ClimbWalls","","F",""));
-		$GrPrtLF($SkillAdj($CharacterContext(),"ReadLanguages","","F",""));
-	};
\(END)

\(BEGIN)
name = Global_Transfer
[EachPartyMember] = $ForEachPossession($CharacterContext(), "item_DrowEquipment");
-$RETURN "1";
[TransferModule] = $ForEachPartyMember("Global_Transfer", "EachPartyMember");
-$IF ($GET_HOOK_PARAM(5) ==# "1"){$SET_HOOK_PARAM(6,"Your drow equipment dissolves.");};
-$RETURN;
\(END)

\(BEGIN)
name = IsAfraid
[AutoAction] = $IF ($SA_COMBATANT_GET("monster_ImmuneFear") != "-?-?-") {$RETURN;}
-$ELSE{$RETURN "F" + $SA_PARAM_GET();};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Afraid");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
\(END)

\(BEGIN)
name = IsBarkskinned
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-  {$RETURN $SA_REMOVE();};
-$SET_HOOK_PARAM( 7, "Barkskin");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($TargetContext(),"IsBarkskinned") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 1);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[SaveVsBW_Save] = $RETURN $GET_HOOK_PARAM(0) -# 1;
[SaveVsPPDM_Save] = $RETURN $GET_HOOK_PARAM(0) -# 1;
[SaveVsPP_Save] = $RETURN $GET_HOOK_PARAM(0) -# 1;
[SaveVsRSW_Save] = $RETURN $GET_HOOK_PARAM(0) -# 1;
[SaveVsSp_Save] = $RETURN $GET_HOOK_PARAM(0) -# 1;
\(END)

\(BEGIN)
name = IsBestowedCurse
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET()){$SA_REMOVE();};
-$SET_HOOK_PARAM( 7, "Curse Bestowed");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$SA_REMOVE();
-$SetFriendly(tgt,$GET_COMBATANT_SA($TargetContext(),"side"));
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($AttackerContext(),"IsBestowedCurse") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 4);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6))
-  {$RETURN "Y";}
-$ELSE {$RETURN "N";};
[SaveVsBW_Save] = $RETURN $GET_HOOK_PARAM(0) +# 4;
[SaveVsPPDM_Save] = $RETURN $GET_HOOK_PARAM(0) +# 4;
[SaveVsPP_Save] = $GET_HOOK_PARAM(0) +# 4;
\(END)

\(BEGIN)
name = IsBlackPuddingDissolving
StartCombatRound = $VAR param;
-$VAR time;
-param = $SA_PARAM_GET();
-time = $GetCombatRound();
-$IF ((param +# 1) > time) {}; // chain mail, elfin chain, ring mail, scale mail, Svirfneblin Chain Mail, quarter staff and buckler
-$IF ((param +# 2) > time) {}; // banded mail, drow chain, plate mail, great helm, helm, drow buckler, shield and silver shield
-$IF ((param +# 3) > time) {};
-$IF ((param +# 4) > time) {};
-$IF ((param +# 5) > time) {};
-$IF ((param +# 6) > time) {};
-$IF ((param +# 7) > time) {};
\(END)

\(BEGIN)
name = IsBlessed
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET()){$RETURN $SA_REMOVE();};
-$SET_HOOK_PARAM( 7,"Blessed");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($AttackerContext(),"IsBlessed") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) -# 1);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6))
-  {$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsBlind
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Blind");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($TargetContext(),"IsBlind") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) -# 4);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6))
-  {$RETURN "Y";}
-$ELSE {$RETURN "N";};
[IsCombatReady] = $RETURN "N";
\(END)

\(BEGIN)
name = IsBlinking
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsBlinking1");
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsBlinking2");
-		$DELETE_CHARACTER_SA($CharacterContext(),"blinking");   
-		$SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Blinking ");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[spawn] = $SET_COMBATANT_SA($Myself(),"IsBlinking1",1);
\(END)

\(BEGIN)
name = IsBlinkingRing
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Blinking ");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
\(END)

\(BEGIN)
name = IsBlinking1
[OnStartCombatantAction] = $SET_COMBATANT_SA($CharacterContext(),"IsBlinking2",1);
[StartCombatRound] = $DELETE_COMBATANT_SA($CharacterContext(),"IsBlinking2");
\(END)

\(BEGIN)
name = IsBlinking2
[IsValidTarget] = $IF ($GET_MONSTERTYPE_SA($GET_CHAR_NAME($IndexOf($AttackerContext())),"monsterSeeEthereal") != "-?-?-"){$RETURN "Y";};
-$IF ($GET_CHARACTER_SA($AttackerContext(),"IsBlinking") != "-?-?-"){$RETURN "Y";};
-$IF ($GET_CHARACTER_SA($AttackerContext(),"IsBlinkingRing") != "-?-?-"){$RETURN "Y";};
-$RETURN "N";
\(END)

\(BEGIN)
name = IsCarrionStenched
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Retching");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($AttackerContext(),"IsCarrionStenched") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 2);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6))
-  {$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsCharmed
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Charmed ");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $VAR clev; // Cast level
-$VAR dlev; // Dispel level
-$VAR cls;  // Class
-$VAR pct;  // Percent
-clev = $SA_PARAM_GET();
-cls  = $SA_SPELL_GET("spell_Dispel");
-dlev = $GET_CHAR_Lvl($IndexOf($AttackerContext()),cls);
-$IF ($GET_CHARACTER_SA($TargetContext(),"z-IsGlobedMinor") != "-?-?-" && cls != "druid")
-	{$RETURN;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"z-IsGlobed") != "-?-?-")
-	{$RETURN;};
-$IF (cls == "paladin"){dlev = dlev -#8;};
-$IF (clev ># dlev) {pct = 50 -# ((clev -# dlev) *# 2);}
-$ELSE {pct = 50 +# ((dlev -# clev) *# 5);};
-$IF ($RANDOM(100) +# 1 <=# pct)
-	{
-		$SetFriendly($IndexOf($TargetContext()),$GET_COMBATANT_SA($TargetContext(),"side"));
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = IsCharmResistant
\(END)

\(BEGIN)
name = IsCharmResistantMin
\(END)

\(BEGIN)
name = IsCloakDisplaced
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($TargetContext(),"IsCloakDisplaced") != "-?-?-" && $GET_COMBATANT_SA($TargetContext(),"displaceMiss") == "-?-?-")
-	{
-		$SET_COMBATANT_SA($TargetContext(),"displaceMiss",1);
-		$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 90);
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[SaveVsBW_Save] = $RETURN $GET_HOOK_PARAM(0) -# 2;
[SaveVsPPDM_Save] = $RETURN $GET_HOOK_PARAM(0) -# 2;
[SaveVsPP_Save] = $RETURN $GET_HOOK_PARAM(0) -# 2;
[SaveVsRSW_Save] = $RETURN $GET_HOOK_PARAM(0) -# 2;
[SaveVsSp_Save] = $RETURN $GET_HOOK_PARAM(0) -# 2;
\(END)

\(BEGIN)
name = IsConfused
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Confused");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $RETURN "0";
[IsCombatReady] = $RETURN "N";
\(END)

\(BEGIN)
name = IsConfusedExtended
[Dispel] = $SA_REMOVE();
[StartCombatRound] = $VAR save;
-$VAR rnd;
-$VAR opr; // once per round
-$VAR com; // combatant
-com = $IndexOf($CombatantContext());
-opr = $GET_COMBATANT_SA($CombatantContext(),"oncePerRnd");
-$IF (opr ==# 0)
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsConfused");
-		save = $SkillAdj($CombatantContext(), "Save Vs SP", "", "F", "");
-		rnd = $RANDOM(20) -# 1;
-		$IF (save <# rnd){$DELETE_COMBATANT_SA($CharacterContext(),"ConfusionSA");$RETURN;};
-		rnd = $RANDOM(10) +# 1;
-		$IF (rnd ==# 1){$SetFriendly(com,1);$RETURN;};
-		$IF (rnd <=# 6){$SET_COMBATANT_SA($CombatantContext(),"IsConfused","Confused");$RETURN;};
-		$IF (rnd ==# 7){$SetFriendly(com,1);$RETURN;};
-		$IF (rnd ==# 8){$SetFriendly(com,2);$RETURN;};
-		$SetFriendly(com,2);
-		$RETURN;
-	};
\(END)

\(BEGIN)
name = IsCursed
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET()){$RETURN $SA_REMOVE();};
-$SET_HOOK_PARAM( 7, "Cursed");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($AttackerContext(),"IsCursed") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 1);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsDetectedEvil
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
\(END)

\(BEGIN)
name = IsDetectingMagic
[CanCastSpells] = $VAR expiration;
-expiration = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() ># expiration){$SA_REMOVE();};
[CanCharacterDetectMagic] = $VAR expiration;
-expiration = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() ># expiration){$SA_REMOVE();};
-$RETURN "Y";
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsDiseased
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[ComputeDamage] = $VAR tgt; // target
-$VAR CHA;
-$VAR spell;
-$VAR spellCount;
-tgt = $IndexOf($CharacterContext());
-CHA = $GET_CHAR_LIMITED_CHA(tgt);
-spell = "$Cure Light Wounds$Cure Serious Wounds$Cure Critical Wounds$Cure Light Wounds|Druid$Cure Serious Wounds|Druid$Cure Critical Wounds|Druid";
-spellCount = $DelimitedStringCount(spell);
-$SET_CHARACTER_SA($CharacterContext(),"diseasedCHA", CHA);
-$MODIFY_CHAR_ATTRIBUTE(tgt, "CHA", CHA -# 2, "MINUTES", 999999999, "Reduction caused by Disease", "SPELL Disease");
-$IF ($SpellContext() == $DelimitedStringSubstring(spell,spellCount)){$RETURN 0;};
-$IF ($SpellContext() == "Cure Disease")
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(), "IsDiseased");
-		$$GET_CHAR_LIMITED_CHA(tgt)(tgt, CHA, $SA_CHARACTER_GET("diseasedCHA"), "MINUTES", 999999999, "reset due to Cure Diease", "SPELL Cure Disease");
-		$DELETE_CHARACTER_SA($CharacterContext(), "diseasedCHA");
-	};
\(END)

\(BEGIN)
name = IsDiseasedSpell
[CanCastSpells] = $VAR chr; // character
-$VAR t10;
-$VAR t60;
-$VAR str;
-chr = $IndexOf($CharacterContext());
-$IF ($GET_CHARACTER_SA($CharacterContext(),"IDSTimer10") == "-?-?-")
-	{
-		$SET_CHARACTER_SA($CharacterContext(),"IDSTimer10",$GET_PARTY_TIME() +# 10);
-		$SET_CHARACTER_SA($CharacterContext(),"IDSTimer60",$GET_PARTY_TIME() +# 60);
-	};
-t10 = $GET_CHARACTER_SA($CharacterContext(),"IDSTimer10");
-t60 = $GET_CHARACTER_SA($CharacterContext(),"IDSTimer60");
-$IF ($GET_CHAR_HITPOINTS(chr) ># $GET_CHARACTER_SA($CharacterContext(),"minhp"))
-	{
-		$IF ($GET_PARTY_TIME() ># t10)
-			{
-				$SET_CHARACTER_SA($CharacterContext(),"IDSTimer10",$GET_PARTY_TIME() +# 10);
-				$SET_CHAR_HITPOINTS(chr,$GET_CHAR_HITPOINTS(chr) -# 1);
-			};
-	};
-str = $GET_CHAR_LIMITED_STR(chr);
-$IF (str ># 3)
-	{
-		$IF ($GET_PARTY_TIME() ># t60)
-			{
-				$SET_CHARACTER_SA($CharacterContext(),"IDSTimer60",$GET_PARTY_TIME() +# 60);
-				$MODIFY_CHAR_ATTRIBUTE(chr,"STR",-1,"MINUTES".999999999,"Diseased STR reduction","SPELL Disease");
-				$IF (str <# 4) {$SET_CHAR_MAXMOVE(chr,2);};
-			};
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Diseased ");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[IsCombatReady] = $IF ($GET_CHAR_LIMITED_STR($IndexOf($CharacterContext())) <# 4){$RETURN "N";};
\(END)

\(BEGIN)
name = IsDispellingEvil
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Dispelling Evil");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($TargetContext(),"IsDispellingEvil") != "-?-?-")
-	{
-		$IF ($AlignmentGood($AttackerContext()) == "" && $GET_COMBATANT_SA($AttackerContext(),"Summoned") != "-?-?-")
-			{
-				$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 7);
-			};
-	}
-$ELSE
-	{
-		$IF ($AlignmentGood($TargetContext()) == "" && $GET_COMBATANT_SA($TargetContext(),"Summoned") != "-?-?-" && $GET_HOOK_PARAM(6) <# $GET_HOOK_PARAM(5) && $GET_CHARACTER_SA($AttackerContext(),"CanDispel") != "-?-?-")
-			{
-				$CastSpellOnTargetAs($TargetContext(),"Banish",$AttackerContext());
-				$DELETE_CHARACTER_SA($AttackerContext(),"CanDispel");
-				$RETURN;
-			};
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsDispellingGood
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Dispelling Good");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($TargetContext(),"IsDispellingGood") != "-?-?-")
-	{
-		$IF ($AlignmentEvil($AttackerContext()) == "" && $GET_COMBATANT_SA($AttackerContext(),"Summoned") != "-?-?-")
-			{
-				$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 7);
-			};
-	}
-$ELSE
-	{
-		$IF ($AlignmentEvil($TargetContext()) == "" && $GET_COMBATANT_SA($TargetContext(),"Summoned") != "-?-?-" && $GET_HOOK_PARAM(6) <# $GET_HOOK_PARAM(5) && $GET_CHARACTER_SA($AttackerContext(),"CanDispel") != "-?-?-")
-			{
-				$CastSpellOnTargetAs($TargetContext(),"Banish",$AttackerContext());
-				$DELETE_CHARACTER_SA($AttackerContext(),"CanDispel");
-				$RETURN;
-			};
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsDragonAdj
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Nervous ");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($AttackerContext(),"IsDragonAdj") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 1);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[IsCombatReady] = $VAR me;
-$VAR sideset;
-$VAR foe;
-$VAR i;
-me = $IndexOf($CharacterContext());
-$IF ($GET_CHAR_ASL(me,"side") == 1){sideset = 3;}
-$ELSE{sideset = 5;};
-foe = 0;
-i = $NextCreatureIndex("",sideset);
-$WHILE (i != "")
-	{
-		$IF ($GET_CHAR_ASL(i,"FearAdj"))
-			{
-				foe = foe +# 1;
-			};
-		i = $NextCreatureIndex(i,sideset);
-	};
-$IF (foe == 0){$SA_REMOVE();};
\(END)

\(BEGIN)
name = IsDragonFear
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Paralyzed with fear");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[IsCombatReady] = $VAR me;
-$VAR sideset;
-$VAR foe;
-$VAR i;
-me = $IndexOf($CharacterContext());
-$IF ($GET_CHAR_ASL(me,"side") == 1){sideset = 3;}
-$ELSE {sideset = 5;};
-foe = 0;
-i = $NextCreatureIndex("",sideset);
-$WHILE (i != "")
-	{
-		$IF ($GET_CHAR_ASL(i,"FearAdj")){foe = foe +# 1;};
-		i = $NextCreatureIndex(i,sideset);
-	};
-$IF (foe == 0)
-	{
-		$SA_REMOVE();
-		$RETURN "Y";
-	};
-$RETURN "N";
\(END)

\(BEGIN)
name = IsDragonFlee
[AutoAction] = $RETURN "F" + $SA_PARAM_GET();
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Fleeing Dragon");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[IsCombatReady] = $VAR me;
-$VAR sideset;
-$VAR foe;
-$VAR i;
-me = $IndexOf($CharacterContext());
-$IF ($GET_CHAR_ASL(me,"side") == 1){sideset = 3;}
-$ELSE {sideset = 5;};
-foe = 0;
-i = $NextCreatureIndex("",sideset);
-$WHILE (i != "")
-	{
-		$IF ($GET_CHAR_ASL(i,"FearAdj")){foe = foe +# 1;};
-		i = $NextCreatureIndex(i,sideset);
-	};
-$IF (foe == 0){$SA_REMOVE();};
\(END)

\(BEGIN)
name = IsDrained
[TrainingCharacter] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsElf
[CreateMonsterCombatant] = $VAR chr; // character
-chr = $IndexOf($CharacterContext());
-$SET_CHARACTER_SA($CharacterContext(),"IsElf",$SA_PARAM_GET());
-$SET_CHAR_RACE(chr,"Elf");
[DoesAttackSucceed] = $VAR wpn;
-wpn = $GET_CHAR_Ready($AttackerContext(),"WEAPON",0);
-$IF ($GET_CHARACTER_SA($AttackerContext(),"IsElf") != "-?-?-" && $GET_ITEM_SA(wpn,"item_ElfBonus") != "-?-?-")
-	{
-		$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) -# 1);
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[DoesSpellAttackSucceed] = $VAR atk;
-$VAR caster;
-$VAR caster1;
-$VAR caster2;
-$VAR level;
-$VAR base;
-$IF ($SA_SPELL_GET("DamageMagical") != "charm"){$RETURN;};
-atk = $IndexOf($AttackerContext());
-caster = $SA_SPELL_GET("Caster");
-caster1 = $DelimitedStringSubstring(caster,0);
-caster2 = $DelimitedStringSubstring(caster,1);
-$IF (caster1 == "monster")
-	{
-		level =  $GET_MONSTERTYPE_SA($GET_CHAR_NAME(atk),"monsterLevel");
-		base = 11;
-	}
-$ELSE
-	{
-		$IF (caster1 == "item")
-			{
-				level = caster2;
-				base = 11;
-			}
-		$ELSE
-			{
-				level = $GET_CHAR_Lvl(atk,caster1);
-				base = caster2;
-			};
-	};
-$IF ($RANDOM(100) <# 90 -# 5 *# (level -# base))
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected" );
-		$RETURN "N";
-	};
\(END)

\(BEGIN)
name = IsEnfeebled
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Enfeebled");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($AttackerContext(),"IsEnfeebled") != "-?-?-")
-  {$SET_COMBATANT_SA($TargetContext(),"IsEnfeebledHit",1);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsEnfeebledHit
[ComputeDamage] = $IF ($GET_COMBATANT_SA($AttackerContext(),"IsEnfeebled") != "-?-?-")
-  {
-   $SET_HOOK_PARAM(5,($GET_HOOK_PARAM(5) *# $GET_COMBATANT_SA($AttackerContext(),"enfeebled")) /# 100);
-   $IF ($GET_HOOK_PARAM(5) == 0) {$SET_HOOK_PARAM(5,1);};
-  };
-$SA_REMOVE();
\(END)

\(BEGIN)
name = IsEnlarged
[CanCastSpells] = $VAR me;
-me = $IndexOf($CharacterContext());
-$IF ($GET_PARTY_TIME() ># $GET_CHARACTER_SA($CharacterContext(),"enlarged"))
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"enlarged");
-		$SET_CHAR_SIZE(me,$GET_CHARACTER_SA($CharacterContext(),"mySize"));
-		$RUN_CHAR_SE_SCRIPTS($CharacterContext(),"Dispel SE");
-		$SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Enlarged");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $VAR me;
-me = $IndexOf($CharacterContext());
-$DELETE_CHARACTER_SA($CharacterContext(),"enlarged");
-$REMOVE_CHAR_MODIFICATION(me,"SPELL Enlarge *");
-$SET_CHAR_SIZE(me,$GET_CHARACTER_SA($CharacterContext(),"mySize"));
-$RUN_CHAR_SE_SCRIPTS($CharacterContext(),"Dispel SE");
-$SA_REMOVE();
[Dispel enlarged] = $VAR me;
-me = $IndexOf($CharacterContext());
-$DELETE_CHARACTER_SA($CharacterContext(),"enlarged");
-$REMOVE_CHAR_MODIFICATION(me,"SPELL Enlarge *");
-$SET_CHAR_SIZE(me,$GET_CHARACTER_SA($CharacterContext(),"mySize"));
-$RUN_CHAR_SE_SCRIPTS($CharacterContext(),"Dispel SE");
-$SA_REMOVE();
\(END)

\(BEGIN)
name = IsEntangled0
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Entangled by Vines");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[ComputeDamage] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 1;
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $RETURN "0";
[IsCombatReady] = $VAR exp; // expiration time
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() >=# exp)
-	{
-		$SA_REMOVE();
-		$RETURN "Y";
-	}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsEntangled1
[CharDisplayStatus] = $RUN_AREA_SE_SCRIPTS("Entangled1", $IndexOf($CharacterContext()));
-$SET_HOOK_PARAM( 7, $GET_HOOK_PARAM(8));
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $VAR chr; // character
-chr = $IndexOf($CharacterContext());
-$SET_HOOK_PARAM(6, $GET_HOOK_PARAM(5));
-$RUN_AREA_SE_SCRIPTS("MovementAdjustments", chr);
-$RETURN $GET_HOOK_PARAM(5);
\(END)

\(BEGIN)
name = IsFast
[AdjustInitiative] = $RETURN -2;
[CharDisplayStatus] = $VAR exp; // expiration time
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() >=# exp){$SA_REMOVE();};
-$SET_HOOK_PARAM( 7,"Hasted");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $RETURN $GET_HOOK_PARAM(5) *# 2;
[GetNumberOfAttacks] = $RETURN 2;
\(END)

\(BEGIN)
name = IsFastBoots
[GetAdjMaxMovement] = $RETURN $GET_HOOK_PARAM(5) *# 2;
\(END)

\(BEGIN)
name = IsFeebleminded
[CanCastSpells] = $RETURN "N";
[CanKnowSpell] = $RETURN "N";
[CanMemorizeSpells] = $RETURN "N";
[IsCombatReady] = $RETURN "N";
\(END)

\(BEGIN)
name = IsFleeing
[AutoAction] = $RETURN "F" + $IndexOf($LEAST_DAMAGED_FRIENDLY());
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
\(END)

\(BEGIN)
name = IsFumbling
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-  {$RETURN $SA_REMOVE();};
-$SET_HOOK_PARAM( 7,"Fumbling ");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $RETURN "0";
[IsCombatReady] = $RETURN "N";
\(END)

\(BEGIN)
name = IsGreenSlimed
[StartCombatRound] = $VAR round;
-$VAR rnd;
-$VAR nRound;
-$IF ($GET_CHARACTER_SA($CharacterContext(),"IsGreenSlimed") != "-?-?-"){$RETURN;};
-round = $SA_PARAM_GET();
-rnd = $RANDOM(4) +# 1;
-nRound = $GetCombatRound();
-$IF (nRound >=# (round +# rnd))
-	{
-		$SET_CHAR_HITPOINTS(tgt,-11);
-		$SET_CHAR_STATUS(tgt,5);
-		$AddCombatant("Green Slime",1);
-	};
\(END)

\(BEGIN)
name = IsHeld
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET()){$RETURN $SA_REMOVE();};
-$SET_HOOK_PARAM( 7,"Held ");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsHeld") != "-?-?-")
-	{$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) -# 30);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[GetItemTargetHitBonus] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 15;
[IsCombatReady] = $RETURN "N";
\(END)

\(BEGIN)
name = IsHelpless
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Helpless");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN "0";
\(END)

\(BEGIN)
name = IsHugged
[CanCastSpells] = $VAR com; // combatant
-com = $IndexOf($CombatantContext());
-$IF ($GET_CHAR_HITPOINTS(com) <# 1) 
-	{
-		$SA_REMOVE();
-		$RETURN;
-	};
-$RETURN "N";
[GetAdjMaxMovement] = $RETURN 0;
\(END)

\(BEGIN)
name = IsImmuneDB
[Dispel] = $SA_REMOVE();
[DoesSpellAttackSucceed] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($SA_SPELL_GET("DragonBreathWeapon") != "-?-?-")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME(tgt) +" is unaffected"); 
-		$RETURN "N";
-	};
\(END)

\(BEGIN)
name = IsImmuneDisease
[CharDisplayStatus] = $SET_HOOK_PARAM(7,"Immune to Disease");
-$SET_HOOK_PARAM(6,"");
-$RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageMagical") == "disease" || $SA_SPELL_GET("DamageNonMagical") == "disease"){$RETURN "N";};
\(END)

\(BEGIN)
name = IsImmuneDragonBreathWeapon
[Dispel] = $SA_REMOVE();
[DoesSpellAttackSucceed] = $VAR param;
-$VAR prm1;
-$VAR prm2;
-$VAR tgt; // target
-param = $SA_PARAM_GET();
-prm1 = $DelimitedStringSubstring(param,0);
-prm2 = $DelimitedStringSubstring(param,1);
-tgt = $IndexOf($TargetContext());
-$IF ($SA_SPELL_GET("DragonBreathWeapon") == prm1)
-	{$SET_HOOK_PARAM(5,$GET_CHAR_NAME(tgt) +" is unaffected"); $RETURN "N";};
-$IF ($SA_SPELL_GET("DragonBreathWeapon") == prm2)
-	{$SET_HOOK_PARAM(5,$GET_CHAR_NAME(tgt) +" is unaffected"); $RETURN "N";};
\(END)

\(BEGIN)
name = IsImmuneNormalMissiles
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{$RETURN $SA_REMOVE();};
-$IF ($GET_HOOK_PARAM(5) == "DISPLAY")
-	{
-		$SET_HOOK_PARAM( 7,"Prot from Normal Missiles");
-		$SET_HOOK_PARAM( 6,"3");
-	};
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsImmuneNormalMissiles") != "-?-?-")
-	{
-		$IF ((($SA_ITEM_GET("item_HurledWeapon") != "-?-?-" && $VisualDistance(tgt,$IndexOf($AttackerContext())) ># 1) || $SA_ITEM_GET("item_MissileWeapon") != "-?-?-") && $SA_ITEM_GET("item_MagicalWeapon") == "-?-?-")
-			{
-				$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 90);
-			};
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsImmunePoison
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageMagical") == "poison" || $SA_SPELL_GET("DamageNonMagical") == "poison"){$RETURN "N";};
\(END)

\(BEGIN)
name = IsImmuneSpells
[Dispel] = $SA_REMOVE();
[DoesSpellAttackSucceed] = $VAR spLvl;
-$VAR spAtk;
-spLvl = $GET_SPELL_Level($SpellContext());
-spAtk = $GET_SPELL_SA($SpellContext(),"spell_Attack");
-$IF (spLvl <=# 4){$IF (spAtk != "-?-?-"){$RETURN "N";};};
\(END)

\(BEGIN)
name = IsImmuneSpellsMinor
[Dispel] = $SA_REMOVE();
[DoesSpellAttackSucceed] = $VAR spLvl;
-$VAR spAtk;
-spLvl = $GET_SPELL_Level($SpellContext());
-spAtk = $GET_SPELL_SA($SpellContext(),"spell_Attack");
-$IF (spLvl <=# 3){$IF (spAtk != "-?-?-"){$RETURN "N";};};
\(END)

\(BEGIN)
name = IsInsectFlee
[AutoAction] = $RETURN "F" + $SA_PARAM_GET();
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Fleeing insects");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
\(END)

\(BEGIN)
name = IsInvisible
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($AttackerContext(),"IsInvisible") != "-?-?-")
-	{
-		$DELETE_CHARACTER_SA($AttackerContext(),"IsInvisibleSpell");
-		$DELETE_COMBATANT_SA($AttackerContext(),"IsInvisible");
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[IsValidTarget] = $IF ($SA_COMBATANT_GET("IsSeeingInvisible") != "-?-?-"){$RETURN "Y";};
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsFaerieFire") != "-?-?-"){$RETURN;}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsInvisiblePotion
[CharDisplayStatus] = $IF ($GET_HOOK_PARAM(5) == "DISPLAY")
-	{
-		$SET_HOOK_PARAM(7,"Invisible, Potion");
-		$SET_HOOK_PARAM(6,"");
-		$RETURN 1;
-	};
[Dispel] = $SA_REMOVE();
[spawn] = $SET_COMBATANT_SA($CharacterContext(),"IsInvisible",1);
\(END)

\(BEGIN)
name = IsInvisibleRing
[CharDisplayStatus] = $IF ($GET_HOOK_PARAM(5) == "DISPLAY")
-	{
-		$SET_HOOK_PARAM(7,"Invisible, Ring");
-		$SET_HOOK_PARAM(6,"");
-		$RETURN 1;
-	};
[Dispel] = $SA_REMOVE();
[OnStartCombatantAction] = $SET_COMBATANT_SA($CharacterContext(),"IsInvisible",1);
[spawn] = $SET_COMBATANT_SA($CharacterContext(),"IsInvisibleRing",1);
-$SET_COMBATANT_SA($CharacterContext(),"IsInvisible",1);
\(END)

\(BEGIN)
name = IsInvisibleSpell
[CharDisplayStatus] = $IF ($GET_HOOK_PARAM(5) == "DISPLAY")
-	{
-		$SET_HOOK_PARAM(7,"Invisible, spell");
-		$SET_HOOK_PARAM(6,2);
-		$RETURN 1;
-	};
[Dispel] = $SA_REMOVE();
[spawn] = $SET_COMBATANT_SA($CharacterContext(),"IsInvisible",1);
\(END)

\(BEGIN)
name = IsInvisibleStalker
[IsValidTarget] = $IF ($SA_COMBATANT_GET("IsSeeingInvisible") != "-?-?-"){$RETURN "Y";};
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsFaerieFire") != "-?-?-"){$RETURN;}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsInvisibleToAnimals
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Invisible to Animals");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[IsValidTarget] = $IF ($GET_ISANIMAL($AttackerContext()) <# 0){$RETURN "Y";};
-$IF ($SA_COMBATANT_GET("IsSeeingInvisible") != "-?-?-") {$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsLichFear
[CanAim] = $RETURN "N";
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET()){$RETURN $SA_REMOVE();};
-$SET_HOOK_PARAM( 7,"Paralyzed with fear");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[ComputeDamage] = $VAR dmg;
-$VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsLichFear") != "-?-?-")
-	{
-		$SET_CHAR_ASL(tgt,"lichfear","");
-		$SET_HOOK_PARAM(5,$GET_CHAR_HITPOINTS(tgt) +# 10);
-		$RETURN $GET_HOOK_PARAM(5);
-	};
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsLichFear") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) -# 30);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[DrawMoveMenu] = $SET_HOOK_PARAM(1,0);
[GetAdjMaxMovement] = $DELETE_CHARACTER_SA($CharacterContext(),"IsFastBoots");
-$RETURN 0;
[GetItemTargetHitBonus] = $DEBUG("ILF githb");
[IsCombatReady] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET()){$RETURN $SA_REMOVE();};
-$RETURN "N";
\(END)

\(BEGIN)
name = IsMindFlayed
[StartCombatRound] = $VAR round;
-$VAR rnd;
-$VAR nRound;
-$IF ($GET_CHARACTER_SA($CharacterContext(),"IsMindFlayed") != "-?-?-"){$RETURN;};
-round = $SA_PARAM_GET();
-rnd = $RANDOM(4) +# 1;
-nRound = $GetCombatRound();
-$IF (nRound >=# (round +# rnd)){$SET_CHAR_HITPOINTS(tgt,-11);$SET_CHAR_STATUS(tgt,5);};
\(END)

\(BEGIN)
name = IsMirrored
[CanCastSpells] = $IF ($IS_AFFECTED_BY_SPELL($CharacterContext(),"Mirror Image") == "")
-  {$SA_REMOVE();};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET() + " mirror images");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $VAR remain;
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsMirrored") != "-?-?-")
-	{
-		remain = $SA_PARAM_GET();
-		$IF ($RANDOM(remain +# 1) !=# 0)
-			{  // Image targeted
-				$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6))
-					{ // Removing image
-						$SA_PARAM_SET(remain -# 1);
-						$IF ($GET_CHARACTER_SA($TargetContext(),"IsMirrored") <# 1)
-							{ // Images depleted
-								$SA_REMOVE();
-							};
-					};
-				$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 90);
-			};
-	};  // Caster targeted
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsMummyDiseased
[CanCastSpells] = $VAR me;
-me = $IndexOf($CharacterContext());
-$IF ($GET_PARTY_DAYS() >=# $SA_PARAM_GET())
-	{
-		$SA_PARAM_SET($GET_PARTY_DAYS() +# 30);
-		$MODIFY_CHAR_ATTRIBUTE(me,"CHA",-2, "MINUTES", 9999999, "Mummy Disease","MONSTER Disease");
-		$SET_CHARACTER_SA($CharacterContext(),"pcCHA",$GET_CHAR_LIMITED_CHA(me));
-		$SET_CHARACTER_SA($CharacterContext(),"rot",$GET_CHARACTER_SA($CharacterContext(),"rot") +# 17);
-		$IF ($RANDOM(100) <= $GET_CHARACTER_SA($CharacterContext(),"rot"))
-			{
-				$SET_CHAR_HITPOINTS(me,0);
-				$SET_CHAR_STATUS(me,5);
-			};
-		$IF ($GET_CHAR_LIMITED_CHA(me) <# 6)
-			{
-				$SET_CHAR_STATUS(me,5);
-			};
-	};
-$IF ($GET_CHAR_STATUS(me) ==# 2 && $GET_CHARACTER_SA($CharacterContext(),"IsMummyRotting") == "-?-?-")
-	{
-		$SET_CHARACTER_SA($CharacterContext(),"IsMummyRotting",$GET_PARTY_TIME() +# 60);
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Has Mummy Rot");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesSpellAttackSucceed] = $VAR dm;
-dm = $SA_SPELL_GET("DamageMagical");
-$IF ($SA_SOURCE_NAME() == "Heal" || dm == "cureDis"){$RETURN $SA_REMOVE();};
-$IF ((dm == "wound" && $SA_SPELL_GET("spell_Attack") == "-?-?-") || dm == "raise"){$RETURN "N";};
\(END)

\(BEGIN)
name = IsMummyFear
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Paralyzed with fear");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsParalyzed") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) -# 30);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[GetItemTargetHitBonus] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 1;
[IsCombatReady] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$SET_COMBATANT_SA($CombatantContext(),"IsOverMummy","");
-		$SA_REMOVE();};
-		$RETURN "1";
-	};
-$RETURN "N";
\(END)

\(BEGIN)
name = IsMummyRotting
[CanCastSpells] = $VAR me;
-me = $IndexOf($CharacterContext());
-$IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"IsMummyDiseased");
-		$SA_REMOVE();
-		$SET_CHAR_HITPOINTS(me,0);
-		$SET_CHAR_STATUS(me,5);
-	};
[DoesSpellAttackSucceed] = $IF ($GET_CHARACTER_SA($TargetContext(),"IsMummyDiseased") == "-?-?-" && $SA_SPELL_GET("DamageMagical") == "raise")
-	{
-		$SA_REMOVE();
-		$RETURN "Y";
-	};
\(END)

\(BEGIN)
name = IsPaladinImmuneDisease
[CharDisplayStatus] = $SET_HOOK_PARAM(7,"Immune to Disease");
-$SET_HOOK_PARAM(6,"");
-$RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageMagical") == "disease" || $SA_SPELL_GET("DamageNonMagical") == "disease"){$RETURN "N";};
\(END)

\(BEGIN)
name = IsPaladinProtectedFromEvil
[CharDisplayStatus] = $SET_HOOK_PARAM(7,"Protected From Evil");
-$SET_HOOK_PARAM(6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($TargetContext(),"IsPaladinProtectedFromEvil") != "-?-?-")
-	{
-		$IF ($GET_COMBATANT_SA($AttackerContext(),"Summoned") != "-?-?-")
- 			{$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 90);};
-		$IF ($AlignmentEvil($AttackerContext()))
-			{$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 2);};
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[SaveVsBW_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsPPDM_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsPP_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsRSW_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsSp_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
\(END)

\(BEGIN)
name = IsParalyzed
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Paralyzed");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsParalyzed") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) -# 30);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[GetItemTargetHitBonus] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 1;
[IsCombatReady] = $RETURN "N";
\(END)

\(BEGIN)
name = IsPerson
Parameters = "brownies, dryads, dwarves, elves, gnolls, gnomes, goblins, half-elves, halflings, half-orcs, hobgoblins, humans, kobolds, lizard men, nixies, orcs, pixies, sprites, troglodytes";
\(END)

\(BEGIN)
name = IsPetrified
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Petrified");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[IsCombatReady] = $RETURN "N";
\(END)

\(BEGIN)
name = IsPlant
\(END)

\(BEGIN)
name = IsPoisoned
[BeginResting] = $RETURN "1";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Poisoned");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
\(END)

\(BEGIN)
name = IsPraying
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Praying");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsProtectedAcidCaster
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"AcidPoints");
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedAcidCaster1");
-		$RETURN $SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Acid");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "acid")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected.");
-		$RETURN "N";
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedAcidCaster1",1);
\(END)

\(BEGIN)
name = IsProtectedAcidCaster1
[ComputeSpellDamage] = $VAR points;
-$VAR adj;
-$IF ($SA_SPELL_GET("DamageMagical") == "acid")
-	{
-		adj = $GET_HOOK_PARAM(0);
-		$IF (adj == "") {adj = $GET_HOOK_PARAM(5);};
-		points = $GET_CHARACTER_SA($TargetContext(),"AcidPoints");
-		$IF (0 -# points <# adj)
-			{
-				$SET_CHARACTER_SA($TargetContext(),"AcidPoints",points +# adj);
-				$SET_HOOK_PARAM(5,0);
-			}
-		$ELSE
-			{
-				$DELETE_CHARACTER_SA($TargetContext(),"AcidPoints");
-				$DELETE_CHARACTER_SA($TargetContext(),"IsProtectedAcidCaster");
-				$SA_REMOVE();
-				$SET_HOOK_PARAM(5,(adj +# points));
-			};
-	};
-$RETURN $GET_HOOK_PARAM(5);
\(END)

\(BEGIN)
name = IsProtectedAcidTarget
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedAcidTarget1");
-		$SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Acid");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "acid")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected.");
-		$RETURN "N";
-	};
[SaveVsBW_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "acid")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[SaveVsRSW_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "acid")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[SaveVsSp_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "acid")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedAcidTarget1",1);
\(END)

\(BEGIN)
name = IsProtectedAcidTarget1
[ComputeSpellDamage] = $VAR adj;
-adj = $GET_HOOK_PARAM(0);
-$IF (adj == ""){adj = $GET_HOOK_PARAM(5);};
-$IF ($SA_SPELL_GET("DamageMagical") == "acid"){$SET_HOOK_PARAM(5,(adj -# 1) /# 2);};
-$RETURN $GET_HOOK_PARAM(5);
\(END)

\(BEGIN)
name = IsProtectedEvil
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-  {$RETURN $SA_REMOVE();};
-$IF ($GET_HOOK_PARAM(5) == "DISPLAY")
-	{
-		$SET_HOOK_PARAM( 7,"Protected from Evil");
-		$SET_HOOK_PARAM( 6,"");
-	};
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($TargetContext(),"IsProtectedEvil") != "-?-?-")
-	{
-		$IF ($GET_COMBATANT_SA($AttackerContext(),"Summoned") != "-?-?-")
-			{$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 90);};
-		$IF ($AlignmentEvil($AttackerContext()))
-			{$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 2);};
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6))
-  {$RETURN "Y";}
-$ELSE {$RETURN "N";};
[SaveVsBW_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsPPDM_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsPP_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsRSW_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsSp_Save] = $IF ($AlignmentEvil($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
\(END)

\(BEGIN)
name = IsProtectedFireCaster
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"FirePoints");
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedFireCaster1");
-		$RETURN $SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Fire");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "fire")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected.");
-		$RETURN "N";
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedFireCaster1",1);
\(END)

\(BEGIN)
name = IsProtectedFireCaster1
[ComputeSpellDamage] = $VAR points;
-$VAR adj;
-$IF ($SA_SPELL_GET("DamageMagical") == "fire")
-	{
-		adj = $GET_HOOK_PARAM(0);
-		$IF (adj == "") {adj = $GET_HOOK_PARAM(5);};
-		points = $GET_CHARACTER_SA($TargetContext(),"FirePoints");
-		$IF (0 -# points <# adj)
-			{
-				$SET_CHARACTER_SA($TargetContext(),"FirePoints",points +# adj);
-				$SET_HOOK_PARAM(5,0);
-			}
-		$ELSE
-			{
-				$DELETE_CHARACTER_SA($TargetContext(),"FirePoints");
-				$DELETE_CHARACTER_SA($TargetContext(),"IsProtectedFireCaster");
-				$SA_REMOVE();
-				$SET_HOOK_PARAM(5,(adj +# points));
-			};
-	};
-$RETURN $GET_HOOK_PARAM(5);
\(END)

\(BEGIN)
name = IsProtectedFireTarget
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedFireTarget1");
-		$SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Fire");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "fire")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected.");
-		$RETURN "N";
-	};
[SaveVsBW_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "fire")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[SaveVsRSW_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "fire")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[SaveVsSp_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "fire")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedFireTarget1",1);
\(END)

\(BEGIN)
name = IsProtectedFireTarget1
[ComputeSpellDamage] = $VAR adj;
-adj = $GET_HOOK_PARAM(0);
-$IF (adj == ""){adj = $GET_HOOK_PARAM(5);};
-$IF ($SA_SPELL_GET("DamageMagical") == "fire"){$SET_HOOK_PARAM(5,(adj -# 1) /# 2);};
-$RETURN $GET_HOOK_PARAM(5);
\(END)

\(BEGIN)
name = IsProtectedGood
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET()){$RETURN $SA_REMOVE();};
-$IF ($GET_HOOK_PARAM(5) == "DISPLAY")
-  {
-    $SET_HOOK_PARAM( 7,"Protected from Good");
-    $SET_HOOK_PARAM( 6,"");
-  };
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_CHARACTER_SA($TargetContext(),"IsProtectedGood") != "-?-?-")
-	{
-		$IF ($GET_COMBATANT_SA($AttackerContext(),"Summoned") != "-?-?-")
-			{$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 90);};
-		$IF ($AlignmentGood($AttackerContext()))
-			{$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 2);};
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[SaveVsBW_Save] = $IF ($AlignmentGood($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsPPDM_Save] = $IF ($AlignmentGood($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsPP_Save] = $IF ($AlignmentGood($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsRSW_Save] = $IF ($AlignmentGood($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
[SaveVsSp_Save] = $IF ($AlignmentGood($AttackerContext())){$RETURN $GET_HOOK_PARAM(0) -# 2;};
\(END)

\(BEGIN)
name = IsProtectedLightningCaster
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"ZapPoints");
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedLightningCaster1");
-		$RETURN $SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Lightning");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesSpellAttackSucceed] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($SA_SPELL_GET("DamageNonMagical") == "electricity")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME(tgt) +" is unaffected.");
-		$RETURN "N";
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedLightningCaster1",1);
\(END)

\(BEGIN)
name = IsProtectedLightningCaster1
[ComputeSpellDamage] = $VAR points;
-$VAR adj;
-$IF ($SA_SPELL_GET("DamageMagical") == "electricity")
-	{
-		adj = $GET_HOOK_PARAM(0);
-		$IF (adj == "") {adj = $GET_HOOK_PARAM(5);};
-		points = $GET_CHARACTER_SA($TargetContext(),"ZapPoints");
-		$IF (0 -# points <# adj)
-			{
-				$SET_CHARACTER_SA($TargetContext(),"ZapPoints",points +# adj);
-				$SET_HOOK_PARAM(5,0);
-			}
-		$ELSE
-			{
-				$DELETE_CHARACTER_SA($TargetContext(),"ZapPoints");
-				$DELETE_CHARACTER_SA($TargetContext(),"IsProtectedLightningCaster");
-				$SA_REMOVE();
-				$SET_HOOK_PARAM(5,(adj +# points));
-			};
-	};
-$RETURN $GET_HOOK_PARAM(5);
\(END)

\(BEGIN)
name = IsProtectedLightningTarget
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedLightningTarget1");
-		$SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Lightning");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "electricity")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected.");
-		$RETURN "N";
-	};
[SaveVsBW_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "electricity")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[SaveVsRSW_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "electricity")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[SaveVsSp_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "electricity")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedLightningTarget1",1);
\(END)

\(BEGIN)
name = IsProtectedLightningTarget1
[ComputeSpellDamage] = $VAR adj;
-adj = $GET_HOOK_PARAM(0);
-$IF (adj == ""){adj = $GET_HOOK_PARAM(5);};
-$IF ($SA_SPELL_GET("DamageMagical") == "electricity"){$SET_HOOK_PARAM(5,(adj -# 1) /# 2);};
-$RETURN $GET_HOOK_PARAM(5);
\(END)

\(BEGIN)
name = IsProtectedPoisonCaster
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"PoisonPoints");
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedPoisonCaster1");
-		$RETURN $SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Poison");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "poison")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected.");
-		$RETURN "N";
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedPoisonCaster1",1);
\(END)

\(BEGIN)
name = IsProtectedPoisonCaster1
[ComputeSpellDamage] = $VAR points;
-$VAR adj;
-$IF ($SA_SPELL_GET("DamageMagical") == "poison")
-	{
-		adj = $GET_HOOK_PARAM(0);
-		$IF (adj == "") {adj = $GET_HOOK_PARAM(5);};
-		points = $GET_CHARACTER_SA($TargetContext(),"PoisonPoints");
-		$IF (0 -# points <# adj)
-			{
-				$SET_CHARACTER_SA($TargetContext(),"PoisonPoints",points +# adj);
-				$SET_HOOK_PARAM(5,0);
-			}
-		$ELSE
-			{
-				$DELETE_CHARACTER_SA($TargetContext(),"PoisonPoints");
-				$DELETE_CHARACTER_SA($TargetContext(),"IsProtectedPoisonCaster");
-				$SA_REMOVE();
-				$SET_HOOK_PARAM(5,(adj +# points));
-			};
-	};
-$RETURN $GET_HOOK_PARAM(5);
\(END)

\(BEGIN)
name = IsProtectedPoisonTarget
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedPoisonTarget1");
-		$SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Poison");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesSpellAttackSucceed] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($SA_SPELL_GET("DamageNonMagical") == "poison")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME(tgt) +" is unaffected.");
-		$RETURN "N";
-	};
[SaveVsBW_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "poison")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[SaveVsRSW_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "poison")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[SaveVsSp_Save] = $IF ($SA_SPELL_GET("DamageMagical") == "poison")
-	{$RETURN $GET_HOOK_PARAM(0) -# 4;};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedPoisonTarget1",1);
\(END)

\(BEGIN)
name = IsProtectedPoisonTarget1
[ComputeSpellDamage] = $VAR adj;
-adj = $GET_HOOK_PARAM(0);
-$IF (adj == ""){adj = $GET_HOOK_PARAM(5);};
-$IF ($SA_SPELL_GET("DamageMagical") == "poison"){$SET_HOOK_PARAM(5,(adj -# 1) /# 2);};
-$RETURN $GET_HOOK_PARAM(5);
\(END)

\(BEGIN)
name = IsReduced
[CanCastSpells] = $VAR me;
-me = $IndexOf($CharacterContext());
-$IF ($GET_PARTY_TIME() ># $GET_CHARACTER_SA($CharacterContext(),"reduced"))
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"reduced");
-		$SET_CHAR_SIZE(me,$GET_CHARACTER_SA($CharacterContext(),"mySize"));
-		$RUN_CHAR_SE_SCRIPTS($CharacterContext(),"Dispel SE");
-		$SA_REMOVE();
-	};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Reduced");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $VAR me;
-me = $IndexOf($CharacterContext());
-$DELETE_CHARACTER_SA($CharacterContext(),"reduced");
-$REMOVE_CHAR_MODIFICATION(me,"SPELL Reduce *");
-$SET_CHAR_SIZE(me,$GET_CHARACTER_SA($CharacterContext(),"mySize"));
-$RUN_CHAR_SE_SCRIPTS($CharacterContext(),"Dispel SE");
-$SA_REMOVE();
[Dispel reduced] = $VAR me;
-me = $IndexOf($CharacterContext());
-$DELETE_CHARACTER_SA($CharacterContext(),"reduced");
-$REMOVE_CHAR_MODIFICATION(me,"SPELL Reduce *");
-$SET_CHAR_SIZE(me,$GET_CHARACTER_SA($CharacterContext(),"mySize"));
-$RUN_CHAR_SE_SCRIPTS($CharacterContext(),"Dispel SE");
-$SA_REMOVE();
[GetAdjMaxMovement] = $RETURN $GET_HOOK_PARAM(5) /# 2;
\(END)

\(BEGIN)
name = IsReflecting
[RedirectSpell] = $VAR atk; // attacker/caster
-$VAR tgt; // target
-$VAR cName; // caster's name
-$VAR tName; // target's name
-$VAR list; // list of gaze type
-$VAR num; // number of gaze type
-$VAR reflect; // gaze being reflected
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-cName = $GET_CHAR_NAME (atk);
-tName = $GET_CHAR_NAME (tgt);
-list = "$its gaze|monsterCharmGaze$its gaze|monsterConfusionGaze$its gaze|monsterPetrifyGaze";
-num = $DelimitedStringCount(list);
-$WHILE (num ># 0)
-	{
-		num = num -# 1;
-		reflect = $DelimitedStringSubstring(list,num);
-		$IF ($SpellContext() == reflect)
-			{
-				$SET_HOOK_PARAM(5,$IndexOf($AttackerContext()));
-				$SET_HOOK_PARAM(6, tName + " reflects " + reflect  + " back at " + cName);
-			};
-	};
\(END)

\(BEGIN)
name = IsResistantCold
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Cold Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR resist;
-$VAR expiration;
-expiration = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() >=# expiration){$SA_REMOVE();};
-resist = $SA_ITEM_GET("DamageMagical");
-$IF (resist == "cold"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[ComputeSpellDamage] = $VAR resist;
-$VAR expiration;
-expiration = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() >=# expiration){$SA_REMOVE();};
-resist = $SA_SPELL_GET("DamageMagical");
-$IF (resist == "cold"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsResistantFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Fire Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR resist;
-$VAR expiration;
-expiration = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() >=# expiration){$SA_REMOVE();};
-resist = $SA_ITEM_GET("DamageMagical");
-$IF (resist == "fire"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[ComputeSpellDamage] = $VAR resist;
-$VAR expiration;
-expiration = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() >=# expiration){$SA_REMOVE();};
-resist = $SA_SPELL_GET("DamageMagical");
-$IF (resist == "fire"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsRingImmuneElectricity
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Electricity");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR immune;
-immune = $SA_ITEM_GET("DamageMagical");
-$IF (immune == "electricity"){$RETURN 0;};
[ComputeSpellDamage] = $VAR immune;
-immune = $SA_SPELL_GET("DamageMagical");
-$IF (immune == "electricity"){$RETURN 0;};
\(END)

\(BEGIN)
name = IsRingResistantCold
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Cold Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR resist;
-resist = $SA_ITEM_GET("DamageMagical");
-$IF (resist == "cold"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[ComputeSpellDamage] = $VAR resist;
-resist = $SA_SPELL_GET("DamageMagical");
-$IF (resist == "cold"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = IsRingResistantFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Fire Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR resist;
-resist = $SA_ITEM_GET("DamageMagical");
-$IF (resist == "fire"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[ComputeSpellDamage] = $VAR resist;
-resist = $SA_SPELL_GET("DamageMagical");
-$IF (resist == "fire"){$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = IsRingWizardry
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Wearing Wizard Ring");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
\(END)

\(BEGIN)
name = IsShielded
[CharDisplayStatus] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET()){$SA_REMOVE();};
-$IF ($GET_HOOK_PARAM(5) == "DISPLAY")
-	{
-		$SET_HOOK_PARAM( 7,"Shield");
-		$SET_HOOK_PARAM( 6,"1");
-	};
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $VAR atk; // attacker/caster
-$VAR tgt; // target
-$VAR par5; // Hook parameter 5
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsShielded") == "-?-?-"){$RETURN;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-par5 = $GET_HOOK_PARAM(5);
-$IF ($SA_ITEM_GET("item_HurledWeapon") != "-?-?-" && $VisualDistance(atk,tgt) ># 1)
-	{$SET_HOOK_PARAM(5,par5 -# 8);}
-$ELSE
-	{
-		$IF ($SA_ITEM_GET("item_MissileWeapon") != "-?-?-"){$SET_HOOK_PARAM(5,$GET_HOOK_PARAM(5) -# 7);}
-		$ELSE {$SET_HOOK_PARAM(5,par5 -# 6);};
-	};
-$IF ($GET_HOOK_PARAM(5) <# $GET_HOOK_PARAM(6)){$RETURN "N";};
[DoesSpellAttackSucceed] = $IF ($SA_SOURCE_NAME() == ("Magic Missile" || "Magic Missile|Ranger")){$RETURN "N";};
\(END)

\(BEGIN)
name = IsShortSaveBonus
[SaveVsBW_Save] = $RETURN $GET_HOOK_PARAM(0) +# $SA_PARAM_GET();
[SaveVsPPDM_Save] = $RETURN $GET_HOOK_PARAM(0) +# $SA_PARAM_GET();
[SaveVsPP_Save] = $RETURN $GET_HOOK_PARAM(0) +# $SA_PARAM_GET();
[SaveVsRSW_Save] = $RETURN $GET_HOOK_PARAM(0) +# $SA_PARAM_GET();
[SaveVsSp_Save] = $RETURN $GET_HOOK_PARAM(0) +# $SA_PARAM_GET();
\(END)

\(BEGIN)
name = IsSilenced
[CanCastSpells] = $VAR exp; // expiration time
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() >=# exp){$SA_REMOVE();};
-$RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Silenced");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsSleepResistant
\(END)

\(BEGIN)
name = IsSleepResistantMin
\(END)

\(BEGIN)
name = IsSleeping
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $RETURN "Y";
[GetAdjMaxMovement] = $RETURN 0;
[GetItemTargetHitBonus] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 15;
[IsCombatReady] = $RETURN "N";
\(END)

\(BEGIN)
name = IsSlow
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $VAR expiration;
-expiration = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() >=# expiration){$SA_REMOVE();};
-$RETURN $GET_HOOK_PARAM(5) /# 2;
[GetNumberOfAttacks] = $VAR attackNum;
-attackNum = $GET_HOOK_PARAM(5);
-$IF ((attackNum %# 2) ==# 0){$RETURN attackNum /# 2;}
-$ELSE
-	{
-		$IF (($GetCombatRound() %# 2) ==# 0){$RETURN (attackNum +# 1) /# 2;}
-		$ELSE{$RETURN (attackNum -# 1) /# 2;};
-	};
\(END)

\(BEGIN)
name = IsSlowedPoison
[CanCastSpells] = $VAR exp; // expiratoin time
-$VAR time;
-$VAR chr; // character
-$VAR hp;
-exp = $SA_PARAM_GET();
-time = $GET_PARTY_TIME();
-chr = $IndexOf($CharacterContext());
-hp = $GET_CHAR_HITPOINTS(chr);
-$IF (time ># exp)
-	{
-		$SA_REMOVE();
-		$SET_CHAR_STATUS(chr,2);
-		$SET_CHAR_HITPOINTS(chr,-11);
-		$RETURN;
-	};
-$SET_CHAR_STATUS(chr,1);
-$IF  (hp <# 1){$SET_CHAR_HITPOINTS(chr,1);};
\(END)

\(BEGIN)
name = IsSnake
\(END)

\(BEGIN)
name = IsSnakeCharmed
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Charmed");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $RETURN "0";
[GetItemTargetHitBonus] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 15;
[IsCombatReady] = $VAR exp;
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() >=# exp){$SA_REMOVE();};
-$RETURN "N";
\(END)

\(BEGIN)
name = IsStinkingCloudy
[CanCastSpells] = $RUN_AREA_SE_SCRIPTS("StinkAdjust", $IndexOf($CharacterContext()));
-$RETURN $GET_HOOK_PARAM(6);
[CharDisplayStatus] = $RUN_AREA_SE_SCRIPTS("StinkingCloudy", $IndexOf($CharacterContext()));
-$SET_HOOK_PARAM( 7, $GET_HOOK_PARAM(8));
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsStinkingStuck
[CharDisplayStatus] = $RUN_AREA_SE_SCRIPTS("StinkingStuck", $IndexOf($CharacterContext()));
-$SET_HOOK_PARAM( 7, $GET_HOOK_PARAM(8));
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[ComputeDamage] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsStinkingStuck") != "-?-?-")
-  {$RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext()));};
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsStinkingStuck") != "-?-?-")
-  {$RETURN "Y";};
[IsCombatReady] = $RUN_AREA_SE_SCRIPTS("StinkAdjust", $IndexOf($CharacterContext()));
-$RETURN $GET_HOOK_PARAM(6);
\(END)

\(BEGIN)
name = IsStunned
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Stunned");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $VAR exp; // expiration time
-$VAR rnd; // round
-exp = $SA_PARAM_GET();
-rnd = $GetCombatRound();
-$IF (rnd >=# exp){$SA_REMOVE();$RETURN;};
-$RETURN "0";
[IsCombatReady] = $VAR exp; // expiration time
-$VAR rnd; // round
-exp = $SA_PARAM_GET();
-rnd = $GetCombatRound();
-$IF (rnd >=# exp){$SA_REMOVE();$RETURN;};
-$RETURN "N";
\(END)

\(BEGIN)
name = IsSweeping
[CombatSpecialAction] = $VAR damage;
-$VAR distance;
-$VAR atk; // attacker
-$VAR tgt; // target
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$IF ($GET_COMBATANT_SA($AttackerContext(),"IsInvisible") != "-?-?-")
-	{
-		$DELETE_CHARACTER_SA($AttackerContext(),"IsInvisibleSpell");
-		$DELETE_COMBATANT_SA($AttackerContext(),"IsInvisible");
-	};
-$IF (tgt ==# -#2){$SET_HOOK_PARAM(5,"Sweeps");$RETURN;}; // first call
-$IF (tgt ==# -#1){$SET_HOOK_PARAM(5,"Sweeps");$RETURN;}; // last call
-distance = $VisualDistance(atk, tgt);
-damage = $ComputeAttackDamage(atk, tgt);
-$IF(distance ># 1) {$RETURN;};
-$IF ($GET_MONSTERTYPE_SA($GET_CHAR_NAME(tgt),"monster_Swept") != "-?-?-" && $GET_COMBATANT_SA($TargetContext(),"side") != 1)
-	{
-		$SET_CHAR_HITPOINTS(tgt, $GET_CHAR_HITPOINTS(tgt) -# damage);
-	};
\(END)

\(BEGIN)
name = itemSlot_Fingers
[CanReady] = $IF ($GET_HOOK_PARAM( 5 ) <# 2){$RETURN "Y";}
-$ELSE {$SET_HOOK_PARAM(6, "Sorry, you can't do that.");$RETURN "N";};
\(END)

\(BEGIN)
name = itemSlot_Pack
[CanReady] = $RETURN "Y";
\(END)

\(BEGIN)
name = item_Antidote
[InvokeSpellOnTarget] = $VAR tgt;
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHARACTER_SA($TargetContext(), "IsPoisoned") == "-?-?-"){$RETURN;};
-$DELETE_CHARACTER_SA($CharacterContext(),"IsPoisoned");
-$IF ($GET_CHAR_HITPOINTS(tgt) <=# 0)
-	{
-		$SET_CHAR_HITPOINTS(tgt, "1");
-		$SET_CHAR_STATUS(tgt, "0");
-	};
\(END)

\(BEGIN)
name = item_BootsOfSpeed
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"IsFastBoots","1");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(),"IsFastBoots");
\(END)

\(BEGIN)
name = item_CloakOfDisplacement
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"IsCloakDisplaced",1);
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(),"IsCloakDisplaced");
\(END)

\(BEGIN)
name = item_CombatAim
[CanAim] = $VAR p5;
-$IF ($GET_HOOK_PARAM(6))
-	{
-		p5 = $GET_HOOK_PARAM(5);
-		$IF(p5 == "Bow" || p5 ==  "Crossbow" || p5 ==  "Sling (no ammo needed)"){$RETURN "N";};
-	};
\(END)

\(BEGIN)
name = item_DrowEquipment
[item_DrowEquipment] = $TAKE_CHAR_ITEM($CharacterContext(), $ItemContext());
-$RETURN "2";
\(END)

\(BEGIN)
name = item_FineLongBow
[DoesAttackSucceed] = $VAR par6;
-$VAR param;
-par6 = $GET_HOOK_PARAM(6);
-param = $SA_PARAM_GET();
-$SET_HOOK_PARAM(6, par6 -# param);
\(END)

\(BEGIN)
name = item_GauntletsOgrePower
[OnReady] = $VAR tgt; // target
-$VAR str;
-$VAR strMod;
-tgt = $IndexOf($CharacterContext());
-str = $GET_CHAR_LIMITED_STR(tgt);
-strMod = $GET_CHAR_LIMITED_STRMOD(tgt);
-$MODIFY_CHAR_ATTRIBUTE(tgt,"STR",18 -# str, "MINUTES", 999999999, "Ogre Strength","ITEM Ogre Strength");
-$IF (strMod ># 0)
-	{
-		$MODIFY_CHAR_ATTRIBUTE(tgt,"STRMOD",100 -# strMod, "MINUTES", 999999999, "","ITEM Ogre Strength");
-	};
[OnUnReady] = $VAR tgt; // target
-tgt = $IndexOf($CharacterContext());
-$REMOVE_CHAR_MODIFICATION(tgt,"ITEM Ogre Strength");
\(END)

\(BEGIN)
name = item_GirdleGiantStrength
[OnReady] = $VAR tgt; // target
-$VAR str;
-$VAR strMod;
-tgt = $IndexOf($Myself());
-str = $GET_CHAR_LIMITED_STR(tgt);
-strMod = $GET_CHAR_LIMITED_STRMOD(tgt);
-$MODIFY_CHAR_ATTRIBUTE(tgt,"STR",$SA_PARAM_GET() -# str,"MINUTES",999999999,"Giant Strength","ITEM Giant Strength");
-$IF (strMod ># 0)
-	{
-		$MODIFY_CHAR_ATTRIBUTE(tgt,"STRMOD",-strMod,"MINUTES",999999999,"","ITEM Giant Strength");
-	};
[OnUnReady] = $VAR tgt; // target
-tgt = $IndexOf($Myself());
-$REMOVE_CHAR_MODIFICATION(tgt,"ITEM Giant Strength");
\(END)

\(BEGIN)
name = item_HolyWater
\(END)

\(BEGIN)
name = item_HurledWeapon
[ComputeDamage] = $VAR par0;
-$VAR par5;
-$VAR dmg;
-$VAR atk; // attacker
-$VAR tgt; // target
-par0 = $GET_HOOK_PARAM(0);
-par5 = $GET_HOOK_PARAM(5);
-dmg = par0;
-$IF (dmg == ""){dmg = par5;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$IF ($VisualDistance(atk,tgt) <# 2)
-  {
-    dmg = dmg +# $GET_CHAR_DAMAGEBONUS(atk);
-  };
-$RETURN dmg;
[DoesAttackSucceed] = $VAR atk; // attacker
-$VAR par5; // Hook parameter 5
-$VAR par6; // Hook parameter 6
-$VAR bonus; // hit bonus
-atk = $IndexOf($AttackerContext());
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-bonus = $GET_CHAR_HITBONUS(atk);
-$IF ($VisualDistance(atk,$IndexOf($TargetContext())) <# 2)
-  {$SET_HOOK_PARAM(6,par6 +# bonus);};
-$IF (par5 >=# par6){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = item_LongSwordVsGiants
[ComputeDamage] = $VAR tgt; // target
-$VAR par5; // Hook parameter 5
-$VAR name;
-tgt = $IndexOf($TargetContext());
-par5 = $GET_HOOK_PARAM(5);
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_ISGIANT($TargetContext())){$SET_HOOK_PARAM(5,(par5 *# 2) +# 1);};
-$IF ($GET_MONSTERTYPE_SA(name,"subGiant") != "-?-?-"){$SET_HOOK_PARAM(5,par5 +# 1);};
[DoesAttackSucceed] = $VAR tgt; // target
-$VAR name;
-$VAR par5; // Hook parameter 5
-$VAR par6; // Hook parameter 6
-tgt = $IndexOf($TargetContext());
-name = $GET_CHAR_NAME(tgt);
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$SET_HOOK_PARAM(7,2);
-$IF ($GET_MONSTERTYPE_SA(name,"subGiant") != "-?-?-" || $GET_ISGIANT($TargetContext()))
-	{
-		$SET_HOOK_PARAM(6,par6 -# 1);
-		$SET_HOOK_PARAM(7,3);
-	};
-$IF (par5 >=# par6){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = item_MagicalWeapon
[ComputeDamage] = $VAR wpn;
-$VAR adj;
-wpn = $GET_CHAR_Ready($AttackerContext(), "WEAPON", 0);
-$IF ($GET_ITEM_SA(wpn,"item_FineWeapon") != "-?-?-")
-	{adj = $GET_CHAR_DAMAGEBONUS($IndexOf($AttackerContext()));};
-$SET_HOOK_PARAM(5,$GET_HOOK_PARAM(5) +# adj);
[DoesAttackSucceed] = $VAR atk; // attacker
-$VAR adj;
-$VAR list;
-$VAR wpn;
-atk = $IndexOf($AttackerContext());
-list = "$-3$-3$-3$-3$-2$-1$0$0$0$0$0$0$0$0$0$0$1$2$3$3$3$4$4$4$5$5";
-adj = $DelimitedStringSubstring(list, $GET_CHAR_LIMITED_DEX(atk));
-wpn = $GET_CHAR_Ready($AttackerContext(), "WEAPON", 0);
-$IF ($GET_ITEM_SA(wpn,"item_FineWeapon") != "-?-?-")
-  {adj = adj +# $GET_CHAR_HITBONUS(atk);};
-$SET_HOOK_PARAM(6, $GET_HOOK_PARAM(6) -# adj);
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
Parameters = "1 - arrow, 2 - bolt, 3 - dart, 4 - javelin/spear, 5 - other";
\(END)

\(BEGIN)
name = item_MissileWeapon
[ComputeDamage] = $VAR atk; // attacker
-$VAR wpn;
-$VAR adj;
-atk = $IndexOf($AttackerContext());
-wpn = $GET_CHAR_Ready($AttackerContext(), "WEAPON", 0);
-$IF ($GET_ITEM_SA(wpn,"item_FineWeapon") != "-?-?-")
-	{adj = $GET_CHAR_DAMAGEBONUS(atk);};
-$SET_HOOK_PARAM(5,$GET_HOOK_PARAM(5) +# adj);
[DoesAttackSucceed] = $VAR atk; // attacker
-$VAR adj;
-$VAR list;
-$VAR wpn;
-atk = $IndexOf($AttackerContext());
-list = "$-3$-3$-3$-3$-2$-1$0$0$0$0$0$0$0$0$0$0$1$2$3$3$3$4$4$4$5$5";
-adj = $DelimitedStringSubstring(list, $GET_CHAR_LIMITED_DEX(atk));
-wpn = $GET_CHAR_Ready($AttackerContext(), "WEAPON", 0);
-$IF ($GET_ITEM_SA(wpn,"item_FineWeapon") != "-?-?-"){adj = adj +# $GET_CHAR_HITBONUS(atk);};
-$SET_HOOK_PARAM(6, $GET_HOOK_PARAM(6) -# adj);
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";};
Parameters = "1 - arrow, 2 - bolt, 3 - dart, 4 - javelin/spear, 5 - other";
\(END)

\(BEGIN)
name = item_Noisy
[CanReady] = $IF ($GET_COMBATANT_SA($CharacterContext(),"IsSilenced") != "-?-?-"){$RETURN "N";};
\(END)

\(BEGIN)
name = item_Periapt
[OnReady] = $SET_CHARACTER_SA($CharacterContext(), "IsImmuneDisease", "1");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(),"IsImmuneDisease");
\(END)

\(BEGIN)
name = item_Poison
DoesAttackSucceed = $VAR tgt; // target
-$VAR time;
-$VAR par5; // Hook parameter 5
-$VAR par6; // Hook parameter 6
-tgt = $IndexOf($TargetContext());
-time = $GET_PARTY_TIME();
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$IF ($SA_CHARACTER_GET("IsImmunePoison") != "-?-?-"){$RETURN;};
-$IF ($SA_CHARACTER_GET("IsProtectedPoisonCaster") != "-?-?-"){$RETURN;};
-$IF ($SA_CHARACTER_GET("IsProtectedPoisonTarget") != "-?-?-"){$RETURN;};
-$IF (par5 ># par6)
-	{
-		$SET_CHARACTER_SA($TargetContext(),"IsPoisoned",time);
-		$SET_CHAR_STATUS(tgt,2);
-		$SET_CHAR_HITPOINTS(tgt,"-11");
-	};
\(END)

\(BEGIN)
name = item_Potion
[CanExamineOrWhatever] = $SET_HOOK_PARAM( 5, "DRINK" );
-$SET_HOOK_PARAM( 6, 0 );
-$RETURN "Y";
[ExamineOrWhatever] = $VAR char;
-$VAR item;
-$VAR newItem;
-$VAR rndm;
-char = $IndexOf($CharacterContext());
-item = "Potion";
-newItem = "Empty Bottle";
-rndm = $RANDOM(4) +# $RANDOM(4) +# 4;
-$IF ($GET_CHAR_Ready($CharacterContext(), "WEAPON", 0) == item)
-	{
-		$TAKE_CHAR_ITEM($CharacterContext(),item);
-		$GIVE_CHAR_ITEM($CharacterContext(),newItem);
-		$SET_CHAR_HITPOINTS(char, $GET_CHAR_HITPOINTS(char) +# rndm);
-		$IF ($GET_CHAR_HITPOINTS(char) ># $GET_CHAR_MAXHITPOINTS(char))
-			{
-				$SET_CHAR_HITPOINTS(char,$GET_CHAR_MAXHITPOINTS(char));
-			};
-	};
\(END)

\(BEGIN)
name = item_Potion1
[CanExamineOrWhatever] = $SET_HOOK_PARAM( 5, "DRINK" );
-$SET_HOOK_PARAM( 6, 0 );
-$RETURN "Y";
[ExamineOrWhatever] = $VAR char;
-$VAR item;
-$VAR newItem;
-$VAR rndm;
-char = $IndexOf($CharacterContext());
-item = "Potion|1";
-newItem = "Potion|1a";
-rndm = $RANDOM(4) +# $RANDOM(4) +# 4;
-$IF ($GET_CHAR_Ready($CharacterContext(), "WEAPON", 0) == item)
-	{
-		$TAKE_CHAR_ITEM($CharacterContext(),item);
-		$GIVE_CHAR_ITEM($CharacterContext(),newItem);
-		$SET_CHAR_HITPOINTS(char, $GET_CHAR_HITPOINTS(char) +# rndm);
-		$IF ($GET_CHAR_HITPOINTS(char) ># $GET_CHAR_MAXHITPOINTS(char))
-			{
-				$SET_CHAR_HITPOINTS(char,$GET_CHAR_MAXHITPOINTS(char));
-			};
-	};
\(END)

\(BEGIN)
name = item_Potion1a
[CanExamineOrWhatever] = $SET_HOOK_PARAM( 5, "DRINK" );
-$SET_HOOK_PARAM( 6, 0 );
-$RETURN "Y";
[ExamineOrWhatever] = $VAR char;
-$VAR item;
-$VAR newItem;
-$VAR rndm;
-char = $IndexOf($CharacterContext());
-item = "Potion|1a";
-newItem = "Potion|1b";
-rndm = $RANDOM(4) +# $RANDOM(4) +# 4;
-$IF ($GET_CHAR_Ready($CharacterContext(), "WEAPON", 0) == item)
-	{
-		$TAKE_CHAR_ITEM($CharacterContext(),item);
-		$GIVE_CHAR_ITEM($CharacterContext(),newItem);
-		$SET_CHAR_HITPOINTS(char, $GET_CHAR_HITPOINTS(char) +# rndm);
-		$IF ($GET_CHAR_HITPOINTS(char) ># $GET_CHAR_MAXHITPOINTS(char))
-			{
-				$SET_CHAR_HITPOINTS(char,$GET_CHAR_MAXHITPOINTS(char));
-			};
-	};
\(END)

\(BEGIN)
name = item_Potion1b
[CanExamineOrWhatever] = $SET_HOOK_PARAM( 5, "DRINK" );
-$SET_HOOK_PARAM( 6, 0 );
-$RETURN "Y";
[ExamineOrWhatever] = $VAR char;
-$VAR item;
-$VAR newItem;
-$VAR rndm;
-char = $IndexOf($CharacterContext());
-item = "Potion|1b";
-newItem = "Empty Bottle";
-rndm = $RANDOM(4) +# $RANDOM(4) +# 4;
-$IF ($GET_CHAR_Ready($CharacterContext(), "WEAPON", 0) == item)
-	{
-		$TAKE_CHAR_ITEM($CharacterContext(),item);
-		$GIVE_CHAR_ITEM($CharacterContext(),newItem);
-		$SET_CHAR_HITPOINTS(char, $GET_CHAR_HITPOINTS(char) +# rndm);
-		$IF ($GET_CHAR_HITPOINTS(char) ># $GET_CHAR_MAXHITPOINTS(char))
-			{
-				$SET_CHAR_HITPOINTS(char, $GET_CHAR_MAXHITPOINTS(char));
-			};
-	};
\(END)

\(BEGIN)
name = item_Potion2
[CanExamineOrWhatever] = $SET_HOOK_PARAM( 5, "DRINK" );
-$SET_HOOK_PARAM( 6, 0 );
-$RETURN "Y";
[ExamineOrWhatever] = $VAR item;
-$VAR newItem;
-item = "Potion|2";
-newItem = "Empty Bottle";
-$IF ($GET_CHAR_Ready($CharacterContext(), "WEAPON", 0) == item)
-	{
-		$TAKE_CHAR_ITEM($CharacterContext(),item);
-		$GIVE_CHAR_ITEM($CharacterContext(),newItem);
-		$CastSpellOnTarget($Myself(),"itemPotionInvisibility");
-	};
\(END)

\(BEGIN)
name = item_Potion3
[CanExamineOrWhatever] = $SET_HOOK_PARAM( 5, "DRINK" );
-$SET_HOOK_PARAM( 6, 0 );
-$RETURN "Y";
[ExamineOrWhatever] = $VAR char;
-$VAR item;
-$VAR newItem;
-char = $IndexOf($CharacterContext());
-item = "Potion|3";
-newItem = "Empty Bottle";
-$IF ($GET_CHAR_Ready($CharacterContext(), "WEAPON", 0) == item)
-	{
-		$TAKE_CHAR_ITEM($CharacterContext(),item);
-		$GIVE_CHAR_ITEM($CharacterContext(),newItem);
-		$SET_CHAR_AGE(char, $GET_CHAR_AGE(char) +# 1);
-		$CastSpellOnTarget($CharacterContext(),"itemPotionSpeed");
-	};
\(END)

\(BEGIN)
name = item_Potion4
[CanExamineOrWhatever] = $SET_HOOK_PARAM( 5, "DRINK" );
-$SET_HOOK_PARAM( 6, 0 );
-$RETURN "Y";
[ExamineOrWhatever] = $VAR item;
-$VAR newItem;
-item = "Potion|4";
-newItem = "Empty Bottle";
-$IF ($GET_CHAR_Ready($CharacterContext(), "WEAPON", 0) == item)
-	{
-		$TAKE_CHAR_ITEM($CharacterContext(),item);
-		$GIVE_CHAR_ITEM($CharacterContext(),newItem);
-		$CastSpellOnTarget($CharacterContext(),"itemPotionGiantStrength");
-	};
\(END)

\(BEGIN)
name = item_Potion5
[CanExamineOrWhatever] = $SET_HOOK_PARAM( 5, "DRINK" );
-$SET_HOOK_PARAM( 6, 0 );
-$RETURN "Y";
[ExamineOrWhatever] = $VAR char;
-$VAR item;
-$VAR newItem;
-char = $IndexOf($CharacterContext());
-item = "Potion|5";
-newItem = "Empty Bottle";
-$IF ($GET_CHAR_Ready($CharacterContext(), "WEAPON", 0) == item)
-	{
-		$TAKE_CHAR_ITEM($CharacterContext(),item);
-		$GIVE_CHAR_ITEM($CharacterContext(),newItem);
-		$IF ($GET_CHARACTER_SA($CharacterContext(), "IsPoisoned") == "-?-?-"){$RETURN;};
-		$DELETE_CHARACTER_SA($CharacterContext(),"IsPoisoned");
-		$IF ($GET_CHAR_HITPOINTS(char) <=# 0)
-			{
-				$SET_CHAR_HITPOINTS(char, "1");
-				$SET_CHAR_STATUS(char, "0");
-			};
-	};
\(END)

\(BEGIN)
name = item_Potion6
[CanExamineOrWhatever] = $SET_HOOK_PARAM( 5, "DRINK" );
-$SET_HOOK_PARAM( 6, 0 );
-$RETURN "Y";
[ExamineOrWhatever] = $VAR me;
-$VAR item;
-$VAR newItem;
-$VAR age;
-$VAR rnd;
-$VAR result;
-me = $IndexOf($CharacterContext());
-item = "Potion|6";
-newItem = "Empty Bottle";
-rnd = $RANDOM(12) +# 1;
-age = $GET_CHAR_AGE(me);
-result = age -# rnd;
-$DEBUG ("item name is really..." + $GET_CHAR_Ready($CharacterContext(), "WEAPON", 0));
-$IF ($GET_CHAR_Ready($CharacterContext(), "WEAPON", 0) == item)
-	{
-		$TAKE_CHAR_ITEM($CharacterContext(),item);
-		$GIVE_CHAR_ITEM($CharacterContext(),newItem);
-		$IF (result <# 18){$RETURN $SET_CHAR_AGE(me, 18);}
-		$ELSE {$RETURN $SET_CHAR_AGE(me, result);};
-		};
\(END)

\(BEGIN)
name = item_PotionInvisibility
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $SET_CHARACTER_SA($TargetContext(),"IsInvisiblePotion",2);
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = item_RangedWeapon
[DoesAttackSucceed] = $VAR par5;
-$VAR par6;
-$VAR parM; // short range number
-$VAR parL; // medium range number
-$VAR tgt;
-$VAR atk;
-$VAR dist;
-$VAR hit;
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-parM = $DelimitedStringSubstring($SA_PARAM_GET(),0);
-parL = $DelimitedStringSubstring($SA_PARAM_GET(),1);
-tgt = $IndexOf($TargetContext());
-atk = $IndexOf($AttackerContext());
-dist = $VisualDistance(atk,tgt);
-$IF (dist ># parM){hit = par5 -# 2;};
-$IF (dist ># parL){hit = par5 -# 5;};
-$IF (hit ># par6){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = item_Reflect
[OnReady] = $SET_CHARACTER_SA($CharacterContext(), "IsReflecting", "1");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(),"IsReflecting");
\(END)

\(BEGIN)
name = item_RingOfBlinking
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"IsBlinkingRing","1");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
-$IF ($GET_CHARACTER_SA($CharacterContext(),"side") != "-?-?-")
-	{
-		$SET_CHARACTER_SA($CharacterContext(),"IsBlinking1",1);
-		$SET_CHARACTER_SA($CharacterContext(),"IsBlinking2",1);
-	};
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(),"IsBlinkingRing");
-$DELETE_CHARACTER_SA($CharacterContext(),"IsBlinking1");
-$DELETE_CHARACTER_SA($CharacterContext(),"DispelLevelItem");
-$DELETE_CHARACTER_SA($CharacterContext(),"IsBlinking2");
\(END)

\(BEGIN)
name = item_RingOfColdResistance
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"IsRingResistantCold", "");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(), "IsRingResistantCold");
\(END)

\(BEGIN)
name = item_RingOfElectricalImmunity
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"IsRingImmuneElectricity", "");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(), "IsRingImmuneElectricity");
-$DELETE_CHARACTER_SA($CharacterContext(),"DispelLevelItem");
\(END)

\(BEGIN)
name = item_RingOfFireResistance
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"IsRingResistantFire", "");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(), "IsRingResistantFire");
-$DELETE_CHARACTER_SA($CharacterContext(),"DispelLevelItem");
\(END)

\(BEGIN)
name = item_RingOfInvisibility
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"IsInvisibleRing",1);
-$SET_COMBATANT_SA($CharacterContext(),"IsInvisibleRing",1);
-$SET_COMBATANT_SA($CharacterContext(),"IsInvisible",1);
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(),"IsInvisibleRing");
-$DELETE_COMBATANT_SA($CharacterContext(),"IsInvisibleRing");
-$DELETE_COMBATANT_SA($CharacterContext(),"IsInvisible");
-$DELETE_CHARACTER_SA($CharacterContext(),"DispelLevelItem");
\(END)

\(BEGIN)
name = item_RingOfProtectionFromEvil
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"IsProtectedEvil","1");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(),"IsProtectedEvil");
-$DELETE_CHARACTER_SA($CharacterContext(),"DispelLevelItem");
\(END)

\(BEGIN)
name = item_RingOfWizardry
[OnReady] = $VAR lvl;
-$VAR actor;
-lvl = $SA_PARAM_GET();
-$SpellAdj($CharacterContext(),"Magic User","ring",lvl,lvl,200,0);
-$SET_CHARACTER_SA($CharacterContext(),"IsRingWizardry", lvl);
[OnUnReady] = $VAR lvl;
-$VAR actor;
-lvl = $SA_PARAM_GET();
-$SpellAdj($CharacterContext(),"Magic User","ring",lvl,lvl,50,0);
-$DELETE_CHARACTER_SA($CharacterContext(),"IsRingWizardry");
\(END)

\(BEGIN)
name = item_Scroll
[OnReady] = $VAR name;
-$VAR cls;
-name = $MyIndex();
-cls = $SA_PARAM_GET();
-$IF ($GET_CHAR_Lvl(name,cls) <# 1 && $GET_CHAR_Lvl(name,"thief") <# 10)
-	{
-		$SET_CHAR_Ready($CharacterContext(),WEAPON,"");
-	};
\(END)

\(BEGIN)
name = item_VorpalLongSword
[ComputeDamage] = $VAR roll;
-$VAR tgt; // target
-$VAR name;
-$VAR dmg;
-$IF ($GET_HASVORPALIMMUNITY($TargetContext()) != "-?-?-"){$RETURN;};
-roll = $GET_COMBATANT_SA($TargetContext(),"vorp");
-tgt = $IndexOf($TargetContext());
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_MONSTERTYPE_SA(name,"MetalOrStone") != "-?-?-"){roll = roll -# 2;}
-$ELSE {$IF ($GET_CHAR_SIZE(tgt) == 2){roll = roll -# 1;};};
-$IF (roll ># 16)
-	{
-		$SET_HOOK_PARAM(7,name +" is beheaded");
-		$SET_HOOK_PARAM(5,$GET_CHAR_HITPOINTS(tgt) +# 11);
-		$RETURN $GET_HOOK_PARAM(5);
-	};
[DoesAttackSucceed] = $VAR par5; // Hook parameter 5
-$VAR par6; // Hook parameter 6
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$SET_COMBATANT_SA($TargetContext(),"vorp",par5);
-$IF (par5 >=# par6){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = item_Wand
[OnReady] = $VAR name;
-$VAR cls;
-name = $MyIndex();
-cls = $SA_PARAM_GET();
-$IF ($GET_CHAR_Lvl(name,cls) <# 1 && $GET_CHAR_Lvl(name,"thief") <# 10)
-	{
-		$SET_CHAR_Ready($CharacterContext(),WEAPON,"",0);
-	};
\(END)

\(BEGIN)
name = item_WeaponType
Parameters = "blunt, piercing, slashing, piercing/slashing";
\(END)

\(BEGIN)
name = item_Whip
[OnReady] = $VAR chr; // character
-chr = $IndexOf($CharacterContext());
-$IF ($GET_CHAR_Lvl(chr,"druid") <# 1 && $GET_CHAR_Lvl(chr,"fighter") <# 1 && $GET_CHAR_Lvl(chr,"paladin") <# 1 && $GET_CHAR_Lvl(chr,"ranger") <# 1 && $GET_CHAR_RACE(chr) != "Drow")
-	{
-		$SET_CHAR_Ready($CharacterContext(),0,"");
-	};
\(END)

\(BEGIN)
name = monster_AuraDragon
[AURA_Create] = $VAR chr; // character
-chr = $IndexOf($CharacterContext());
-$AURA_Attach("Combatant");
-$AURA_Combatant(chr);
-$AURA_Size(0,10,0,360);
-$AURA_Shape("AnnularSector");
-$AURA_Wavelength("Xray");
[AURA_Enter] = $VAR com; // comabtant
-$VAR race; // combatant's race
-$VAR cLvl; // combatant's level
-$VAR mLvl; // monster level
-$VAR rndm;
-$VAR prm; // sa's parameter
-com = $IndexOf($CombatantContext());
-race = $GET_CHAR_NAME(com);
-cLvl = $GetHighestLevelBaseclass(com);
-mLvl = $GET_COMBATANT_SA($CombatantContext(),"monsterLevel");
-rndm = $RANDOM(2);
-prm = $SA_PARAM_GET();
-$IF (race == "Dragon"){$RETURN;};
-$IF (cLvl >=# 6){$RETURN;};
-$IF (mLvl >=# 6){$RETURN;};
-$IF (cLvl >=# 3){$RETURN $SET_COMBATANT_SA($CombatantContext(),"IsDragonAdj","");};
-$IF (rndm ==# 0){$SET_COMBATANT_SA($CombatantContext(),"IsDragonFear","");};
-$IF (rndm ==# 1){$SET_COMBATANT_SA($CombatantContext(),"IsDragonFlee",prm);};
[CreateMonsterCombatant] = $VAR prm; // sa's parameter
-prm = $SA_PARAM_GET();
-$AURA_Create("monster_AuraDragon",prm,0,0,0);
\(END)

\(BEGIN)
name = monster_AuraGhast
[AURA_Create] = $VAR chr; // character
-chr = $IndexOf($CharacterContext());
-$AURA_Attach("Combatant");
-$AURA_Combatant(chr);
-$AURA_Size(0,1,0,360);
-$AURA_Shape("AnnularSector");
-$AURA_Wavelength("Xray");
[AURA_Enter] = $VAR save; // save vs poison
-$VAR rndm;
-save = $SkillAdj($CombatantContext(),"Save Vs PP","ghast","F",0);
-rndm = $RANDOM(20) +# 1;
-$IF (rndm <# save){$RETURN $SET_COMBATANT_SA($CombatantContext(),"IsCarrionStenched","");};
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsCarrionStenched");
[CreateMonsterCombatant] = $VAR prm; // sa's parameter
-prm = $SA_PARAM_GET();
-$AURA_Create("monster_AuraGhast",prm,0,0,0);
\(END)

\(BEGIN)
name = monster_AuraMummy
[AURA_Create] = $VAR chr; // character
-chr = $IndexOf($CharacterContext());
-$AURA_Attach("Combatant");
-$AURA_Combatant(chr);
-$AURA_Size(0,6,0,360);
-$AURA_Shape("AnnularSector");
-$AURA_Wavelength("Xray");
[AURA_Enter] = $VAR com; // comabtant
-$VAR race;
-$VAR save;
-$VAR rndm;
-$VAR time;
-$IF ($GET_COMBATANT_SA($CombatantContext(),"IsOverMummy") != "-?-?-"){$RETURN;};
-com = $IndexOf($CombatantContext());
-race = $GET_CHAR_NAME(com);
-save = $SkillAdj($CombatantContext(),"Save Vs PPDM","mummy","F",0);
-rndm = $RANDOM(20) +# 1;
-time = $GET_PARTY_TIME();
-$IF (race == "Human"){save = save +# 2;};
-$IF (rndm >=# save){$RETURN $SET_COMBATANT_SA($CombatantContext(),"IsOverMummy","");}
-$ELSE ($RETURN $SET_COMBATANT_SA($CombatantContext(),"IsMummyFear",time);};
[CreateMonsterCombatant] = $VAR prm; // sa's parameter
-prm = $GET_PARTY_TIME() +# $RANDOM(4) +# 1;
-$AURA_Create("monster_AuraMummy",prm,0,0,0);
\(END)

\(BEGIN)
name = monster_BearHug1
[InvokeSpellOnTarget] = $SET_COMBATANT_SA($AttackerContext(),"CombatRoundStart",1);
\(END)

\(BEGIN)
name = monster_BearHug2
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$IF ($GET_COMBATANT_SA($AttackerContext(),"CombatRoundStart") ==# 1)
-	{
-		$IF ($GET_CHARACTER_SA($TargetContext(),"IsHugged") == "-?-?-")
-			{
-				$SET_COMBATANT_SA($AttackerContext(),"HugLink",tgt);
-				$SET_COMBATANT_SA($AttackerContext(),"monster_BearHugging",tgt);
-				$SET_COMBATANT_SA($TargetContext(),"monster_BearHugged",atk);
-				$SET_COMBATANT_SA($TargetContext(),"HugLink",atk);
-				$SET_CHARACTER_SA($TargetContext(),"IsHugged",1);
-			};
-	};
\(END)

\(BEGIN)
name = monster_BearHugged
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Hugged by Bear");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk;
-atk = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(atk) <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"HugLink");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsHugged");
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = monster_BearHugging
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Hugging");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[GetNumberOfAttacks] = $RETURN 0;
[OnStartCombatantAction] = $VAR Tgt;
-$VAR name;
-$VAR dmg;
-Tgt = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(Tgt) ># 0)
-	{
-		name = $GET_CHAR_NAME($IndexOf($CombatantContext()));
-		$IF (name == "Black Bear"){dmg = ($RANDOM(4) +# $RANDOM(4) +# 2);};
-		$IF (name == "Brown Bear"||name == "Grizzly Bear"){dmg = ($RANDOM(6) +# $RANDOM(6) +# 2);};
-		$IF (name == "Cave Bear"||name == "Owlbear"||name == "Werebear" ){dmg = ($RANDOM(8) +# $RANDOM(8) +# 2);};
-		$IF (name == "Northern Bear"){dmg = ($RANDOM(6) +# $RANDOM(6) +# $RANDOM(6) +# 3);};
-		$SET_CHAR_HITPOINTS(Tgt,$GET_CHAR_HITPOINTS(Tgt) -# dmg);
-	};
-$IF ($GET_CHAR_HITPOINTS(Tgt) <# 1) 
-	{
-		$IF ($GET_CHAR_HITPOINTS(Tgt) <# "-9")  {$SET_CHAR_STATUS(Tgt,2);}
-		$ELSE {$SET_CHAR_STATUS(Tgt,9);};
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_BearHugging");
-	};
\(END)

\(BEGIN)
name = monster_BeholderAttacks
[StartCombatRound] = $GIVE_CHAR_ITEM( $Myself(), "monsterBeholderCharm" );
-$GIVE_CHAR_ITEM( $Myself(), "monsterBeholderSleep" );
-$GIVE_CHAR_ITEM( $Myself(), "monsterBeholderFleshToStone" );
-$GIVE_CHAR_ITEM( $Myself(), "monsterBeholderFear" );
-$GIVE_CHAR_ITEM( $Myself(), "monsterBeholderSlow" );
\(END)

\(BEGIN)
name = monster_CombatantAlignment
[CreateMonsterCombatant] = $VAR param;
-$VAR char;
-param = $SA_PARAM_GET();
-char = $IndexOf($CharacterContext());
-$IF (param == "good"){$SET_CHAR_ALIGNMENT(char,1);};
-$IF (param == "neutral"){$SET_CHAR_ALIGNMENT(char,4);};
-$IF (param == "evil"){$SET_CHAR_ALIGNMENT(char,7);};
\(END)

\(BEGIN)
name = monster_Displacement
[InvokeSpellOnTarget] = $SET_COMBATANT_SA($CombatantContext(),"IsDisplaced","");
\(END)

\(BEGIN)
name = monster_DragonSavingThrow
[CreateMonsterCombatant] = $VAR param;
-param = $SA_PARAM_GET();
-$IF (param == "second")
-	{
-		$SkillAdj($CharacterContext(), "Save Vs BR", "", "F", "13");
-		$SkillAdj($CharacterContext(), "Save Vs PP", "", "F", "11");
-		$SkillAdj($CharacterContext(), "Save Vs PPDM", "", "F", "13");
-		$SkillAdj($CharacterContext(), "Save Vs RSW", "", "F", "9");
-		$SkillAdj($CharacterContext(), "Save Vs SP", "", "F", "10");
-	};
-$IF (param == "rhitd")
-	{
-		$SkillAdj($CharacterContext(), "Save Vs BR", "", "F", "11");
-		$SkillAdj($CharacterContext(), "Save Vs PP", "", "F", "9");
-		$SkillAdj($CharacterContext(), "Save Vs PPDM", "", "F", "11");
-		$SkillAdj($CharacterContext(), "Save Vs RSW", "", "F", "7");
-		$SkillAdj($CharacterContext(), "Save Vs SP", "", "F", "8");
-	};
\(END)

\(BEGIN)
name = monster_DrainStrength
[InvokeSpellOnTarget] = $VAR tgt; // target
-$VAR dur;
-$VAR time;
-$VAR str; // strength
-$VAR strMod;
-tgt = $IndexOf($TargetContext());
-dur = ($RANDOM(4) +# $RANDOM(4) +# 2) *# 10;
-time = $GET_PARTY_TIME();
-str = $GET_CHAR_LIMITED_STR(tgt);
-strMod = $GET_CHAR_LIMITED_STRMOD(tgt);
-// SA lowStr used to circumvent Min/Max
-$IF (str <# 4 && $GET_COMBATANT_SA($TargetContext(),"lowStr") != "-?-?-")
-	{
-		$SET_COMBATANT_SA($TargetContext(),"lowStr",$GET_COMBATANT_SA($TargetContext(),"lowStr") -# 1);
-	}; 
-$IF (str <# 4 && $GET_COMBATANT_SA($TargetContext(),"lowStr") == "-?-?-")
-	{
-		$SET_COMBATANT_SA($TargetContext(),"lowStr",2);
-	};
-$MODIFY_CHAR_ATTRIBUTE(tgt, "STR", -1, "MINUTES", dur, "Weakened", "MONSTER Drain Strength");
-$IF (strMod ># 0) {$MODIFY_CHAR_ATTRIBUTE(tgt, "STRMOD", -strMod, "MINUTES", dur, "" , "MONSTER Drain Strength");};
-$IF ($GET_COMBATANT_SA($TargetContext(),"lowStr") ==# 0 || $GET_CHAR_HITPOINTS(tgt) <# 1)
-	{
-		$SET_CHAR_HITPOINTS(tgt,"-10");
-		$RETURN $SET_CHAR_STATUS(tgt,5);
-	};
\(END)

\(BEGIN)
name = monster_EfreetiFireResistance
[DoesAttackSucceed] = $IF ($GET_ITEM_SA($ItemContext(),"DamageNonMagical") == "fire"){$RETURN "N";};
-$IF ($GET_ITEM_SA($ItemContext(),"DamageMagical") == "fire")
-	{$RETURN $SET_HOOK_PARAM(5, $GET_HOOK_PARAM(5) -# 1);};
[DoesSpellAttackSucceed] = $IF ($GET_SPELL_SA($ItemContext(),"DamageMagical") == "fire")
-	{$RETURN $SET_HOOK_PARAM(5, $GET_HOOK_PARAM(5) -# 1);};
[ComputeDamage] = $IF ($GET_ITEM_SA($ItemContext(),"DamageMagical") == "fire")
-	{$RETURN $GET_HOOK_PARAM(5) /# 6 *# 5;};
[ComputeDamage] = $IF ($GET_SPELL_SA($ItemContext(),"DamageMagical") == "fire")
-	{$RETURN $GET_HOOK_PARAM(5) /# 6 *# 5;};
\(END)

\(BEGIN)
name = monster_Engulf1
[InvokeSpellOnTarget] = $SET_COMBATANT_SA($AttackerContext(),"CombatRoundStart",1);
\(END)

\(BEGIN)
name = monster_Engulf2
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$IF ($GET_COMBATANT_SA($AttackerContext(),"CombatRoundStart") ==# 1)
-	{
-		$IF ($GET_CHARACTER_SA($TargetContext(),"IsHugged") == "-?-?-")
-			{
-				$SET_COMBATANT_SA($AttackerContext(),"HugLink",tgt);
-				$SET_COMBATANT_SA($AttackerContext(),"monster_Engulfing",tgt);
-				$SET_COMBATANT_SA($AttackerContext(),"IsHosed",$RANDOM(4) +# $RANDOM(4) +# 2);
-				$SET_COMBATANT_SA($TargetContext(),"monster_Engulfed",atk);
-				$SET_COMBATANT_SA($TargetContext(),"HugLink",atk);
-				$SET_CHARACTER_SA($TargetContext(),"IsHugged",1);
-			};
-	};
\(END)

\(BEGIN)
name = monster_Engulfed
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Engulfed");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk; // attacker
-atk = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(atk) <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"HugLink");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsHugged");
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = monster_Engulfing
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Engulfing");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[GetNumberOfAttacks] = $RETURN 0;
[OnStartCombatantAction] = $VAR tgt; // target
-$VAR name;
-$VAR count;
-tgt = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(tgt) ># 0)
-	{
-		count = $GET_COMBATANT_SA($CombatantContext(),"IsHosed") -#1;
-		$SET_COMBATANT_SA($CombatantContext(),"IsHosed",count);
-		$IF (count <=# 0)
-			{
-				$SET_CHAR_STATUS(tgt,2);
-				$SET_CHAR_HITPOINTS(tgt,0);
-			};
-	};
-$IF ($GET_CHAR_HITPOINTS(tgt) <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_Engulfing");
-		$DELETE_COMBATANT_SA($CombatantContext(),"IsHosed");
-	};
\(END)

\(BEGIN)
name = monster_FireBatAttack
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR link;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$SET_COMBATANT_SA($AttackerContext(),"monster_FireBatDrain","");
-$IF ($GET_COMBATANT_SA($AttackerContext(),"monster_FireBatBloodCap") == "-?-?-")
-	{
-		$SET_COMBATANT_SA($AttackerContext(),"monster_FireBatBloodCap",3);
-	};
-$SET_COMBATANT_SA($AttackerContext(),"monster_FireBatLink",tgt);
-$SET_COMBATANT_SA($TargetContext(),"monster_FireBatDrainee","");
-$SET_CHARACTER_SA($TargetContext(),"IsHugged",1);
-link = $GET_COMBATANT_SA($TargetContext(),"monster_FireBatLink");
-$IF (link == "-?-?-")
-	{
-		$SET_COMBATANT_SA($TargetContext(),"monster_FireBatLink","$255$" + atk);
-	}
-$ELSE
-	{
-		link = link + "$" + atk;
-		$SET_COMBATANT_SA($TargetContext(),"monster_FireBatLink",link);
-	};
\(END)

\(BEGIN)
name = monster_FireBatDrain
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[GetNumberOfAttacks] = $RETURN 0;
[OnStartCombatantAction] = $VAR tgt; // target
-$VAR name;
-$VAR cap;
-$VAR dmg;
-// Test Target and Compute & Apply Drain
-tgt = $GET_COMBATANT_SA($CombatantContext(),"monster_FireBatLink");
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_CHAR_STATUS(tgt) ==# 0) 
-	{
-		cap = $GET_COMBATANT_SA($CombatantContext(),"monster_FireBatBloodCap");
-		dmg = $RANDOM(4) +# 1;
-		cap = cap -# 1;
-		$SET_COMBATANT_SA($CombatantContext(),"monster_FireBatBloodCap",cap);
-		$SET_CHAR_HITPOINTS(tgt, $GET_CHAR_HITPOINTS(tgt) -# dmg);
-// Is Target Dead?
-		$IF ($GET_CHAR_HITPOINTS(tgt) <# 1)
-			{
-				$SET_CHAR_STATUS(tgt,1);
-				$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatDrain");
-				$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatLink");
-			};
-// Am I Full?
-		$IF (cap <# 1)
-			{
-				$SET_CHAR_STATUS($MyIndex(),8);
-				$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatDrain");
-				$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatLink");
-				$SET_COMBATANT_SA($CombatantContext(),"IsFleeing","Fleeing Fire Bat");
-				$DELETE_CHARACTER_SA($Name(name),"IsHugged");
-			};
-	}
-$ELSE
-	{
-// Someone Else Killed It
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatDrain");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatLink");
-	};
\(END)

\(BEGIN)
name = monster_FireBatDrainee
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk; // attacker
-$VAR i;
-$VAR foes;
-$VAR alive;
-foes = $GET_COMBATANT_SA($Myself(),"monster_FireBatLink");
-i = 1;
-alive = "-1";
-atk = $DelimitedStringSubstring(foes, i);
-$WHILE (atk != "")
-	{
-		$IF ($GET_CHAR_STATUS(atk) ==# 0){alive = alive +# 1;};
-		i = i +# 1;
-	};
-// alive = alive -# 1;
-$IF (alive <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatDrainee");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatLink");
-		$DELETE_CHARACTER_SA($Myself(),"IsHugged");
-	};
\(END)

\(BEGIN)
name = monster_GiantSlugSpit
[CheckProximity] = $VAR tgt; // target
-$VAR myself;
-$VAR range;
-$VAR distance;
-tgt = $GET_HOOK_PARAM(6);
-myself = $GET_HOOK_PARAM(5);
-range = $SA_PARAM_GET();
-distance = $VisualDistance(tgt, myself);
-$SA_PARAM_SET(distance);
[DAS bak] = $VAR random;
-$VAR distance;
-random = $RANDOM(100);
-distance = $SA_PARAM_GET();
-$IF ($GetCombatRound() ==# 1)
-	{
-		$IF (random <# 10){$RETURN "Y";}
-		$ELSE{$RETURN "N";};
-	};
-$IF (random <# 110 -# (10 *# distance)){$RETURN "Y";}
-$ELSE{$RETURN "N";};
[DoesSpellAttackSucceed] = 
\(END)

\(BEGIN)
name = monster_GiantWeaselAttack
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR link;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$SET_COMBATANT_SA($AttackerContext(),"monster_GiantWeaselDrain","");
-$SET_COMBATANT_SA($AttackerContext(),"monster_GiantWeaselLink",tgt);
-$SET_COMBATANT_SA($TargetContext(),"monster_GiantWeaselDrainee","");
-$SET_CHARACTER_SA($TargetContext(),"IsHugged",1);
-link = $GET_COMBATANT_SA($TargetContext(),"monster_GiantWeaselLink");
-$IF (link == "-?-?-")
-	{
-		$SET_COMBATANT_SA($TargetContext(),"monster_GiantWeaselLink","$255$" + atk);
-	}
-$ELSE
-	{
-		link = link + "$" + atk;
-		$SET_COMBATANT_SA($TargetContext(),"monster_GiantWeaselLink",link);
-	};
\(END)

\(BEGIN)
name = monster_GiantWeaselDrain
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[GetNumberOfAttacks] = $RETURN 0;
[OnStartCombatantAction] = $VAR tgt; // target
-$VAR name;
-$VAR dmg;
-$VAR HP; // hit points
-// Test Target and Compute & Apply Drain
-tgt = $GET_COMBATANT_SA($CombatantContext(),"monster_GiantWeaselLink");
-name = $GET_CHAR_NAME(tgt);
-HP = $GET_CHAR_HITPOINTS(tgt);
-$IF ($GET_CHAR_STATUS(tgt) ==# 0) 
-	{
-		dmg = ($RANDOM(6) +# 1) +# ($RANDOM(6) +# 1);
-		$SET_CHAR_HITPOINTS(tgt,HP -# dmg);
-// Is Target Dead?
-		$IF (HP <# 1)
-			{
-// Target
-				$SET_CHAR_STATUS(tgt,1);
-// Attacker
-				$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantWeaselDrain");
-				$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantWeaselLink");
-			};
-	}
-$ELSE
-	{
-// Someone Else Killed It
-// Attacker
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantWeaselDrain");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantWeaselLink");
-	};
\(END)

\(BEGIN)
name = monster_GiantWeaselDrainee
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk; // attacker
-$VAR i;
-$VAR foes;
-$VAR alive;
-foes = $GET_COMBATANT_SA($Myself(),"monster_GiantWeaselLink");
-i = 1;
-alive = "-1";
-atk = $DelimitedStringSubstring(foes, i);
-$WHILE (atk != "")
-	{
-		atk = $DelimitedStringSubstring(foes, i);
-		$IF ($GET_CHAR_STATUS(atk) ==# 0){alive = alive +# 1;};
-		i = i +# 1;
-	};
-// alive = alive -# 1;
-$IF (alive <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantWeaselDrainee");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantWeaselLink");
-		$DELETE_CHARACTER_SA($Myself(),"IsHugged");
-	};
\(END)

\(BEGIN)
name = monster_GorgonBreath
[InvokeSpellOnTarget] = $SET_CHARACTER_SA($TargetContext(),"IsPetrified","Petrified");
\(END)

\(BEGIN)
name = monster_HellHoundAttack
[StartCombatRound] = $GIVE_CHAR_ITEM( $Myself(), "monsterHellHoundBreath" );
\(END)

\(BEGIN)
name = monster_ImmuneCharm
\(END)

\(BEGIN)
name = monster_ImmuneCold
\(END)

\(BEGIN)
name = monster_ImmuneElectricity
\(END)

\(BEGIN)
name = monster_ImmuneFear
\(END)

\(BEGIN)
name = monster_ImmuneFire
\(END)

\(BEGIN)
name = monster_ImmuneHold
\(END)

\(BEGIN)
name = monster_ImmunePoison
[InvokeSpellOnTarget] = $SET_CHARACTER_SA($CharacterContext(),"IsImmunePoison","");
\(END)

\(BEGIN)
name = monster_ImmuneSleep
\(END)

\(BEGIN)
name = monster_ImmuneSpellsGreenSlime
[ComputeDamage] = $IF (($SA_SPELL_GET("DamageMagical") != "cold") || ($SA_SPELL_GET("DamageMagical") != "fire")){ $RETURN "0";};
\(END)

\(BEGIN)
name = monster_ImmuneSpellsIronGolem
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageMagical") == "electricity")
-  {$SET_COMBATANT_SA($TargetContext(),"IsSlow",$GET_PARTY_TIME() +# 3);}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = monster_KuoToaFireSave
[DoesSpellAttackSucceed] = $IF ($GET_SPELL_SA($SpellContext(), "DamageMagical") == "fire")
-	{$SkillAdj($CombatantContext(), "Save Vs SP", "", "+", "2");};
\(END)

\(BEGIN)
name = monster_KuoToaMagicMissile
[ComputeSpellDamage] = $IF ($SpellContext() == "Magic Missile"){$RETURN "1";};
-$IF ($SpellContext() == "Magic Missile|Ranger"){$RETURN "1";};
-$IF ($SpellContext() == "monsterMageMagicMissile"){$RETURN "1";};
\(END)

\(BEGIN)
name = monster_LichFear
[CheckProximity] = $VAR me;
-$VAR it;
-$VAR nameMe;
-$VAR nameIt;
-me = $IndexOf($CombatantContext());
-it = $GET_HOOK_PARAM(5);
-nameMe = $GET_CHAR_NAME(me);
-nameIt = $GET_CHAR_NAME(it);
-$IF ($GET_CHAR_ASL(me,"side") == $GET_CHAR_ASL(it,"side")){$RETURN;};
-$IF (nameMe != "Lich" && nameIt == "Lich")
-	{
-		$IF ($VisualDistance(me,it) <# 7 || $GET_CHAR_ASL(me,"lichfear") == 1)
-			{
-				$SET_COMBATANT_SA($CombatantContext(),"IsLichFear",$GET_PARTY_TIME() +# $RANDOM(4) +# 1);
-				$SET_CHAR_ASL(me,"lichfear","");
-				$RETURN $SA_REMOVE();
-			};
-	};
-$IF (nameMe == "Lich" && nameIt != "Lich")
-	{
-		$IF ($VisualDistance(me,it) <# 7 && $GET_CHAR_NAME(it) != "Lich"){$SET_CHAR_ASL(it,"lichfear",1);};
-	};
[ComputeDamage] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHAR_ASL(tgt,"lichfear") == 1 && $GET_COMBATANT_SA($TargetContext(),"monster_LichFear") != "-?-?-")
-	{
-		$SET_CHAR_ASL(tgt,"lichfear","");
-		$RETURN $GET_HOOK_PARAM(5) +# ($GET_CHAR_HITPOINTS(tgt));
-	};
[DoesAttackSucceed] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHAR_ASL(tgt,"lichfear") == 1 && $GET_COMBATANT_SA($TargetContext(),"monster_LichFear") != "-?-?-")
-	{$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 30);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[IsCombatReady] = $VAR me;
-$VAR i;
-$VAR sideset;
-$VAR set;
-me = $IndexOf($CombatantContext());
-set = $GET_CHAR_ASL(me,"lichfear");
-$IF ($GET_CHAR_ASL(me,"side") == 1){sideset = 3;}
-$ELSE{sideset = 5;};
-i = $NextCreatureIndex("",sideset);
-$WHILE (i != "")
-	{
-		$IF ($GET_CHAR_NAME(i) == "Lich" && $VisualDistance(me,i) <# 7){set = 1;};
-		$IF (set == 1)
-			{
-				$SET_COMBATANT_SA($CombatantContext(),"IsLichFear",$GET_PARTY_TIME() +# $RANDOM(4) +# 1);
-				$SET_CHAR_ASL(me,"lichfear","");
-				$RETURN $SA_REMOVE();
-			};
-		i = $NextCreatureIndex(i,sideset);
-	};
\(END)

\(BEGIN)
name = monster_LightSusceptible
[DoesAttackSucceed] = $VAR par5;
-par5 = $GET_HOOK_PARAM(5);
-$IF ($GET_CHARACTER_SA($Myself(), "light") != "-?-?-"){$SET_HOOK_PARAM(5, par5 -# 1);};
\(END)

\(BEGIN)
name = monster_ModronElementalResistance
[ComputeDamage] = $VAR element;
-element = $SA_ITEM_GET("DamageMagical");
-$IF (element == ("acid" || "cold" || "fire")){$RETURN $GET_HOOK_PARAM(5) /# 6 *# 5;};
[ComputeSpellDamage] = $VAR element;
-element = $SA_SPELL_GET("DamageMagical");
-$IF (element == ("acid" || "cold" || "fire")){$RETURN $GET_HOOK_PARAM(5) /# 6 *# 5;};
[DoesAttackSucceed] = $VAR par5;
-$VAR ele;
-par5 = $GET_HOOK_PARAM(5);
-ele = $SA_SPELL_GET("DamageMagical");
-$IF (ele = ("acid" || "cold" || "fire"){$SET_HOOK_PARAM(5,par5 =# 1);
\(END)

\(BEGIN)
name = monster_MummyFear
[CheckProximity] = $VAR me;
-$VAR it;
-$VAR nameMe;
-$VAR nameIt;
-me = $IndexOf($CombatantContext());
-it = $GET_HOOK_PARAM(5);
-nameMe = $GET_CHAR_NAME(me);
-nameIt = $GET_CHAR_NAME(it);
-$IF ($GET_CHAR_ASL(me,"side") == $GET_CHAR_ASL(it,"side")){$RETURN;};
-$IF (nameMe != "Mummy" && nameIt == "Mummy")
-	{
-		$IF ($VisualDistance(me,it) <# 7 || $GET_CHAR_ASL(me,"mummyfear") == 1)
-			{
-				$SET_COMBATANT_SA($CombatantContext(),"IsMummyFear",$GET_PARTY_TIME() +# $RANDOM(4) +# 1);
-				$SET_CHAR_ASL(me,"mummyfear","");
-				$RETURN $SA_REMOVE();
-			};
-	};
-$IF (nameMe == "Mummy" && nameIt != "Mummy")
-	{
-		$IF ($VisualDistance(me,it) <# 7 && $GET_CHAR_NAME(it) != "Mummy"){$SET_CHAR_ASL(it,"mummyfear",1);};
-	};
[ComputeDamage] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHAR_ASL(tgt,"mummyfear") == 1 && $GET_COMBATANT_SA($TargetContext(),"monster_MummyFear") != "-?-?-")
-	{
-		$SET_CHAR_ASL(tgt,"mummyfear","");
-		$RETURN $GET_HOOK_PARAM(5) +# ($GET_CHAR_HITPOINTS(tgt));
-	};
[DoesAttackSucceed] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHAR_ASL(tgt,"mummyfear") == 1 && $GET_COMBATANT_SA($TargetContext(),"monster_MummyFear") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 30);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[IsCombatReady] = $VAR me;
-$VAR i;
-$VAR sideset;
-$VAR set;
-me = $IndexOf($CombatantContext());
-set = $GET_CHAR_ASL(me,"mummyfear");
-$IF ($GET_CHAR_ASL(me,"side") == 1){sideset = 3;}
-$ELSE{sideset = 5;};
-i = $NextCreatureIndex("",sideset);
-$WHILE (i != "")
-	{
-		$IF ($GET_CHAR_NAME(i) == "Mummy" && $VisualDistance(me,i) <# 7){set = 1;};
-		$IF (set == 1)
-			{
-				$SET_COMBATANT_SA($CombatantContext(),"IsMummyFear",$GET_PARTY_TIME() +# $RANDOM(4) +# 1);
-				$SET_CHAR_ASL(me,"mummyfear","");
-				$RETURN $SA_REMOVE();
-			};
-		i = $NextCreatureIndex(i,sideset);
-	};
\(END)

\(BEGIN)
name = monster_PlayerControl
[AutoAction] = $RETURN "CP";
\(END)

\(BEGIN)
name = monster_Poison
[InvokeSpellOnTarget] = $VAR time;
-$VAR tgt; // target
-time = $GET_PARTY_TIME();
-tgt = $IndexOf($TargetContext());
-$IF ($SA_CHARACTER_GET("IsImmunePoison") != "-?-?-"){$RETURN;};
-$IF ($SA_CHARACTER_GET("IsProtectedPoisonCaster") != "-?-?-"){$RETURN;};
-$IF ($SA_CHARACTER_GET("IsProtectedPoisonTarget") != "-?-?-"){$RETURN;};
-$SET_CHARACTER_SA($TargetContext(),"IsPoisoned",time);
-$SET_CHAR_STATUS(tgt,9);
-$SET_CHAR_HITPOINTS(tgt,"-1");
\(END)

\(BEGIN)
name = monster_RakshasaSpellImmunity
[DoesSpellAttackSucceed] = $IF ($GET_SPELL_Level($SpellContext()) <# 9){$RETURN "N";};
\(END)

\(BEGIN)
name = monster_RakshasaVulnerability
[ComputeDamage] = $VAR tgt;
-tgt = $IndexOf($TargetContext());
-$IF ($ItemContext() == "Bolt|1"){$SET_CHAR_HITPOINTS(tgt,-11);$SET_CHAR_STATUS(tgt,2);};
\(END)

\(BEGIN)
name = monster_RearClawRake1
[InvokeSpellOnTarget] = $SET_COMBATANT_SA($AttackerContext(),"CombatRoundStart",1);
\(END)

\(BEGIN)
name = monster_RearClawRake2
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR HP; // hit points
-$VAR name;
-$VAR dmg;
-$VAR i;
-$VAR AC;
-$VAR TH;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-HP = $GET_CHAR_HITPOINTS(tgt);
-$IF (HP <# 1) {$RETURN;};
-$IF ($GET_COMBATANT_SA($AttackerContext(),"CombatRoundStart") ==# 1)
-	{
- 		i = 0;
-		AC = $GET_CHAR_AC(tgt);
-		TH = $GET_CHAR_THAC0(atk);
-		$WHILE (i <# 2)
-			{
-				$IF($RANDOM(20) +# 1 >=# TH -# AC)
-					{
-						name = $GET_CHAR_NAME(atk);
-						$IF (name == "Giant Lynx"){dmg = ($RANDOM(3) +# 1);};
-						$IF (name == "Leopard"||name == "Mountain Lion"){dmg = ($RANDOM(4) +# 1);};
-						$IF (name == "Jaguar"||name == "Weretiger"){dmg = ($RANDOM(4) +# 2);};
-						$IF (name == "Lion"){dmg = ($RANDOM(6) +# 2);};
-						$IF (name == "Spotted Lion"||name == "Tiger"||name == "Sabre-tooth Tiger"){dmg = ($RANDOM(4) +# $RANDOM(4) +# 2);};
-						$SET_CHAR_HITPOINTS(tgt,HP -# dmg);
-					};
-				i = i +# 1;
-			};
-		$IF (HP<# 1)
-			{
-				$IF (HP <# "-9"){$SET_CHAR_STATUS(tgt,2);}
-				$ELSE{$SET_CHAR_STATUS(tgt,9);};
-			};
-	};
\(END)

\(BEGIN)
name = monster_Regeneration
[StartCombatRound] = $VAR chr; // character
-$VAR hp; // hit points
-chr = $IndexOf($CharacterContext());
-hp = $GET_CHAR_HITPOINTS(chr);
-$IF (hp >=# $GET_CHAR_MAXHITPOINTS(chr)){$RETURN;};
-$SET_CHAR_HITPOINTS(chr, hp +# $SA_PARAM_GET());
\(END)

\(BEGIN)
name = monster_Revulsion
[CheckProximity] = $VAR tgt; // target
-$VAR myself;
-$VAR range;
-$VAR distance;
-$VAR saveVsPoison;
-$VAR roll;
-$IF ($GET_CHAR_NAME($MyIndex()) == "Troglodyte"){$RETURN;};
-$IF ($SA_COMBATANT_GET("ImmuneRevulsion") != "-?-?-"){$RETURN;};
-tgt = $GET_HOOK_PARAM(5);
-myself = $GET_HOOK_PARAM(6);
-range = $SA_PARAM_GET();
-distance = $VisualDistance(tgt, myself);
-$IF (range <# distance) {$RETURN;};
-saveVsPoison = $SkillAdj($CombatantContext(), "Save Vs PPDM", "monster", "G", "");
-roll = $RANDOM(20) +# 1;
-$IF (saveVsPoison ># roll){$SET_CHAR_THAC0(tgt,($GET_CHAR_THAC0(tgt) +# 2));}
-$ELSE{$SET_COMBATANT_SA($CombatantContext(), "ImmuneRevulsion", 4);};
\(END)

\(BEGIN)
name = monster_SlimeWeakness
\(END)

\(BEGIN)
name = monster_SpellImmunity
Parameters = "parameter is delimited string";
[DoesSpellAttackSucceed] = $VAR splList;
-$VAR sNum;
-$VAR spl;
-$VAR cont;
-splList = $SA_PARAM_GET();
-sNum = $DelimitedStringCount(splList);
-$WHILE (count <=# sNum)
-	{
-		spl = $DelimitedStringSubstring(splList,count);
-		$IF ($SpellContext() == spl){$RETURN "N";};
-		count = count +# 1;
-	};
\(END)

\(BEGIN)
name = monster_StirgeAttack
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR link;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-// Attacker
-$SET_COMBATANT_SA($AttackerContext(),"monster_StirgeDrain","");
-$IF ($GET_COMBATANT_SA($AttackerContext(),"monster_StirgeBloodCap") == "-?-?-")
-	{
-		$SET_COMBATANT_SA($AttackerContext(),"monster_StirgeBloodCap",12);
-	};
-$SET_COMBATANT_SA($AttackerContext(),"monster_StirgeLink",tgt);
-// Target
-$SET_COMBATANT_SA($TargetContext(),"monster_StirgeDrainee","");
-$SET_CHARACTER_SA($TargetContext(),"IsHugged",1);
-// Link
-link = $GET_COMBATANT_SA($TargetContext(),"monster_StirgeLink");
-$IF (link == "-?-?-"){$SET_COMBATANT_SA($TargetContext(),"monster_StirgeLink","$255$" + atk);}
-$ELSE
-	{
-		link = link + "$" + atk;
-		$SET_COMBATANT_SA($TargetContext(),"monster_StirgeLink",link);
-	};
\(END)

\(BEGIN)
name = monster_StirgeDrain
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[GetNumberOfAttacks] = $RETURN 0;
[OnStartCombatantAction] = $VAR tgt; // target
-$VAR name;
-$VAR cap;
-$VAR dmg;
-// Test Target and Compute & Apply Drain
-tgt = $GET_COMBATANT_SA($CombatantContext(),"monster_StirgeLink");
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_CHAR_STATUS(tgt) ==# 0) 
-  {
-    cap = $GET_COMBATANT_SA($CombatantContext(),"monster_StirgeBloodCap");
-    dmg = $RANDOM(4) +# 1;
-    $IF (cap <# dmg) {dmg = cap;};
-    cap = cap -# dmg;
-    $SET_COMBATANT_SA($CombatantContext(),"monster_StirgeBloodCap",cap);
-    $SET_CHAR_HITPOINTS(tgt, $GET_CHAR_HITPOINTS(tgt) -# dmg);
-// Is Target Dead?
-    $IF ($GET_CHAR_HITPOINTS(tgt) <# 1)
-      {
-// Target
-        $SET_CHAR_STATUS(tgt,1);
-// Attacker
-        $DELETE_COMBATANT_SA($CombatantContext(),"monster_StirgeDrain");
-        $DELETE_COMBATANT_SA($CombatantContext(),"monster_StirgeLink");
-      };
-// Am I Full?
-    $IF (cap <# 1)
-      {
-        $SET_CHAR_STATUS($MyIndex(),8);
-        $DELETE_COMBATANT_SA($CombatantContext(),"monster_StirgeDrain");
-        $DELETE_COMBATANT_SA($CombatantContext(),"monster_StirgeLink");
-        $SET_COMBATANT_SA($CombatantContext(),"IsFleeing","Fleeing Stirge");
-// Target
-        $DELETE_CHARACTER_SA($Name(name),"IsHugged");
-      };
-  }
-$ELSE
-  {
-// Someone Else Killed It
-// Attacker
-    $DELETE_COMBATANT_SA($CombatantContext(),"monster_StirgeDrain");
-    $DELETE_COMBATANT_SA($CombatantContext(),"monster_StirgeLink");
-  };
\(END)

\(BEGIN)
name = monster_StirgeDrainee
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk; // attacker
-$VAR i;
-$VAR foes;
-$VAR alive;
-foes = $GET_COMBATANT_SA($Myself(),"monster_StirgeLink");
-i = 1;
-alive = "-1";
-atk = $DelimitedStringSubstring(foes, i);
-$WHILE (atk != "")
-	{
-		atk = $DelimitedStringSubstring(foes, i);
-		$IF ($GET_CHAR_STATUS(atk) ==# 0){alive = alive +# 1;};
-		i = i +# 1;
-	};
-// alive = alive -# 1;
-$IF (alive <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_StirgeDrainee");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_StirgeLink");
-		$DELETE_CHARACTER_SA($Myself(),"IsHugged");
-	};
\(END)

\(BEGIN)
name = monster_SummonSlaad
[StartCombatRound] = $VAR round;
-round = $GetCombatRound();
-$IF (round ==# 3) {$AddCombatant("Red Slaad","1");};
\(END)

\(BEGIN)
name = monster_TrollGetUp
[StartCombatRound] = $VAR cbt; // combatant
-$VAR hp; // hit points
-$VAR round;
-$VAR getUp;
-$VAR name;
-$VAR nt;
-$VAR x;
-$VAR y;
-$VAR mhp; // max hit point
-$VAR i;
-$VAR n;
-cbt = $SA_PARAM_GET();
-hp = $GET_CHAR_HITPOINTS(cbt);
-$IF (hp <=# 0)
-	{
-		name = $GET_CHAR_NAME(cbt);
-		round = $GetCombatRound();
-		$IF ($GET_COMBATANT_SA($CombatantContext(),"timeToRise") == "-?-?-")
-			{
-				getUp = ($RANDOM(6) +# $RANDOM(6) +# $RANDOM(6) +# 3);
-				$SET_COMBATANT_SA($CombatantContext(),"timeToRise", round +# getUp);
-			};
-		$IF (round ==# ($SA_COMBATANT_GET("timeToRise")))
-			{
-				i = $NextCreatureIndex("",0);
-				$WHILE (i != "")
-					{
-						n = i;
-						i = $NextCreatureIndex(i,0);
-					};
-				nt = n +# 1;
-				x = $CombatantLocation(cbt,"X");
-				y = $CombatantLocation(cbt,"Y");
-				mhp = $GET_CHAR_MAXHITPOINTS(cbt);
-				$AddCombatant(name,0);
-				$TeleportCombatant(nt,x,y);
-				$SET_CHAR_MAXHITPOINTS(nt,mhp); 
-				$SET_CHAR_HITPOINTS(nt,mhp);
-			};
-	};
\(END)

\(BEGIN)
name = monster_TrollRegeneration
[StartCombatRound] = $VAR tgt;
-$VAR currHP;
-$VAR round;
-tgt = $IndexOf($Myself());
-currHP = $GET_CHAR_HITPOINTS(tgt);
-round = $GetCombatRound();
-$IF (currHP <# 42)
-	{
-		$IF ($SA_COMBATANT_GET("timeToRegen") == "-?-?-")
-		{
-			$SET_COMBATANT_SA($Myself(),"timeToRegen",round +# 3);
-		};
-	};
-$IF (round ==# $SA_COMBATANT_GET("timeToRegen"))
-	{
-		$RETURN $SET_COMBATANT_SA($Myself(),"monster_Regeneration",$SA_PARAM_GET());
-	};
\(END)

\(BEGIN)
name = monster_UnicornSavingThrows
[CreateMonsterCombatant] = $SkillAdj($CharacterContext(), "Save Vs BR", "", "F", "11");
-$SkillAdj($CharacterContext(), "Save Vs PP", "", "F", "9");
-$SkillAdj($CharacterContext(), "Save Vs PPDM", "", "F", "11");
-$SkillAdj($CharacterContext(), "Save Vs RSW", "", "F", "7");
-$SkillAdj($CharacterContext(), "Save Vs SP", "", "F", "8");
\(END)
// saving throw matrices DMG p79

\(BEGIN)
name = monster_VulnerableToHolyWater
[ComputeDamage] = $VAR vulnHolyWater;
-vulnHolyWater = $SA_ITEM_GET("item_HolyWater");
-$IF (vulnHolyWater >=# 0){$RETURN $RANDOM(4) +# $RANDOM(4) +# 2;};
\(END)

\(BEGIN)
name = monster_WeaponDamageOnlyOne
[ComputeDamage] = $VAR oneDamage;
-oneDamage = $SA_ITEM_GET("item_MagicalWespon");
-$IF (oneDamage >=# 3){$RETURN "1";};
\(END)

\(BEGIN)
name = monster_WeaponImmunity
[DoesAttackSucceed] = $VAR atk; // attacker
-$VAR item;
-$VAR mlev;
-$VAR list;
-$VAR name;
-$VAR par5; // Hook parameter 5
-$VAR par6; // Hook parameter 6
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-name = $GET_CHAR_NAME($IndexOf($TargetContext()));
-$IF ($GET_MONSTERTYPE_SA(name,"monster_WeaponImmunity") != "-?-?-")
-	{
-		atk = $IndexOf($AttackerContext());
-		item = $SA_ITEM_GET("item_MagicalWeapon");
-		$IF ($SA_ITEM_GET("AdjustBonus") != "-?-?-"){item = $GET_HOOK_PARAM(7);};
-		$IF ($GET_MONSTERTYPE_SA(name,"vulnSilver") != "-?-?-" && $SA_ITEM_GET("item_SilverWeapon") != "-?-?-")
-			{item = 5;};
- 		$IF (item == "-?-?-")
-			{
-				mlev = $GET_MONSTERTYPE_SA($GET_CHAR_NAME(atk),"monsterLevel");
-				$IF (mlev != "-?-?-")
-					{
-						list = "$0$0$0$0$0$1$1$2$2$3$3";
-						$IF (mlev <# 11)
-							{item = $DelimitedStringSubstring(list,mlev);}
-						$ELSE {item = 4;};
- 					};
-			};
-		$IF (item <# $SA_PARAM_GET()){$SET_HOOK_PARAM(6,par6 +# 90);};
-	};
-$IF (par5 >=# par6){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = monster_WeaponImmunityType
[DoesAttackSucceed] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_MONSTERTYPE_SA($GET_CHAR_NAME(tgt),$SA_NAME()) != "-?-?-" && $SA_ITEM_GET("item_WeaponType") ==# $SA_PARAM_GET())
-	{$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) +# 90);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = monster_WeaponResistance
[ComputeDamage] = $VAR atk; // attacker
-$VAR item;
-atk = $IndexOf($AttackerContext());
-item = $SA_ITEM_GET("item_MagicalWeapon");
-$IF ($GET_CHAR_TYPE(atk) != "@PC@" && $GET_CHAR_TYPE(atk) != "@NPC@") {$RETURN;};
-$IF (item == "-?-?-")
-	{
-		$IF (item <# $SA_PARAM_GET()){$RETURN $GET_HOOK_PARAM(5) /# 2;};
-	};
[CreateMonsterCombatant] = $SET_COMBATANT_SA($CharacterContext(),"monster_WeaponResistance",$SA_PARAM_GET());
\(END)

\(BEGIN)
name = monster_WeaponResistanceType
[ComputeDamage] = $VAR weapon;
-weapon = $SA_ITEM_GET("item_WeaponType");
-$IF (weapon == $SA_PARAM_GET()){$RETURN $GET_HOOK_PARAM(5) /# 2;};
[CreateMonsterCombatant] = $SET_COMBATANT_SA($CharacterContext(),"monster_WeaponResistanceType",$SA_PARAM_GET());
\(END)

\(BEGIN)
name = race_Elf
[PostCreateCharacter] = $SET_CHARACTER_SA($CharacterContext(),"IsElf",1);
\(END)

\(BEGIN)
name = race_HalfElf
[PostCreateCharacter] = $SET_CHARACTER_SA($CharacterContext(),"IsCharmResistantMin","Half-Elf");
-$SET_CHARACTER_SA($CharacterContext(),"IsSleepResistantMin","Half-Elf");
\(END)

\(BEGIN)
name = race_RaceSuppress
[SelectCharacterRace] = $RETURN "Y";
\(END)

\(BEGIN)
name = race_ShortSaveBonus
[CreateMonsterCombatant] = $VAR chr; // character
-$VAR adj;
-$VAR par;
-chr = $IndexOf($CharacterContext());
-adj = $GET_CHAR_LIMITED_CON(chr) *# 2) /# 7;
-par = $SA_PARAM_GET();
-$IF (con ># par){$SET_CHARACTER_SA($CharacterContext(),"IsShortSaveBonus",par);}
-$ELSE {$SET_CHARACTER_SA($CharacterContext(),"IsShortSaveBonus",adj);};
[PostCreateCharacter] = $VAR chr; // character
-chr = $IndexOf($CharacterContext());
-$SET_CHARACTER_SA($CharacterContext(),"IsShortSaveBonus",($GET_CHAR_LIMITED_CON(chr) *# 2) /# 7);
\(END)

\(BEGIN)
name = SaveAdjPPDM
[SaveVsPPDM_Save] = $VAR adj;
-adj = $SA_PARAM_GET();
-$SA_REMOVE();
-$RETURN $GET_HOOK_PARAM(0) +# adj;
\(END)

\(BEGIN)
name = SaveAdjSpell
[SaveVsSp_Save] = $VAR adj;
-adj = $SA_PARAM_GET();
-$SA_REMOVE();
-$RETURN $GET_HOOK_PARAM(0) +# adj;
\(END)

\(BEGIN)
name = spell_Attack
[InvokeSpellOnTarget] = $IF ($GET_COMBATANT_SA($AttackerContext(),"IsInvisible"))
-  {
-   $DELETE_CHARACTER_SA($AttackerContext(),"IsInvisibleSpell");
-   $DELETE_CHARACTER_SA($AttackerContext(),"IsInvisiblePotion");
-   $DELETE_COMBATANT_SA($AttackerContext(),"IsInvisible");
-  };
\(END)

\(BEGIN)
name = spell_Barkskin
[InvokeSpellOnTarget] = $VAR cls;
-$VAR atk; // attacker
-$VAR lvl;
-cls = $SA_PARAM_GET();
-atk = $IndexOf($AttackerContext());
-lvl = $GET_CHAR_Lvl(atk,cls);
-$IF (cls == "ranger") {lvl = lvl -# 7;};
-$SET_CHARACTER_SA($TargetContext(),"IsBarkskinned",$GET_PARTY_TIME() +# lvl +# 4);
\(END)

\(BEGIN)
name = spell_Bless
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR mySide;
-$VAR tgt; // target
-mySide = $GET_COMBATANT_SA($AttackerContext(),"side");
-tgt = $IndexOf($TargetContext());
-$IF (mySide != "-?-?-")
-	{
-		$IF (mySide !=# $GET_COMBATANT_SA($TargetContext(),"side")){$RETURN;};
-		$IF ($VisualDistance(tgt, $IndexOf($NEAREST_ENEMY_TO($TargetContext()))) <# 2){$RETURN;};
-		$SET_CHARACTER_SA($TargetContext(),"IsBlessed",$GET_PARTY_TIME() +# 6);
-		$SET_COMBATANT_SA($TargetContext(),"IsBlessed1",1);
-	}
-$ELSE {$SET_CHARACTER_SA($TargetContext(),"IsBlessed",$GET_PARTY_TIME() +# 6);};
\(END)

\(BEGIN)
name = spell_Blind
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-$IF ($RANDOM(20) +# 1 <# $GET_CHAR_THAC0(atk) -# $GET_CHAR_AC(tgt)){$RETURN;};
-$SET_CHARACTER_SA($TargetContext(),"IsBlind","Blind");
\(END)

\(BEGIN)
name = spell_Blink
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-lvl = $GET_CHAR_Lvl(atk,"magicUser");
-$SET_CHARACTER_SA($AttackerContext(),"IsBlinking",$GET_PARTY_TIME() +# lvl);
-$IF ($GET_COMBATANT_SA($AttackerContext(),"side") != "-?-?-")
-	{
-		$SET_COMBATANT_SA($AttackerContext(),"IsBlinking1",1);
-		$SET_COMBATANT_SA($AttackerContext(),"IsBlinking2",1);
-	};
\(END)

\(BEGIN)
name = spell_CauseDisease
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR minhp;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved") == 1){$RETURN;};
-$IF ($RANDOM(20) +# 1 <# $GET_CHAR_THAC0(atk) -# $GET_CHAR_AC(tgt)){$RETURN;};
-// Need a better To-Hit check;
-$IF ($GET_CHARACTER_SA($TargetContext(),"pcSTR") == "-?-?-")
-	{
-		$SET_CHARACTER_SA($TargetContext(),"pcSTR", $GET_CHAR_LIMITED_STR(tgt));
-		$SET_CHARACTER_SA($TargetContext(),"pcSTRMOD", $GET_CHAR_LIMITED_STRMOD(tgt));
-	};
-minhp = $GET_CHAR_MAXHITPOINTS(tgt) /# 10;
-$IF (minhp <# 1){minhp = 1;};
-$SET_CHARACTER_SA($TargetContext(),"minhp",minhp);
-$SET_CHARACTER_SA($TargetContext(),"IsDiseasedSpell",$GET_PARTY_TIME() +# (($RANDOM(6) +# 1) *# 10));
\(END)

\(BEGIN)
name = spell_Charm
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR name;
-$VAR cls;
-$VAR lvl;
-tgt = $IndexOf($TargetContext());
-atk = $IndexOf($AttackerContext());
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved" )) {$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) != 1){$RETURN;};
-$IF ($GET_MONSTERTYPE_SA(name,"monsterLevel") != "-?-?-")
-	{  //  MONSTERTYPE_SA checks go here
-//$IF ($GET_MONSTERTYPE_SA(tgt,"IsPerson") != "-?-?-"){$RETURN;};
-	};
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SetFriendly(tgt,$GET_COMBATANT_SA($Myself(),"side"));
-$SET_COMBATANT_SA($TargetContext(),"IsCharmed",lvl);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
\(END)

\(BEGIN)
name = spell_CharmMonster
[InvokeSpellOnTarget] = $VAR side;  // caster's side
-$VAR atk; // attacker/caster
-$VAR tgt; // target
-$VAR cLvl;  // caster level
-$VAR name;  // target name
-$VAR lvl;   // target level
-$VAR mLvl;  // temporary target level
-$VAR cls; // caster baseclass
-$VAR tcls; // target baseclass
-$VAR opr;   // once per round
-$VAR rnd; // value of point pool
-$VAR tgtnum;// target number
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) != 1) {$RETURN;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved" )) {$RETURN;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-opr = $GET_COMBATANT_SA($AttackerContext(),"CombatRoundStart");
-$IF (opr == "-?-?-" || opr == 0)
-	{
-		$SET_COMBATANT_SA($AttackerContext(),"CombatRoundStart",5);
-		$SET_COMBATANT_SA($AttackerContext(),"tgtnum",0);
-		$SET_COMBATANT_SA($AttackerContext(),"PointPool",$RANDOM(4) +# $RANDOM(4) +# 2);
-	};
-rnd = $GET_COMBATANT_SA($AttackerContext(), "PointPool");
-$IF (rnd <# 1) {$RETURN;};
-cls = $SA_PARAM_GET();
-cLvl = $GET_CHAR_Lvl(atk,cls);
-side = $GET_COMBATANT_SA($AttackerContext(), "side");
-name = $GET_CHAR_NAME(tgt);
-mLvl = $GET_MONSTERTYPE_SA(name,"monsterLevel");
-$IF (mLvl != "-?-?-"){lvl = mLvl;}
-$ELSE
-	{
-		tcls = $GetHighestLevelBaseclass(tgt);
-		lvl = $GetBaseclassLevel(tgt, tcls);
-	};
-$SET_COMBATANT_SA($AttackerContext(), "tgtnum",$GET_COMBATANT_SA($AttackerContext(),"tgtnum") +# 1);
-tgtnum = $GET_COMBATANT_SA($AttackerContext(),"tgtnum");
-$IF (tgtnum != "-?-?-")
-	{
-		$IF (lvl ># 3)
-			{
-				$SET_COMBATANT_SA($AttackerContext(),"PointPool",0);
-				$SetFriendly(tgt,side);
-				$SET_COMBATANT_SA($TargetContext(),"IsCharmed",cLvl);
-				$RETURN;
-			};
-	};
-$IF (lvl ># rnd){$RETURN;}
-$ELSE
-	{
-		$SET_COMBATANT_SA($AttackerContext(),"PointPool",rnd -# lvl);
-		$SetFriendly(tgt,side);
-		$SET_COMBATANT_SA($TargetContext(),"IsCharmed",cLvl);
-	};
\(END)

\(BEGIN)
name = spell_CharmPerson
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR cls;
-$VAR lvl;
-tgt = $IndexOf($TargetContext());
-atk = $IndexOf($AttackerContext());
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) != 1){$RETURN;};
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsPerson") == "-?-?-"){$RETURN;};
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SetFriendly(tgt,$GET_COMBATANT_SA($Myself(),"side"));
-$SET_COMBATANT_SA($TargetContext(),"IsCharmed",lvl);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
\(END)

\(BEGIN)
name = spell_CharmPersonOrMammal
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR name;
-$VAR cls;
-$VAR lvl;
-tgt = $IndexOf($TargetContext());
-atk = $IndexOf($AttackerContext());
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved" )) {$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) != 1){$RETURN;};
-$IF ($GET_MONSTERTYPE_SA(name,"monsterLevel") != "-?-?-")
-	{  //  MONSTERTYPE_SA checks go here
-		$IF ($GET_MONSTERTYPE_SA(name,"IsPerson") == "-?-?-" && $GET_ISMAMMAL($TargetContext()) != 1){$RETURN;};
-	};
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SetFriendly(tgt,$GET_COMBATANT_SA($Myself(),"side"));
-$SET_COMBATANT_SA($TargetContext(),"IsCharmed",lvl);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
\(END)

\(BEGIN)
name = spell_CharmPlant
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR name;
-$VAR cls;
-$VAR lvl;
-tgt = $IndexOf($TargetContext());
-atk = $IndexOf($AttackerContext());
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved" )) {$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) != 1){$RETURN;};
-$IF ($GET_MONSTERTYPE_SA(name,"monsterLevel") != "-?-?-")
-	{  //  MONSTERTYPE_SA checks go here
-		$IF ($GET_MONSTERTYPE_SA(name,"IsPlant") == "-?-?-"){$RETURN;};
-	};
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SetFriendly(tgt,$GET_COMBATANT_SA($Myself(),"side"));
-$SET_COMBATANT_SA($TargetContext(),"IsCharmed",lvl);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
\(END)

\(BEGIN)
name = spell_Cloudkill
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[SpellLingerBlockage] = $IF ($GET_HASPOISONIMMUNITY($CombatantContext()))
-  {$RETURN "N";};
\(END)

\(BEGIN)
name = spell_ColdResistant
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsResistantCold",exp);
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_Confusion
$SET_CHARACTER_SA($TargetContext(),"DispelLevel",$GET_CHAR_Lvl(atk,cls));-*$IF ($GET_CHAR_STATUS(tgt) ! = 0){$RETURN;};
-monName = $GET_CHAR_NAME(tgt);
-$IF ($GET_MONSTERTYPE_SA(monName,"zConfusionSA") != "-?-?-" ||
-$GET_COMBATANT_SA($TargetContext(),"zConfusionSA") != "-?-?-"){$RETURN;};
-monLvl = $GET_MONSTERTYPE_SA(monName,"monsterLevel");
-$IF (monLvl != "-?-?-")
-	{
-		$IF (monLvl >=# 17){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 6 );}
-		$ELSE
-			{
-				$IF (monLvl >=# 15){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 7 );}
-				$ELSE
-					{
-						$IF (monLvl >=# 13){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 8 );}
-						$ELSE
-							{
-								$IF (monLvl >=# 11){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 10 );}
-								$ELSE
-									{
-										$IF (monLvl >=# 9){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 11 );}
-										$ELSE
-											{
-												$IF (monLvl >=# 7){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 13 );}
-												$ELSE
-													{
-														$IF (monLvl >=# 5){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 14 );}
-														$ELSE
-															{
-																$IF (monLvl >=# 3){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 16 );}
-																$ELSE {$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 17 );};
-															};
-													};
-											};
-									};
-							};
-					};
-			};
-	};
-opr = $GET_COMBATANT_SA($AttackerContext(), "CombatRoundStart");
-$IF (opr  == "-?-?-")
-	{
-		$SET_COMBATANT_SA( $AttackerContext(), "CombatRoundStart",5);
-		rnd = (($RANDOM(4) +# 1) +# ($RANDOM(4) +# 1));
-		$SET_COMBATANT_SA( $AttackerContext(), "PointPool", rnd);
-	};
-opr = $GET_COMBATANT_SA($AttackerContext(), "CombatRoundStart");
-$IF (opr  <# 2)
-	{
-		$SET_COMBATANT_SA( $AttackerContext(), "CombatRoundStart", 3);
-		rnd = (($RANDOM(4) +# 1) +# ($RANDOM(4) +# 1));
-		$SET_COMBATANT_SA( $AttackerContext(), "PointPool", rnd);
-	};
-rnd = $GET_COMBATANT_SA( $AttackerContext(), "PointPool");
-$IF (rnd <# 1) {$RETURN;};
-rnd2 = ($RANDOM(20) +# 1);
-$IF ($SkillAdj($TargetContext(), "Save Vs SP", "spell", "G", "") ># rnd2)
-	{
-		$SET_COMBATANT_SA($TargetContext(),"IsConfusedExtended",1);
-		$SET_COMBATANT_SA($TargetContext(),"CombatRoundStart",1);
-	};
-rnd = $RANDOM(10) +# 1;
-$IF (rnd ==# 1){$SetFriendly(tgt,1);$RETURN;};
-$IF (rnd <=# 6){$SET_COMBATANT_SA($TargetContext(),"IsConfused","Confused");$RETURN;};
-$IF (rnd ==# 7){$SetFriendly(tgt,1);$RETURN;};
-$IF (rnd ==# 8){$SetFriendly(tgt,2);$RETURN;};
-$SetFriendly(tgt,2);
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR monName;
-$VAR monLvl;
-$VAR opr; // once per round
-$VAR rnd;
-$VAR rnd2;
-$VAR cls;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-cls = $SA_PARAM_GET();
\(END)

\(BEGIN)
name = spell_Curse
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$IF ($RANDOM(20) +# 1 <# $GET_CHAR_THAC0(atk) -# $GET_CHAR_AC(tgt)){$RETURN;};
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-exp = $GET_PARTY_TIME() +# (10 *# lvl);
-$SET_CHARACTER_SA($TargetContext(),"IsBestowedCurse",exp);
\(END)

\(BEGIN)
name = spell_CurseMinor
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR mySide;
-mySide = $GET_COMBATANT_SA($AttackerContext(),"side");
-$IF (mySide ==# $GET_COMBATANT_SA($TargetContext(),"side")){$RETURN;};
-$SET_CHARACTER_SA($TargetContext(),"IsCursed",$GET_PARTY_TIME() +# 6);
\(END)

\(BEGIN)
name = spell_DeathSpell
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-lvl = $GET_CHAR_Lvl(atk,$SA_PARAM_GET());
-$SET_CHARACTER_SA($TargetContext(),"IsDispellingEvil",$GET_PARTY_TIME() +# lvl);
-$SET_CHARACTER_SA($TargetContext(),"CanDispel",1);
\(END)

\(BEGIN)
name = spell_DispelGood
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-lvl = $GET_CHAR_Lvl(atk,$SA_PARAM_GET());
-$SET_CHARACTER_SA($TargetContext(),"IsDispellingGood",$GET_PARTY_TIME() +# lvl);
-$SET_CHARACTER_SA($TargetContext(),"CanDispel",1);
\(END)

\(BEGIN)
name = spell_DetectMagic
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $SET_CHARACTER_SA($TargetContext(),"IsDetectingMagic",$GET_PARTY_TIME() +# $SA_SPELL_GET("time"));
\(END)

\(BEGIN)
name = spell_DetectMagicMage
[InvokeSpellOnTarget] = $VAR atk; // attacker/caster
-$VAR cls;
-$VAR lvl;
-$VAR adj;
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"IsDetectingMagic",$GET_PARTY_TIME() +# (lvl *# 2));
\(END)

\(BEGIN)
name = spell_DimensionDoor
[InvokeSpellOnTarget] = $VAR atk; // attacker
-atk = $IndexOf($AttackerContext());
-$TeleportCombatant(atk,$GET_HOOK_PARAM(5),$GET_HOOK_PARAM(6));
[IsValidTarget] = $VAR me;
-$VAR x0;
-$VAR y0;
-$VAR x1;
-$VAR y1;
-me = $IndexOf($Myself());
-x1 = $GET_HOOK_PARAM(5);
-y1 = $GET_HOOK_PARAM(6);
-x0 = $CombatantLocation(me,"X");
-y0 = $CombatantLocation(me,"Y");
-$IF ($IsLineOfSight(x0,y0,x1,y1,1) != "1"){$RETURN "N";}
-$ELSE{$RETURN "";};
\(END)

\(BEGIN)
name = spell_Disease
[InvokeSpellOnTarget] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHAR_Lvl(tgt,"paladin") >=# 1){$RETURN;};
-$IF($GET_CHARACTER_SA($TargetContext(),"IsImmuneDisease") != "-?-?-"){$RETURN;};
-$SET_CHARACTER_SA($TargetContext(),"IsDiseased","Diseased");
\(END)

\(BEGIN)
name = spell_Dispel
[InvokeSpellOnTarget] = $VAR atk; // attacker/caster
-$VAR tgt; // target
-$VAR name;
-$VAR cls; // caster's class (creator)
-$VAR cLvl; // caster's level (creator)
-$VAR iLvl; // caster's level (item)
-$VAR dLvl; // caster's level (destroyer)
-$VAR percent;
-$VAR rndm;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-name = $GET_CHAR_NAME(tgt);
-cls = $SA_PARAM_GET();
-cLvl = $GET_CHARACTER_SA($TargetContext(),"DispelLevel");
-iLvl = $GET_CHARACTER_SA($TargetContext(),"DispelLevelItem");
-dLvl = $GET_CHAR_Lvl(atk,cls);
-rndm = $RANDOM(100) +# 1;
-// potions
-$IF (dLvl ># 21){$ForEachPossession($CharacterContext(),"item_Potion");};
-$IF (iLvl != "-?-?-"){cLvl = iLvl;};
-$IF (dLvl ># cLvl){percent = (dLvl -# cLvl) *# 5 +# 50;}
-$ELSE{percent = 50 -# (cLvl -# dLvl) *# 2;};
-$IF (rndm <=# percent){$ForEachPossession($CharacterContext(),"item_Potion");};
-// spells and spell effects
-$IF (dLvl ># cLvl){percent = (dLvl -# cLvl) *# 5 +# 50;}
-$ELSE{percent = 50 -# (cLvl -# dLvl) *# 2;};
-$IF (rndm <=# percent)
-	{
-		$RUN_CHAR_SCRIPTS(tgt,"Dispel");
-		$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
-		$RETURN;
-	};
[SpellLingeringScripts] = $VAR cLvl; // caster's level (creator)
-$VAR dLvl; // caster's level (destroyer)
-$VAR percent;
-$VAR rndm;
-$IF ($GET_SPELL_SA($SpellContext(),"Dispelled") != "-?-?-"){ $RETURN "RemoveLinger"; };
-cLvl = $GET_HOOK_PARAM(7);
-dLvl = $GET_HOOK_PARAM(6);
-rndm = $RANDOM(100) +# 1;
-$IF (dLvl ># cLvl){percent = (dLvl -# cLvl) *# 5 +# 50;}
-$ELSE{percent = 50 -# (cLvl -# dLvl) *# 2;};
-$IF (rndm <=# percent){$RETURN "RemoveLinger";};
\(END)

\(BEGIN)
name = spell_DispelEvil
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-lvl = $GET_CHAR_Lvl(atk,$SA_PARAM_GET());
-$SET_CHARACTER_SA($TargetContext(),"IsDispellingEvil",$GET_PARTY_TIME() +# lvl);
-$SET_CHARACTER_SA($TargetContext(),"CanDispel",1);
\(END)

\(BEGIN)
name = spell_DispelGood
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-lvl = $GET_CHAR_Lvl(atk,$SA_PARAM_GET());
-$SET_CHARACTER_SA($TargetContext(),"IsDispellingGood",$GET_PARTY_TIME() +# lvl);
-$SET_CHARACTER_SA($TargetContext(),"CanDispel",1);
\(END)

\(BEGIN)
name = spell_Drain
[InvokeSpellOnTarget] = $VAR trgt; // trgt of draining
-$VAR bName; // name of baseclass
-$VAR bLvl; // level of baseclasses
-$VAR bDie; // type of die used for HP for baseclass
-$VAR bNum; // number of baseclasses in class
-$VAR name;
-$VAR monHit; // monster THAC0
-$VAR rand;
-$VAR drain; // amount of HP drained
-$VAR prevDrain; // previous Drains
-trgt = $IndexOf($TargetContext());
-bName = $GetHighestLevelBaseclass(trgt);
-bLvl = $GetBaseclassLevel(trgt,bName);
-name = $GET_CHAR_NAME(trgt);
-$SET_CHAR_Lvl(trgt,bName,bLvl -# 1);
-$IF ((bLvl -# 1) <=# 0)
-	{
-		$SET_CHAR_HITPOINTS(trgt,-11);
-		$SET_CHAR_MAXHITPOINTS(trgt,-11);
-		$SET_CHAR_STATUS(trgt,5); // status 5 = gone, PC cannot be raised or resurrected
-		$RETURN ;
-	};
-bDie = $RollHitPointDice(bName,bLvl,bLvl); 
-bNum = $DelimitedStringCount($GET_CHARACTER_SA($TargetContext(),"class_baseName"));
-$IF (bNum <# 1){bNum = 1;};
-rand = $RANDOM(bDie) +# 1;
-drain = rand /# bNum;
-$IF (drain <# 1){drain = 1;};
-$SET_CHAR_MAXHITPOINTS(trgt,$GET_CHAR_MAXHITPOINTS(trgt) -# drain);
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsDrained") == "-?-?-")
-	{
-		$SET_CHARACTER_SA($TargetContext(),"IsDrained","#$" + bName + "$" + bLvl + "$" + drain + "#$99");
-	}
-$ELSE
-	{
-		prevDrain = $GET_CHARACTER_SA($TargetContext(),"IsDrained");
-		$SET_CHARACTER_SA($TargetContext(),"IsDrained","#$" + bName + "$" + bLvl + "$" + drain + prevDrain);
-	};
-$SET_CHAR_Exp(trgt,bName,$DAT_Baseclass_Experience(bName,bLvl -# 1));
\(END)

\(BEGIN)
name = spell_DrainVamp
[InvokeSpellOnTarget] = $VAR trgt; // trgt of draining
-$VAR bName; // name of baseclass
-$VAR bLvl; // level of baseclasses
-$VAR bDie; // type of die used for HP for baseclass
-$VAR bNum; // number of baseclasses in class
-$VAR name;
-$VAR monHit; // monster THAC0
-$VAR rand;
-$VAR drain; // amount of HP drained
-$VAR prevDrain; // previous Drains
-trgt = $IndexOf($TargetContext());
-bName = $GetHighestLevelBaseclass(trgt);
-bLvl = $GetBaseclassLevel(trgt,bName);
-name = $GET_CHAR_NAME(trgt);
-$SET_CHAR_Lvl(trgt,bName,bLvl -# 2);
-$IF ((bLvl -# 2) <=# 0)
-	{
-		$SET_CHAR_HITPOINTS(trgt,-11);
-		$SET_CHAR_MAXHITPOINTS(trgt,-11);
-		$SET_CHAR_STATUS(trgt,5); // status 5 = gone, PC cannot be raised or resurrected
-		$RETURN ;
-	};
-bDie = $RollHitPointDice(bName,bLvl,bLvl); 
-bNum = $DelimitedStringCount($GET_CHARACTER_SA($TargetContext(),"class_baseName"));
-$IF (bNum <# 1){bNum = 1;};
-rand = $RANDOM(bDie) +# 1;
-drain = rand /# bNum;
-$IF (drain <# 1){drain = 1;};
-$SET_CHAR_MAXHITPOINTS(trgt,$GET_CHAR_MAXHITPOINTS(trgt) -# drain);
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsDrained") == "-?-?-")
-	{
-		$SET_CHARACTER_SA($TargetContext(),"IsDrained","#$" + bName + "$" + bLvl + "$" + drain + "#$99");
-	}
-$ELSE
-	{
-		prevDrain = $GET_CHARACTER_SA($TargetContext(),"IsDrained");
-		$SET_CHARACTER_SA($TargetContext(),"IsDrained","#$" + bName + "$" + bLvl + "$" + drain + prevDrain);
-	};
-$SET_CHAR_Exp(trgt,bName,$DAT_Baseclass_Experience(bName,bLvl -# 1));
\(END)

\(BEGIN)
name = spell_Enfeeble
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR lvl;
-$VAR cls;
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SET_COMBATANT_SA($TargetContext(),"enfeebled",100 -# (22 +# lvl));
-$SET_COMBATANT_SA($TargetContext(),"IsEnfeebled",$GET_PARTY_TIME() +# lvl);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
\(END)

\(BEGIN)
name = spell_Enlarge
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(), $GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker/caster
-$VAR tgt; // target
-$VAR str;
-$VAR strMod;
-$VAR adjStr;
-$VAR adjStrMod;
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR list1;
-$VAR list2;
-$IF ($GET_CHARACTER_SA($TargetContext(),"reduced") != "-?-?-")
-	{$RETURN $RUN_CHAR_SCRIPTS(tgt,"Dispel reduced");};
-$IF ($GET_COMBATANT_SA($TargetContext(),"side") != $GET_COMBATANT_SA($AttackerContext(),"side"))
-	{$IF ($SkillAdj($TargetContext(), "Save Vs SP", "", "F", "") == 1) {$RETURN;};};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-str = $GET_CHAR_LIMITED_STR(tgt);
-strMod = $GET_CHAR_LIMITED_STRMOD(tgt);
-adjStr = 18 -# str;
-adjStrMod = 100 -# strMod;
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$IF (lvl ># 10) {lvl =# 10;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"myStr") == "-?-?-")
-	{
-		$SET_CHARACTER_SA($TargetContext(),"myStr", str);
-		$SET_CHARACTER_SA($TargetContext(),"myStrMod", strMod);
-	};
-$IF ($GET_CHARACTER_SA($TargetContext(),"mySize") == "-?-?-")
-	{$SET_CHARACTER_SA($TargetContext(),"mySize", $GET_CHAR_SIZE(tgt));};
-list1 = "|$18$0|$18$0|$18$01|$18$51|$18$76|$18$91|$18$100|$19$0|$20$0|$21$0|$22$0";
-list2 = $DelimitedStringSubstring(list1,lvl);
-$IF (str <# $DelimitedStringSubstring(list2,0))
-	{$MODIFY_CHAR_ATTRIBUTE(tgt,"STR",adjStr,"MINUTES",10 *# lvl,"Enlarge STR","SPELL Enlarge STR");};
-str = $GET_CHAR_LIMITED_STR(tgt);
-$IF (str ==# 18)
-	{
-		$IF (strMod <# $DelimitedStringSubstring(list2,1))
-			{
-				$MODIFY_CHAR_ATTRIBUTE(tgt,"STRMOD",adjStrMod,"MINUTES",10 *# lvl,"Enlarge STRMOD","SPELL Enlarge STRMOD");
-			};
-	}
-$ELSE {$MODIFY_CHAR_ATTRIBUTE(tgt,"STRMOD",strMod -# strMod,"MINUTES",10 *# lvl,"Enlarge STRMOD","SPELL Enlarge STRMOD");};
-$IF (lvl ># 4) {$SET_CHAR_SIZE(tgt,2);};
-$SET_CHARACTER_SA($TargetContext(),"IsEnlarged",lvl);
-$SET_CHARACTER_SA($TargetContext(),"enlarged",1);
\(END)

\(BEGIN)
name = spell_Entangle
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[Entangled1] = $RETURN $SET_HOOK_PARAM(8 ,"Slowed by Plants");
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-exp = $GET_PARTY_TIME() +# 10;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$IF ($SkillAdj($TargetContext(), "Save Vs SP", "", "F", "") ># $RANDOM(20))
-  {$SET_COMBATANT_SA($TargetContext(),"IsEntangled0",exp);}
-$ELSE{$SET_COMBATANT_SA($TargetContext(),"IsEntangled1",$GET_CHAR_MAXMOVE(tgt) /# 2);};
[MovementAdjustments] = $VAR speed;
-speed = $GET_HOOK_PARAM(5);
-speed = speed /# 2;
-$SET_HOOK_PARAM(5, speed);
[RemoveLinger] = $RETURN "AREA";
[SpellLingerBlockage] = $IF ($GET_COMBATANT_SA($CombatantContext(),"IsEntangled1") != "-?-?-"){$RETURN "N";};
\(END)

\(BEGIN)
name = spell_Fear
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$SET_COMBATANT_SA($TargetContext(),"IsAfraid","");
\(END)

\(BEGIN)
name = spell_FireResistant
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsResistantFire",exp);
[RemoveLinger] = $RETURN "TARGETS";
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_FireShield
[OverrideSpellSelection] = $RETURN "$Cold Fire Shield$Hot Fire Shield";
\(END)

\(BEGIN)
name = spell_FireShieldCold
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR exp; // expiration time
-$VAR atk; // attacker
-$VAR cls;
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME();
-exp = exp +# 2 +# lvl;
-$RETURN $SET_CHARACTER_SA($TargetContext(),"IsFireShieldedCold", exp);
[RemoveLinger] = $RETURN "TARGETS";
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_FireShieldHot
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR exp; // expiration time
-$VAR atk; // attacker
-$VAR cls;
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME();
-exp = exp +# 2 +# lvl;
-$RETURN $SET_CHARACTER_SA($TargetContext(),"IsFireShieldedHot", exp);
[RemoveLinger] = $RETURN "TARGETS";
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_FixBlind
[FixCharacter] = $VAR blind;
-blind = $GET_CHARACTER_SA($CharacterContext(),"IsBlind");
-$RETURN blind != "-?-?-";
Info = "cure blindness, heal for FIX";
\(END)

\(BEGIN)
name = spell_FixCure
[FixCharacter] = $VAR chr; // character
-$VAR HP; // hit points
-$VAR maxHP; // maximum hit points
-chr = $IndexOf($CharacterContext());
-HP = $GET_CHAR_HITPOINTS(chr);
-maxHP = $GET_CHAR_MAXHITPOINTS(chr);
-$RETURN maxHP ># HP;
Info = "cure light/serious/critical wounds, heal for FIX";
\(END)

\(BEGIN)
name = spell_FixCurse
[FixCharacter] = $VAR curse;
-curse = $GET_CHARACTER_SA($CharacterContext(),"IsCursed");
-$RETURN curse != "-?-?-";
Info = "remove curse for FIX";
\(END)

\(BEGIN)
name = spell_FixDisease
[FixCharacter] = $VAR disease;
-disease = $GET_CHARACTER_SA($CharacterContext(),"IsDiseased");
-$RETURN disease != "-?-?-";
Info = "cure disease, heal for FIX";
\(END)

\(BEGIN)
name = spell_FixDrain
[FixCharacter] = $VAR drain;
-drain = $GET_CHARACTER_SA($CharacterContext(),"IsDrained");
-$RETURN drain != "-?-?-";
Info = "restoration for FIX";
\(END)

\(BEGIN)
name = spell_FixFeeblemind
[FixCharacter] = $VAR feeblemind;
-feeblemind = $GET_CHARACTER_SA($CharacterContext(),"IsFeebleminded");
-$RETURN feeblemind != "-?-?-";
Info = "heal for FIX";
\(END)

\(BEGIN)
name = spell_FixPoison
[FixCharacter] = $VAR poison;
-poison = $GET_CHARACTER_SA($CharacterContext(),"IsPoisoned");
-$RETURN poison != "-?-?-";
Info = "slow/neutralize poison for FIX";
\(END)

\(BEGIN)
name = spell_FixRaise
[FixCharacter] = $VAR chr; // character
-$VAR status;
-chr = $IndexOf($CharacterContext());
-status = $GET_CHAR_STATUS(chr);
-$RETURN status ==# 2;
Info = "raise dead, resurrection for FIX";
\(END)

\(BEGIN)
name = spell_Fumble
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(), "IsFumbling",exp);
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_Harm
[InvokeSpellOnTarget] = $IF ($GET_CHAR_UNDEAD($IndexOf($TargetContext())) != "none"){$RETURN;};
-$CastSpellOnTarget($TargetContext(),"HarmDisease");
\(END)

\(BEGIN)
name = spell_HarmDisease
[InvokeSpellOnTarget] = $VAR tgt; // target
-$VAR minhp;
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHARACTER_SA($TargetContext(),"pcSTR") == "-?-?-")
-  {
-   $SET_CHARACTER_SA($TargetContext(),"pcSTR", $GET_CHAR_LIMITED_STR(tgt));
-   $SET_CHARACTER_SA($TargetContext(),"pcSTRMOD", $GET_CHAR_LIMITED_STRMOD(tgt));
-  };
-minhp = $GET_CHAR_MAXHITPOINTS(tgt) /# 10;
-$IF (minhp <# 1){minhp = 1;};
-$SET_CHARACTER_SA($TargetContext(),"minhp",minhp);
-$SET_CHARACTER_SA($TargetContext(),"IsDiseasedSpell",$GET_PARTY_TIME() +# (($RANDOM(6) +# 1) *# 10));
\(END)

\(BEGIN)
name = spell_Haste
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_COMBATANT_SA($TargetContext(),"IsFast",exp);
\(END)

\(BEGIN)
name = spell_Heal
[InvokeSpellOnTarget] = $VAR tgt; // target
-$VAR hp; // hit points
-$VAR maxHP; // max hit points
-tgt = $IndexOf($TargetContext());
-hp = $GET_CHAR_HITPOINTS(tgt);
-maxHP = $GET_CHAR_MAXHITPOINTS(tgt);
-$IF ($GET_CHAR_UNDEAD(tgt) != "none") {$RETURN;};
-$IF ($GET_CHAR_STATUS(tgt) ># 1) {$RETURN;};
-$DELETE_CHARACTER_SA($TargetContext(),"IsBlind");
-$DELETE_CHARACTER_SA($TargetContext(),"IsDiseased");
-$DELETE_CHARACTER_SA($TargetContext(),"IsDiseasedSpell");
-$DELETE_CHARACTER_SA($TargetContext(),"IsMummyDiseased");
-$DELETE_CHARACTER_SA($TargetContext(),"IsFeebleminded");
-$IF (hp <# (maxHP -# 4))
-	{
-		$SET_CHAR_STATUS(tgt,0);
-		$SET_CHAR_HITPOINTS(tgt,(maxHP -# ($RANDOM(4)+#1)));
-	}
-$ELSE
-	{
-		$SET_CHAR_STATUS(tgt,0);
-		$SET_CHAR_HITPOINTS(tgt,(maxHP));
-	};
\(END)

\(BEGIN)
name = spell_HoldAnimal
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-$IF($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-$IF ($GET_ISANIMAL($TargetContext()) !=# 1){$RETURN;};
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-exp = $GET_PARTY_TIME() +# (lvl *# 2);
-$SET_COMBATANT_SA($TargetContext(),"IsHeld",exp);
\(END)

\(BEGIN)
name = spell_HoldMonster
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR lvl;
-$VAR exp; // expiration time
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_COMBATANT_SA($TargetContext(),"IsHeld",exp);
\(END)

\(BEGIN)
name = spell_HoldPersonCleric
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR cls;
-$VAR adj; 
-$VAR lvl;
-$VAR exp; // expiration time
-$VAR name;
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_MONSTERTYPE_SA(name,"monsterLevel") != "-?-?-")
-	{  //  MONSTERTYPE_SA checks go here
-		$IF ($GET_MONSTERTYPE_SA(name,"IsPerson") == "-?-?-") {$RETURN;};
-	};
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-exp = $GET_PARTY_TIME() +# 4 +# lvl;
-$SET_COMBATANT_SA($TargetContext(),"IsHeld",exp);
\(END)

\(BEGIN)
name = spell_HoldPersonMU
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR name;
-$VAR cls;
-$VAR lvl;
-$VAR exp; // expiration time
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_MONSTERTYPE_SA(name,"monsterLevel") != "-?-?-")
-	{  //  MONSTERTYPE_SA checks go here
-		$IF ($GET_MONSTERTYPE_SA(name,"IsPerson") == "-?-?-") {$RETURN;};
-	};
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-exp = $GET_PARTY_TIME() +# (lvl *# 2);
-$SET_COMBATANT_SA($TargetContext(),"IsHeld",exp);
\(END)

\(BEGIN)
name = spell_ImmuneDragonBreath
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$SET_COMBATANT_SA($CombatantContext(),"IsImmuneDB","4");
\(END)

\(BEGIN)
name = spell_ImmuneNormalMissiles
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(), "IsImmuneNormalMissiles",exp);
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_ImmuneSpells
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($CharacterContext(),"IsImmuneSpells",exp);
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_ImmuneSpellsMinor
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($CharacterContext(),"IsImmuneSpellsMinor",exp);
\(END)

\(BEGIN)
name = spell_InsectPlagueDruid
[CheckProximity] = $VAR atk; // attacker/caster
-$VAR tgt; // target
-$VAR range;
-$VAR distance;
-$VAR sVS; // Save Vs Spell
-$VAR roll;
-$VAR bCls; // target baseclass
-$VAR lvl; // target level
-atk = $GET_HOOK_PARAM(5);
-tgt = $GET_HOOK_PARAM(6);
-range = $SA_PARAM_GET();
-distance = $VisualDistance(tgt, atk);
-$IF (range <# distance) {$RETURN;};
-sVS = $SkillAdj($TargetContext(), "Save Vs SP", "", "F", "");
-roll = $RANDOM(20) +# 1;
-bCls = $GetHighestLevelBaseclass(tgt);
-lvl = $GetBaseclassLevel(tgt,bCls);
-$IF (lvl <# 3){$SET_COMBATANT_SA($TargetContext(),"IsInsectFlee",atk);};
-$IF (lvl <# 6){$IF (sVS ># roll){$SET_COMBATANT_SA($TargetContext(),"IsInsectFlee",atk);};};
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[RemoveLinger] = $RETURN "AREA";
\(END)

\(BEGIN)
name = spell_Invisible
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker/caster
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$SET_CHARACTER_SA($TargetContext(),"IsInvisibleSpell",2);
-$SET_COMBATANT_SA($TargetContext(),"IsInvisible",2);
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = spell_InvisibleToAnimals
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsInvisibleToAnimals",exp);
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = spell_MassCharm
[InvokeSpellOnTarget] = $VAR side;  // caster's side
-$VAR atk; // attacker
-$VAR tgt; // target
-$VAR clvl;  // caster level
-$VAR name;  // target name
-$VAR lvl;   // target level
-$VAR tlvl;  // temporary target level
-$VAR bCls;
-$VAR cls;
-$VAR opr;   //once per round
-$VAR rnd;
-opr = $GET_COMBATANT_SA($AttackerContext(),"CombatRoundStart");
-$IF (opr == "-?-?-" || opr ==# 0)
-	{
-		$SET_COMBATANT_SA($AttackerContext(),"CombatRoundStart",5);
-		$SET_COMBATANT_SA($AttackerContext(),"PointPool",clvl *# 2);
-	};
-rnd = $GET_COMBATANT_SA($AttackerContext(),"PointPool");
-$IF (rnd <# 1) {$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) != 1) {$RETURN;};
-side = $GET_COMBATANT_SA($AttackerContext(), "side");
-$IF ($GET_COMBATANT_SA($TargetContext(), "side") ==# side) {$RETURN;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-cls = $SA_PARAM_GET();
-clvl = $GET_CHAR_Lvl(atk,cls);
-name = $GET_CHAR_NAME(tgt);
-tlvl = $GET_MONSTERTYPE_SA(name,"monsterLevel");
-$IF (tlvl != "-?-?-") {lvl = tlvl;}
-$ELSE
-	{
-		bCls = $GetHighestLevelBaseclass(tgt);
-		lvl = $GetBaseclassLevel(tgt,bCls);
-	};
-$IF (lvl ># rnd) {$RETURN;}
-$ELSE
-	{
-		$SET_COMBATANT_SA($AttackerContext(),"PointPool",rnd -# lvl);
-		$IF ($GET_CHARACTER_SA($TargetContext(),"saved" )) {$RETURN;};
-		$SetFriendly(tgt,side);
-		$SET_COMBATANT_SA($TargetContext(),"IsCharmed",clvl);
-	};
\(END)

\(BEGIN)
name = spell_MindBlast
[InvokeSpellOnTarget] = $VAR exp;
-exp = $GetCombatRound() +# $RANDOM(9) +# 4;
-$SET_COMBATANT_SA($TargetContext(),"IsStunned","Stunned");
\(END)

\(BEGIN)
name = spell_MirrorImage
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR rndm;
-$VAR images;
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-// Determine number of new images
-rndm = $RANDOM(100) +# 1 +# lvl;
-$IF (rndm ># 75){images = 4;}
-$ELSE
-	{
-		$IF (rndm ># 50){images = 3;}
-		$ELSE
-			{
-				$IF (rndm ># 25){images = 2;}
-				$ELSE{images = 1;};
-			};
-	};
-// Test for existing images
-$IF ($GET_CHARACTER_SA($AttackerContext(),"IsMirrored") == "-?-?-")
-  {$SET_CHARACTER_SA($AttackerContext(),"IsMirrored",0);};
-// Add new images
-$SET_CHARACTER_SA($AttackerContext(),"IsMirrored",$GET_CHARACTER_SA($AttackerContext(),"IsMirrored") +# images);
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = spell_MummyRot
[InvokeSpellOnTarget] = $SET_CHARACTER_SA($TargetContext(),"IsMummyDiseased",$GET_PARTY_DAYS() +# 30);
\(END)

\(BEGIN)
name = spell_NeutralizePoison
[InvokeSpellOnTarget] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHARACTER_SA($TargetContext(), "IsPoisoned") == "-?-?-"){$RETURN;};
-$DELETE_CHARACTER_SA($CharacterContext(),"IsPoisoned");
-$IF ($GET_CHAR_HITPOINTS(tgt) <=# 0)
-	{
-		$SET_CHAR_HITPOINTS(tgt, "1");
-		$SET_CHAR_STATUS(tgt, "0");
-	};
\(END)

\(BEGIN)
name = spell_Paralysis
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR name;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsImmuneParalysis") != "-?-?-"){$RETURN;};
-$IF ($GET_MONSTERTYPE_SA(name,"monster_ImmuneParalysis") != "-?-?-"){$RETURN;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-$IF ($GET_CHAR_NAME(atk) == "Ghoul" && $GET_CHAR_RACE(tgt) == "Elf"){$RETURN;};
-$SET_COMBATANT_SA($TargetContext(),"IsParalyzed","Paralyzed");
\(END)

\(BEGIN)
name = spell_Petrify
[InvokeSpellOnTarget] = $SET_CHARACTER_SA($TargetContext(),"IsPetrified","Petrified");
\(END)

\(BEGIN)
name = spell_Poison
[InvokeSpellOnTarget] = $VAR tgt; // target
-$VAR time;
-tgt = $IndexOf($TargetContext());
-time = $GET_PARTY_TIME();
-$IF ($SA_CHARACTER_GET("IsImmunePoison") != "-?-?-"){$RETURN;};
-$IF ($SA_CHARACTER_GET("IsProtectedPoisonCaster") != "-?-?-"){$RETURN;};
-$IF ($SA_CHARACTER_GET("IsProtectedPoisonTarget") != "-?-?-"){$RETURN;};
-$SET_CHARACTER_SA($TargetContext(),"IsPoisoned",time);
-$SET_CHAR_STATUS(tgt,2);
-$SET_CHAR_HITPOINTS(tgt,"-11");
\(END)

\(BEGIN)
name = spell_PowerWordKill
[ComputeDamage] = $VAR tgt; // target
-$VAR tgtHP;
-tgt = $IndexOf($TargetContext());
-tgtHP = $GET_CHAR_HITPOINTS(tgt);
-$IF (tgtHP <=# 60){$RETURN tgtHP +# 11;};
\(END)

\(BEGIN)
name = spell_PowerWordStun
[InvokeSpellOnTarget] = $VAR exp; // expiration time
-exp = $GET_PARTY_TIME() +# $RANDOM(4) +# $RANDOM(4) +# 2;
-$SET_COMBATANT_SA($TargetContext(),"IsStunned",exp);
\(END)

\(BEGIN)
name = spell_Prayer
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsPraying",exp);
\(END)

\(BEGIN)
name = spell_ProtectionFromEvil
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsProtectedEvil",exp);
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_ProtectionFromFire
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl *# 10;
-$IF (atk ==# tgt)
-	{
-		$SET_CHARACTER_SA($TargetContext(),"IsProtectedFireCaster",exp);
-		$SET_CHARACTER_SA($TargetContext(),"FirePoints",lvl *# 12);
-	}
-$ELSE{$SET_CHARACTER_SA($TargetContext(),"IsProtectedFireTarget",exp);};
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = spell_ProtectionFromGood
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsProtectedGood",exp);
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_ProtectionFromLightning
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl *# 10;
-$IF (atk ==# tgt)
-	{
-		$SET_CHARACTER_SA($TargetContext(),"IsProtectedLightningCaster",exp);
-		$SET_CHARACTER_SA($TargetContext(),"FirePoints",lvl *# 12);
-	}
-$ELSE{$SET_CHARACTER_SA($TargetContext(),"IsProtectedLightningTarget",exp);};
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = spell_RaiseDead
[InvokeSpellOnTarget] = $VAR tgt; // target
-$VAR type;
-$VAR CON; // Constitution
-$VAR raised;
-$VAR list;
-$VAR pct; // percent
-tgt = $IndexOf($TargetContext());
-$IF ($GET_COMBATANT_SA($TargetContext(),"mummy") == 1)
-	{ // Mummy Swap
-		$AddCombatant("Ancient Fighter",0);
-		$TeleportCombatant($IndexOf($Name("Ancient Fighter")),$GET_HOOK_PARAM(5),$GET_HOOK_PARAM(6));
-		$DELETE_COMBATANT_SA($TargetContext(),"mummy");
-		$RETURN;
-	};
-$IF ($GET_CHAR_STATUS(tgt) !=# 2){$RETURN;};
-CON = $GET_CHAR_LIMITED_CON(tgt);
-raised = $GET_CHARACTER_SA($TargetContext(),"raised");
-$IF (raised == "-?-?-"){raised = CON;}
-$ELSE {raised = raised -# 1;};
-$IF (raised <# 1 || $GET_CHAR_RACE(tgt) == "Elf"){$RETURN $SET_CHAR_STATUS(tgt,5);};
-$SET_CHARACTER_SA($TargetContext(),"raised",raised);
-list = "$0$30$35$40$45$50$55$60$65$70$75$80$85$90$92$94$96$98$100$100$100$100$100$100$100$100";
-pct = $DelimitedStringSubstring(list,CON);
-$IF (pct <# $RANDOM(100) +# 1){$RETURN $SET_CHAR_STATUS(tgt,5);};
-$MODIFY_CHAR_ATTRIBUTE(tgt,"CON", -1, "MINUTES", 999999999, "Raise Dead CON reduction", "SPELL Raise Dead");
-$SET_CHAR_HITPOINTS(tgt,1);
-$SET_CHAR_STATUS(tgt,1);
\(END)

\(BEGIN)
name = spell_ReadMagic
[CanIdentify] = $IF ($GET_ITEM_SA($ItemContext(), "item_Scroll" ) != "-?-?-")
-	{
-		$RETURN "Y";
-	};
[Identify] = $SA_REMOVE();
-$RETURN "Y";
\(END)

\(BEGIN)
name = spell_Reduce
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5 ));
[InvokeSpellOnTarget] = $VAR atk; // attacker/caster
-$VAR tgt; // target
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR str;
-$VAR strMod;
-$VAR adjStr;
-$IF ($GET_CHARACTER_SA($TargetContext(),"enlarged") != "-?-?-")
-	{$RETURN $RUN_CHAR_SCRIPTS(tgt,"Dispel enlarged");};
-$IF ($GET_COMBATANT_SA($TargetContext(),"side") != $GET_COMBATANT_SA($AttackerContext(),"side"))
-	{$IF ($SkillAdj($TargetContext(), "Save Vs SP", "", "F", "") == 1) {$RETURN;};};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-str = $GET_CHAR_LIMITED_STR(tgt);
-strMod = $GET_CHAR_LIMITED_STRMOD(tgt);
-adjStr = str -# 6;
-$IF (lvl ># 10) {lvl =# 10;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"myStr") == "-?-?-")
-	{
-		$SET_CHARACTER_SA($TargetContext(),"myStr", str);
-		$SET_CHARACTER_SA($TargetContext(),"myStrMod", strMod);
-	};
-$IF ($GET_CHARACTER_SA($TargetContext(),"mySize") == "-?-?-")
-	{$SET_CHARACTER_SA($TargetContext(),"mySize", $GET_CHAR_SIZE(tgt));};
-$IF ($GET_CHAR_SIZE(tgt) ># 0){$SET_CHAR_SIZE(tgt, 0);};
-$IF ($GET_CHAR_LIMITED_STR(tgt) ># 6)
-	{
-		$MODIFY_CHAR_ATTRIBUTE(tgt,"STR",adjStr,"MINUTES",10 *# lvl,"Reduce STR","SPELL Reduce STR");
-		$MODIFY_CHAR_ATTRIBUTE(tgt,"STRMOD",-#strMod,"MINUTES",10 *# lvl,"Reduce STRMOD","SPELL Reduce STRMOD");
-	};
-$SET_CHARACTER_SA($TargetContext(),"IsReduced",lvl);
-$SET_CHARACTER_SA($TargetContext(),"reduced",1);
\(END)

\(BEGIN)
name = spell_RemoveBlindness
[InvokeSpellOnTarget] = $DELETE_CHARACTER_SA($CharacterContext(),"IsBlind");
\(END)

\(BEGIN)
name = spell_RemoveDisease
[InvokeSpellOnTarget] = $DELETE_CHARACTER_SA($TargetContext(),"IsDiseased");
\(END)

\(BEGIN)
name = spell_RemoveFeeblemind
[InvokeSpellOnTarget] = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$DELETE_CHARACTER_SA($TargetContext(),"IsFeebleminded");
-$REMOVE_CHAR_MODIFICATION(tgt,"SPELL Feeblemind");
\(END)

\(BEGIN)
name = spell_RemovePetrified
[InvokeSpellOnTarget] = $DELETE_CHARACTER_SA($CharacterContext(),"IsPetrified");
\(END)

\(BEGIN)
name = spell_Restoration
[InvokeSpellOnTarget] = $VAR tgt; // target
-$VAR feebled;
-$VAR drained;
-$VAR head;
-$VAR cls;
-$VAR level;
-$VAR hp;
-$VAR done;
-$VAR tHP;
-$VAR tMaxHP;
-tgt = $IndexOf($TargetContext());
-done = 0;
-// Level restoration
-drained = $GET_CHARACTER_SA($TargetContext(),"IsDrained");
-$IF (drained != "-?-?-")
-	{
-		tHP = $GET_CHAR_HITPOINTS(tgt);
-		tMaxHP = $GET_CHAR_MAXHITPOINTS(tgt);
-		$WHILE (done <# 1)
-			{
-				head = $DelimitedStringHead(drained);
-				cls = $DelimitedStringSubstring(head,0);
-				$IF ($GET_CHAR_Lvl(tgt,cls) <# $DelimitedStringSubstring(head,1))
-					{
-						level = $DelimitedStringSubstring(head,1);
-						$SET_CHAR_Lvl(tgt,cls,level);
-						$SET_CHAR_Exp(tgt,cls,$DAT_Baseclass_Experience(cls,level));
-						hp = $DelimitedStringSubstring(head,2);
-						$SET_CHAR_MAXHITPOINTS(tgt,tMaxHP +# hp);
-						$SET_CHAR_HITPOINTS(tgt,tHP +# hp); 
-						done = 2;
-					};
-				$SET_CHARACTER_SA($TargetContext(),"IsDrained",$DelimitedStringTail(drained));
-				$IF ($GET_CHARACTER_SA($TargetContext(),"IsDrained") == "$|99")
-					{
-						$DELETE_CHARACTER_SA($TargetContext(),"IsDrained");
-						done = 3;
-					};
-			};
-	};
\(END)

\(BEGIN)
name = spell_Resurrection
[InvokeSpellOnTarget] = $VAR tgt; // target
-$VAR monName;
-$VAR monLvl;
-$VAR CON; // Constitution
-$VAR pct; // percent
-tgt = $IndexOf($TargetContext());
-$IF ($InParty($Myself())){$SET_CHAR_AGE($MyIndex(), ($GET_CHAR_AGE($MyIndex()) +# 3));};
-monName = $GET_CHAR_NAME(tgt);
-monLvl = $GET_MONSTERTYPE_SA(monName,"monsterLevel"); 
-$IF (monLvl != "-?-?-") 
-	{
-		$IF (monName == "Ghast"||monName == "Ghoul"||monName == "Skeleton"||monName == "Wight"||monName == "Wraith"||monName == "Zombie")
-			{
-				$SET_CHAR_STATUS(tgt, 2);
-				$SET_CHAR_HITPOINTS(tgt, "-11");
-				$RETURN;
-			};
-		$IF (monName == "Mummy")
-			{
-				$SET_CHAR_HITPOINTS(tgt, "-11");
-				$SET_CHAR_STATUS(tgt, 2);
-				$AddCombatant("Ancient Fighter", 0 );
-			};
-	};
-$IF (monLvl == "-?-?-")
-	{
-		$IF ($GET_CHAR_RACE(tgt) == "Elf"){$RETURN;};
-		$IF ($GET_CHAR_STATUS(tgt) !=# 2){$RETURN;};
-		CON = $GET_CHAR_LIMITED_CON(tgt);
-		pct = 0;
-		$IF (CON ># 0){pct = 30;};
-		$IF (CON ># 1){pct = 35;};
-		$IF (CON ># 2){pct = 40;};
-		$IF (CON ># 3){pct = 45;};
-		$IF (CON ># 4){pct = 50;};
-		$IF (CON ># 5){pct = 55;};
-		$IF (CON ># 6){pct = 60;};
-		$IF (CON ># 7){pct = 65;};
-		$IF (CON ># 8){pct = 70;};
-		$IF (CON ># 9){pct = 75;};
-		$IF (CON ># 10){pct = 80;};
-		$IF (CON ># 11){pct = 85;};
-		$IF (CON ># 12){pct = 90;};
-		$IF (CON ># 13){pct = 92;};
-		$IF (CON ># 14){pct = 94;};
-		$IF (CON ># 15){pct = 96;};
-		$IF (CON ># 16){pct = 98;};
-		$IF (CON ># 17){pct = 100;};
-		$IF (pct <# ($RANDOM(100) +# 1)){$SET_CHAR_STATUS(tgt, 5); $RETURN;}
-		$ELSE
-			{
-				$SET_CHAR_HITPOINTS(tgt, $GET_CHAR_MAXHITPOINTS(tgt));
-				$SET_CHAR_STATUS(tgt, 0);
-				$RETURN;
-			};
-	};
\(END)

\(BEGIN)
name = spell_SeeInvisible
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsSeeingInvisible",exp);
\(END)

\(BEGIN)
name = spell_Shield
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl *# 5;
-$SET_CHARACTER_SA($TargetContext(),"IsShielded",exp);
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = spell_Silence
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_COMBATANT_SA($TargetContext(), "IsSilenced",exp);
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_Sleep
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR cls;
-$VAR name;
-$VAR index;
-$VAR lvl;
-$VAR tLevel; // temporary level
-$VAR bCls;
-$VAR opr; // once per round
-$VAR round;
-$VAR pv; // point value
-$VAR adj;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$IF ($GET_CHAR_STATUS(tgt) != 0){$RETURN;};
-$IF ($GET_CHAR_UNDEAD(tgt) != "none"){$RETURN;};
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_MONSTERTYPE_SA(name,"monster_ImmuneSleep") != "-?-?-") {$RETURN;};
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsSleeping") != "-?-?-") {$RETURN;};
-opr = $GET_COMBATANT_SA($AttackerContext(),"CombatRoundStart");
-$IF (opr  == "-?-?-" || opr  <# 2)
-	{
-		$SET_COMBATANT_SA($AttackerContext(),"CombatRoundStart",5);
-		round = ($RANDOM(4) +# $RANDOM(4) +# $RANDOM(4) +# $RANDOM(4) +# 4);
-		$SET_COMBATANT_SA( $AttackerContext(), "PointPool", round);
-	};
-round = $GET_COMBATANT_SA($AttackerContext(), "PointPool");
-$IF (round <# 1){$RETURN;};
-tLevel = $GET_MONSTERTYPE_SA(name,"monsterLevel");
-$IF (tLevel != "-?-?-") {lvl = tLevel;}
-$ELSE
-	{
-		bCls = $GetHighestLevelBaseclass(tgt);
-		lvl = $GetBaseclassLevel(tgt,bCls);
-	};
-$IF (lvl ># 0){pv =# 1;};
-$IF (lvl ># 1){pv =# 2;};
-$IF (lvl ># 2){pv =# 4;};
-$IF (lvl ># 3){pv =# 6;};
-$IF (lvl ># 4){pv = "";};
-$IF (pv != "" )
-	{
-		$IF ( round >=# pv )
-			{
-				round = round -# pv;
-				$SET_COMBATANT_SA($AttackerContext(),"PointPool",round);
-				$SET_COMBATANT_SA($TargetContext(),"IsSleeping","Sleeping");
-			};
-	};
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
\(END)

\(BEGIN)
name = spell_Slow
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsSlow",exp);
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_SlowPoison
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-$VAR isPsnd;
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl *# 60;
-isPsnd = $GET_CHARACTER_SA($TargetContext(), "IsPoisoned");
-$IF (isPsnd != "-?-?-")
-	{$IF (isPsnd <# (exp +# lvl)){$RETURN $SET_CHARACTER_SA($TargetContext(),"IsSlowedPoisoned",exp);};};
\(END)

\(BEGIN)
name = spell_SnakeCharm
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$VAR exp; // expiration time
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsSnake") == "-?-?-"){$RETURN;};
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
\(END)

\(BEGIN)
name = spell_StinkingCloud
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR cls;
-$VAR adj;
-$VAR lvl;
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsImmunePoison") != "-?-?-"){$RETURN;};
-$IF ($GET_HASPOISONIMMUNITY($TargetContext()) == 1){$RETURN;};
-$IF($GET_CHARACTER_SA($TargetContext(),"IsProtectedPoisonCaster") != "-?-?-"){$RETURN;};
-$IF($GET_CHARACTER_SA($TargetContext(),"IsProtectedPoisonTarget") != "-?-?-"){$RETURN;};
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_COMBATANT_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$IF ($GET_COMBATANT_SA($TargetContext(),"StinkingSave") == "-?-?-")
-  {
-   $SET_COMBATANT_SA($TargetContext(),"StinkingSave",$SkillAdj($TargetContext(), "Save Vs PPDM", "", "F", ""));
-   $IF ($GET_COMBATANT_SA($TargetContext(),"StinkingSave") != 1)
-     {$SET_COMBATANT_SA($TargetContext(),"IsStinkingStuck",$GetCombatRound() +# $RANDOM(4) +# 2);};
-  };
-$IF ($GET_COMBATANT_SA($TargetContext(),"StinkingSave") == 1)
-  {$SET_CHARACTER_SA($TargetContext(),"IsStinkingCloudy",$GetCombatRound());};
[RemoveLinger] = $RETURN "AREA";
[SpellLingerBlockage] = $IF ($GET_CHARACTER_SA($CombatantContext(),"IsImmunePoison") != "-?-?-" || $GET_HASPOISONIMMUNITY($CombatantContext()) == 1 || $SA_CHARACTER_GET("IsProtectedPoisonCaster") != "-?-?-" || $SA_CHARACTER_GET("IsProtectedPoisonTarget") != "-?-?-"){$RETURN;};
-$IF ($GET_COMBATANT_SA($CombatantContext(),"StinkingSave") != "-?-?-")
-  {$RETURN "N";};
[StinkAdjust] = $SET_HOOK_PARAM(6, "N");
[StinkingCloudy] = $RETURN $SET_HOOK_PARAM(8 ,"Coughing");
[StinkingStuck] = $RETURN $SET_HOOK_PARAM(8 ,"Coughing Uncontrollably");
\(END)

\(BEGIN)
name = spell_Summon1
[CharDisplayStatus] = $SET_HOOK_PARAM(7, "");
-$SET_HOOK_PARAM(6, "");
-$RETURN "1";
[InvokeSpellOnTarget] = $VAR rndmRnd;
-rndmRnd = $RANDOM(4) +# $GetCombatRound();
-$SET_COMBATANT_SA($TargetContext(), "summoning1", rndmRnd);
\(END)

\(BEGIN)
name = spell_Summon2
[CharDisplayStatus] = $SET_HOOK_PARAM(7, "");
-$SET_HOOK_PARAM(6, "");
-$RETURN "1";
[InvokeSpellOnTarget] = $VAR rndmRnd;
-rndmRnd = $RANDOM(4) +# $GetCombatRound();
-$SET_COMBATANT_SA($TargetContext(), "summoning2", rndmRnd);
\(END)

\(BEGIN)
name = spell_Summon3
[CharDisplayStatus] = $SET_HOOK_PARAM(7, "");
-$SET_HOOK_PARAM(6, "");
-$RETURN "1";
[InvokeSpellOnTarget] = $VAR rndmRnd;
-rndmRnd = $RANDOM(4) +# $GetCombatRound();
-$SET_COMBATANT_SA($TargetContext(), "summoning3", rndmRnd);
\(END)

\(BEGIN)
name = spell_Summon4
[CharDisplayStatus] = $SET_HOOK_PARAM(7, "");
-$SET_HOOK_PARAM(6, "");
-$RETURN "1";
[InvokeSpellOnTarget] = $VAR rndmRnd;
-rndmRnd = $RANDOM(3) +# $GetCombatRound();
-$SET_COMBATANT_SA($TargetContext(), "summoning4", rndmRnd);
\(END)

\(BEGIN)
name = spell_Summon5
[CharDisplayStatus] = $SET_HOOK_PARAM(7, "");
-$SET_HOOK_PARAM(6, "");
-$RETURN "1";
[InvokeSpellOnTarget] = $VAR rndmRnd;
-rndmRnd = $RANDOM(3) +# $GetCombatRound();
-$SET_COMBATANT_SA($TargetContext(), "summoning5", rndmRnd);
\(END)

\(BEGIN)
name = spell_Summon6
[CharDisplayStatus] = $SET_HOOK_PARAM(7, "");
-$SET_HOOK_PARAM(6, "");
-$RETURN "1";
[InvokeSpellOnTarget] = $VAR rndmRnd;
-rndmRnd = $RANDOM(3) +# $GetCombatRound();
-$SET_COMBATANT_SA($TargetContext(), "summoning6", rndmRnd);
\(END)

\(BEGIN)
name = spell_Summon7
[CharDisplayStatus] = $SET_HOOK_PARAM(7, "");
-$SET_HOOK_PARAM(6, "");
-$RETURN "1";
[InvokeSpellOnTarget] = $VAR rndmRnd;
-rndmRnd = $RANDOM(2) +# $GetCombatRound();
-$SET_COMBATANT_SA($TargetContext(), "summoning7", rndmRnd);
\(END)

\(BEGIN)
name = spell_SummonAnimal1
[InvokeSpellOnTarget] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR sCount;
-list = "$Wild Dog$Owl";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-sCount = $RANDOM(8);
-$WHILE (sCount >=# 0)
-	{
-		$AddCombatant(monster1,"1");
-		sCount = sCount -# 1;
-	};
\(END)

\(BEGIN)
name = spell_SummonAnimal2
[InvokeSpellOnTarget] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR sCount;
-list = "$Brown Bear$Giant Badger";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-sCount = $RANDOM(6);
-$WHILE (sCount >=# 0)
-	{
-		$AddCombatant(monster1,"1");
-		sCount = sCount -# 1;
-	};
\(END)

\(BEGIN)
name = spell_SummonAnimal3
[InvokeSpellOnTarget] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR sCount;
-list = "$Elephant$Rhinoceros";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-sCount = $RANDOM(4);
-$WHILE (sCount >=# 0)
-	{
-		$AddCombatant(monster1,"1");
-		sCount = sCount -# 1;
-	};
\(END)

\(BEGIN)
name = spell_SummonElementalAir
[InvokeSpellOnTarget] = $AddCombatant("Air Elemental","1");
\(END)

\(BEGIN)
name = spell_SummonElementalEarth
[InvokeSpellOnTarget] = $AddCombatant("Earth Elemental","1");
\(END)

\(BEGIN)
name = spell_SummonElementalFire
[InvokeSpellOnTarget] = $AddCombatant("Fire Elemental",1);
\(END)

\(BEGIN)
name = spell_SummonElementalWater
[InvokeSpellOnTarget] = $AddCombatant("Water Elemental",1);
\(END)

\(BEGIN)
name = spell_SummonInvisibleStalker
[InvokeSpellOnTarget] = $AddCombatant("Invisible Stalker","1");
\(END)

\(BEGIN)
name = spell_Unlock
[OpenLocks] = $RETURN "Y";
\(END)

\(BEGIN)
name = StandardDisplaySpellEffect
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, $SA_PARAM_GET());
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = Summoned
[CreateMonsterCombatant] = $SET_COMBATANT_SA($CharacterContext(),"Summoned",$SA_PARAM_GET());
Dispel = $VAR tgt; // target
-tgt = $IndexOf($TargetContext());
-$IF ($GET_COMBATANT_SA($TargetContext(), "Summoned") != "-?-?-")
-	{
-		$SET_CHAR_STATUS(tgt, "2");
-		$SET_CHAR_HITPOINTS(tgt, "-20");
-	};
\(END)

\(BEGIN)
name = summoning1
[StartCombatRound] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR rndmRnd;
-list = "$Goblin$Hobgoblin$Orc$Giant Rat";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-rndmRnd = $SA_PARAM_GET();
-$IF (rndmRnd ==# $GetCombatRound())
-	{
-		$AddCombatant(monster1,1);
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = summoning2
[StartCombatRound] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR rndmRnd;
-list = "$Gnoll$Stirge$Giant Centipede$Troglodyte";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-rndmRnd = $SA_PARAM_GET();
-$IF (rndmRnd ==# $GetCombatRound())
-	{
-		$AddCombatant(monster1,1);
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = summoning3
[StartCombatRound] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR rndmRnd;
-list = "$Bugbear$Gelatinous Cube$Ghoul$Ogre";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-rndmRnd = $SA_PARAM_GET();
-$IF (rndmRnd ==# $GetCombatRound())
-	{
-		$AddCombatant(monster1,1);
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = summoning4
[StartCombatRound] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR rndmRnd;
-list = "$Gargoyle$Hell Hound$Ghast$Werewolf";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-rndmRnd = $SA_PARAM_GET();
-$IF (rndmRnd ==# $GetCombatRound())
-	{
-		$AddCombatant(monster1,1);
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = summoning5
[StartCombatRound] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR rndmRnd;
-list = "$Cockatrice$Displacer Beast$Giant Snake$Giant Spider";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-rndmRnd = $SA_PARAM_GET();
-$IF (rndmRnd ==# $GetCombatRound())
-	{
-		$AddCombatant(monster1,1);
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = summoning6
[StartCombatRound] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR rndmRnd;
-list = "$Troll$Wight$Wraith$Wyvern";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-rndmRnd = $SA_PARAM_GET();
-$IF (rndmRnd ==# $GetCombatRound())
-	{
-		$AddCombatant(monster1,1);
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = summoning7
[StartCombatRound] = $VAR list;
-$VAR count;
-$VAR n;
-$VAR monster1;
-$VAR rndmRnd;
-list = "$Ettin$Umber Hulk$Xorn$Neo-Otyugh";
-count = $DelimitedStringCount(list);
-n = $RANDOM(count);
-monster1 = $DelimitedStringSubstring(list,n);
-rndmRnd = $SA_PARAM_GET();
-$IF (rndmRnd ==# $GetCombatRound())
-	{
-		$AddCombatant(monster1,1);
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = TeleporterDestinations
[/1/0/0] = $RETURN $GET_PARTY_ASL("spot");
\(END)

\(BEGIN)
name = Turn$SYS$
<Skeleton> = 1100112
-1070112
-1040112
-1010112
-1010112
-2010112
-2010112
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
<Zombie> = 1130112
-1100112
-1070112
-1010112
-1010112
-2010112
-2010112
-2010112
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
<Ghoul> = 1160112
-1130112
-1100112
-1040112
-1010112
-1010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
<Shadow> = 1190112
-1160112
-1160112
-1070112
-1040112
-1010112
-1010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
-2010712
<Wight> = 1200112
-1190112
-1160112
-1100112
-1070112
-1040112
-1010112
-1010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
<Ghast> = 1210112
-1200112
-1190112
-1130112
-1100112
-1070112
-1040112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
<Wraith> = 1210112
-1210112
-1200112
-1160112
-1130112
-1100112
-1070112
-1040112
-1010112
-1010112
-1010112
-1010112
-1010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
-2010112
<Mummy> = 1210112
-1210112
-1210112
-1200112
-1160112
-1130112
-1100112
-1070112
-1040112
-1040112
-1040112
-1040112
-1040112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
<Spectre> = 1210112
-1210112
-1210112
-1210112
-1200112
-1160112
-1130112
-1100112
-1070112
-1070112
-1070112
-1070112
-1070112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
-1010112
<Vampire> = 1210112
-1210112
-1210112
-1210112
-1210112
-1200112
-1160112
-1130112
-1100112
-1100112
-1100112
-1100112
-1100112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
-1040112
<Ghost> = 1210112
-1210112
-1210112
-1210112
-1210112
-1210112
-1200112
-1160112
-1130112
-1130112
-1130112
-1130112
-1130112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
<Lich> = 1210112
-1210112
-1210112
-1210112
-1210112
-1210112
-1210112
-1190112
-1160112
-1160112
-1160112
-1160112
-1160112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
-1100112
<Special> = 1210112
-1210112
-1210112
-1210112
-1210112
-1210112
-1210112
-1200112
-1190112
-1190112
-1190112
-1190112
-1190112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
-1130112
\(END)

\(BEGIN)
name = turnUndead
[CanTurn] = $VAR par5;
-$VAR com;
-$VAR clrc;
-$VAR pldn;
-par5 = $GET_HOOK_PARAM(5);
-com = $IndexOf($CombatantContext());
-clrc = $GET_CHAR_Lvl(com,"cleric");
-pldn = $GET_CHAR_Lvl(com,"paladin");
-$IF (clrc ># 0 || pldn ># 2){$RETURN par5;}; // turning undead table - DMG 25
[TurnAttempt] = $VAR par5;
-$VAR par6;
-$VAR num;
-$VAR turn;
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-num = $DelimitedStringCount(par5);
-turn = $DelimitedStringSubstring(par5,num);
-$RETURN par5;
\(END)

\(BEGIN)
name = _AncientAura
[AURA_Create] = $VAR chr; // character
-$VAR prm; // SA parameter
-$DEBUG($SA_NAME());
-chr = $IndexOf($CharacterContext());
-prm = $SA_PARAM_GET();
-$AURA_Attach("Combatant");
-$AURA_Combatant(chr);
-$AURA_Size(0,prm,0,360);
-$AURA_Shape("AnnularSector");
-$AURA_Spell("AncientAura");
-$AURA_Wavelength("Xray");
[AURA_Enter] = $VAR com; // comabtant
-$VAR cName; // combatant's name
-com = $IndexOf($CombatantContext());
-cName = $GET_CHAR_NAME(com);
-$DEBUG ($SA_NAME() + ", ARUA_Enter");
-$IF (cName == "Ancient Fighter"){$RETURN;};
-$SET_COMBATANT_SA($CombatantContext(),"_IsAuraed","");
[AURA_Exit] = $DEBUG ($SA_NAME() + ", AURA_Exit");
-$DELETE_COMBATANT_SA($CombatantContext(),"_IsAuraed");
[CreateMonsterCombatant] = $AURA_Create("_AncientAura",3,0,0,0);
\(END)

\(BEGIN)
name = _BigGuyAura
[AURA_Create] = $VAR prm; // SA parameter
-prm = $SA_PARAM_GET();
-$DEBUG("Big Guy Aura");
-$AURA_Attach("Combatant");
-$AURA_Combatant($IndexOf($CharacterContext()));
-$AURA_Size(0,prm,0,360);
-$AURA_Shape("AnnularSector");
-$AURA_Spell("BigGuyAura");
-$AURA_Wavelength("Visible");
[CreateMonsterCombatant] = $AURA_Create("_BigGuyAura",3,0,0,0);
\(END)

\(BEGIN)
name = _IsAuraed
[CharDisplayStatus] = $DEBUG ("IsAuraed");
-$SET_HOOK_PARAM( 7, "Auraed");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
\(END)

\(BEGIN)
name = _PaladinAuraSA
[AURA_Create] = $VAR rnd;
-$VAR time;
-rnd = $GetCombatRound();
-time = rnd +# 6;
-$DEBUG("Paladin Aura");
-$AURA_Attach("CombatantFacing");
-$AURA_Combatant($IndexOf($Myself()));
-$AURA_Size(0,2,315,90);
-$AURA_Shape("AnnularSector");
-$AURA_Spell("PaladinAura");
-$AURA_Wavelength("Neutrino");
-$SET_COMBATANT_SA($Myself(),"PaladinAura",time);
[AURA_Effect] = $DEBUG ($SA_NAME() + ", AURA_Effect - round number = " + $GetCombatRound());
-$IF ($GetCombatRound() ># 6){$AURA_Destroy();};
-$DEBUG ($SA_NAME() + " AURA_GetSA _IsAuraed = " + $AURA_GetSA("_IsAuraed"));
[AURA_Round] = $VAR exp; // expiration time
-exp = $GET_COMBATANT_SA($Myself(),"PaladinAura");
-$DEBUG ($SA_NAME() + ", AURA_Round - round number = " + $GetCombatRound());
-$IF ($GetCombatRound() ># exp)
-	{
-		$AURA_Destroy();
-		$DELETE_COMBATANT_SA($Myself(),"PaladinAura");
-	};
\(END)

\(BEGIN)
name = $$Help
Date = "Octoboer 15, 2014"
Version = "1.01"
Updates1_01 = "fixed spell_HoldAnimal, spell_HoldMonster, spell_HoldPersonCleric and spell_HoldPersonMU, updated/fixed FreeAttack-AttackOver and FreeAttack-CanFreeAttack, updated monster_SpellImmunity, IsImmuneSpells and IsImmuneSpellsMinor, fixed Global_Display to correctly show all character statuses"
Updates1_02 = "fixed display issue to show dmg done by weapons in party members possession"
\(END)

