// 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 = $$Help
Date = "October 31, 2019"
Updated171222 = "fixed ComputeDamage scripts for item_MagicalWeapon, item_MissileWeapon, item_VorpalLongSword, monster_EfreetiFireResistance, monster_WeaponImmunity, monster_WeaponResistance; fixed ComputeSpellDamage scripts for IsProtectedAcidCaster1, IsProtectedAcidTarget1, IsProtectedFireCaster1, IsProtectedFireTarget1, IsProtectedLightningCaster1, IsProtectedLightningTarget1, IsProtectedPoisonCaster1, IsProtectedPoisonTarget1; CanCastSpells changed to StartCombatRound for IsProtectedAcidCaster, IsProtectedAcidTarget, IsProtectedFireCaster, IsProtectedFireTarget, IsProtectedLightningCaster, IsProtectedLightningTarget, IsProtectedPoisonCaster, IsProtectedPoisonTarget; fixed minor errors in spell_ProtectionFromAcid and spell_ProtectionFromLightning"
Updates170321 = "rewrote $EVENT_WhoTries_Attempt"
Updates170510 = "added missing monster SAs - elemental_ImmuneStone, elemental_ImmuneWater, monster_DaoDoubleHolyWater, monster_DjinniAirResistance, monster_MaridColdResistance, monster_MaridFireVulnerability"
Updates170713 = "added SpecialGraphics"
Updates170715 = "added Hooks FacingText, LocationText, SearchingText, and TimeText to Global_Display to manage displayed time, location and searching with the compass"
Updates170921 = "added ChangeClassXXX - where XXX is the name of a single class"
Updates171108 = "added new scripts to ChangeClassXXX to control what happens when changing to or from the class at the time of changing."
Updates171113 = "made IsParalyzed dispellable"
Updates171128 = "updated class_MageScribe and SpecialGraphics"
Updates171201 = "updated class_MageScribe and ChangeClassMagicUser"
Updates180114 = "updated spell_CharmXXX to provide for monster immunity to charm"
Updates180123 = "updated IsPaladinProtectedEvil, IsProtectedEvil, and IsProtectedGood; added missing IsDisplaced script"
Updates180320 = "updated ChangeClassXXX for all baseclasses, added DualClassedXXX for all baseclasses"
Updates180330 = "updated Global_Display and SpecialGraphics to accomodate 1024x768 screen settings"
Updates180608 = "corrected spell_Paralysis, monster_AuraDragon, monster_AuraGhast and monster_AuraMummy"
Updates180614 = "changed save for ghast aura to PPDM, altered monster_AuraGhast to not affect ghasts, altered monster_AuraMummy to not affect mummies"
Updates180629 = "updated SpecialGraphics"
Updates181010 = "updated class_MageScribe LearnSpellsNum script to allow magic users proper number of spells at time of creation"
Updates191031 = "added IsAided, IsBrave, IsColorBlind, IsColorSleep, IsColorStun, IsCommanded, IsDarkBlinded, IsDetectingCharms, IsDetectingEvil, IsDetectingGood, IsDetectingIllusions, IsDetectingLies, IsDetectingSecretDoors, IsDetectingTraps, IsHolyDeafened, IsHolyStunned, IsImprovedInvisible, IsInsane, IsLightBlinded, IsMonsterProtectedEvil, IsSeeingAstral, IsSeeingDisplaced, IsSeeingEthereal, IsSymbolPersuaded, IsWebbed, item_BowUse, item_SwordUse, monster_DemodandSummonShaggyDemodand, monster_DemodandSummonSlimeDemodand, monster_DemodandSummonTarryDemodand, monster_DispelInvisibility, monster_HighestInitiative, monster_ImmuneAttackNegativePlane, monster_ImmuneAttackPositivePlane, monster_ImmuneCharm, monster_ImmuneConfusion, monster_ImmuneDeathMagic, monster_ImmuneDomination, monster_ImmuneEnchantment, monster_ImmuneFeeblemind, monster_ImmuneGas, monster_ImmuneIllusions, monster_ImmuneLevelLoss, monster_ImmuneMagic, monster_ImmuneMagicMissile, monster_ImmuneNormalFire, monster_ImmunePetrification, monster_ImmunePsionics, monster_ImmuneSleep, monster_ImmuneSurprise, monster_Infravision, monster_ModronDamageReduction, monster_ModronElementalResistance, monster_ModronSave, monster_PlanetarGateDeva, monster_PlanetarSummonGoodCreature, monster_PrimusPlaneShift, monster_ProtectionFromEvil40'Radius, monster_ProtectionFromEvil40'RadiusAURA, monster_ProtectionFromEvil70'Radius, monster_ProtectionFromEvil70'RadiusAURA, monster_ResistantDragonFire, monster_ResistantMagicalFire, monster_SlaadGateBlueSlaad, monster_SlaadGateDeathSlaad, monster_SlaadGateGreenSlaad, monster_SlaadGateGreySlaad, monster_SlaadGateSsendam, monster_SlaadGateYgorl, monster_SlaadSummonPhantasmalKiller, monster_SlaadSummonRedSlaad, monster_SolarFirstStrike, monster_SolarGatePlanetarOrDeva, monster_SolarNeverSurprised, monster_SolarSummonGoodCreature, monster_Ultravision, spell_ColorSpray, spell_Command, spell_ContinualLightCleric, spell_ContinualLightClericAURA, spell_ContinualLightMage, spell_ContinualLightMageAURA, spell_DetectCharms, spell_DispelIllusion, spell_HoldElemental, spell_HolyWord, spell_ImprovedInvisible, spell_LightCleric, spell_LightClericAURA, spell_LightMage, spell_LightMageAURA, spell_PrismaticSpray, spell_Regenerate, spell_RemoveFearCleric, spell_SpeakWithDead, spell_TeleportWithoutError, spell_TrueSeeing, spell_Web, SymbolOfPersuasion, SymbolOfPersuasionAURA, IsAbolethEnslaved, IsConstricted, IsConstrictedBothArms, IsConstrictedOneArm, IsFloatingEyeHypnotized, IsManatRaySwallowed, IsNereidBlind, IsRedUrchinSleeping, IsSIlverUrchinCatatonic, IsStingRayParalyzed, IsStrangleWeeded, IsYellowUrchinParalyzed, monster_AbolethEnslave, monster_AuraElectricEelDischarge, monster_AuraGiantElectricEelDischarge, monster_AuraMorkothCharm, monster_AuraNereidMesmerize, monster_AuraSeaHagFright, monster_AuraWhaleTailSmash, monster_DolphinSave, monster_EyeOfTheDeepStun, monster_FloatingEyeHypnotism, monster_GiantJellyfishParalyzation, monster_GiantLampreyDrain, monster_GiantLampreyDrainBlood, monster_GiantLampreyDrainee, monster_GiantOctopusConstricted, monster_GiantOctopusConstricting, monster_GiantOctopusConstriction, monster_GiantSquidConstricted, monster_GiantSquidConstricting, monster_GiantSquidConstriction, monster_GreaterVodyanoiSummonSharks, monster_KrakenConstricted, monster_KrakenConstricting, monster_KrakenConstriction, monster_KuoToaFireSave, monster_KuoToaMagicMissile, monster_LampreyDrain, monster_LampreyDrainBlood, monster_LampreyDrainee, monster_MantaRayStun, monster_MantaRaySwallow, monster_MantaRaySwallower, monster_MorkothSpellReflection, monster_NereidBlind, monster_NixieCharm, monster_NymphCharm, monster_RedUrchinVenom, monster_SilverUrchinVenom, monster_SirineSong, monster_SirineTouch, monster_StingRayPoison, monster_StrangleWeedConstrict, monster_StrangleWeedConstricted, monster_StrangleWeedConstricting, monster_WeaponImmunityWater, monster_YellowUrchinVenom"
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 spell_Sleep, changed Competing so that now roll of 20 always hits and roll of 1 always misses, monster_WeaponImmunity changed so that weapons will hit monster but only do damage if of appropriate magical level"
Updates1_03 = "added class_Druid, IsDruidImmuneWoodlandCharm, IsDruidShapeChanger; fixed spell_Confusion, spell_Sleep, spell_HoldMonster, spell_HollPersonCleric, spell_HoldPersonMU, fixed times in class_Paladin"
Updates1_04 = "fixed spell_Charm, spell_HoldPersonCleric, IsDiseased, IsDiseasedSpell, IsGreenSlimed, IsMindFlayed, IsMummyFear, item_GirdleGiantStrength, item_Scroll, monster_AuraMummy, monster_DrainStrength, monster_ModronElementalResistance, monster_SpellImmunity, spell_Confusion; redid Saving Throw scripts for class_Paladin, IsBarkskinned, IsBestowedCurse, IsCloakDisplaced, IsPaladinProtectedFromEvil, IsProtectedAcidTarget, IsProtectedEvil, IsProtectedFireTarget, IsProtectedGood, IsProtectedLightningTarget, IsProtectedPoisonTarget, item_CloakDisplaced, race_ShortSaveBonus, spell_Barkskin, spell_BestowCurse, spell_ProtectionFromAcid, spell_ProtectionFromEvil, spell_ProtectionFromFire, spell_ProtectionFromGood, spell_ProtectionFromLightning; removed IsShortSaveBonus, SaveAdjPPDM, SaveAdjSpell; added spell_DispelEvil"
Updates1_05 = "Global_CreateMonsterCombatant skillAdj functions modified, IsRingImmuneElectricity and item_RingOfElectricalImmunity fixed by Nol Drek, fixed elemental_ImmuneAcid, elemental_ImmuneCold, elemental_ImmuneElectricity, elemental_ImmuneFire, elemental_ResistantCold, elemental_ResistantElectricity, elemental_ResistantFire, elemental_SlowingCold, elemental_SlowingElectricity, elemental_SlowingFire, elemental_VulnerableCold, elemental_VulnerableFire, IsRingResistantCold, IsRingResistantFire, item_Periapt, item_RingOfColdResistance, item_RingOfFireResistance; added IsPeriaptImmuneDisease"
Updates1_06 = "all elemental_ SAs updated and new ones added so that acid, cold, electricity and fire are possibility for each; IsRingImmuneElectricty, IsRingResistantCold and IsRingResistantFire removed; added item_RingOfAcidImmunity/Resistance/Vulnerability, item_RingOfColdImmunity/Vulnerability, item_RingOfElectricalImmunity/Resistance/Vulnerability and item_RingOfFireImmunity/Vulnerability; added IsImmuneAcid/Cold/Electricity/Fire, IsResistantAcid/Electricity, IsImmuneNormalFire"
Updates1_07 = "IsImmune/Resistant, monster_Immune/Resistant, spell_Immune/Resistant updated"
Updates1_08 = "added JoinParty (allows NPC to enter play with spells memorized); fixed monster_WeaponImmunityType"
Updates1_09 = "added item_GAuntletsDexterity, monster_CrysmalBluntWeapon, monster_CrysmalElectricalResistance, monster_CheetahNotSurprised, monster_RearClawRakeCat1, monster_RearClawRakeCat2, IsDetectedGood, IsStuckInMud, spell_TransmuteRockToMud, spell_WallOfStone. Fixed spell_Enlarge, spell_Reduce, spell_Bless, spell_Blink, spell_FireResistant, spell_Haste, spell_ImmuneDragonBreath, spell_ImmuneNormalMissiles, spell_ImmuneSpells, spell_ImmuneSpellsMinor, spell_Invisible, spell_MirrorImage, spell_Prayer, spell_ProtectionFromAcid, spell_ProtectionFromEvil, spell_ProtectionFromGood, spell_ProtectionFromLightning, spell_RaiseDead, spell_SeeInvisible, spell_Shield, spell_Silence, spell_Slow, spell_SlowPoison"
Updates1_10 = "changed Global_Display to use class_ThievingSkills instead of class names, changed Competing to use class_Sweep, class_AttacksPerRound, class_AttacksPerRoundAdj and class_Leader instead of class names"
Updates1_11 = "Fixed issues with parens in spell_Enlarge, spel_Reduce, all the various elemental SAs; corrected several score context issues relative to $GET_CHARACTER_SA();"
Updates1_12 = "Fixed item_Scroll"
Updates1_13 = "Fixed varous contexts to match correctly with Hooks"
Updates1_14 = "removed item_wand"
\(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($CharacterContext());
-$SWITCH (abName)
-	{
-		$CASE "Strength": abLevel = $GET_CHAR_LIMITED_STR(me);$BREAK;
-		$CASE "Intelligence": abLevel = $GET_CHAR_LIMITED_INT(me);$BREAK;
-		$CASE "Wisdom": abLevel = $GET_CHAR_LIMITED_WIS(me);$BREAK;
-		$CASE "Dexterity": abLevel = $GET_CHAR_LIMITED_DEX(me);$BREAK;
-		$CASE "Constitution": abLevel = $GET_CHAR_LIMITED_CON(me);$BREAK;
-		$CASE "Charisma": abLevel = $GET_CHAR_LIMITED_CHA(me);$BREAK;
-		$CASE "StrengthMod": abLevel = $GET_CHAR_LIMITED_STRMOD(me);$BREAK;
-		$DEFAULT: $RETURN "N";
-	} $ENDSWITCH;
-$IF (abNeed <# 0)
-	{
-		abDie = $RANDOM (0 -# abNeed);
-		$IF (abLevel <# abDie){$RETURN "N";};
-	};
-$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);
-$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);
-		$IF (skillLevel <# skillDie){$RETURN "N";};
-	};
-$IF (time ># 6 && time <# 18){$RETURN "N";};
-$IF (skillLevel <# skillNeed){$RETURN "N";};
OldAbility = $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($CharacterContext());
-$IF (abName == "Strength"){abLevel = $GET_CHAR_LIMITED_STR(me);};
-$IF (abName == "Intelligence"){abLevel = $GET_CHAR_LIMITED_INT(me);};
-$IF (abName == "Wisdom"){abLevel = $GET_CHAR_LIMITED_WIS(me);};
-$IF (abName == "Dexterity"){abLevel = $GET_CHAR_LIMITED_DEX(me);};
-$IF (abName == "Constitution"){abLevel = $GET_CHAR_LIMITED_CON(me);};
-$IF (abName == "Charisma"){abLevel = $GET_CHAR_LIMITED_CHA(me);};
-$IF (abName == "StrengthMod"){abLevel = $GET_CHAR_LIMITED_STRMOD(me);};
-$IF (abLevel == "") {$RETURN "N";};
-$IF (abNeed <# 0)
-	{
-		abDie = $RANDOM (0 -# abNeed);
-		$IF (abLevel <# abDie){$RETURN "N";};
-	};
-$IF (abLevel <# abNeed){$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);
-		$IF (skillLevel <# skillDie){$RETURN "N";};
-	};
-$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 = ChangeClassAssassin
[CanChangeFromClass] = $RETURN "Y";
[CanChangeToClass] = $VAR me; $VAR align; $VAR race;
-me = $IndexOf($CharacterContext());
-align = $GET_CHAR_ALIGNMENT(me);
-$IF (align >=# 6) {$RETURN "Y";};
[ChangeClassFrom] = $VAR me; $VAR cls; $VAR bc; $VAR lvl; $VAR XP; $VAR toHit;
-me = $IndexOf($CharacterContext());
-cls = $GET_CHAR_CLASS(me); bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc); XP = $GET_CHAR_Exp(me,bc); toHit = $GET_CHAR_THAC0(me);
-$DELETE_CHARACTER_SA($CharacterContext(),"class_NoSpells");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_ThievingSkills");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_baseName");
-$SET_CHARACTER_SA($CharacterContext(),"prevSklPP",$SkillAdj($CharacterContext(),"PickPockets","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklOL",$SkillAdj($CharacterContext(),"OpenLocks","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklFT",$SkillAdj($CharacterContext(),"FindTraps","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklMS",$SkillAdj($CharacterContext(),"MoveSilent","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklHIS",$SkillAdj($CharacterContext(),"HideInShadows","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklHN",$SkillAdj($CharacterContext(),"HearNoise","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklCW",$SkillAdj($CharacterContext(),"ClimbWalls","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklRL",$SkillAdj($CharacterContext(),"ReadLanguages","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevBackstab",$SkillAdj($CharacterContext(),"BackstabMultiplier","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM",$SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP",$SkillAdj($CharacterContext(),"Save Vs PP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW",$SkillAdj($CharacterContext(),"Save Vs RSW","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR",$SkillAdj($CharacterContext(),"Save Vs BR","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP",$SkillAdj($CharacterContext(),"Save Vs SP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"preDualClass","$"+cls+"$"+lvl);
-$SET_CHARACTER_SA($CharacterContext(),"DualClassedAssassin","$"+cls+"$"+lvl);
-$SET_CHARACTER_SA($CharacterContext(),"prevTHAC0",toHit);
[ChangeClassTo] = $SET_CHARACTER_SA($CharacterContext(),"class_NoSpells","assassin");
-$SET_CHARACTER_SA($CharacterContext(),"class_ThievingSkills","assassin");
-$SET_CHARACTER_SA($CharacterContext(),"class_baseName","$assassin");
-$SET_CHARACTER_SA($CharacterContext(),$SA_NAME(),"$assassin");
[TrainingCharacter] = $VAR me; $VAR bc; $VAR lvl; $VAR pdc; $VAR prv; $VAR cls;
-me = $IndexOf($CharacterContext());
-bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc);
-pdc = $GET_CHARACTER_SA($CharacterContext(),"prevDualClass");
-$IF (pdc == "-?-?-") {$RETURN;};
-prv = $DelimitedStringSubstring(pdc,1); cls = $DelimitedStringSubstring(pdc,0);
-$IF (prv ># lvl) {$RUN_CHAR_SCRIPTS(me,"DualClassAchieved"+cls);};
\(END)

\(BEGIN)
name = ChangeClassCleric
[CanChangeFromClass] = $VAR me; $VAR WIS;
-me = $IndexOf($CharacterContext());
-WIS = $GET_CHAR_LIMITED_WIS(me);
-$IF (WIS >=# 15) {$RETURN "Y";};
[CanChangeToClass] = $VAR me; $VAR WIS; $VAR race;
-me = $IndexOf($CharacterContext());
-WIS = $GET_CHAR_LIMITED_WIS(me); race = $GET_CHAR_RACE(me);
-$IF (race != "Human") {$RETURN "N";};
-$IF (WIS >=# 17) {$RETURN "Y";};
[ChangeClassFrom] = $VAR me; $VAR cls; $VAR lvl; $VAR toHit;
-me = $IndexOf($CharacterContext());
-cls = $GET_CHAR_CLASS(me); lvl = $GET_CHAR_Lvl(me,"cleric"); toHit = $GET_CHAR_THAC0(me);
-$DELETE_CHARACTER_SA($CharacterContext(),"class_baseName");
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM",$SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP",$SkillAdj($CharacterContext(),"Save Vs PP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW",$SkillAdj($CharacterContext(),"Save Vs RSW","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR",$SkillAdj($CharacterContext(),"Save Vs BR","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP",$SkillAdj($CharacterContext(),"Save Vs SP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevTHAC0",toHit);
-$SET_CHARACTER_SA($CharacterContext(),"preDualClass","$"+cls+"$"+lvl);
-$SET_CHARACTER_SA($CharacterContext(),"DualClassedCleric","$"+cls+"$"+lvl);
[ChangeClassTo] = $SET_CHARACTER_SA($CharacterContext(),"class_baseName","$cleric");
-$SET_CHARACTER_SA($CharacterContext(),"DualClassedCleric","$cleric");
[TrainingCharacter] = $VAR me; $VAR bc; $VAR lvl; $VAR pdc; $VAR prv; $VAR cls;
-me = $IndexOf($CharacterContext());
-bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc);
-pdc = $GET_CHARACTER_SA($CharacterContext(),"preDualClass");
-prv = $DelimitedStringSubstring(pdc,1); cls = $DelimitedStringSubstring(pdc,0);
-$IF (pdc == "-?-?-") {$RETURN;};
-$IF (lvl ># prv) {$RUN_CHAR_SCRIPTS(me,"DualClassAchieved"+cls);};
\(END)

\(BEGIN)
name = ChangeClassDruid
[CanChangeFromClass] = $VAR me; $VAR WIS; $VAR CHA;
-me = $IndexOf($CharacterContext());
-WIS = $GET_CHAR_LIMITED_WIS(me);
-CHA = $GET_CHAR_LIMITED_CHA(me);
-$IF ((WIS >=# 15) && (CHA >=# 15)) {$RETURN "Y";};
[CanChangeToClass] = $VAR me; $VAR WIS; $VAR CHA; $VAR align; $VAR race;
-me = $IndexOf($CharacterContext());
-WIS = $GET_CHAR_LIMITED_WIS(me); CHA = $GET_CHAR_LIMITED_CHA(me);
-align = $GET_CHAR_ALIGNMENT(me); race = $GET_CHAR_RACE(me);
-$IF (race != "Human") {$RETURN "N";};
-$IF ((WIS >=# 15) && (CHA >=# 17) && (align ==# 4)) {$RETURN "Y";};
[ChangeClassFrom] = $VAR me; $VAR cls; $VAR lvl; $VAR toHit;
-me = $IndexOf($CharacterContext());
-cls = $GET_CHAR_CLASS(me); lvl = $GET_CHAR_Lvl(me,"fighter"); toHit = $GET_CHAR_THAC0(me);
-$DELETE_CHARACTER_SA($CharacterContext(),"class_baseName");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_Druid");
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM",$SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP",$SkillAdj($CharacterContext(),"Save Vs PP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW",$SkillAdj($CharacterContext(),"Save Vs RSW","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR",$SkillAdj($CharacterContext(),"Save Vs BR","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP",$SkillAdj($CharacterContext(),"Save Vs SP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevTHAC0",toHit);
-$SET_CHARACTER_SA($CharacterContext(),"preDualClass","$"+cls+"$"+lvl);
[ChangeClassTo] = $SET_CHARACTER_SA($CharacterContext(),"class_baseName","$druid");
-$SET_CHARACTER_SA($CharacterContext(),"class_Druid","druid");
-$SET_CHARACTER_SA($CharacterContext(),$SA_NAME(),"$druid");
[TrainingCharacter] = $VAR me; $VAR bc; $VAR lvl; $VAR pdc; $VAR prv; $VAR cls;
-me = $IndexOf($CharacterContext());
-bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc);
-pdc = $GET_CHARACTER_SA($CharacterContext(),"preDualClass");
-prv = $DelimitedStringSubstring(pdc,1); cls = $DelimitedStringSubstring(pdc,0);
-$IF (pdc == "-?-?-") {$RETURN;};
-$IF (lvl ># prv) {$RUN_CHAR_SCRIPTS(me,"DualClassAchieved"+cls);};
\(END)

\(BEGIN)
name = ChangeClassFighter
[CanChangeFromClass] = $VAR me; $VAR STR;
-me = $IndexOf($CharacterContext());
-STR = $GET_CHAR_LIMITED_STR(me);
-$IF (STR >=# 15) {$RETURN "Y";};
[CanChangeToClass] = $VAR me; $VAR STR; $VAR race;
-me = $IndexOf($CharacterContext());
-STR = $GET_CHAR_LIMITED_STR(me); race = $GET_CHAR_RACE(me);
-$IF (race != "Human") {$RETURN "N";};
-$IF (STR >=# 17) {$RETURN "Y";};
[ChangeClassFrom] = $VAR me; $VAR cls; $VAR lvl; $VAR toHit;
-me = $IndexOf($CharacterContext());
-cls = $GET_CHAR_CLASS(me); lvl = $GET_CHAR_Lvl(me,"fighter"); toHit = $GET_CHAR_THAC0(me);
-$DELETE_CHARACTER_SA($CharacterContext(),"class_NoSpells");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_Sweep");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_baseName");
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM",$SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP",$SkillAdj($CharacterContext(),"Save Vs PP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW",$SkillAdj($CharacterContext(),"Save Vs RSW","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR",$SkillAdj($CharacterContext(),"Save Vs BR","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP",$SkillAdj($CharacterContext(),"Save Vs SP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevTHAC0",toHit);
-$IF (lvl ># 12) {$SET_CHARACTER_SA($CharacterContext(),"prevNumberOfAttacks","2");};
-$IF (lvl ># 6) {$SET_CHARACTER_SA($CharacterContext(),"prevNumberOfAttacks","(($GetCombatRound() +# 1) %# 2) +# 1");};
-$SET_CHARACTER_SA($CharacterContext(),"preDualClass","$"+cls+"$"+lvl);
-$SET_CHARACTER_SA($CharacterContext(),"preBardFighter",lvl);
[ChangeClassTo] = $VAR me;
-me = $IndexOf($CharacterContext());
-$SET_CHARACTER_SA($CharacterContext(),"class_NoSpells","fighter");
-$SET_CHARACTER_SA($CharacterContext(),"class_Sweep","fighter");
-$SET_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound","fighter");
-$SET_CHARACTER_SA($CharacterContext(),"class_baseName","$fighter");
-$SET_CHARACTER_SA($CharacterContext(),$SA_NAME(),"$fighter");
[TrainingCharacter] = $VAR me; $VAR bc; $VAR lvl; $VAR pdc; $VAR prv; $VAR cls;
-me = $IndexOf($CharacterContext());
-bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc);
-pdc = $GET_CHARACTER_SA($CharacterContext(),"preDualClass");
-prv = $DelimitedStringSubstring(pdc,1); cls = $DelimitedStringSubstring(pdc,0);
-$IF (pdc == "-?-?-") {$RETURN;};
-$IF (lvl ># prv) {$RUN_CHAR_SCRIPTS(me,"DualClassAchieved"+cls);};
\(END)

\(BEGIN)
name = ChangeClassMagicUser
[CanChangeFromClass] = $VAR me; $VAR INT;
-me = $IndexOf($CharacterContext());
-INT = $GET_CHAR_LIMITED_INT(me);
-$IF (INT >=# 15) {$RETURN "Y";};
[CanChangeToClass] = $VAR me; $VAR INT; $VAR race;
-me = $IndexOf($CharacterContext());
-INT = $GET_CHAR_LIMITED_INT(me);
-race = $GET_CHAR_RACE(me);
-$IF (race != "Human") {$RETURN "N";};
-$IF (INT >=# 17) {$RETURN "Y";};
[ChangeClassFrom] = $VAR me; $VAR cls; $VAR lvl; $VAR toHit;
-me = $IndexOf($CharacterContext());
-cls = $GET_CHAR_CLASS(me); lvl = $GET_CHAR_Lvl(me,"magicUser"); toHit = $GET_CHAR_THAC0(me);
-$DELETE_CHARACTER_SA($CharacterContext(),"class_baseName");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_MageScribe");
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM",$SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP",$SkillAdj($CharacterContext(),"Save Vs PP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW",$SkillAdj($CharacterContext(),"Save Vs RSW","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR",$SkillAdj($CharacterContext(),"Save Vs BR","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP",$SkillAdj($CharacterContext(),"Save Vs SP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevTHAC0",toHit);
-$SET_CHARACTER_SA($CharacterContext(),"preDualClass","$MagicUser$"+lvl);
[ChangeClassTo] = $SET_CHARACTER_SA($CharacterContext(),"class_MageScribe","magicUser");
-$SET_CHARACTER_SA($CharacterContext(),"class_baseName","$magicUser");
-$KNOW_SPELL($CharacterContext(),"Magic Missile","1");
-$KNOW_SPELL($CharacterContext(),"Sleep","1");
-$SET_CHARACTER_SA($CharacterContext(),$SA_NAME(),"$magicUser");
[TrainingCharacter] = $VAR me; $VAR bc; $VAR lvl; $VAR pdc; $VAR prv; $VAR cls;
-me = $IndexOf($CharacterContext());
-bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc);
-pdc = $GET_CHARACTER_SA($CharacterContext(),"preDualClass");
-prv = $DelimitedStringSubstring(pdc,1); cls = $DelimitedStringSubstring(pdc,0);
-$IF (pdc == "-?-?-") {$RETURN;};
-$IF (lvl ># prv) {$RUN_CHAR_SCRIPTS(me,"DualClassAchieved"+cls);};
\(END)

\(BEGIN)
name = ChangeClassPaladin
[CanChangeFromClass] = $VAR me; $VAR STR; $VAR WIS;
-me = $IndexOf($CharacterContext());
-STR = $GET_CHAR_LIMITED_STR(me); WIS = $GET_CHAR_LIMITED_WIS(me);
-$IF ((STR >=# 15) && (WIS >=# 15)) {$RETURN "Y";};
[CanChangeToClass] = $VAR me; $VAR STR; $VAR WIS; $VAR CHA; $VAR INT; $VAR CON; $VAR align; $VAR race;
-me = $IndexOf($CharacterContext());
-STR = $GET_CHAR_LIMITED_STR(me); WIS = $GET_CHAR_LIMITED_WIS(me); CHA = $GET_CHAR_LIMITED_CHA(me);
-INT = $GET_CHAR_LIMITED_INT(me); CON = $GET_CHAR_LIMITED_CON(me); align = $GET_CHAR_ALIGNMENT(me);
-race = $GET_CHAR_RACE(me);
-$IF (race != "Human") {$RETURN "N";};
-$IF ((STR >=# 17) && (WIS >=# 17) && (CHA >=# 17) && (INT >=# 9) && (CON >=# 9) && (align ==# 0)) {$RETURN "Y";};
[ChangeClassFrom] = $VAR me; $VAR cls; $VAR lvl; $VAR toHit;
-me = $IndexOf($CharacterContext());
-cls = $GET_CHAR_CLASS(me); lvl = $GET_CHAR_Lvl(me,"paladin"); toHit = $GET_CHAR_THAC0(me);
-$DELETE_CHARACTER_SA($CharacterContext(),"class_Paladin");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_baseName");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_Sweep");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_Leader");
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM",$SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP",$SkillAdj($CharacterContext(),"Save Vs PP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW",$SkillAdj($CharacterContext(),"Save Vs RSW","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR",$SkillAdj($CharacterContext(),"Save Vs BR","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP",$SkillAdj($CharacterContext(),"Save Vs SP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevTHAC0",toHit);
-$IF (lvl ># 12) {$SET_CHARACTER_SA($CharacterContext(),"prevNumberOfAttacks","2");};
-$IF (lvl ># 6) {$SET_CHARACTER_SA($CharacterContext(),"prevNumberOfAttacks","(($GetCombatRound() +# 1) %# 2) +# 1");};
-$SET_CHARACTER_SA($CharacterContext(),"preDualClass","$"+cls+"$"+lvl);
[ChangeClassTo] = $SET_CHARACTER_SA($CharacterContext(),"class_Paladin","paladin");
-$SET_CHARACTER_SA($CharacterContext(),"class_baseName","$paladin");
-$SET_CHARACTER_SA($CharacterContext(),"class_Sweep","$paladin");
-$SET_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound","$paladin");
-$SET_CHARACTER_SA($CharacterContext(),"class_Leader","$paladin");
-$SET_CHARACTER_SA($CharacterContext(),$SA_NAME(),"$paladin");
[TrainingCharacter] = $VAR me; $VAR bc; $VAR lvl; $VAR pdc; $VAR prv; $VAR cls;
-me = $IndexOf($CharacterContext());
-bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc);
-pdc = $GET_CHARACTER_SA($CharacterContext(),"preDualClass");
-prv = $DelimitedStringSubstring(pdc,1); cls = $DelimitedStringSubstring(pdc,0);
-$IF (pdc == "-?-?-") {$RETURN;};
-$IF (lvl ># prv) {$RUN_CHAR_SCRIPTS(me,"DualClassAchieved"+cls);};
\(END)

\(BEGIN)
name = ChangeClassRanger
[CanChangeFromClass] = $VAR me; $VAR STR; $VAR INT; $VAR WIS;
-me = $IndexOf($CharacterContext());
-STR = $GET_CHAR_LIMITED_STR(me); INT = $GET_CHAR_LIMITED_INT(me); WIS = $GET_CHAR_LIMITED_WIS(me);
-$IF ((STR >=# 15) && (INT >=# 15) && (WIS >=# 15)) {$RETURN "Y";};
[CanChangeToClass] = $VAR me; $VAR STR; $VAR INT; $VAR WIS; $VAR CON; $VAR align; $VAR race;
-me = $IndexOf($CharacterContext());
-STR = $GET_CHAR_LIMITED_STR(me); INT = $GET_CHAR_LIMITED_INT(me);
-WIS = $GET_CHAR_LIMITED_WIS(me); CON = $GET_CHAR_LIMITED_CON(me);
-align = $GET_CHAR_ALIGNMENT(me); race = $GET_CHAR_RACE(me);
-$IF (race != "Human") {$RETURN "N";};
-$IF ((STR >=# 17) && (INT >=# 17) && (WIS >=# 17) && (WIS >=# 14) && (align <=# 2)) {$RETURN "Y";};
[ChangeClassFrom] = $VAR me; $VAR cls; $VAR lvl; $VAR toHit;
-me = $IndexOf($CharacterContext());
-cls = $GET_CHAR_CLASS(me); lvl = $GET_CHAR_Lvl(me,"fighter"); toHit = $GET_CHAR_THAC0(me);
-$DELETE_CHARACTER_SA($CharacterContext(),"class_Unsurprised");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_Sweep");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_AttacksPerRoundAdj");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_baseName");
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM",$SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP",$SkillAdj($CharacterContext(),"Save Vs PP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW",$SkillAdj($CharacterContext(),"Save Vs RSW","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR",$SkillAdj($CharacterContext(),"Save Vs BR","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP",$SkillAdj($CharacterContext(),"Save Vs SP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevTHAC0",toHit);
-$IF (lvl ># 13) {$SET_CHARACTER_SA($CharacterContext(),"prevNumberOfAttacks","2");};
-$IF (lvl ># 7) {$SET_CHARACTER_SA($CharacterContext(),"prevNumberOfAttacks","(($GetCombatRound() +# 1) %# 2) +# 1");};
-$SET_CHARACTER_SA($CharacterContext(),"preDualClass","$"+cls+"$"+lvl);
[ChangeClassTo] = $VAR me;
-me = $IndexOf($CharacterContext());
-$SET_CHARACTER_SA($CharacterContext(),"class_baseName","$ranger");
-$SET_CHARACTER_SA($CharacterContext(),"class_Unsurprised","$ranger");
-$SET_CHARACTER_SA($CharacterContext(),"class_Sweep","ranger");
-$SET_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound","ranger");
-$SET_CHARACTER_SA($CharacterContext(),"class_AttacksPerRoundAdj","15");
-$SET_CHARACTER_SA($CharacterContext(),$SA_NAME(),"$ranger");
[TrainingCharacter] = $VAR me; $VAR bc; $VAR lvl; $VAR pdc; $VAR prv; $VAR cls;
-me = $IndexOf($CharacterContext());
-bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc);
-pdc = $GET_CHARACTER_SA($CharacterContext(),"preDualClass");
-prv = $DelimitedStringSubstring(pdc,1); cls = $DelimitedStringSubstring(pdc,0);
-$IF (pdc == "-?-?-") {$RETURN;};
-$IF (lvl ># prv) {$RUN_CHAR_SCRIPTS(me,"DualClassAchieved"+cls);};
\(END)

\(BEGIN)
name = ChangeClassThief
[CanChangeFromClass] = $VAR me; $VAR DEX;
-me = $IndexOf($CharacterContext());
-DEX = $GET_CHAR_LIMITED_DEX(me);
-$IF (DEX >=# 15) {$RETURN "Y";};
[CanChangeToClass] = $VAR me; $VAR DEX; $VAR align; $VAR race;
-me = $IndexOf($CharacterContext());
-DEX = $GET_CHAR_LIMITED_DEX(me);
-align = $GET_CHAR_ALIGNMENT(me);
-race = $GET_CHAR_RACE(me);
-$IF (race != "Human") {$RETURN "N";};
-$IF ((DEX >=# 17) && (align !=# 0)) {$RETURN "Y";};
[ChangeClassFrom] = $VAR me; $VAR cls; $VAR bc; $VAR lvl; $VAR XP; $VAR toHit;
-me = $IndexOf($CharacterContext());
-cls = $GET_CHAR_CLASS(me); bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc); XP = $GET_CHAR_Exp(me,bc); toHit = $GET_CHAR_THAC0(me);
-$DELETE_CHARACTER_SA($CharacterContext(),"class_NoSpells");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_ThievingSkills");
-$DELETE_CHARACTER_SA($CharacterContext(),"class_baseName");
-$IF (lvl ==# 6){$SET_CHARACTER_SA($CharacterContext(),"preAcrobat",XP);};
-$SET_CHARACTER_SA($CharacterContext(),"prevSklPP",$SkillAdj($CharacterContext(),"PickPockets","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklOL",$SkillAdj($CharacterContext(),"OpenLocks","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklFT",$SkillAdj($CharacterContext(),"FindTraps","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklMS",$SkillAdj($CharacterContext(),"MoveSilent","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklHIS",$SkillAdj($CharacterContext(),"HideInShadows","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklHN",$SkillAdj($CharacterContext(),"HearNoise","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklCW",$SkillAdj($CharacterContext(),"ClimbWalls","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSklRL",$SkillAdj($CharacterContext(),"ReadLanguages","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevBackstab",$SkillAdj($CharacterContext(),"BackstabMultiplier","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM",$SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP",$SkillAdj($CharacterContext(),"Save Vs PP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW",$SkillAdj($CharacterContext(),"Save Vs RSW","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR",$SkillAdj($CharacterContext(),"Save Vs BR","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP",$SkillAdj($CharacterContext(),"Save Vs SP","","F",""));
-$SET_CHARACTER_SA($CharacterContext(),"preDualClass","$"+cls+"$"+lvl);
-$SET_CHARACTER_SA($CharacterContext(),"prevTHAC0",toHit);
-$SET_CHARACTER_SA($CharacterContext(),"ChangeClassThief","postClass");
[ChangeClassTo] = $SET_CHARACTER_SA($CharacterContext(),"class_NoSpells","thief");
-$SET_CHARACTER_SA($CharacterContext(),"class_ThievingSkills","$thief");
-$SET_CHARACTER_SA($CharacterContext(),"class_baseName","$thief");
-$SET_CHARACTER_SA($CharacterContext(),$SA_NAME(),"$thief");
[TrainingCharacter] = $VAR me; $VAR bc; $VAR lvl; $VAR pdc; $VAR prv; $VAR cls;
-me = $IndexOf($CharacterContext());
-bc = $GetHighestLevelBaseclass(me);
-lvl = $GET_CHAR_Lvl(me,bc);
-pdc = $GET_CHARACTER_SA($CharacterContext(),"preDualClass");
-$IF (pdc == "-?-?-") {$RETURN;};
-prv = $DelimitedStringSubstring(pdc,1); cls = $DelimitedStringSubstring(pdc,0);
-$IF (prv ># lvl) {$RUN_CHAR_SCRIPTS(me,"DualClassAchieved"+cls);};
-$IF ((lvl ># 4) && (lvl <# 10)) {$CALL_GLOBAL_SCRIPT ("ChangeClassBard","CanChangeToClass");};
\(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; $VAR un;
-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);
-un = $GET_COMBATANT_SA($CombatantContext(),"class_Unsurprised");
-$IF ($NOT($GetCombatRound()))//Past round 1
-	{$RETURN adj;};
-$IF (p5 != 18)// adjustment for unsurprised
-	{$RETURN adj;};
-$IF (adj <# "-1" || adj ==# "-1" && un != "-?-?-")// negate surprise for -2 or better
-	{redo = 1;};
-$IF (un != "-?-?-" || 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 adj; $VAR count; $VAR t; $VAR tgt; $VAR bc; $VAR lvl;
-bc = $GET_CHARACTER_SA($CharacterContext(),"class_Sweep");
-$IF (bc != "-?-?-") {lvl = $GET_CHAR_Lvl($MyIndex(),bc);};
-$IF (lvl ># 1)
-	{
-		adj = $ListAdjacentCombatants($MyIndex());
-		t = 0;
-		count = $DelimitedStringCount(adj);
-		$WHILE (count >=# 0)
-			{
-				tgt = $DelimitedStringSubstring(adj,count);
-				$IF ($GET_MONSTERTYPE_SA($GET_CHAR_NAME(tgt),"monster_Swept") != "-?-?-" && $GET_CHAR_STATUS(tgt) ==# 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);
-			};
-	};
[DoesAttackSucceed] = $VAR par5;
-par5 = $GET_HOOK_PARAM(5);
-$IF (par5 ==# 20) {$RETURN "Y";};
-$IF (par5 ==# 1) {$RETURN "N";};
[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; $VAR bc; $VAR lvl; $VAR adj; $VAR adjLvl;
-com = $IndexOf($CombatantContext());
-bc = $GET_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound");
-// monk starts
-$IF ($GET_CHAR_Lvl(com,"monk") ># 0)
-	{
-		lvl = $GET_CHAR_Lvl(com,"monk");
-		$IF (lvl >=# 16) {$RETURN 4;};
-		$IF (lvl >=# 14) {$RETURN 3;};
-		$IF (lvl >=# 11) {$IF ((($GetCombatRound() +# 1) %# 2) ==# 0) {$RETURN 2;}
-						  $ELSE {$RETURN 3;};};
-		$IF (lvl >=# 9) {$RETURN 2;};
-		$IF (lvl >=# 6) {$RETURN (($GetCombatRound() +# 1) %# 2) +# 1;};
-		$IF (lvl >=# 4) {$IF ((($GetCombatRound() +# 1) %# 4) ==# 0) {$RETURN 2;};};
-// monk ends
-	};
-$IF (bc == "-?-?-") {$RETURN;};
-adj = $GET_CHARACTER_SA($CharacterContext(),"class_AttacksPerRoundAdj");
-$IF (adj != "-?-?-") {adjLvl = ($GET_CHAR_Lvl(com,bc) -# 1) /# 7;}
-$ELSE {adjLvl = 0;};
-lvl = $GET_CHAR_Lvl(com,bc) -# adjLvl;
-$IF ($GET_MONSTERTYPE_SA($MonsterTypeContext(),"monsterLevel") != "-?-?-"){$RETURN;};
-$IF (lvl >=# 13) {$RETURN 2;};
-$IF (lvl >=# 7) {$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 lead; $VAR controlNPC;
-$VAR idx1; $VAR idx4; $VAR modCha;
-me = $IndexOf($CharacterContext());
-name = $GET_CHAR_NAME(me);
-idx1 = $NextCreatureIndex("", 1);
-idx4 = $NextCreatureIndex("", 4);
-$SET_CHARACTER_SA($CharacterContext(  ),"turnUndead","");
-$IF ($NextCreatureIndex(me -# 1, 4) == me)
-	{
-		$SET_CHARACTER_SA($CharacterContext(),"side",1);
-		$SET_CHAR_ASL(me,"side",1);
-	}
-$ELSE
-	{
-		$SET_CHARACTER_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_CHARACTER_SA($CharacterContext(),"endControl", 1);
-lead = $GET_CHARACTER_SA($CharacterContext(),"class_Leader");
-lvl = $GET_CHAR_Lvl(me,lead);
-$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_CHARACTER_SA($CharacterContext(),"side") == 1 && $RANDOM(100) <# $GET_PARTY_ASL("controlNPC"))
-	{
-		$SET_CHARACTER_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 = "acid, blunt, cold, crushing, electricity, fire, piercing, poison, psionic, slashing, venom";
\(END)

\(BEGIN)
name = DualClassedAssassin
[DualClassAchievedAssassin] = $VAR sklPP; $VAR prevSklPP; 
-$VAR sklOL; 	$VAR prevSklOL; $VAR sklFT;	 $VAR prevSklFT; 
-$VAR sklMS; 	$VAR prevSklMS; $VAR sklHIS;	$VAR prevSklHIS; 
-$VAR sklHN; 	$VAR prevSklHN; $VAR sklCW; 	$VAR prevSklCW; 
-$VAR sklRL; 	$VAR prevSklRL; $VAR back; 	$VAR prevBack;
-$VAR savePPDM; $VAR prevSavePPDM; $VAR savePP; 	$VAR prevSavePP;
-$VAR saveRSW; 	$VAR prevSaveRSW; $VAR saveBR; 	$VAR prevSaveBR;
-$VAR saveSP; 	$VAR prevSaveSP; $VAR toHit; 	$VAR prevToHit; 
-$VAR me;
-me = $IndexOf($CharacterContext());
-sklPP = $SkillAdj($CharacterContext(),"PickPockets","","F",""); prevSklPP = $GET_CHARACTER_SA($CharacterContext(),"prevSklPP");
-sklOL = $SkillAdj($CharacterContext(),"OpenLocks","","F",""); prevSklOL = $GET_CHARACTER_SA($CharacterContext(),"prevSklOL");
-sklFT = $SkillAdj($CharacterContext(),"FindTraps","","F",""); prevSklFT = $GET_CHARACTER_SA($CharacterContext(),"prevSklFT");
-sklMS = $SkillAdj($CharacterContext(),"MoveSilent","","F",""); prevSklMS = $GET_CHARACTER_SA($CharacterContext(),"prevSklMS");
-sklHIS = $SkillAdj($CharacterContext(),"HideInShadows","","F",""); prevSklHIS = $GET_CHARACTER_SA($CharacterContext(),"prevSklHIS");
-sklHN = $SkillAdj($CharacterContext(),"HearNoise","","F",""); prevSklHN = $GET_CHARACTER_SA($CharacterContext(),"prevSklHN");
-sklCW = $SkillAdj($CharacterContext(),"ClimbWalls","","F",""); prevSklCW = $GET_CHARACTER_SA($CharacterContext(),"prevSklCW");
-sklRL = $SkillAdj($CharacterContext(),"ReadLanguages","","F",""); prevSklRL = $GET_CHARACTER_SA($CharacterContext(),"prevSklRL");
-back = $SkillAdj($CharacterContext(),"BackstabMultiplier","","F",""); prevBack = $GET_CHARACTER_SA($CharacterContext(),"prevBackstab");
-savePPDM = $SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""); prevSavePPDM = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM");
-savePP = $SkillAdj($CharacterContext(),"Save Vs PP","","F",""); prevSavePP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP");
-saveRSW = $SkillAdj($CharacterContext(),"Save Vs RSW","","F",""); prevSaveRSW = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW");
-saveBR = $SkillAdj($CharacterContext(),"Save Vs BR","","F",""); prevSaveBR = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR");
-saveSP = $SkillAdj($CharacterContext(),"Save Vs SP","","F",""); prevSaveSP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP");
-toHit = $GET_CHAR_THAC0(me); prevToHit = $GET_CHARACTER_SA($CharacterContext(),"prevTHAC0");
-
-$IF (prevSklPP ># sklPP){$SkillAdj($CharacterContext(),"PickPockets","postDualClass","+",prevSklPP);};
-$IF (prevSklOL ># sklOL){$SkillAdj($CharacterContext(),"OpenLocks","postDualClass","+",prevSklOL);};
-$IF (prevSklFT ># sklFT){$SkillAdj($CharacterContext(),"FindTraps","postDualClass","+",prevSklFT);};
-$IF (prevSklMS ># sklMS){$SkillAdj($CharacterContext(),"MoveSilent","postDualClass","+",prevSklMS);};
-$IF (prevSklHIS ># sklHIS){$SkillAdj($CharacterContext(),"HideInShadows","postDualClass","+",prevSklHIS);};
-$IF (prevSklHN ># sklHN){$SkillAdj($CharacterContext(),"HearNoise","postDualClass","+",prevSklHN);};
-$IF (prevSklCW ># sklCW){$SkillAdj($CharacterContext(),"ClimbWalls","postDualClass","+",prevSklCW);};
-$IF (prevSklRL ># sklRL){$SkillAdj($CharacterContext(),"ReadLanguages","postDualClass","+",prevSklRL);};
-$IF (prevBack ># back){$SkillAdj($CharacterContext(),"BackstabMultiplier","postDualClass","+",prevBack);};
-
-$IF (savePPDM ># prevSavePPDM) {$SkillAdj($CharacterContext(),"Save Vs PPDM","postDualClass","=",prevSavePPDM);};
-$IF (savePP ># prevSavePP) {$SkillAdj($CharacterContext(),"Save Vs PP","postDualClass","=",prevSavePP);};
-$IF (saveRSW ># prevSaveRSW) {$SkillAdj($CharacterContext(),"Save Vs RSW","postDualClass","=",saveRSW);};
-$IF (saveBR ># prevSaveBR) {$SkillAdj($CharacterContext(),"Save Vs BR","postDualClass","=",saveBR);};
-$IF (saveSP ># prevSaveSP) {$SkillAdj($CharacterContext(),"Save Vs SP","postDualClass","=",saveSP);};
-$IF (toHit ># prevToHit) {$SET_CHAR_THAC0(me,prevToHit);};
\(END)

\(BEGIN)
name = DualClassedCleric
[DualClassAchievedCleric] = $VAR savePPDM; $VAR prevSavePPDM;
-$VAR savePP; 	$VAR prevSavePP; $VAR saveRSW; 	$VAR prevSaveRSW;
-$VAR saveBR; 	$VAR prevSaveBR; $VAR saveSP; 	$VAR prevSaveSP; 
-$VAR toHit; 	$VAR prevToHit;  $VAR me;
-me = $IndexOf($CharacterContext());
-savePPDM = $SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""); prevSavePPDM = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM");
-savePP = $SkillAdj($CharacterContext(),"Save Vs PP","","F",""); prevSavePP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP");
-saveRSW = $SkillAdj($CharacterContext(),"Save Vs RSW","","F",""); prevSaveRSW = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW");
-saveBR = $SkillAdj($CharacterContext(),"Save Vs BR","","F",""); prevSaveBR = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR");
-saveSP = $SkillAdj($CharacterContext(),"Save Vs SP","","F",""); prevSaveSP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP");
-toHit = $GET_CHAR_THAC0(me); prevToHit = $GET_CHARACTER_SA($CharacterContext(),"prevTHAC0");
-$IF (savePPDM ># prevSavePPDM) {$SkillAdj($CharacterContext(),"Save Vs PPDM","postDualClass","=",prevSavePPDM);};
-$IF (savePP ># prevSavePP) {$SkillAdj($CharacterContext(),"Save Vs PP","postDualClass","=",prevSavePP);};
-$IF (saveRSW ># prevSaveRSW) {$SkillAdj($CharacterContext(),"Save Vs RSW","postDualClass","=",saveRSW);};
-$IF (saveBR ># prevSaveBR) {$SkillAdj($CharacterContext(),"Save Vs BR","postDualClass","=",saveBR);};
-$IF (saveSP ># prevSaveSP) {$SkillAdj($CharacterContext(),"Save Vs SP","postDualClass","=",saveSP);};
-$IF (toHit ># prevToHit) {$SET_CHAR_THAC0(me,prevToHit);};
-$DELETE_CHARACTER_SA($CharacterContext(),"NoSpellsAssassin");
-$DELETE_CHARACTER_SA($CharacterContext(),"NoSpellsFighter");
-$DELETE_CHARACTER_SA($CharacterContext(),"NoSpellsThief");
\(END)

\(BEGIN)
name = DualClassedDruid
[DualClassAchievedDruid] = $VAR savePPDM; $VAR prevSavePPDM;
-$VAR savePP; 	$VAR prevSavePP; $VAR saveRSW; 	$VAR prevSaveRSW;
-$VAR saveBR; 	$VAR prevSaveBR; $VAR saveSP; 	$VAR prevSaveSP; 
-$VAR toHit; 	$VAR prevToHit; $VAR me;
-me = $IndexOf($CharacterContext());
-savePPDM = $SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""); prevSavePPDM = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM");
-savePP = $SkillAdj($CharacterContext(),"Save Vs PP","","F",""); prevSavePP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP");
-saveRSW = $SkillAdj($CharacterContext(),"Save Vs RSW","","F",""); prevSaveRSW = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW");
-saveBR = $SkillAdj($CharacterContext(),"Save Vs BR","","F",""); prevSaveBR = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR");
-saveSP = $SkillAdj($CharacterContext(),"Save Vs SP","","F",""); prevSaveSP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP");
-toHit = $GET_CHAR_THAC0(me); prevToHit = $GET_CHARACTER_SA($CharacterContext(),"prevTHAC0");
-$IF (savePPDM ># prevSavePPDM) {$SkillAdj($CharacterContext(),"Save Vs PPDM","postDualClass","=",prevSavePPDM);};
-$IF (savePP ># prevSavePP) {$SkillAdj($CharacterContext(),"Save Vs PP","postDualClass","=",prevSavePP);};
-$IF (saveRSW ># prevSaveRSW) {$SkillAdj($CharacterContext(),"Save Vs RSW","postDualClass","=",saveRSW);};
-$IF (saveBR ># prevSaveBR) {$SkillAdj($CharacterContext(),"Save Vs BR","postDualClass","=",saveBR);};
-$IF (saveSP ># prevSaveSP) {$SkillAdj($CharacterContext(),"Save Vs SP","postDualClass","=",saveSP);};
-$IF (toHit ># prevToHit) {$SET_CHAR_THAC0(me,prevToHit);};
-$DELETE_CHARACTER_SA($CharacterContext(),"class_NoSpells");
\(END)

\(BEGIN)
name = DualClassedFighter
[DualClassAchievedFighter] = $VAR savePPDM; $VAR prevSavePPDM;
-$VAR savePP; 	$VAR prevSavePP; $VAR saveRSW; 	$VAR prevSaveRSW;
-$VAR saveBR; 	$VAR prevSaveBR; $VAR saveSP; 	$VAR prevSaveSP; 
-$VAR toHit; 	$VAR prevToHit; $VAR me;
-me = $IndexOf($CharacterContext());
-savePPDM = $SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""); prevSavePPDM = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM");
-savePP = $SkillAdj($CharacterContext(),"Save Vs PP","","F",""); prevSavePP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP");
-saveRSW = $SkillAdj($CharacterContext(),"Save Vs RSW","","F",""); prevSaveRSW = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW");
-saveBR = $SkillAdj($CharacterContext(),"Save Vs BR","","F",""); prevSaveBR = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR");
-saveSP = $SkillAdj($CharacterContext(),"Save Vs SP","","F",""); prevSaveSP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP");
-toHit = $GET_CHAR_THAC0(me); prevToHit = $GET_CHARACTER_SA($CharacterContext(),"prevTHAC0");
-$IF (savePPDM ># prevSavePPDM) {$SkillAdj($CharacterContext(),"Save Vs PPDM","postDualClass","=",prevSavePPDM);};
-$IF (savePP ># prevSavePP) {$SkillAdj($CharacterContext(),"Save Vs PP","postDualClass","=",prevSavePP);};
-$IF (saveRSW ># prevSaveRSW) {$SkillAdj($CharacterContext(),"Save Vs RSW","postDualClass","=",saveRSW);};
-$IF (saveBR ># prevSaveBR) {$SkillAdj($CharacterContext(),"Save Vs BR","postDualClass","=",saveBR);};
-$IF (saveSP ># prevSaveSP) {$SkillAdj($CharacterContext(),"Save Vs SP","postDualClass","=",saveSP);};
-$IF (toHit ># prevToHit) {$SET_CHAR_THAC0(me,prevToHit);};
-$SET_CHARACTER_SA($CharacterContext(),"class_Sweep","fighter");
-$SET_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound","fighter");
\(END)

\(BEGIN)
name = DualClassedPaladin
[DualClassAchievedPaladin] = $VAR savePPDM; $VAR prevSavePPDM;
-$VAR savePP; 	$VAR prevSavePP; $VAR saveRSW; 	$VAR prevSaveRSW;
-$VAR saveBR; 	$VAR prevSaveBR; $VAR saveSP; 	$VAR prevSaveSP; 
-$VAR toHit; 	$VAR prevToHit; $VAR me;
-me = $IndexOf($CharacterContext());
-savePPDM = $SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""); prevSavePPDM = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM");
-savePP = $SkillAdj($CharacterContext(),"Save Vs PP","","F",""); prevSavePP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP");
-saveRSW = $SkillAdj($CharacterContext(),"Save Vs RSW","","F",""); prevSaveRSW = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW");
-saveBR = $SkillAdj($CharacterContext(),"Save Vs BR","","F",""); prevSaveBR = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR");
-saveSP = $SkillAdj($CharacterContext(),"Save Vs SP","","F",""); prevSaveSP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP");
-toHit = $GET_CHAR_THAC0(me); prevToHit = $GET_CHARACTER_SA($CharacterContext(),"prevTHAC0");
-
-$IF (savePPDM ># prevSavePPDM) {$SkillAdj($CharacterContext(),"Save Vs PPDM","postDualClass","=",prevSavePPDM);};
-$IF (savePP ># prevSavePP) {$SkillAdj($CharacterContext(),"Save Vs PP","postDualClass","=",prevSavePP);};
-$IF (saveRSW ># prevSaveRSW) {$SkillAdj($CharacterContext(),"Save Vs RSW","postDualClass","=",saveRSW);};
-$IF (saveBR ># prevSaveBR) {$SkillAdj($CharacterContext(),"Save Vs BR","postDualClass","=",saveBR);};
-$IF (saveSP ># prevSaveSP) {$SkillAdj($CharacterContext(),"Save Vs SP","postDualClass","=",saveSP);};
-$IF (toHit ># prevToHit) {$SET_CHAR_THAC0(me,prevToHit);};
-$DELETE_CHARACTER_SA($CharacterContext(),"class_NoSpells");
-$SET_CHARACTER_SA($CharacterContext(),"class_Sweep","paladin");
-$SET_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound","paladin");
\(END)

\(BEGIN)
name = DualClassedRanger
[DualClassAchievedRanger] = $VAR savePPDM; $VAR prevSavePPDM;
-$VAR savePP; 	$VAR prevSavePP; $VAR saveRSW; 	$VAR prevSaveRSW;
-$VAR saveBR; 	$VAR prevSaveBR; $VAR saveSP; 	$VAR prevSaveSP; 
-$VAR toHit; 	$VAR prevToHit; $VAR me;
-me = $IndexOf($CharacterContext());
-savePPDM = $SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""); prevSavePPDM = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM");
-savePP = $SkillAdj($CharacterContext(),"Save Vs PP","","F",""); prevSavePP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP");
-saveRSW = $SkillAdj($CharacterContext(),"Save Vs RSW","","F",""); prevSaveRSW = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW");
-saveBR = $SkillAdj($CharacterContext(),"Save Vs BR","","F",""); prevSaveBR = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR");
-saveSP = $SkillAdj($CharacterContext(),"Save Vs SP","","F",""); prevSaveSP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP");
-toHit = $GET_CHAR_THAC0(me); prevToHit = $GET_CHARACTER_SA($CharacterContext(),"prevTHAC0");
-
-$IF (savePPDM ># prevSavePPDM) {$SkillAdj($CharacterContext(),"Save Vs PPDM","postDualClass","=",prevSavePPDM);};
-$IF (savePP ># prevSavePP) {$SkillAdj($CharacterContext(),"Save Vs PP","postDualClass","=",prevSavePP);};
-$IF (saveRSW ># prevSaveRSW) {$SkillAdj($CharacterContext(),"Save Vs RSW","postDualClass","=",saveRSW);};
-$IF (saveBR ># prevSaveBR) {$SkillAdj($CharacterContext(),"Save Vs BR","postDualClass","=",saveBR);};
-$IF (saveSP ># prevSaveSP) {$SkillAdj($CharacterContext(),"Save Vs SP","postDualClass","=",saveSP);};
-$IF (toHit ># prevToHit) {$SET_CHAR_THAC0(me,prevToHit);};
-$DELETE_CHARACTER_SA($CharacterContext(),"class_NoSpells");
-$SET_CHARACTER_SA($CharacterContext(),"class_Sweep","ranger");
-$SET_CHARACTER_SA($CharacterContext(),"class_AttacksPerRound","ranger");
\(END)

\(BEGIN)
name = DualClassedThief
[DualClassAchievedThief] = $VAR sklPP; $VAR prevSklPP; 
-$VAR sklOL; 	$VAR prevSklOL; $VAR sklFT;	 $VAR prevSklFT; 
-$VAR sklMS; 	$VAR prevSklMS; $VAR sklHIS;	$VAR prevSklHIS; 
-$VAR sklHN; 	$VAR prevSklHN; $VAR sklCW; 	$VAR prevSklCW; 
-$VAR sklRL; 	$VAR prevSklRL; $VAR back; 	$VAR prevBack;
-$VAR savePPDM; $VAR prevSavePPDM; $VAR savePP; 	$VAR prevSavePP;
-$VAR saveRSW; 	$VAR prevSaveRSW; $VAR saveBR; 	$VAR prevSaveBR;
-$VAR saveSP; 	$VAR prevSaveSP; $VAR toHit; 	$VAR prevToHit; $VAR me;
-me = $IndexOf($CharacterContext());
-sklPP = $SkillAdj($CharacterContext(),"PickPockets","","F",""); prevSklPP = $GET_CHARACTER_SA($CharacterContext(),"prevSklPP");
-sklOL = $SkillAdj($CharacterContext(),"OpenLocks","","F",""); prevSklOL = $GET_CHARACTER_SA($CharacterContext(),"prevSklOL");
-sklFT = $SkillAdj($CharacterContext(),"FindTraps","","F",""); prevSklFT = $GET_CHARACTER_SA($CharacterContext(),"prevSklFT");
-sklMS = $SkillAdj($CharacterContext(),"MoveSilent","","F",""); prevSklMS = $GET_CHARACTER_SA($CharacterContext(),"prevSklMS");
-sklHIS = $SkillAdj($CharacterContext(),"HideInShadows","","F",""); prevSklHIS = $GET_CHARACTER_SA($CharacterContext(),"prevSklHIS");
-sklHN = $SkillAdj($CharacterContext(),"HearNoise","","F",""); prevSklHN = $GET_CHARACTER_SA($CharacterContext(),"prevSklHN");
-sklCW = $SkillAdj($CharacterContext(),"ClimbWalls","","F",""); prevSklCW = $GET_CHARACTER_SA($CharacterContext(),"prevSklCW");
-sklRL = $SkillAdj($CharacterContext(),"ReadLanguages","","F",""); prevSklRL = $GET_CHARACTER_SA($CharacterContext(),"prevSklRL");
-back = $SkillAdj($CharacterContext(),"BackstabMultiplier","","F",""); prevBack = $GET_CHARACTER_SA($CharacterContext(),"prevBackstab");
-savePPDM = $SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""); prevSavePPDM = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM");
-savePP = $SkillAdj($CharacterContext(),"Save Vs PP","","F",""); prevSavePP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP");
-saveRSW = $SkillAdj($CharacterContext(),"Save Vs RSW","","F",""); prevSaveRSW = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW");
-saveBR = $SkillAdj($CharacterContext(),"Save Vs BR","","F",""); prevSaveBR = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR");
-saveSP = $SkillAdj($CharacterContext(),"Save Vs SP","","F",""); prevSaveSP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP");
-toHit = $GET_CHAR_THAC0(me); prevToHit = $GET_CHARACTER_SA($CharacterContext(),"prevTHAC0");
-
-$IF (prevSklPP ># sklPP){$SkillAdj($CharacterContext(),"PickPockets","postDualClass","+",prevSklPP);};
-$IF (prevSklOL ># sklOL){$SkillAdj($CharacterContext(),"OpenLocks","postDualClass","+",prevSklOL);};
-$IF (prevSklFT ># sklFT){$SkillAdj($CharacterContext(),"FindTraps","postDualClass","+",prevSklFT);};
-$IF (prevSklMS ># sklMS){$SkillAdj($CharacterContext(),"MoveSilent","postDualClass","+",prevSklMS);};
-$IF (prevSklHIS ># sklHIS){$SkillAdj($CharacterContext(),"HideInShadows","postDualClass","+",prevSklHIS);};
-$IF (prevSklHN ># sklHN){$SkillAdj($CharacterContext(),"HearNoise","postDualClass","+",prevSklHN);};
-$IF (prevSklCW ># sklCW){$SkillAdj($CharacterContext(),"ClimbWalls","postDualClass","+",prevSklCW);};
-$IF (prevSklRL ># sklRL){$SkillAdj($CharacterContext(),"ReadLanguages","postDualClass","+",prevSklRL);};
-$IF (prevBack ># back){$SkillAdj($CharacterContext(),"BackstabMultiplier","postDualClass","+",prevBack);};
-$IF (savePPDM ># prevSavePPDM) {$SkillAdj($CharacterContext(),"Save Vs PPDM","postDualClass","=",prevSavePPDM);};
-$IF (savePP ># prevSavePP) {$SkillAdj($CharacterContext(),"Save Vs PP","postDualClass","=",prevSavePP);};
-$IF (saveRSW ># prevSaveRSW) {$SkillAdj($CharacterContext(),"Save Vs RSW","postDualClass","=",saveRSW);};
-$IF (saveBR ># prevSaveBR) {$SkillAdj($CharacterContext(),"Save Vs BR","postDualClass","=",saveBR);};
-$IF (saveSP ># prevSaveSP) {$SkillAdj($CharacterContext(),"Save Vs SP","postDualClass","=",saveSP);};
-$IF (toHit ># prevToHit) {$SET_CHAR_THAC0(me,prevToHit);};
\(END)

\(BEGIN)
name = DualclassedMagicUser
[DualClassAchievedMagicUser] = $VAR savePPDM; $VAR prevSavePPDM;
-$VAR savePP; 	$VAR prevSavePP; $VAR saveRSW; 	$VAR prevSaveRSW;
-$VAR saveBR; 	$VAR prevSaveBR; $VAR saveSP; 	$VAR prevSaveSP; 
-$VAR toHit; 	$VAR prevToHit; $VAR me;
-me = $IndexOf($CharacterContext());
-savePPDM = $SkillAdj($CharacterContext(),"Save Vs PPDM","","F",""); prevSavePPDM = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPPDM");
-savePP = $SkillAdj($CharacterContext(),"Save Vs PP","","F",""); prevSavePP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsPP");
-saveRSW = $SkillAdj($CharacterContext(),"Save Vs RSW","","F",""); prevSaveRSW = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsRSW");
-saveBR = $SkillAdj($CharacterContext(),"Save Vs BR","","F",""); prevSaveBR = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsBR");
-saveSP = $SkillAdj($CharacterContext(),"Save Vs SP","","F",""); prevSaveSP = $GET_CHARACTER_SA($CharacterContext(),"prevSaveVsSP");
-toHit = $GET_CHAR_THAC0(me); prevToHit = $GET_CHARACTER_SA($CharacterContext(),"prevTHAC0");
-$IF (savePPDM ># prevSavePPDM) {$SkillAdj($CharacterContext(),"Save Vs PPDM","postDualClass","=",prevSavePPDM);};
-$IF (savePP ># prevSavePP) {$SkillAdj($CharacterContext(),"Save Vs PP","postDualClass","=",prevSavePP);};
-$IF (saveRSW ># prevSaveRSW) {$SkillAdj($CharacterContext(),"Save Vs RSW","postDualClass","=",saveRSW);};
-$IF (saveBR ># prevSaveBR) {$SkillAdj($CharacterContext(),"Save Vs BR","postDualClass","=",saveBR);};
-$IF (saveSP ># prevSaveSP) {$SkillAdj($CharacterContext(),"Save Vs SP","postDualClass","=",saveSP);};
-$IF (toHit ># prevToHit) {$SET_CHAR_THAC0(me,prevToHit);};
-$DELETE_CHARACTER_SA($CharacterContext(),"class_NoSpells");
-$SET_CHARACTER_SA($CharacterContext(),"class_MageScribe","magicUser");
\(END)

\(BEGIN)
name = Global_Combat
[PartyArrangement] = $IF ($GET_HOOK_PARAM(5) == "I")
-  {
-    $RETURN "ABABBBbBABBBABBBBCCCbBABBBBCCCbBABBBACCCBCbBABBBCBACCCBCbBABBBCBACDCBCCCcBbBABBBCBACDCBCCCcBbBABBBCBbCACDCBCCCcBbBABBBCBDBbCACDCBCCCcBbBABBBCBDBbCACDCBCECCCbAbAABcbbAABbAABcAbBcbbAABcAbBcbbAABdbbBcAcbbAABBCdbbBcAcbbAABBCdbACcAbBdccbbAABBCdbACcAbBdccbbAABBCecACdbcAbBdccbbAABBCCDecACdbcAbBdccbbAABBCCDecBDdbcAbBACAAAAbABAAAbAAAbAbbcbBAAAbAbbcbBAAAbAAbcbbbCABAAAbAAbcbbbCABAAAbABbcbAbbbCABAAAbAcABbcbAbbbCABAAAbAcABbdbcbAbbbDACABAAAbAcABbdbcbAbbbDACABAAAbAcACbdbBbcbAbbbBBBBAACCBBAABBAACBBACCBBAACBBACCBBAADCBACBCCBBAAbbDCBACBCCBBAAbbDCAbCBBACCBBAAbbccDCAbCBBACCBBAAbbccDCbcAbCBBADDCCBBAAbbccDCbcAbCBBADDCCBBAAbbccEDbcAbDCCBBA";
-  }
-$ELSE
-  {
-    $RETURN "ABABBBbBABBBbBABBBCBcBbBABBBCBcBbbABBBCBDBdBcBbBABBBCBDBeBdBcBbBABBBCBDBeBdBcBbBABBBCBDBEBfBeBdBcBbBABBBCBDBEBfBeBdBcBbBABBBCBDBEBFBgBfBeBdBcBbBABBBCBDBEBFBbAbAABcbbAABcbbAABBCdccbbAABBCdccbbAABBCCDeddccbbAABBCCDeddccbbAABBCCDDEfeeddccbbAABBCCDDEfeeddccbbAABBCCDDEEFgffeeddccbbAABBCCDDEEFgffeeddccbbAABBCCDDEEFFGAAAAbABAAAbACABAAAbACABAAAbAbADACABAAAbAcADACABAAAbAcAdAEADACABAAAbAcAdAEADACABAAAbAcAdAeAFAEADACABAAAbAcAdAeAFAEADACABAAAbAcAdAeAfAGAFAEADACABAAAbAcAdAeAfABBBBAACCBBAACCBBAAbbDDCCBBAAbbDDCCBBAAbbccEEDDCCBBAAbbccEEDDCCBBAAbbccddFFEEDDCCBBAAbbccddFFEEDDCCBBAAbbccddeeGGFFEEDDCCBBAAbbccddeeGGFFEEDDCCBBAAbbccddeeff";
-  };
[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", "", "=", $DelimitedStringSubstring(levelTbl, 1));
-				$SkillAdj($CharacterContext(), "Save Vs PP", "", "=", $DelimitedStringSubstring(levelTbl, 2));
-				$SkillAdj($CharacterContext(), "Save Vs PPDM", "", "=", $DelimitedStringSubstring(levelTbl, 4));
-				$SkillAdj($CharacterContext(), "Save Vs RSW", "", "=", $DelimitedStringSubstring(levelTbl, 3));
-				$SkillAdj($CharacterContext(), "Save Vs SP", "", "=", $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
-$VAR skilled;
-$VAR mpc; $VAR mp;
-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");
-	};
-mpc = $GET_CHARACTER_SA($CharacterContext(),"charManaPointsCurrent");
-mp = $GET_CHARACTER_SA($CharacterContext(),"charManaPoints");
-//mp = $GET_CLASS_SA($ClassContext(),"charManaPoints");
-
-$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);
-$GrSet("ManaPool",425,270);
-$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 >=# 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));
-$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);
-
-skilled = $GET_CHARACTER_SA($CharacterContext(),"class_ThievingSkills");
-$IF (skilled != "-?-?-")
-	{
-		$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",""));
-	};
-
-//$GrMoveTo("ManaPool");
-//$GrColor("GREEN");$GrPrint("Mana Pool ");$GrColor("YELLOW");$GrPrint(mpc);$GrColor("GREEN");$GrPrint(" / ");$GrColor("YELLOW");$GrPrtLF(mp);
[FacingText] = $VAR sWidth;
-sWidth = $GET_CONFIG("Screen_Width");
-$SET_HOOK_PARAM(5,650);
-$SET_HOOK_PARAM(6,490);
-$IF (sWidth ==# 1024)
-	{
-		$SET_HOOK_PARAM(5,1030);
-		$SET_HOOK_PARAM(6,490);
-	};
-$RETURN;
[LocationText] = $VAR sWidth;
-sWidth = $GET_CONFIG("Screen_Width");
-$SET_HOOK_PARAM(5,440);
-$SET_HOOK_PARAM(6,275);
-$IF (sWidth ==# 1024)
-	{
-		$SET_HOOK_PARAM(5,620);
-		$SET_HOOK_PARAM(6,542);
-	};
-$SET_HOOK_PARAM(8,"Yellow");
-$RETURN;
[SearchingText] = $VAR look; $VAR sWidth;
-look = $GET_HOOK_PARAM(1);
-sWidth = $GET_CONFIG("Screen_Width");
-$SET_HOOK_PARAM(5,360);
-$SET_HOOK_PARAM(6,275);
-$IF (sWidth ==# 1024)
-	{
-		$SET_HOOK_PARAM(5,620);
-		$SET_HOOK_PARAM(6,522);
-	};
-$IF (look !=# "0"){$SET_HOOK_PARAM( 7,"Searching...");};
-$SET_HOOK_PARAM( 8, "Yellow" );
-$RETURN;
[TimeText] = $VAR p1; $VAR p2; $VAR p3; $VAR day; $VAR dayList; $VAR dow; $VAR sWidth;
-sWidth = $GET_CONFIG("Screen_Width");
-$SET_HOOK_PARAM(5,480);
-$SET_HOOK_PARAM(6,275);
-$IF (sWidth ==# 1024)
-	{
-		$SET_HOOK_PARAM(5,660);
-		$SET_HOOK_PARAM(6,542);
-	};
-p1 = $GET_HOOK_PARAM(1);
-p2 = $GET_HOOK_PARAM(2);
-p3 = $GET_HOOK_PARAM(3);
-dow = p1 %# 7;
-dayList = "$Sunday$Monday$Tuesday$Wednesday$Thursday$Friday$Saturday";
-day = $DelimitedStringSubstring(dayList, dow);
-$SET_HOOK_PARAM(8,"Yellow");
-$IF (p2 <# 13)
-	{
-		$IF (p2 ==# 0)
-			{
-				$IF (p3 <# 10)
-					{$SET_HOOK_PARAM(7,"12" + ":" + "0" + p3 + " am" + "  " + day);}
-				$ELSE
-					{$SET_HOOK_PARAM(7,"12" + ":" + p3 + " am" + "  " + day);};
-				$RETURN;
-			};
-		$IF (p2 <# 10)
-			{
-				$IF (p3 <# 10)
-					{$SET_HOOK_PARAM(7," " + p2 + ":" + "0" + p3 + " am" + "  " + day);}
-				$ELSE
-					{$SET_HOOK_PARAM(7," " + p2 + ":" + p3 + " am" + "  " + day);};
-				$RETURN;
-			};
-		$IF (p2 <# 12)
-			{
-				$IF (p3 <# 10)
-					{$SET_HOOK_PARAM(7,p2 + ":" + "0" + p3 + " am" + "  " + day);}
-				$ELSE
-					{$SET_HOOK_PARAM(7,p2 + ":" + p3 + " am" + "  " + day);};
-				$RETURN;
-			}
-		$ELSE
-			{
-				$IF (p3 <# 10)
-					{$SET_HOOK_PARAM(7,p2 + ":" + "0" + p3 + " pm" + "  " + day);}
-				$ELSE
-					{$SET_HOOK_PARAM(7,p2 + ":" + p3 + " pm" + "  " + day);};
-				$RETURN;
-			};
-	}
-$ELSE
-	{
-		$IF (p2 <# 22)
-			{
-				$IF (p3 <# 10)
-					{$SET_HOOK_PARAM(7," " + p2 %# 12 + ":" + "0" + p3 + " pm" + "  " + day);}
-				$ELSE
-					{$SET_HOOK_PARAM(7," " + p2 %# 12 + ":" + p3 + " pm" + "  " + day);};
-				$RETURN;
-			}
-		$ELSE
-			{
-				$IF (p3 <# 10)
-					{$SET_HOOK_PARAM(7,p2 %# 12 + ":" + "0" + p3 + " pm" + "  " + day);}
-				$ELSE
-					{$SET_HOOK_PARAM(7,p2 %# 12 + ":" + p3 + " pm" + "  " + day);};
-				$RETURN;
-			};
-	};
\(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 = IsAbolethEnslaved
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Enslaved by Aboleth");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $RETURN 0;
[IsCombatReady] = $RETURN "N";
\(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 = IsAided
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Aided");$SET_HOOK_PARAM( 6,"");$RETURN 1;
[Dispel] = $VAR ohp; $VAR mhp; $VAR tgt; $VAR hit; $VAR max;
-tgt = $IndexOf($TargetContext());
-ohp = $GET_CHARACTER_SA($TargetContext(),"tempAidOldHP");
-mhp = $GET_CHARACTER_SA($TargetContext(),"tempAidOldMaxHP");
-hit = $GET_CHAR_HITPOINTS(tgt);
-max = $GET_CHAR_MAXHITPOINTS(tgt);
-$SA_REMOVE();
-$IF (max ># mhp) {$SET_CHAR_MAXHITPOINTS(tgt,mhp);};
-$IF (hit ># ohp) {$SET_CHAR_HITPOINTS(tgt,ohp);};
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($AttackerContext(),"IsAided") != "-?-?-")
-  {$SET_HOOK_PARAM(6,$GET_HOOK_PARAM(6) -# 1);};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[StartCombatRound] = $VAR exp; $VAR ohp; $VAR mhp; $VAR tgt; $VAR hit; $VAR max;
-exp = $SA_PARAM_GET();
-tgt = $IndexOf($TargetContext());
-ohp = $GET_CHARACTER_SA($TargetContext(),"tempAidOldHP");
-mhp = $GET_CHARACTER_SA($TargetContext(),"tempAidOldMaxHP");
-hit = $GET_CHAR_HITPOINTS(tgt);
-max = $GET_CHAR_MAXHITPOINTS(tgt);
-$IF ($GET_PARTY_TIME() ># exp)
-	{
-		$SA_REMOVE();
-		$IF (max ># mhp) {$SET_CHAR_MAXHITPOINTS(tgt,mhp);};
-		$IF (hit ># ohp) {$SET_CHAR_HITPOINTS(tgt,ohp);};
-	};
\(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_COMBATANT_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";};
\(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_COMBATANT_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";};
\(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_COMBATANT_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_COMBATANT_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 = IsBlindPyrotechnics
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Blind");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsBlindPyrotechnics") != "-?-?-")
-  {$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";
[StartCombatRound] = $VAR exp; $VAR time;
-exp = $SA_PARAM_GET(); time = $GET_PARTY_TIME();
-$IF (time ># exp) {$DELETE_COMBATANT_SA($CombatantContext(),"IsBlindPyrotechnics");};
\(END)

\(BEGIN)
name = IsBlinking
[CanCastSpells] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"IsBlinking1");
-		$DELETE_COMBATANT_SA($CombatantContext(),"IsBlinking2");
-		$DELETE_CHARACTER_SA($CombatantContext(),"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 = IsBlinking1
[OnStartCombatantAction] = $SET_COMBATANT_SA($CombatantContext(),"IsBlinking2",1);
[StartCombatRound] = $DELETE_COMBATANT_SA($CombatantContext(),"IsBlinking2");
\(END)

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

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

\(BEGIN)
name = IsBrave
[Dispel] = $SA_REMOVE();
[DoesSpellAttackSucceed] = $VAR sav; $VAR rdm;
-sav = $SkillAdj($CharacterContext(),"Save Vs SO","","F","") -# 4;
-rdm = $RANDOM(20) +# 1;
-$IF ($GET_SPELL_SA($SpellContext(),"DamageMagical") == "fear")
-	{
-		$IF (sav <# rdm) {$RETURN "Y";}
-		$ELSE {$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 = IsCharmResistant
\(END)

\(BEGIN)
name = IsCharmResistantMin
\(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 = IsCloakDisplaced
[DoesAttackSucceed] = $IF ($GET_COMBATANT_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";};
\(END)

\(BEGIN)
name = IsColorBlind
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Blind");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_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";
[StartCombatRound] = $VAR prm; $VAR exp;
-prm = $SA_PARAM_GET(); exp = $GET_PARTY_TIME();
-$IF (prm ># exp){$RETURN $SA_REMOVE();};
\(END)

\(BEGIN)
name = IsColorSleep
[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";
[StartCombatRound] = $VAR prm; $VAR exp;
-prm = $SA_PARAM_GET(); exp = $GET_PARTY_TIME();
-$IF (prm ># exp){$RETURN $SA_REMOVE();};
\(END)

\(BEGIN)
name = IsColorStun
[AdjustInitiative] = $RETURN "9";
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Stunned");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[StartCombatRound] = $VAR prm; $VAR exp;
-prm = $SA_PARAM_GET(); exp = $GET_PARTY_TIME();
-$IF (prm ># exp){$RETURN $SA_REMOVE();};
\(END)

\(BEGIN)
name = IsCommanded
[AutoAction] = $RETURN "F" + $SA_PARAM_GET();
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Commanded");$SET_HOOK_PARAM( 6,"");$RETURN 1;
\(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($CombatantContext(),"IsConfused");
-		save = $SkillAdj($CombatantContext(), "Save Vs SP", "", "F", "");
-		rnd = $RANDOM(20) -# 1;
-		$IF (save <# rnd){$DELETE_COMBATANT_SA($CombatantContext(),"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 = IsConstricted
[CanCastSpells] = $VAR com;
-com = $IndexOf($CombatantContext());
-$IF ($GET_CHAR_HITPOINTS(com) <# 1) {$SA_REMOVE();$RETURN;};
-$RETURN "N";
[GetAdjMaxMovement] = $RETURN 0;
\(END)

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

\(BEGIN)
name = IsConstrictedOneArm
[CanCastSpells] = $VAR com;
-com = $IndexOf($CombatantContext());
-$IF ($GET_CHAR_HITPOINTS(com) <# 1) {$SA_REMOVE();$RETURN;};
-$RETURN "N";
[DoesAttackSucceed] = $IF (($GET_HOOK_PARAM(5) -# 3) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
[GetAdjMaxMovement] = $RETURN 0;
\(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_COMBATANT_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 = IsDarkBlinded
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Blind in the dark");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsDarkBlinded") != "-?-?-")
-  {$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 = IsDetectedEvil
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
\(END)

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

\(BEGIN)
name = IsDetectingCharms
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Detecting Charms"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

\(BEGIN)
name = IsDetectingEvil
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Detecting Evil"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

\(BEGIN)
name = IsDetectingGood
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Detecting Good"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

\(BEGIN)
name = IsDetectingIllusions
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Detecting Illusions"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

\(BEGIN)
name = IsDetectingLies
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Detecting Lies"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

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

\(BEGIN)
name = IsDetectingSecretDoors
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Detecting Secret Doors"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

\(BEGIN)
name = IsDetectingTraps
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Detecting Traps"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(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($TargetContext(),"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($TargetContext(), "IsDiseased");
-		$MODIFY_CHAR_ATTRIBUTE(tgt, CHA, $SA_CHARACTER_GET("diseasedCHA"), "MINUTES", 999999999, "reset due to Cure Diease", "SPELL Cure Disease");
-		$DELETE_CHARACTER_SA($TargetContext(), "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_COMBATANT_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_COMBATANT_SA($AttackerContext(),"CanDispel") != "-?-?-")
-			{
-				$CastSpellOnTargetAs($TargetContext(),"Banish",$AttackerContext());
-				$DELETE_COMBATANT_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_COMBATANT_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_COMBATANT_SA($AttackerContext(),"CanDispel") != "-?-?-")
-			{
-				$CastSpellOnTargetAs($TargetContext(),"Banish",$AttackerContext());
-				$DELETE_COMBATANT_SA($AttackerContext(),"CanDispel");
-				$RETURN;
-			};
-	};
-$IF ($GET_HOOK_PARAM(5) >=# $GET_HOOK_PARAM(6)){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = IsDisplaced
[DoesAttackSucceed] = $IF ($GET_COMBATANT_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";};
\(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 = IsDruidImmuneWoodlandCharm
[DoesSpellAttackSucceed] = $VAR me;
-me = $IndexOf($TargetContext());
-$IF ($SA_SPELL_GET("DamageMagical") != "charm"){$RETURN;};
-$IF ($GET_COMBATANT_SA($AttackerContext(),"IsWoodlandCreature") == "-?-?-") {$RETURN;};
-$SET_HOOK_PARAM(5,$GET_CHAR_NAME(me) +" is unaffected" );
-$RETURN "N";
\(END)

\(BEGIN)
name = IsDruidShapeChanger
[CanLayOrWhatever] = $VAR prevTime;
-$VAR curTime;
-$VAR elapsedTime;
-prevTime = $GET_CHARACTER_SA($CharacterContext(),"druidChangeTime");
-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, "SHAPE CHANGE" );
-$SET_HOOK_PARAM( 6, "0");
[LayOrWhatever] = $VAR curTime;
-curTime = $GET_PARTY_TIME();
-$SET_CHARACTER_SA($CharacterContext(),"druidChangeTime",curTime);
-$SET_HOOK_PARAM(1,"druidShapeChange");
-$RETURN "CastSpell";
\(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_COMBATANT_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 = IsFalseSeeing
[CanCastSpells] = $VAR rndm;
-rndm = $RANDOM(3);
-$IF (rndm ==# 0){$RETURN "N";};
[DoesAttackSucceed] = $VAR IFS; $VAR p5; $VAR p6;
-IFS = $GET_CHARACTER_SA($AttackerContext(),"IsFalseSeeing");
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-$IF (IFS == "-?-?-"){$RETURN;};
-$IF ((p5 -# 5) ># p6){$RETURN "Y";};
[StartCombatRound] = $VAR exp;
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() ># exp){$SA_REMOVE();};
\(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 = IsFieryCloudy
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Partially blinded by smoke"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $VAR p5; $VAR p6;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-$IF (p5 ># (p6 -# 4)) {$RETURN "Y";};
[OnEndCombat] = $SA_REMOVE();
-$DELETE_CHARACTER_SA($CombatantContext(),"FieryLevel"); $DELETE_CHARACTER_SA($CombatantContext(),"FierySave");
[StartCombatRound] = $VAR prm; $VAR rnd; $VAR lvl; $VAR tgt; $VAR hp; $VAR save; $VAR roll;
-prm = $SA_PARAM_GET(); rnd = $GetCombatRound(); lvl = $SA_CHARACTER_GET("FieryLevel"); roll = $RANDOM(20) +# 1;
-tgt = $IndexOf($TargetContext()); hp = $GET_CHAR_HITPOINTS(tgt); save = $SA_CHARACTER_GET("FierySave");
-$IF ((rnd -# prm) ==# 3) {$RETURN $SET_CHAR_HITPOINTS(tgt,hp -# (lvl /# 2));};
-$IF ((rnd -# prm) ==# 4) {$IF (roll <=# save) {$SA_REMOVE(); $RETURN $SET_CHAR_HITPOINTS(tgt,hp -# lvl);};};
-$IF ((rnd -# prm) ==# 5) {$IF (roll <=# save) {$SA_REMOVE(); $RETURN $SET_CHAR_HITPOINTS(tgt,hp -# (lvl /# 2));};};
\(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 = IsFloatingEyeHypnotized
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, $SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN "0";
[IsCombatReady] = $RETURN "N";
\(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 = IsGeasAttack
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Geased Attacking"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

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

\(BEGIN)
name = IsGreenSlimed
[StartCombatRound] = $VAR round;
-$VAR tgt;
-$VAR rnd;
-$VAR nRound;
-$IF ($GET_CHARACTER_SA($CharacterContext(),"IsGreenSlimed") != "-?-?-"){$RETURN;};
-round = $SA_PARAM_GET();
-rnd = $RANDOM(4) +# 1;
-nRound = $GetCombatRound();
-tgt = $IndexOf($TargetContext());
-$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 = IsHolyDeafened
[CanCastSpells] = $VAR rdm;
-rdm = $RANDOM(2);
-$IF (rdm ==# 1) {$RETURN "N";};
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Deagened"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[DoesAttackSucceed] = $VAR p5; $VAR p6;
-p5 = $GET_HOOK_PARAM(5) -# 2;
-p6 = $GET_HOOK_PARAM(6);
-$IF (p5 <=# p6) {$RETURN "N";};
[GetAdjMaxMovement] = $VAR p5;
-p5 = $GET_HOOK_PARAM(5);
-$RETURN p5 /# 4 *# 3;
[StartCombatRound] = $VAR exp;
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() ># exp){$SA_REMOVE();$RETURN;};
\(END)

\(BEGIN)
name = IsHolyStunned
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Stunned"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[DoesAttackSucceed] = $VAR p5; $VAR p6;
-p5 = $GET_HOOK_PARAM(5) -# 4;
-p6 = $GET_HOOK_PARAM(6);
-$IF (p5 <=# p6) {$RETURN "N";};
[GetAdjMaxMovement] = $VAR p5;
-p5 = $GET_HOOK_PARAM(5);
-$RETURN p5 /# 2;
[StartCombatRound] = $VAR exp;
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() ># exp){$SA_REMOVE();$RETURN;};
\(END)

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

\(BEGIN)
name = IsImmuneAcid
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Acid");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "acid") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "acid") {$RETURN 0;};
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsImmuneCold
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Cold");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "cold") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "cold") {$RETURN 0;};
[Dispel] = $SA_REMOVE();
\(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 = IsImmuneElectricity
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Electricity");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "electricity") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "electricity") {$RETURN 0;};
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsImmuneFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Fire");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "fire") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "fire") {$RETURN 0;};
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsImmuneNormalFire
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "fire"){$RETURN "N";};
-$IF ($SA_ITEM_GET("DamageNonMagical") == "fire"){$RETURN "N";};
-$IF ($SA_MONSTERTYPE_GET("DamageNonMagical") == "fire"){$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_COMBATANT_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 = IsImprovedInvisible
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $VAR p5; $VAR p6; $VAR iii;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-iii = $GET_COMBATANT_SA($TargetContext(),"IsImprovedInvisible");
-$IF (iii != "-?-?-"){p5 = p5 -# 4;};
-$IF (p5 >=# p6){$RETURN "Y";};
[DoesSpellAttackSucceed] = $VAR p5; $VAR p6; $VAR iii;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-iii = $GET_COMBATANT_SA($TargetContext(),"IsImprovedInvisible");
-$IF (iii != "-?-?-"){p5 = p5 -# 4;};
-$IF (p5 >=# p6){$RETURN "Y";};
[IsValidTarget] = $IF ($SA_COMBATANT_GET("IsSeeingInvisible") != "-?-?-"){$RETURN "Y";};
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsFaerieFire") != "-?-?-"){$RETURN;}
-$ELSE {$RETURN "N";};
[RemoveFireLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = IsInsane
[CanCastSpells] = $RETURN "N";
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $RETURN 0;
[IsCombatReady] = $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_COMBATANT_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_COMBATANT_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","");
-		dmg = $GET_CHAR_HITPOINTS(tgt) +# 10;
-		$RETURN dmg;
-	};
[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] = $RETURN;
[IsCombatReady] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET()){$RETURN $SA_REMOVE();};
-$RETURN "N";
\(END)

\(BEGIN)
name = IsLightBlinded
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Blind in the light");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsLightBlinded") != "-?-?-")
-  {$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 = IsManatRaySwallowed
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Swallowed by Manta Ray.");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $VAR exp; $VAR par; $VAR pen; $VAR par5; $VAR par6;
-exp = $GetCombatRound();
-par = $SA_PARAM_GET();
-pen = 6 -# (par -# exp);
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$IF ((par5 -# pen) ># par6) {$RETURN "Y";};
[OnStartCombatantAction] = $VAR atk; $VAR i; $VAR foes; $VAR alive;
-foes = $GET_COMBATANT_SA($Myself(),"monster_MantaRayLink");
-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;
-	};
-$IF (alive <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_MantaRaySwallowee");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_MantaRayLink");
-		$DELETE_CHARACTER_SA($Myself(),"IsHugged");
-	};
[StartCombatRound] = $VAR exp; $VAR par; $VAR tgt;
-exp = $GetCombatRound();
-par = $SA_PARAM_GET();
-tgt = $IndexOf($TargetContext());
-$IF ( par <# exp) {$SET_CHAR_STATUS(tgt,"2"); $SET_CHAR_HITPOINTS(tgt, "-11");};
\(END)

\(BEGIN)
name = IsMindFlayed
[StartCombatRound] = $VAR round;
-$VAR tgt;
-$VAR rnd;
-$VAR nRound;
-$IF ($GET_CHARACTER_SA($CharacterContext(),"IsMindFlayed") != "-?-?-"){$RETURN;};
-round = $SA_PARAM_GET();
-rnd = $RANDOM(4) +# 1;
-nRound = $GetCombatRound();
-tgt = $IndexOf($TargetContext());
-$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_COMBATANT_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_COMBATANT_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 = IsMonsterProtectedEvil
[DoesAttackSucceed] = $VAR p5; $VAR p6; $VAR smn; $VAR evl; $VAR prot;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-smn = $GET_COMBATANT_SA($AttackerContext(),"Summoned");
-evl = $GET_COMBATANT_SA($AttackerContext(),"monsterCombatantAlignment");
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsMonsterProtectedEvil") != "-?-?-")
-	{
-		$IF ((smn != "-?-?-") && (evl == "evil")){p6 = p6 +# 90;};
-		$IF ($AlignmentEvil($AttackerContext())){p6 = p6 +# 2;};
-	};
-$IF (p5 <=# p6){$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_COMBATANT_SA($TargetContext(),"IsMummyDiseased") == "-?-?-" && $SA_SPELL_GET("DamageMagical") == "raise")
-	{
-		$SA_REMOVE();
-		$RETURN "Y";
-	};
\(END)

\(BEGIN)
name = IsNereidBlind
[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";
[StartCombatRound] = $VAR exp; $VAR rnd;
-exp = $SA_PARAM_GET();
-rnd = $GetCombatRound();
-$IF (rnd >=# exp){$SA_REMOVE();$RETURN;};
\(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] = $VAR p5; $VAR p6; $VAR smn; $VAR evl;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-smn = $GET_COMBATANT_SA($AttackerContext(),"Summoned");
-evl = $GET_COMBATANT_SA($AttackerContext(),"monsterCombatantAlignment");
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsMonsterProtectedEvil") != "-?-?-")
-	{
-		$IF ((smn != "-?-?-") && (evl == "evil")){p6 = p6 +# 90;};
-		$IF ($AlignmentEvil($AttackerContext())){p6 = p6 +# 2;};
-	};
-$IF (p5 <=# p6){$RETURN "N";};
\(END)

\(BEGIN)
name = IsParalyzed
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Paralyzed");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[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";
[StartCombatRound] = $VAR exp;
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() ># exp) {$RETURN $SA_REMOVE();};
\(END)

\(BEGIN)
name = IsPeriaptImmuneDisease
[CharDisplayStatus] = $SET_HOOK_PARAM(7,"Immune to Disease");
-$SET_HOOK_PARAM(6,"");
-$RETURN 1;
[DoesSpellAttackSucceed] = $VAR spell;
-$VAR periapt;
-spell = $SA_SPELL_GET("DamageMagical");
-periapt = $GET_COMBATANT_SA($TargetContext(), "IsPeriaptImmuneDisease");
-$IF (spell == "electricity") {$IF (periapt == "immune") {$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
[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";
-	};
[StartCombatRound] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"AcidPoints");
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedAcidCaster1");
-		$RETURN $SA_REMOVE();
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedAcidCaster1",1);
\(END)

\(BEGIN)
name = IsProtectedAcidCaster1
[ComputeSpellDamage] = $VAR points;
-$VAR adj;
-$VAR dmg;
-$IF ($SA_SPELL_GET("DamageMagical") == "acid"){$RETURN;};
-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);
-		dmg = "0";
-	}
-$ELSE
-	{
-		$DELETE_CHARACTER_SA($TargetContext(),"AcidPoints");
-		$DELETE_CHARACTER_SA($TargetContext(),"IsProtectedAcidCaster");
-		$SA_REMOVE();
-		dmg = points +# adj;
-	};
-$RETURN dmg;
\(END)

\(BEGIN)
name = IsProtectedAcidTarget
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Acid");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
-$SkillAdj($TargetContext(),"Save Vs BR","protectionAcid","D","");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectionAcid","D","");
-$SkillAdj($TargetContext(),"Save Vs SP","protectionAcid","D","");
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "acid")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected.");
-		$RETURN "N";
-	};
[StartCombatRound] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedAcidTarget1");
-		$SA_REMOVE();
-		$SkillAdj($TargetContext(),"Save Vs BR","protectionAcid","D","");
-		$SkillAdj($TargetContext(),"Save Vs RSW","protectionAcid","D","");
-		$SkillAdj($TargetContext(),"Save Vs SP","protectionAcid","D","");
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedAcidTarget1",1);
\(END)

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

\(BEGIN)
name = IsProtectedEvil
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Protected from Evil"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[Dispel] = $SA_REMOVE();
-$SkillAdj($TargetContext(),"Save Vs BR","protectedEvil","D","");
-$SkillAdj($TargetContext(),"Save Vs PP","protectedEvil","D","");
-$SkillAdj($TargetContext(),"Save Vs PPDM","protectedEvil","D","");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectedEvil","D","");
-$SkillAdj($TargetContext(),"Save Vs SP","protectedEvil","D","");
[DoesAttackSucceed] = $VAR p5; $VAR p6; $VAR smn; $VAR evl;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-smn = $GET_COMBATANT_SA($AttackerContext(),"Summoned");
-evl = $GET_COMBATANT_SA($AttackerContext(),"monsterCombatantAlignment");
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsMonsterProtectedEvil") != "-?-?-")
-	{
-		$IF ((smn != "-?-?-") && (evl == "evil")){p6 = p6 +# 90;};
-		$IF ($AlignmentEvil($AttackerContext())){p6 = p6 +# 2;};
-	};
-$IF (p5 <=# p6){$RETURN "N";};
\(END)

\(BEGIN)
name = IsProtectedFireCaster
[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";
-	};
[StartCombatRound] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"FirePoints");
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedFireCaster1");
-		$RETURN $SA_REMOVE();
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedFireCaster1",1);
\(END)

\(BEGIN)
name = IsProtectedFireCaster1
[ComputeSpellDamage] = $VAR points;
-$VAR adj;
-$VAR dmg;
-$IF ($SA_SPELL_GET("DamageMagical") != "fire"){$RETURN;};
-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);
-		dmg = "0";
-	}
-$ELSE
-	{
-		$DELETE_CHARACTER_SA($TargetContext(),"FirePoints");
-		$DELETE_CHARACTER_SA($TargetContext(),"IsProtectedFireCaster");
-		$SA_REMOVE();
-			dmg = points +# adj;
-	};
-$RETURN dmg;
\(END)

\(BEGIN)
name = IsProtectedFireTarget
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Fire");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
-$SkillAdj($TargetContext(),"Save Vs BR","protectedFire","D","");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectedFire","D","");
-$SkillAdj($TargetContext(),"Save Vs SP","protectedFire","D","");
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "fire")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected.");
-		$RETURN "N";
-	};
[StartCombatRound] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedFireTarget1");
-		$SA_REMOVE();
-		$SkillAdj($TargetContext(),"Save Vs BR","protectedFire","D","");
-		$SkillAdj($TargetContext(),"Save Vs RSW","protectedFire","D","");
-		$SkillAdj($TargetContext(),"Save Vs SP","protectedFire","D","");
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedFireTarget1",1);
\(END)

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

\(BEGIN)
name = IsProtectedGood
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Protected from Good"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[Dispel] = $SA_REMOVE();
-$SkillAdj($TargetContext(),"Save Vs BR","protectedGood","D","");
-$SkillAdj($TargetContext(),"Save Vs PP","protectedGood","D","");
-$SkillAdj($TargetContext(),"Save Vs PPDM","protectedGood","D","");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectedGood","","");
-$SkillAdj($TargetContext(),"Save Vs SP","protectedGood","D","");
[DoesAttackSucceed] = $VAR p5; $VAR p6; $VAR smn; $VAR gd;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-smn = $GET_COMBATANT_SA($AttackerContext(),"Summoned");
-gd = $GET_COMBATANT_SA($AttackerContext(),"monsterCombatantAlignment");
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsMonsterProtectedEvil") != "-?-?-")
-	{
-		$IF ((smn != "-?-?-") && (gd == "good")){p6 = p6 +# 90;};
-		$IF ($AlignmentEvil($AttackerContext())){p6 = p6 +# 2;};
-	};
-$IF (p5 <=# p6){$RETURN "N";};
\(END)

\(BEGIN)
name = IsProtectedLightningCaster
[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";
-	};
[StartCombatRound] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"LightningPoints");
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedLightningCaster1");
-		$RETURN $SA_REMOVE();
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedLightningCaster1",1);
\(END)

\(BEGIN)
name = IsProtectedLightningCaster1
[ComputeSpellDamage] = $VAR points;
-$VAR adj;
-$VAR dmg;
-$IF ($SA_SPELL_GET("DamageMagical") != "electricity"){$RETURN;};
-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);
-		dmg = "0";
-	}
-$ELSE
-	{
-		$DELETE_CHARACTER_SA($TargetContext(),"ZapPoints");
-		$DELETE_CHARACTER_SA($TargetContext(),"IsProtectedLightningCaster");
-		$SA_REMOVE();
-		dmg = points +# adj;
-	};
-$RETURN dmg;
\(END)

\(BEGIN)
name = IsProtectedLightningTarget
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Lightning");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
-$SkillAdj($TargetContext(),"Save Vs BR","protectedLightning","D","");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectedLightning","D","");
-$SkillAdj($TargetContext(),"Save Vs SP","protectedLightning","D","");
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageNonMagical") == "electricity")
-	{
-		$SET_HOOK_PARAM(5,$GET_CHAR_NAME($IndexOf($TargetContext())) +" is unaffected.");
-		$RETURN "N";
-	};
[StartCombatRound] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedLightningTarget1");
-		$SA_REMOVE();
-		$SkillAdj($TargetContext(),"Save Vs BR","protectedLightning","D","");
-		$SkillAdj($TargetContext(),"Save Vs RSW","protectedLightning","D","");
-		$SkillAdj($TargetContext(),"Save Vs SP","protectedLightning","D","");
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedLightningTarget1",1);
\(END)

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

\(BEGIN)
name = IsProtectedPoisonCaster
[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";
-	};
[StartCombatRound] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_CHARACTER_SA($CharacterContext(),"PoisonPoints");
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedPoisonCaster1");
-		$RETURN $SA_REMOVE();
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedPoisonCaster1",1);
\(END)

\(BEGIN)
name = IsProtectedPoisonCaster1
[ComputeSpellDamage] = $VAR points;
-$VAR adj;
-$VAR dmg;
-$IF ($SA_SPELL_GET("DamageMagical") != "poison"){$RETURN;};
-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);
-		dmg = "0";
-	}
-$ELSE
-	{
-		$DELETE_CHARACTER_SA($TargetContext(),"PoisonPoints");
-		$DELETE_CHARACTER_SA($TargetContext(),"IsProtectedPoisonCaster");
-		$SA_REMOVE();
-		dmg = points +# adj;
-	};
-$RETURN dmg;
\(END)

\(BEGIN)
name = IsProtectedPoisonTarget
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Protected from Poison");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[Dispel] = $SA_REMOVE();
[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";
-	};
[StartCombatRound] = $IF ($GET_PARTY_TIME() ># $SA_PARAM_GET())
-	{
-		$DELETE_COMBATANT_SA($CharacterContext(),"IsProtectedPoisonTarget1");
-		$SA_REMOVE();
-	};
[spawn] = $SET_COMBATANT_SA($Myself(),"IsProtectedPoisonTarget1",1);
\(END)

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

\(BEGIN)
name = IsRedUrchinSleeping
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Sleeping");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $RETURN "Y";
[GetAdjMaxMovement] = $RETURN 0;
[GetItemTargetHitBonus] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 15;
[IsCombatReady] = $RETURN "N";
[StartCombatRound] = $VAR exp; $VAR rnd;
-exp = $SA_PARAM_GET();
-rnd = $GetCombatRound();
-$IF (rnd >=# exp) {$RETURN $SA_REMOVE();};
\(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 = IsResistantAcid
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Acid Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "acid") {$RETURN par5 /# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "acid") {$RETURN par5 /# 2;};
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsResistantCold
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Cold Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "cold") {$RETURN par5 /# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "cold") {$RETURN par5 /# 2;};
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsResistantElectricity
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Electricity Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "electricity") {$RETURN par5 /# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "electricity") {$RETURN par5 /# 2;};
[Dispel] = $SA_REMOVE();
\(END)

\(BEGIN)
name = IsResistantFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Fire Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "fire") {$RETURN par5 /# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "fire") {$RETURN par5 /# 2;};
[Dispel] = $SA_REMOVE();
\(END)

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

\(BEGIN)
name = IsSIlverUrchinCatatonic
[CanCastSpells] = $RETURN "N";
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Catatonic");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $RETURN "Y";
[GetAdjMaxMovement] = $RETURN 0;
[GetItemTargetHitBonus] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 15;
[IsCombatReady] = $RETURN "N";
[StartCombatRound] = $VAR exp; $VAR rnd;
-exp = $SA_PARAM_GET();
-rnd = $GET_PARTY_DAYS();
-$IF (rnd >=# exp) {$RETURN $SA_REMOVE();};
\(END)

\(BEGIN)
name = IsSeeingAstral
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Seeing Astral"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

\(BEGIN)
name = IsSeeingDisplaced
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Seeing Displaced"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[StartCombatRound] = $VAR dis;
-dis = $GET_COMBATANT_SA($TargetContext(),"displaceMiss");
-$IF (dis == "-?-?-"){$SET_COMBATANT_SA($TargetContext(),"displaceMiss",1);};
\(END)

\(BEGIN)
name = IsSeeingEthereal
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Seeing Ethereal"); $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_COMBATANT_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 = 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 = IsStingRayParalyzed
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Paralyzed");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[DoesAttackSucceed] = $IF ($GET_COMBATANT_SA($TargetContext(),"IsStingRayParalyzed") != "-?-?-") {$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";
[StartCombatRound] = $VAR par; $VAR rnd;
-par = $SA_PARAM_GET();
-rnd = $GetCombatRound();
-$IF (rnd ># par) {$SA_REMOVE();};
\(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 = IsStrangleWeeded
[CanCastSpells] = $RETURN "N";
[GetAdjMaxMovement] = $RETURN 0;
[StartCombatRound] = $VAR tgt; $VAR par; $VAR hp; $VAR str; $VAR roll;
-tgt = $IndexOf($CombatantContext());
-par = $SA_PARAM_GET();
-hp = $GET_CHAR_HITPOINTS(tgt);
-str = $GET_CHAR_LIMITED_STR(tgt);
-roll = $RANDOM(20) +# 1;
-$IF (par ># str) {$RETURN $SET_CHAR_HITPOINTS(tgt,hp -# par +# str);};
-$IF ((str -# par) ># roll)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"StrangleLink");
-		$DELETE_CHARACTER_SA($CombatantContext(),"monster_StrangleWeedConstricted");
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = IsStuckInMud
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Stuck in Mud");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[ComputeDamage] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 1;
[Dispel] = $SA_REMOVE();
[GetAdjMaxMovement] = $RETURN "0";
[IsCombatReady] = $RETURN "N";
\(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_COMBATANT_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 = IsSymbolFeared
[AutoAction] = $VAR atk;
-atk = $SA_PARAM_GET();
-$RETURN "F" + atk;
\(END)

\(BEGIN)
name = IsSymbolFearedDone
[StartCombatRound] = $VAR exp;
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() ># exp)
-	{$SA_REMOVE(); $DELETE_COMBATANT_SA($CombatantContext(),"IsSymbolFeared");};
\(END)

\(BEGIN)
name = IsSymbolHopelessnessed
[AutoAction] = $VAR atk;
-atk = $SA_PARAM_GET();
-$RETURN "F" + atk;
\(END)

\(BEGIN)
name = IsSymbolHopelessnessedDone
[StartCombatRound] = $VAR exp;
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() ># exp)
-	{$SA_REMOVE(); $DELETE_COMBATANT_SA($CombatantContext(),"IsSymbolHopelessnessed");};
\(END)

\(BEGIN)
name = IsSymbolInsaned
[AutoAction] = $VAR atk;
-atk = $SA_PARAM_GET();
-$RETURN "F" + atk;
\(END)

\(BEGIN)
name = IsSymbolInsanedDone
[StartCombatRound] = $VAR exp;
-exp = $SA_PARAM_GET();
-$IF ($GET_PARTY_TIME() ># exp)
-	{$SA_REMOVE(); $DELETE_COMBATANT_SA($CombatantContext(),"IsSymbolInsaned");};
\(END)

\(BEGIN)
name = IsSymbolPained
[DoesAttackSucceed] = $VAR p5;
-p5 = $GET_HOOK_PARAM(5);
-$RETURN p5 -# 4;
[StartCombatRound] = $VAR exp; $VAR tgt;
-exp = $SA_PARAM_GET(); tgt = $IndexOf($TargetContext());
-$IF ($GET_PARTY_TIME() ># exp){$SA_REMOVE();$REMOVE_CHAR_MODIFICATION(tgt,"Symbol of Pain");};
\(END)

\(BEGIN)
name = IsSymbolPersuaded
[StartCombatRound] = $VAR me; $VAR exp; $VAR sd; $VAR fsd;
-me = $IndexOf($CombatantContext());
-exp = $SA_PARAM_GET();
-sd = $GET_COMBATANT_SA($Myself(),"side");
-$IF (sd ==# 1){fsd = "2";};
-$IF (sd ==# 2){fsd = "1";};
-$IF ($GET_PARTY_TIME() ># exp){$SA_REMOVE();$SetFriendly(me,fsd);};
\(END)

\(BEGIN)
name = IsWebbed
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Stuck in Webbing");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[ComputeDamage] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 1;
[Dispel] = $SA_REMOVE();
[DoesAttackSucceed] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "fire") 
-	{
-		$SA_REMOVE();
-		$DELETE_CHARACTER_SA($Myself(),"IsWebbedTime");
-	};
[DoesSpellAttackSucceed] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "fire")
-	{
-		$SA_REMOVE();
-		$DELETE_CHARACTER_SA($Myself(),"IsWebbedTime");
-	};
[GetAdjMaxMovement] = $RETURN "0";
[IsCombatReady] = $VAR exp; $VAR chr; $VAR str; $VAR rnd;
-exp = $SA_PARAM_GET();
-chr = $MyIndex();
-str = $GET_CHAR_LIMITED_STR(chr);
-rnd = $SA_CHARACTER_GET("IsWebbedTime");
-$IF (str ># 12 && str <# 18) 
-	{
-		$IF ($GET_PARTY_TIME() >=# (rnd +# 10))
-			{
-				$SA_REMOVE();
-				$DELETE_CHARACTER_SA($Myself(),"IsWebbedTime");
-				$RETURN "Y";
-			};
-	};
-$IF (str ># 17) 
-	{
-		$IF ($GET_PARTY_TIME() >=# (rnd +# 1))
-			{
-				$SA_REMOVE();
-				$DELETE_CHARACTER_SA($Myself(),"IsWebbedTime");
-				$RETURN "Y";
-			};
-	};
-$IF ($GET_PARTY_TIME() >=# exp) {$SA_REMOVE(); $RETURN "Y";}
-$ELSE {$RETURN "N";};
[StartCombatRound] = $VAR time; $VAR now; $VAR n; $VAR rnd; $VAR tgt;
-time = $SA_CHARACTER_GET("IsWebbedTime");
-now = $GET_PARTY_TIME();
-n = "10";
-rnd = $RANDOM(20);
-tgt = $MyIndex();
-$IF (now -# time ># n)
-	{
-		$IF (((now -# time) %# n ==# 0) && (rnd ==# 0))
-			{
-				$SET_CHAR_HITPOINTS(tgt,-11);
-				$SET_CHAR_STATUS(tgt,"2");
-			};
-	};
\(END)

\(BEGIN)
name = IsWithered
[DoesAttackSucceed] = $VAR p5;
-p5 = $GET_HOOK_PARAM(5);
-$RETURN p5 -# 4;
\(END)

\(BEGIN)
name = IsYellowUrchinParalyzed
[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";
[StartCombatRound] = $VAR exp; $VAR rnd;
-exp = $SA_PARAM_GET();
-rnd = $GetCombatRound();
-$IF (rnd >=# exp) {$RETURN $SA_REMOVE();};
\(END)

\(BEGIN)
name = JoinParty
[JoinParty] = $VAR spellbook; $VAR schoolBook;
-$FUNC MemorizeLevel(levelBook)
-	{
-		$VAR spellName;
-		levelBook = $DelimitedStringTail(levelBook);
-		$WHILE (levelBook)
-			{
-				spellName = $DelimitedStringHead(levelBook);
-				levelBook = $DelimitedStringTail(levelBook);
-				spellName = $DelimitedStringHead(spellName);
-				$SelectSpell($CharacterContext(),spellName);
-			};
-	} MemorizeLevel;
-$FUNC MemorizeSchool(schoolBook)
-	{
-		$VAR levelBook;
-		$DEBUG("school spells = " + schoolBook);
-		// Discard the school ID
-		schoolBook = $DelimitedStringTail(schoolBook);
-		$WHILE (schoolBook)
-			{
-				levelBook = $DelimitedStringHead(schoolBook);
-				MemorizeLevel(levelBook);
-				schoolBook = $DelimitedStringTail(schoolBook);
-			};
-	} MemorizeSchool;
-spellbook = $GET_SPELLBOOK($CharacterContext(),"%@#&");
-$WHILE (spellbook)
-	{
-		schoolBook = $DelimitedStringHead(spellbook);
-		MemorizeSchool(schoolBook);
-		spellbook = $DelimitedStringTail(spellbook);
-	};
-$Memorize($CharacterContext());
\(END)

\(BEGIN)
name = SpecialGraphics
[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl$CompassDisplay] = $VAR sWidth; $VAR face;
-$IF ($GET_EVENT_Attribute(0,"NoCompass") != "-?-?-") {$RETURN;};
-sWidth = $GET_CONFIG("Screen_Width");
-face = $GET_PARTY_FACING();
-$IF (sWidth ==# 640)
-	{
-		$SET_HOOK_PARAM( 3, "border_Compass.png" );
-		$SET_HOOK_PARAM( 4, 272 );
-		$SET_HOOK_PARAM( 5, 263 );
-		$SET_HOOK_PARAM( 6, 78 *# face );
-		$SET_HOOK_PARAM( 7, 0 );
-		$SET_HOOK_PARAM( 8, 78 );
-		$SET_HOOK_PARAM( 9, 46 );
-	};
-$IF (sWidth ==# 1024)
-	{
-		$SET_HOOK_PARAM( 3, "border_Compass.png" );
-		$SET_HOOK_PARAM( 4, 512 );
-		$SET_HOOK_PARAM( 5, 520 );
-		$SET_HOOK_PARAM( 6, 78 *# face );
-		$SET_HOOK_PARAM( 7, 0 );
-		$SET_HOOK_PARAM( 8, 78 );
-		$SET_HOOK_PARAM( 9, 46 );
-	};
\(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 = SymbolOfFear
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR rndm; $VAR exp;
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-rndm = ($RANDOM(4) +# $RANDOM(4) +# $RANDOM(4) +# 3) *# 10; exp = $GET_PARTY_TIME() +# rndm;
-$AURA_Create("SymbolOfFearAURA","",atk,tgt,exp);
\(END)

\(BEGIN)
name = SymbolOfFearAURA
[AURA_Create] = $AURA_Attach("XY");
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,15,0,360);
-$AURA_Spell("Symbol Of Fear");
-$AURA_Wavelength("Visible");
[AURA_Enter] = $VAR IR; $VAR atk; $VAR exp;
-atk = $AURA_GetData(0); exp = $AURA_GetData(2);
-$SET_COMBATANT_SA($CombatantContext(),"IsSymbolFeared",atk);
-$SET_COMBATANT_SA($CombatantContext(),"IsSymbolFearedDone",exp);
\(END)

\(BEGIN)
name = SymbolOfHopelessness
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR rndm; $VAR exp;
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-rndm = ($RANDOM(4) +# $RANDOM(4) +# $RANDOM(4) +# 3) *# 10; exp = $GET_PARTY_TIME() +# rndm;
-$AURA_Create("SymbolOfHopelessnessAURA","",atk,tgt,exp);
\(END)

\(BEGIN)
name = SymbolOfHopelessnessAURA
[AURA_Create] = $AURA_Attach("XY");
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,15,0,360);
-$AURA_Spell("Symbol Of Hopelessness");
-$AURA_Wavelength("Visible");
[AURA_Enter] = $VAR IR; $VAR atk; $VAR exp;
-atk = $AURA_GetData(0); exp = $AURA_GetData(2);
-$SET_COMBATANT_SA($CombatantContext(),"IsSymbolHopelessnessed",atk);
-$SET_COMBATANT_SA($CombatantContext(),"IsSymbolHopelessnessedDone",exp);
\(END)

\(BEGIN)
name = SymbolOfInsanity
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR rndm; $VAR exp;
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-rndm = ($RANDOM(4) +# $RANDOM(4) +# $RANDOM(4) +# 3) *# 10; exp = $GET_PARTY_TIME() +# rndm;
-$AURA_Create("SymbolOfInsanityAURA","",atk,tgt,exp);
\(END)

\(BEGIN)
name = SymbolOfInsanityAURA
[AURA_Create] = $AURA_Attach("XY");
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,15,0,360);
-$AURA_Spell("Symbol Of Insanity");
-$AURA_Wavelength("Visible");
[AURA_Enter] = $VAR IR; $VAR atk; $VAR exp;
-atk = $AURA_GetData(0); exp = $AURA_GetData(2);
-$SET_COMBATANT_SA($CombatantContext(),"IsSymbolInsaned",atk);
-$SET_COMBATANT_SA($CombatantContext(),"IsSymbolInsanedDone",exp);
\(END)

\(BEGIN)
name = SymbolOfPain
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR rndm; $VAR exp;
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-rndm = ($RANDOM(10) +# $RANDOM(10) +# 2) *# 10; exp = $GET_PARTY_TIME() +# rndm;
-$AURA_Create("SymbolOfPainAURA","",atk,tgt,exp);
\(END)

\(BEGIN)
name = SymbolOfPainAURA
[AURA_Create] = $AURA_Attach("XY");
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,15,0,360);
-$AURA_Spell("Symbol Of Pain");
-$AURA_Wavelength("Visible");
[AURA_Enter] = $VAR tgt; $VAR exp; $VAR sd;
-tgt = $AURA_GetData(1); exp = $AURA_GetData(2);
-$SET_COMBATANT_SA($CombatantContext(),"IsSymbolPained",exp);
-$SetFriendly(tgt,$GET_COMBATANT_SA($Myself(),"side"));
\(END)

\(BEGIN)
name = SymbolOfPersuasion
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR rndm; $VAR exp;
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-rndm = ($RANDOM(20) +# 1) *# 10; exp = $GET_PARTY_TIME() +# rndm;
-$AURA_Create("SymbolOfPersuasionAURA","",atk,tgt,exp);
\(END)

\(BEGIN)
name = SymbolOfPersuasionAURA
[AURA_Create] = $AURA_Attach("XY");
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,15,0,360);
-$AURA_Spell("Symbol Of Persuasion");
-$AURA_Wavelength("Visible");
[AURA_Enter] = $VAR tgt; $VAR exp;
-tgt = $AURA_GetData(1); exp = $AURA_GetData(2);
-$SET_COMBATANT_SA($CombatantContext(),"IsSymbolPersuaded",exp);
\(END)

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

\(BEGIN)
name = Turn$SYS$
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
\(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;
-$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] = $IF ($GetCombatRound() ># 6){$AURA_Destroy();};
[AURA_Round] = $VAR exp; // expiration time
-exp = $GET_COMBATANT_SA($Myself(),"PaladinAura");
-$IF ($GetCombatRound() ># exp)
-	{
-		$AURA_Destroy();
-		$DELETE_COMBATANT_SA($Myself(),"PaladinAura");
-	};
\(END)

\(BEGIN)
name = baseclassWitch
[IsBaseclassAllowed] = $VAR par5;
-par5 = $GET_HOOK_PARAM(5);
-$IF (par5 != "F"){$RETURN "N";};
\(END)

\(BEGIN)
name = baseclassWizard
[IsBaseclassAllowed] = $VAR par5;
-par5 = $GET_HOOK_PARAM(5);
-$IF (par5 != "M"){$RETURN "N";};
\(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 nom;
-$VAR list;
-$VAR cls; // class of spell caster
-$VAR adj; // level modifier
-$VAR lvl; // level
-atk = $IndexOf($AttackerContext());
-nom = $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(nom,"monsterLevel");};
-$IF (cls == "item"){$RETURN adj;}
-$ELSE {$RETURN lvl;};
\(END)

\(BEGIN)
name = class_Assassin
\(END)

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

\(BEGIN)
name = class_Druid
[CharDisplayStatus] = $SET_HOOK_PARAM(7,"Immune to Woodland Creature Charm");
-$SET_HOOK_PARAM(6,"");
-$RETURN 1;
TrainingCharacter $VAR me;-*me = $IndexOf($CharacterContext());
-$IF ($GET_CHARACTER_SA($CharacterContext(),"IsDruidImmuneWoodlandCharm") != "-?-?-") {$RETURN;};
-$IF ($GET_CHAR_Lvl(me,"druid") ># 6)
-	{
-		$SET_CHARACTER_SA($CharacterContext(),"IsDruidImmuneWoodlandCharm","");
-		$SET_CHARACTER_SA($CharacterContext(),"IsDruidShapeChanger","");
-	};
\(END)

\(BEGIN)
name = class_MageScribe
[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";
-			};
-	};
[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");
[LearnSpells] = $VAR spl;
-spl = $GET_SPELL_SA($SpellContext(),"spellClass");
-$IF (spl != "-?-?-"){$RETURN "100";}
-$ELSE {$RETURN "0";};
[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);
-spl = $DelimitedStringSubstring(lvl,par6 -# 1);
-$IF (par4 == "I")
-	{
-		$IF (par6 ==# 0) {$RETURN;};
-		$SET_HOOK_PARAM(8,spl);
-		$SET_HOOK_PARAM(9,1);
-		$RETURN "1";
-	};
-$IF (par4 != "I")
-	{
-		$IF (par6 ==# 0) {$SET_HOOK_PARAM(8,1); $RETURN;};
-		$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");
TrainingCharacter = $VAR me; $VAR lvl;
-me = $IndexOf($CharacterContext());
-lvl = $GET_CHAR_Lvl(me,"magicUser");
-$IF ($GET_CHARACTER_SA($CharacterContext(),"class_NoSpells") == "-?-?-") {$RETURN;};
-$IF (lvl ># 0){$DELETE_CHARACTER_SA($CharacterContext(),"class_NoSpells");};
\(END)

\(BEGIN)
name = class_NoSpells
[CanCastSpells] = $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($CharacterContext(),"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 = 10080 /# 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($CharacterContext(),"paladinLayTime");
-curTime = $GET_PARTY_TIME();
-$IF(prevTime)  // First time fudge.
-{elapsedTime = curTime -# prevTime;}
-$ELSE{elapsedTime = 999;};
-$IF ((elapsedTime >= 0) && (elapsedTime <# 1440)) {$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");
-		$SkillAdj($CharacterContext(),"Save Vs BR","paladinProtEvil","-","2");
-		$SkillAdj($CharacterContext(),"Save Vs PP","paladinProtEvil","-","2");
-		$SkillAdj($CharacterContext(),"Save Vs PPDM","paladinProtEvil","-","2");
-		$SkillAdj($CharacterContext(),"Save Vs RSW","paladinProtEvil","-","2");
-		$SkillAdj($CharacterContext(),"Save Vs SP","paladinProtEvil","-","2");
-	};
[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");
-$SkillAdj($CharacterContext(),"Save Vs BR","paladinProtEvil","-","2");
-$SkillAdj($CharacterContext(),"Save Vs PP","paladinProtEvil","-","2");
-$SkillAdj($CharacterContext(),"Save Vs PPDM","paladinProtEvil","-","2");
-$SkillAdj($CharacterContext(),"Save Vs RSW","paladinProtEvil","-","2");
-$SkillAdj($CharacterContext(),"Save Vs SP","paladinProtEvil","-","2");
[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 = class_baseName
[PostCreateCharacter] = $SET_CHARACTER_SA($CharacterContext(), "class_baseName", $SA_PARAM_GET());
\(END)

\(BEGIN)
name = elemental_GrowthAcid
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Acid Growth");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesAttackSucceed] = $VAR tgt; $VAR tgtName; $VAR hp;
-$VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR grow;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {grow = item;};
-$IF (itmNon != "-?-?-") {grow = itmNon;};
-$IF (monster != "-?-?-") {grow = monster;};
-$IF (monNon != "-?-?-") {grow = monNon;};
-$IF (grow == "acid")
-	{
-		tgt = $IndexOf($TargetContext());
-		hp = $RANDOM(8) +# 1;
-		tgtName = $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(tgtName,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,tgtName +" grows.");
-		$RETURN "N";
-	};
[DoesSpellAttackSucceed] = $VAR tgt; $VAR tgtName; $VAR hp;
-$VAR spell; $VAR splNon; $VAR grow;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")) {$RETURN;};
-$IF (spell != "-?-?-") {grow = spell;};
-$IF (splNon != "-?-?-") {grow = splNon;};
-$IF (grow == "acid")
-	{
-		tgt = $IndexOf($TargetContext());
-		tgtName = $GET_CHAR_NAME(tgt);
-		hp = $RANDOM(8) +# 1;
-		$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(tgtName,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,tgtName +" grows.");
-		$RETURN "N";
-	};
\(END)

\(BEGIN)
name = elemental_GrowthCold
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Cold Growth");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesAttackSucceed] = $VAR tgt; $VAR tgtName; $VAR hp;
-$VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR grow;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {grow = item;};
-$IF (itmNon != "-?-?-") {grow = itmNon;};
-$IF (monster != "-?-?-") {grow = monster;};
-$IF (monNon != "-?-?-") {grow = monNon;};
-$IF (grow == "cold")
-	{
-		tgt = $IndexOf($TargetContext());
-		hp = $RANDOM(8) +# 1;
-		tgtName = $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(tgtName,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,tgtName +" grows.");
-		$RETURN "N";
-	};
[DoesSpellAttackSucceed] = $VAR tgt; $VAR tgtName; $VAR hp;
-$VAR spell; $VAR splNon; $VAR grow;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")) {$RETURN;};
-$IF (spell != "-?-?-") {grow = spell;};
-$IF (splNon != "-?-?-") {grow = splNon;};
-$IF (grow == "cold")
-	{
-		tgt = $IndexOf($TargetContext());
-		tgtName = $GET_CHAR_NAME(tgt);
-		hp = $RANDOM(8) +# 1;
-		$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(tgtName,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,tgtName +" grows.");
-		$RETURN "N";
-	};
\(END)

\(BEGIN)
name = elemental_GrowthElectricity
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Electrical Growth");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesAttackSucceed] = $VAR tgt; $VAR tgtName; $VAR hp;
-$VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR grow;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {grow = item;};
-$IF (itmNon != "-?-?-") {grow = itmNon;};
-$IF (monster != "-?-?-") {grow = monster;};
-$IF (monNon != "-?-?-") {grow = monNon;};
-$IF (grow == "electricity")
-	{
-		tgt = $IndexOf($TargetContext());
-		hp = $RANDOM(8) +# 1;
-		tgtName = $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(tgtName,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,tgtName +" grows.");
-		$RETURN "N";
-	};
[DoesSpellAttackSucceed] = $VAR tgt; $VAR tgtName; $VAR hp;
-$VAR spell; $VAR splNon; $VAR grow;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")) {$RETURN;};
-$IF (spell != "-?-?-") {grow = spell;};
-$IF (splNon != "-?-?-") {grow = splNon;};
-$IF (grow == "electricity")
-	{
-		tgt = $IndexOf($TargetContext());
-		tgtName = $GET_CHAR_NAME(tgt);
-		hp = $RANDOM(8) +# 1;
-		$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(tgtName,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,tgtName +" grows.");
-		$RETURN "N";
-	};
\(END)

\(BEGIN)
name = elemental_GrowthFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Fire Growth");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[DoesAttackSucceed] = $VAR tgt; $VAR tgtName; $VAR hp;
-$VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR grow;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {grow = item;};
-$IF (itmNon != "-?-?-") {grow = itmNon;};
-$IF (monster != "-?-?-") {grow = monster;};
-$IF (monNon != "-?-?-") {grow = monNon;};
-$IF (grow == "fire")
-	{
-		tgt = $IndexOf($TargetContext());
-		hp = $RANDOM(8) +# 1;
-		tgtName = $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(tgtName,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,tgtName +" grows.");
-		$RETURN "N";
-	};
[DoesSpellAttackSucceed] = $VAR tgt; $VAR tgtName; $VAR hp;
-$VAR spell; $VAR splNon; $VAR grow;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")) {$RETURN;};
-$IF (spell != "-?-?-") {grow = spell;};
-$IF (splNon != "-?-?-") {grow = splNon;};
-$IF (grow == "fire")
-	{
-		tgt = $IndexOf($TargetContext());
-		tgtName = $GET_CHAR_NAME(tgt);
-		hp = $RANDOM(8) +# 1;
-		$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(tgtName,"monsterLevel") +# 1);
-		$SET_HOOK_PARAM(5,tgtName +" grows.");
-		$RETURN "N";
-	};
\(END)

\(BEGIN)
name = elemental_ImmuneAcid
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Acid");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "acid") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "acid") {$RETURN 0;};
\(END)

\(BEGIN)
name = elemental_ImmuneCold
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Cold");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "cold") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "cold") {$RETURN 0;};
\(END)

\(BEGIN)
name = elemental_ImmuneElectricity
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Electricity");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "electricity") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "electricity") {$RETURN 0;};
\(END)

\(BEGIN)
name = elemental_ImmuneFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Fire");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "fire") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "fire") {$RETURN 0;};
\(END)

\(BEGIN)
name = elemental_ImmuneStone
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Earth and Stone"); $SET_HOOK_PARAM( 6, ""); $RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "stone") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "stone") {$RETURN 0;};
\(END)

\(BEGIN)
name = elemental_ImmuneWater
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Water");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "water") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "water") {$RETURN 0;};
\(END)

\(BEGIN)
name = elemental_ResistantAcid
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Acid Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "acid") {$RETURN par5 /# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "acid") {$RETURN par5 /# 2;};
\(END)

\(BEGIN)
name = elemental_ResistantCold
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Cold Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "cold") {$RETURN par5 /# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "cold") {$RETURN par5 /# 2;};
\(END)

\(BEGIN)
name = elemental_ResistantElectricity
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Electricity Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "electricity") {$RETURN par5 /# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "electricity") {$RETURN par5 /# 2;};
\(END)

\(BEGIN)
name = elemental_ResistantFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Fire Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "fire") {$RETURN par5 /# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "fire") {$RETURN par5 /# 2;};
\(END)

\(BEGIN)
name = elemental_SlowingAcid
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Acid Causes Slowing"); $SET_HOOK_PARAM( 6, ""); $RETURN 1;
[GetAdjMaxMovement] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon;
-$VAR spell; $VAR splNon; $VAR slow;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-") && (spell == "-?-?-") && (splNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {slow = item;};
-$IF (itmNon != "-?-?-") {slow = itmNon;};
-$IF (monster != "-?-?-") {slow = monster;};
-$IF (monNon != "-?-?-") {slow = monNon;};
-$IF (spell != "-?-?-") {slow = spell;};
-$IF (splNon != "-?-?-") {slow = splNon;};
-$IF (slow == "acid") {$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_SlowingCold
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Cold Causes Slowing");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[GetAdjMaxMovement] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon;
-$VAR spell; $VAR splNon; $VAR slow;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-") && (spell == "-?-?-") && (splNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {slow = item;};
-$IF (itmNon != "-?-?-") {slow = itmNon;};
-$IF (monster != "-?-?-") {slow = monster;};
-$IF (monNon != "-?-?-") {slow = monNon;};
-$IF (spell != "-?-?-") {slow = spell;};
-$IF (splNon != "-?-?-") {slow = splNon;};
-$IF (slow == "cold") {$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_SlowingElectricity
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Electricity Causes Slowing");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[GetAdjMaxMovement] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon;
-$VAR spell; $VAR splNon; $VAR slow;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-") && (spell == "-?-?-") && (splNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {slow = item;};
-$IF (itmNon != "-?-?-") {slow = itmNon;};
-$IF (monster != "-?-?-") {slow = monster;};
-$IF (monNon != "-?-?-") {slow = monNon;};
-$IF (spell != "-?-?-") {slow = spell;};
-$IF (splNon != "-?-?-") {slow = splNon;};
-$IF (slow == "electricity") {$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_SlowingFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Fire Causes Slowing");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[GetAdjMaxMovement] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon;
-$VAR spell; $VAR splNon; $VAR slow;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-") && (spell == "-?-?-") && (splNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {slow = item;};
-$IF (itmNon != "-?-?-") {slow = itmNon;};
-$IF (monster != "-?-?-") {slow = monster;};
-$IF (monNon != "-?-?-") {slow = monNon;};
-$IF (spell != "-?-?-") {slow = spell;};
-$IF (splNon != "-?-?-") {slow = splNon;};
-$IF (slow == "fire") {$RETURN $GET_HOOK_PARAM(5) /# 2;};
\(END)

\(BEGIN)
name = elemental_VulnerableAcid
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Vulnerable to Acid");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR vuln; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {vuln = item;};
-$IF (itmNon != "-?-?-") {vuln = itmNon;};
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "acid") {$RETURN par5 *# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR vuln; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {vuln = spell;};
-$IF (splNon != "-?-?-") {vuln = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "acid") {$RETURN par5 *# 2;};
\(END)

\(BEGIN)
name = elemental_VulnerableCold
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Vulnerable to Cold");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR vuln; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {vuln = item;};
-$IF (itmNon != "-?-?-") {vuln = itmNon;};
-$IF (monster != "-?-?-") {vuln = monster;};
-$IF (monNon != "-?-?-") {vuln = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "cold") {$RETURN par5 *# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR vuln; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {vuln = spell;};
-$IF (splNon != "-?-?-") {vuln = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "cold") {$RETURN par5 *# 2;};
\(END)

\(BEGIN)
name = elemental_VulnerableElectricity
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Vulnerable to Electricity");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR vuln; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {vuln = item;};
-$IF (itmNon != "-?-?-") {vuln = itmNon;};
-$IF (monster != "-?-?-") {vuln = monster;};
-$IF (monNon != "-?-?-") {vuln = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "electricity") {$RETURN par5 *# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR vuln; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {vuln = spell;};
-$IF (splNon != "-?-?-") {vuln = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "electricity") {$RETURN par5 *# 2;};
\(END)

\(BEGIN)
name = elemental_VulnerableFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Vulnerable to Fire");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR vuln; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $GET_CHARACTER_SA($AttackerContext(),"DamageMagical");
-monNon = $GET_CHARACTER_SA($AttackerContext(),"DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {vuln = item;};
-$IF (itmNon != "-?-?-") {vuln = itmNon;};
-$IF (monster != "-?-?-") {vuln = monster;};
-$IF (monNon != "-?-?-") {vuln = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "fire") {$RETURN par5 *# 2;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR vuln; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {vuln = spell;};
-$IF (splNon != "-?-?-") {vuln = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "fire") {$RETURN par5 *# 2;};
\(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($TargetContext(),"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_BowUse
[CanReady] = $VAR prm; $VAR mon;
-prm = $SA_PARAM_GET(); mon = $MonsterTypeContext();
-$IF (prm != mon){$RETURN "N";};
\(END)

\(BEGIN)
name = item_CloakOfDisplacement
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"IsCloakDisplaced",1);
-$SkillAdj($CharacterContext(),"Save Vs BR","cloak","-","2");
-$SkillAdj($CharacterContext(),"Save Vs PP","cloak","-","2");
-$SkillAdj($CharacterContext(),"Save Vs PPDM","cloak","-","2");
-$SkillAdj($CharacterContext(),"Save Vs RSW","cloak","-","2");
-$SkillAdj($CharacterContext(),"Save Vs SP","cloak","-","2");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(),"IsCloakDisplaced");
-$SkillAdj($CharacterContext(),"Save Vs BR","cloak","D","");
-$SkillAdj($CharacterContext(),"Save Vs PP","cloak","D","");
-$SkillAdj($CharacterContext(),"Save Vs PPDM","cloak","D","");
-$SkillAdj($CharacterContext(),"Save Vs RSW","cloak","D","");
-$SkillAdj($CharacterContext(),"Save Vs SP","cloak","D","");
\(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_DoubleVsUndead
[ComputeDamage] = $VAR tgt; $VAR p5;
-tgt = $IndexOf($TargetContext());
-p5 = $GET_HOOK_PARAM(5);
-$IF ($GET_CHAR_UNDEAD(tgt) != "none") {$RETURN p5 *# 2;};
\(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_GAuntletsDexterity
[OnReady] = $VAR tgt; $VAR dex; $VAR num;
-tgt = $IndexOf($CharacterContext());
-dex = $GET_CHAR_LIMITED_DEX(tgt);
-$IF (dex >=# 1) {num = 4;};
-$IF (dex >=# 7) {num = 2;};
-$IF (dex >=# 14) {num = 1;};
-$MODIFY_CHAR_ATTRIBUTE(tgt,"DEX",num, "MINUTES", 999999999, "gauntlets","ITEM Gauntlets Dexterity");
-$IF ($SkillAdj($CharacterContext(),"PickPockets","","F","") ># 0)
-	{$SkillAdj($CharacterContext(),"PickPockets","ITEM Gauntlets Dexterity","%","110");}
-$ELSE {$SkillAdj($CharacterContext(),"PickPockets","ITEM Gauntlets Dexterity","+","45");};
[OnUnReady] = $VAR tgt;
-tgt = $IndexOf($CharacterContext());
-$REMOVE_CHAR_MODIFICATION(tgt,"ITEM Gauntlets Dexterity");
-$SkillAdj($CharacterContext(),"PickPockets","ITEM Gauntlets Dexterity","D","");
\(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($CharacterContext());
-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",100 -# 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()) ==# 1){$RETURN par5 *# 2 +# 1;};
-$IF ($GET_MONSTERTYPE_SA(name,"subGiant") != "-?-?-"){$RETURN 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 atk;
-$VAR par5;
-$VAR adj;
-wpn = $GET_CHAR_Ready($AttackerContext(), "WEAPON", 0);
-atk = $IndexOf($AttackerContext());
-par5 = $GET_HOOK_PARAM(5);
-adj = 0;
-$IF ($GET_ITEM_SA(wpn,"item_FineWeapon") != "-?-?-")
-	{adj = $GET_CHAR_DAMAGEBONUS(atk);};
-$RETURN par5 +# 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 par5;
-$VAR adj;
-atk = $IndexOf($AttackerContext());
-wpn = $GET_CHAR_Ready($AttackerContext(), "WEAPON", 0);
-par5 = $GET_HOOK_PARAM(5);
-adj = 0;
-$IF ($GET_ITEM_SA(wpn,"item_FineWeapon") != "-?-?-")
-	{adj = $GET_CHAR_DAMAGEBONUS(atk);};
-$RETURN par5 +# 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(), "IsPeriaptImmuneDisease", "1");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(),"IsPeriaptImmuneDisease");
\(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 ($GET_COMBATANT_SA($TargetContext(),"IsImmunePoison") != "-?-?-"){$RETURN;};
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsProtectedPoisonCaster") != "-?-?-"){$RETURN;};
-$IF ($GET_COMBATANT_SA($TargetContext(),"IsProtectedPoisonTarget") != "-?-?-"){$RETURN;};
-$IF (par5 ># par6)
-	{
-		$SET_COMBATANT_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;
-$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);
-hit = par5;
-$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_RingOfAcidImmunity
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"elemental_ImmuneAcid", "");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(), "elemental_ImmuneAcid");
-$DELETE_CHARACTER_SA($CharacterContext(),"DispelLevelItem");
\(END)

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

\(BEGIN)
name = item_RingOfAcidVulnerability
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"elemental_VulnerableAcid", "");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(), "elemental_VulnerableAcid");
-$DELETE_CHARACTER_SA($CharacterContext(),"DispelLevelItem");
\(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_RingOfColdImmunity
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"elemental_ImmuneCold", "");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(), "elemental_ImmuneCold");
-$DELETE_CHARACTER_SA($CharacterContext(),"DispelLevelItem");
\(END)

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

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

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

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

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

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

\(BEGIN)
name = item_RingOfFireVulnerability
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"elemental_VulnerableFire", "");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(), "elemental_VulnerableFire");
-$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_RingOfelectricalVulnerability
[OnReady] = $SET_CHARACTER_SA($CharacterContext(),"elemental_VulnerableElectricity", "");
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevelItem","12");
[OnUnReady] = $DELETE_CHARACTER_SA($CharacterContext(), "elemental_VulnerableElectricity");
-$DELETE_CHARACTER_SA($CharacterContext(),"DispelLevelItem");
\(END)

\(BEGIN)
name = item_Scroll
[CanReady] = $VAR me; $VAR cls;
-me = $MyIndex(); cls = $SA_PARAM_GET();
-$IF (($GET_CHAR_Lvl(me,cls) <# 1) || ($GET_CHAR_Lvl(me,"thief")) <# 10){$RETURN "N";};
\(END)

\(BEGIN)
name = item_SwordUse
[CanReady] = $VAR prm; $VAR mon;
-prm = $SA_PARAM_GET(); mon = $MonsterTypeContext();
-$IF (prm != mon){$RETURN "N";};
\(END)

\(BEGIN)
name = item_VorpalLongSword
[ComputeDamage] = $VAR roll;
-$VAR tgt; // target
-$VAR nom;
-$VAR par5;
-$IF ($GET_HASVORPALIMMUNITY($TargetContext()) != ""){$RETURN;};
-roll = $GET_COMBATANT_SA($TargetContext(),"vorp");
-tgt = $IndexOf($TargetContext());
-nom = $GET_CHAR_NAME(tgt);
-par5 = $GET_HOOK_PARAM(5);
-$IF ($GET_MONSTERTYPE_SA(nom,"MetalOrStone") != "-?-?-"){roll = roll -# 2;};
-$IF ($GET_CHAR_SIZE(tgt) == 2){roll = roll -# 1;};
-$IF (roll ># 16)
-	{
-		$SET_HOOK_PARAM(7,nom +" is beheaded");
-		$RETURN (par5 +# 11);
-	};
[DoesAttackSucceed] = $VAR par5; $VAR par6;
-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_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 = monsterGreenhagNotSurprised
[AdjustInitiative] = $RETURN "-10";
\(END)

\(BEGIN)
name = monster_AbolethEnslave
[InvokeSpellOnTarget] = $IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-$SetFriendly($IndexOf($TargetContext()), $GET_COMBATANT_SA($Myself(),"side"));
-$SET_COMBATANT_SA($TargetContext(),"IsAbolethEnslaved","11");
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel","11");
\(END)

\(BEGIN)
name = monster_AuraDragon
[AURA_Create] = $VAR chr; // character
-chr = $AURA_GetData(0);
-$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 me; // sa's parameter
-me = $IndexOf($CharacterContext());
-$AURA_Create("monster_AuraDragon","",me,"","");
\(END)

\(BEGIN)
name = monster_AuraElectricEelDischarge
[AURA_Create] = $VAR chr;
-chr = $IndexOf($CharacterContext());
-$AURA_Attach("Combatant");
-$AURA_Combatant(chr);
-$AURA_Size(0,3,0,360);
-$AURA_Shape("AnnularSector");
-$AURA_Wavelength("Xray");
[AURA_Effect] = $VAR dst; $VAR dmg1; $VAR dmg2; $VAR dmg3; $VAR rnd; $VAR atk; $VAR tgt; $VAR hp;
-dmg1 = $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# 3; dmg2 = $RANDOM(8) +# $RANDOM(8) +# 2; dmg3 = $RANDOM(8) +# 1;
-rnd = $GetCombatRound(); atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-dst = $VisualDistance(atk,tgt); hp = $GET_CHAR_HITPOINTS(tgt);
-$IF (rnd  ==# "5")
-	{
-		$IF (dst ==# 1) {$RETURN $SET_CHAR_HITPOINTS(tgt,hp -# dmg1);};
-		$IF (dst ==# 2) {$RETURN $SET_CHAR_HITPOINTS(tgt,hp -# dmg2);};
-		$IF (dst ==# 3) {$RETURN $SET_CHAR_HITPOINTS(tgt,hp -# dmg3);};
-	};
[AURA_Round] = $VAR rnd;
-rnd = $GetCombatRound();
-$IF (rnd >=# "6") {$RETURN $AURA_Destroy();};
[CreateMonsterCombatant] = $VAR prm;
-prm = $SA_PARAM_GET();
-$AURA_Create("monster_AuraElectricEelDischarge",prm,0,0,0);
\(END)

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

\(BEGIN)
name = monster_AuraGiantElectricEelDischarge
[AURA_Create] = $VAR chr;
-chr = $IndexOf($CharacterContext());
-$AURA_Attach("Combatant");
-$AURA_Combatant(chr);
-$AURA_Size(0,3,0,360);
-$AURA_Shape("AnnularSector");
-$AURA_Wavelength("Xray");
[AURA_Effect] = $VAR dst; $VAR dmg1; $VAR dmg2; $VAR dmg3; $VAR rnd; $VAR atk; $VAR tgt; $VAR rndm; $VAR save; $VAR hp;
-dmg1 = $RANDOM(6) +# $RANDOM(6) +# $RANDOM(6) +# $RANDOM(6) +# $RANDOM(6) +# $RANDOM(6) +# 6;
-dmg2 = $RANDOM(6) +# $RANDOM(6) +# $RANDOM(6) +# $RANDOM(6) +# 4; dmg3 = $RANDOM(6) +# $RANDOM(6) +# 2;
-rnd = $GetCombatRound(); atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-dst = $VisualDistance(atk,tgt); rndm = $RANDOM(20) +# 1; save = $SkillAdj($CombatantContext(),"Save Vs PPDM","","F",0);
-hp = $GET_CHAR_HITPOINTS(tgt);
-$IF ((rnd %# 8)  ==# "0")
-	{
-		$IF (dst ==# 1)
-			{
-				$SET_CHAR_HITPOINTS(tgt,hp -# dmg1);
-				$IF (rndm <# save){$RETURN $SET_COMBATANT_SA($CombatantContext(),"IsStunned",dmg1);};
-			};
-		$IF (dst ==# 2)
-			{
-				$SET_CHAR_HITPOINTS(tgt,hp -# dmg2);
-				$IF ((rndm +# 1) <# save){$RETURN $SET_COMBATANT_SA($CombatantContext(),"IsStunned",dmg2);};
-			};
-		$IF (dst ==# 3)
-			{
-				$SET_CHAR_HITPOINTS(tgt,hp -# dmg3);
-				$IF ((rndm +# 2) <# save){$RETURN $SET_COMBATANT_SA($CombatantContext(),"IsStunned",dmg3);};
-			};
-	};
[AURA_Round] = $VAR rnd;
-rnd = $GetCombatRound();
-$IF (rnd >=# "6") {$RETURN $AURA_Destroy();};
[CreateMonsterCombatant] = $VAR prm;
-prm = $SA_PARAM_GET();
-$AURA_Create("monster_AuraGiantElectricEelDischarge",prm,0,0,0);
\(END)

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

\(BEGIN)
name = monster_AuraMummy
[AURA_Create] = $VAR chr; 
-chr = $AURA_GetData(0);
-$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);
-$IF ($SA_SOURCE_NAME() == $GET_CHAR_NAME(race)) {$RETURN;};
-save = $SkillAdj($CombatantContext(),"Save Vs PPDM","mummy","F",0);
-rndm = $RANDOM(20) +# 1;
-time = $AURA_GetData(1);
-$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 me; $VAR exp;
-me = $IndexOf($CharacterContext()); exp = $GET_PARTY_TIME() +# $RANDOM(4) +# 1;
-$AURA_Create("monster_AuraMummy","",me,exp,"");
\(END)

\(BEGIN)
name = monster_AuraNereidMesmerize
[AURA_Create] = $VAR chr;
-chr = $IndexOf($CharacterContext());
-$AURA_Attach("Combatant");
-$AURA_Combatant(chr);
-$AURA_Size(0,3,0,360);
-$AURA_Shape("AnnularSector");
-$AURA_Wavelength("Xray");
[AURA_Enter] = $VAR tgt; $VAR gndr;
-tgt = $IndexOf($TargetContext());
-gndr = $GET_CHAR_GENDER(tgt);
-$IF (gndr !=# "0") {$RETURN $SET_COMBATANT_SA($CombatantContext(),"IsStunned","");};
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsStunned");
[CreateMonsterCombatant] = $VAR prm;
-prm = $SA_PARAM_GET();
-$AURA_Create("monster_AuraNereidMesmerize",prm,0,0,0);
\(END)

\(BEGIN)
name = monster_AuraSeaHagFright
[AURA_Create] = $VAR chr;
-chr = $IndexOf($CharacterContext());
-$AURA_Attach("Combatant");
-$AURA_Combatant(chr);
-$AURA_Size(0,3,0,360);
-$AURA_Shape("AnnularSector");
-$AURA_Wavelength("Xray");
[AURA_Enter] = $VAR save; $VAR rndm; $VAR exp; $VAR tgt; $VAR str; $VAR strMod;
-$VAR adjStr; $VAR adjStrMod;
-save = $SkillAdj($CombatantContext(),"Save Vs SP","","F",0);
-rndm = $RANDOM(20) +# 1;
-exp = $GetCombatRound() +# $RANDOM(6) +# 1;
-tgt = $IndexOf($TargetContext());
-str = $GET_CHAR_LIMITED_STR(tgt);
-strMod = $GET_CHAR_LIMITED_STRMOD(tgt);
-adjStr = str /# 2;
-adjStrMod = 100 -# strMod;
-$IF (rndm <# save)
-	{
-		$MODIFY_CHAR_ATTRIBUTE(tgt,"STR",adjStr,"MINUTES",99,"","MONSTER Sea Hag Fright STR");
-		$IF (strMod != "") {$MODIFY_CHAR_ATTRIBUTE(tgt,"STRMOD",adjStrMod,"MINUTES",99,"","MONSTER Sea Hag Fright STRMOD");};
-		$RETURN $SET_COMBATANT_SA($CombatantContext(),"IsSeaHagWeakened",exp);
-	};
[CreateMonsterCombatant] = $VAR prm;
-prm = $SA_PARAM_GET();
-$AURA_Create("monster_AuraSeaHagFright",prm,0,0,0);
\(END)

\(BEGIN)
name = monster_AuraWhaleTailSmash
[AURA_Create] = $VAR chr;
-chr = $IndexOf($CharacterContext());
-$AURA_Attach("Combatant");
-$AURA_Combatant(chr);
-$AURA_Size(0,2,135,225);
-$AURA_Shape("AnnularSector");
-$AURA_Wavelength("Xray");
[AURA_Effect] = $VAR lvl; $VAR dmg; $VAR atk; $VAR tgt; $VAR rnd; $VAR dst; $VAR hp;
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext()); lvl = $SA_PARAM_GET(); rnd = $GetCombatRound();
-dst = $VisualDistance(atk,tgt); hp = $GET_CHAR_HITPOINTS(tgt);
-$IF (lvl ==# 7) {dmg = $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# 7;};
-$IF (lvl ==# 11) {dmg = $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# 11;};
-$IF (lvl ==# 15) {dmg = $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# 15;};
-$IF (lvl ==# 17) {dmg = $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# 17;};
-$IF (lvl ==# 20) {dmg = $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# $RANDOM(8) +# 20;};
-$IF ((rnd %# 16)  ==# "5") {$IF (dst ==# 1) {$SET_CHAR_HITPOINTS(tgt, hp -# dmg);};};
[CreateMonsterCombatant] = $VAR prm;
-prm = $SA_PARAM_GET();
-$AURA_Create("monster_AuraElectricEelDischarge",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_COMBATANT_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_COMBATANT_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_COMBATANT_SA($CharacterContext(),"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( $CombatantContext(), "monsterBeholderCharm" );
-$GIVE_CHAR_ITEM( $CombatantContext(), "monsterBeholderSleep" );
-$GIVE_CHAR_ITEM( $CombatantContext(), "monsterBeholderFleshToStone" );
-$GIVE_CHAR_ITEM( $CombatantContext(), "monsterBeholderFear" );
-$GIVE_CHAR_ITEM( $CombatantContext(), "monsterBeholderSlow" );
\(END)

\(BEGIN)
name = monster_CheetahNotSurprised
[AdjustInitiative] = $RETURN "-2";
\(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_CrysmalBluntWeapon
[DoesAttackSucceed] = $VAR par5; $VAR par6;
-par5 = $GET_HOOK_PARAM(5); par6 = $GET_HOOK_PARAM(6);
-$IF ($SA_ITEM_GET("item_WeaponType") == "blunt"){$SET_HOOK_PARAM(6,par6 -# 4);};
-$IF (par5 >=# par6){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = monster_CrysmalElectricalResistance
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Electricity Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "electricity") {$RETURN par5 /# 4;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "electricity") {$RETURN par5 /# 4;};
\(END)

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

\(BEGIN)
name = monster_DemodandSummonShaggyDemodand
[InvokeSpellOnTarget] = $VAR rdm; $VAR rd1; $VAR pct;
-pct = $RANDOM(100); rd1 = $RANDOM(8);
-$IF (pct >=# 60){$RETURN;};
-$WHILE (rd1 >=# 0) {$AddCombatant("Shaggy Deomdand|Shator",0); rd1 = rd1 -# 1;};
\(END)

\(BEGIN)
name = monster_DemodandSummonSlimeDemodand
[InvokeSpellOnTarget] = $VAR rdm; $VAR rd1; $VAR pct;
-pct = $RANDOM(100); rd1 = $RANDOM(2);
-$IF (pct >=# 50){$RETURN;};
-$WHILE (rd1 >=# 0) {$AddCombatant("Slime Demodand|Kelubar",0); rd1 = rd1 -# 1;};
\(END)

\(BEGIN)
name = monster_DemodandSummonTarryDemodand
[InvokeSpellOnTarget] = $VAR rdm; $VAR rd1; $VAR pct;
-pct = $RANDOM(100); rd1 = $RANDOM(2);
-$IF (pct >=# 50){$RETURN;};
-$WHILE (rd1 >=# 0) {$AddCombatant("Tarry Demodand|Farastu",0); rd1 = rd1 -# 1;};
\(END)

\(BEGIN)
name = monster_DispelInvisibility
[SpellLingeringScripts] = $VAR tgt; $VAR cLvl; $VAR dLvl; $VAR percent; $VAR rndm;
-tgt = $IndexOf($TargetContext());
-$IF ($SpellContext() != ("Improved Invisibility" || "Invisibility" || "Invisibility to Animals" || "Invisibility 10' Radius" || "Mass Invisibility" || "Invisibility to Animals|Ranger" || "Invisibility|Ranger" || "itemPotionInvisibility" || "Invisibility|MonsterOgreMage" || "Invisibility|MonsterMage" || "ImprovedInvisibility|MonsterIllusionist")){$RETURN;};
-$RUN_CHAR_SCRIPTS(tgt,"Dispel");
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
-$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 = monster_Displacement
[InvokeSpellOnTarget] = $SET_COMBATANT_SA($TargetContext(),"IsDisplaced","");
\(END)

\(BEGIN)
name = monster_DjinniAirResistance
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Air Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "air") {$RETURN par5 +# 1;};
[DoesAttackSucceed] = $IF (($GET_HOOK_PARAM(5) +# 1) <=# $GET_HOOK_PARAM(6)) {$RETURN "N";};
[DoesSpellAttackSucceed] = $IF (($GET_HOOK_PARAM(5) +# 1) <=# $GET_HOOK_PARAM(6)) {$RETURN "N";};
[GetAdjMaxMovement] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "air") {$RETURN par5 +# 1;};
\(END)

\(BEGIN)
name = monster_DolphinSave
[OnStartCombat] = $SkillAdj($CharacterContext(), "Save Vs BR", "", "-", "2");
-$SkillAdj($CharacterContext(), "Save Vs PP", "", "-", "2");
-$SkillAdj($CharacterContext(), "Save Vs PPDM", "", "-", "2");
-$SkillAdj($CharacterContext(), "Save Vs RSW", "", "-", "2");
-$SkillAdj($CharacterContext(), "Save Vs SP", "", "-", "2");
\(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", 100 -# 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
[ComputeDamage] = $IF ($GET_ITEM_SA($ItemContext(),"DamageMagical") == "fire")
-	{$RETURN $GET_HOOK_PARAM(5) /# 6 *# 5;};
[ComputeSpellDamage] = $IF ($GET_SPELL_SA($ItemContext(),"DamageMagical") == "fire")
-	{$RETURN $GET_HOOK_PARAM(5) /# 6 *# 5;};
[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);};
\(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_COMBATANT_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_COMBATANT_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_COMBATANT_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_EyeOfTheDeepStun
[InvokeSpellOnTarget] = $VAR rndm; $VAR exp;
-rndm = $RANDOM(4) +# $RANDOM(4) +# 2;
-exp = $GetCombatRound() +# rndm;
-$SET_COMBATANT_SA($TargetContext(),"IsStunned", exp);
\(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_COMBATANT_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($CombatantContext(),"monster_FireBatLink");
-i = $DelimitedStringCount(foes);
-alive = "0";
-$WHILE (i >=# 0)
-	{
-		atk = $DelimitedStringSubstring(foes,i);
-		$IF ($GET_CHAR_STATUS(atk) ==# 0){alive = alive +# 1;};
-		i = i -# 1;
-	};
-$IF (alive <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatDrainee");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_FireBatLink");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsHugged");
-	};
\(END)

\(BEGIN)
name = monster_FloatingEyeHypnotism
[InvokeSpellOnTarget] = $SET_COMBATANT_SA($TargetContext(),"IsFloatingEyeHypnotized","Hypnotyzed");
\(END)

\(BEGIN)
name = monster_GiantJellyfishParalyzation
[InvokeSpellOnTarget] = $SET_COMBATANT_SA($TargetContext(),"IsParalyzed","Paralyzed");
\(END)

\(BEGIN)
name = monster_GiantLampreyDrain
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[GetNumberOfAttacks] = $RETURN 0;
[OnStartCombatantAction] = $VAR tgt; $VAR nom; $VAR dmg;
-// Test Target and Compute & Apply Drain
-tgt = $GET_COMBATANT_SA($CombatantContext(),"monster_GiantLampreyLink");
-nom = $GET_CHAR_NAME(tgt);
-dmg = "10";
-$IF ($GET_CHAR_STATUS(tgt) ==# 0) 
-  {
-    $SET_CHAR_HITPOINTS(tgt, $GET_CHAR_HITPOINTS(tgt) -# dmg);
-    $IF ($GET_CHAR_HITPOINTS(tgt) <# 1)
-      {
-			$SET_CHAR_STATUS(tgt,1);
-			$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantLampreyDrain");
-			$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantLampreyLink");
-			$DELETE_CHARACTER_SA($Name(nom),"IsHugged");
-		};
-  }
-$ELSE
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantLampreyDrain");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantLampreyLink");
-		$DELETE_CHARACTER_SA($Name(nom),"IsHugged");
-	};
\(END)

\(BEGIN)
name = monster_GiantLampreyDrainBlood
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR link;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-// Attacker
-$SET_COMBATANT_SA($AttackerContext(),"monster_GiantLampreyDrain","");
-$SET_COMBATANT_SA($AttackerContext(),"monster_GiantLampreyLink",tgt);
-// Target
-$SET_COMBATANT_SA($TargetContext(),"monster_GiantLampreyDrainee","");
-$SET_COMBATANT_SA($TargetContext(),"IsHugged",1);
-// Link
-link = $GET_COMBATANT_SA($TargetContext(),"monster_GiantLampreyLink");
-$IF (link == "-?-?-"){$SET_COMBATANT_SA($TargetContext(),"monster_GiantLampreyLink","$255$" + atk);}
-$ELSE
-	{
-		link = link + "$" + atk;
-		$SET_COMBATANT_SA($TargetContext(),"monster_GiantLampreyLink",link);
-	};
\(END)

\(BEGIN)
name = monster_GiantLampreyDrainee
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk; $VAR i; $VAR foes; $VAR alive;
-foes = $GET_COMBATANT_SA($Myself(),"monster_GiantLampreyLink");
-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;
-	};
-$IF (alive <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantLampreyDrainee");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_GiantLampreyLink");
-		$DELETE_CHARACTER_SA($Myself(),"IsHugged");
-	};
\(END)

\(BEGIN)
name = monster_GiantOctopusConstricted
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Held by Giant Octopus");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk;
-atk = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(atk) <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"ConstrictLink");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsConstricted");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsConstrictedBothArms");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsConstrictedOneArm");
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = monster_GiantOctopusConstricting
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Consticting");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[OnStartCombatantAction] = $VAR Tgt;
-Tgt = $SA_PARAM_GET();
-$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_GiantOctopusConstricting");
-	};
\(END)

\(BEGIN)
name = monster_GiantOctopusConstriction
[InvokeSpellOnTarget] = $VAR atk;
-$VAR tgt;
-$VAR roll;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-roll = $RANDOM(4);
-	$IF ($GET_COMBATANT_SA($TargetContext(),"IsConstricted") == "-?-?-")
-		{
-			$SET_COMBATANT_SA($AttackerContext(),"ConstrictLink",tgt);
-			$SET_COMBATANT_SA($AttackerContext(),"monster_GiantOctopusConstricting",tgt);
-			$SET_COMBATANT_SA($TargetContext(),"monster_GiantOctopusConstricted",atk);
-			$SET_COMBATANT_SA($TargetContext(),"ConstrictLink",atk);
-			$IF (roll ==# 0)
-				{$SET_COMBATANT_SA($TargetContext(),"IsConstricted","");};
-			$IF (roll ==# 3)
-				{$SET_COMBATANT_SA($TargetContext(),"IsConstrictedBothArms","");}
-			$ELSE
-				{$SET_COMBATANT_SA($TargetContext(),"IsConstrictedOneArm","");};
-		};
\(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_GiantSquidConstricted
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Held by Giant Squid");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk;
-atk = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(atk) <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"ConstrictLink");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsConstricted");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsConstrictedBothArms");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsConstrictedOneArm");
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = monster_GiantSquidConstricting
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Consticting");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[OnStartCombatantAction] = $VAR Tgt;
-$VAR dmg;
-Tgt = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(Tgt) ># 0)
-	{
-		dmg = ($RANDOM(6) +# $RANDOM(6) +# 2);
-		$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_GiantSquidConstricting");
-	};
\(END)

\(BEGIN)
name = monster_GiantSquidConstriction
[InvokeSpellOnTarget] = $VAR atk;
-$VAR tgt;
-$VAR roll;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-roll = $RANDOM(4);
-	$IF ($GET_COMBATANT_SA($TargetContext(),"IsConstricted") == "-?-?-")
-		{
-			$SET_COMBATANT_SA($AttackerContext(),"ConstrictLink",tgt);
-			$SET_COMBATANT_SA($AttackerContext(),"monster_GiantSquidConstricting",tgt);
-			$SET_COMBATANT_SA($TargetContext(),"monster_GiantSquidConstricted",atk);
-			$SET_COMBATANT_SA($TargetContext(),"ConstrictLink",atk);
-			$IF (roll ==# 0)
-				{$SET_COMBATANT_SA($TargetContext(),"IsConstricted","");};
-			$IF (roll ==# 3)
-				{$SET_COMBATANT_SA($TargetContext(),"IsConstrictedBothArms","");}
-			$ELSE
-				{$SET_COMBATANT_SA($TargetContext(),"IsConstrictedOneArm","");};
-		};
\(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_COMBATANT_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_GreaterVodyanoiSummonSharks
[InvokeSpellOnTarget] = $VAR n;
-n = $RANDOM(4) +# $RANDOM(4) +# 2;
-$WHILE (n ># 0) {$AddCombatant("Bull Shark",2); n = n -# 1;};
\(END)

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

\(BEGIN)
name = monster_HighestInitiative
[AdjustInitiative] = $SET_HOOK_PARAM(5,"1");
\(END)

\(BEGIN)
name = monster_ImmuneAttackNegativePlane
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Negative Plane Attacks");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical"); itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical"); monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;}; $IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;}; $IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "negative") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical"); splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;}; $IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "negative") {$RETURN 0;};
\(END)

\(BEGIN)
name = monster_ImmuneAttackPositivePlane
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Immune to Positive Plane Attacks");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical"); itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical"); monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;}; $IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (monster != "-?-?-") {immune = monster;}; $IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "positive") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical"); splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;}; $IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "positive") {$RETURN 0;};
\(END)

\(BEGIN)
name = monster_ImmuneCharm
\(END)

\(BEGIN)
name = monster_ImmuneCold
\(END)

\(BEGIN)
name = monster_ImmuneConfusion
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Confusion"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SpellContext() == "Confusion"){$RETURN "N";};
\(END)

\(BEGIN)
name = monster_ImmuneDeathMagic
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Death Magic"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SpellContext() == "Death Magic"){$RETURN "N";};
\(END)

\(BEGIN)
name = monster_ImmuneDomination
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Domination"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SpellContext() == "Domination"){$RETURN "N";};
\(END)

\(BEGIN)
name = monster_ImmuneElectricity
\(END)

\(BEGIN)
name = monster_ImmuneEnchantment
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageMagical") == "enchantment"){$RETURN "N";};
\(END)

\(BEGIN)
name = monster_ImmuneFear
\(END)

\(BEGIN)
name = monster_ImmuneFeeblemind
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Feeblemind"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SpellContext() == ("Feeblemind" || "Feeblemind|Druid" || "Feeblemind|MonsterMage")){$RETURN "N";};
\(END)

\(BEGIN)
name = monster_ImmuneFire
\(END)

\(BEGIN)
name = monster_ImmuneGas
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Gas"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[ComputeDamage] = $VAR itm; $VAR itmNon; $VAR mon; $VAR monNon; $VAR immune;
-itm = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-mon = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((itm == "-?-?-") && (itmNon == "-?-?-") && (mon == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (itm != "-?-?-") {immune = itm;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (mon != "-?-?-") {immune = mon;};
-$IF (monNon != "-?-?-") {immune = monNon;};
-$IF (immune == "gas") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR immune;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {immune = spell;};
-$IF (splNon != "-?-?-") {immune = splNon;};
-$IF (immune == "gas") {$RETURN 0;};
\(END)

\(BEGIN)
name = monster_ImmuneHold
\(END)

\(BEGIN)
name = monster_ImmuneIllusions
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageMagical") == "illusion"){$RETURN "N";};
\(END)

\(BEGIN)
name = monster_ImmuneLevelLoss
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Level Loss"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

\(BEGIN)
name = monster_ImmuneMagic
[DoesSpellAttackSucceed] = $RETURN "N";
\(END)

\(BEGIN)
name = monster_ImmuneMagicMissile
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Magic Missile"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[DoesSpellAttackSucceed] = $IF ($SpellContext() == ("Magic Missile" || "Magic Missile|Ranger" || "Magic Missile|MonsterMage")){$RETURN "N";};
\(END)

\(BEGIN)
name = monster_ImmuneNormalFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Normal Fire"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
[ComputeDamage] = $VAR itm; $VAR mon; $VAR immune;
-itm = $GET_ITEM_SA($ItemContext(),"DamageNonMagical");
-mon = $GET_MONSTERTYPE_SA($MonsterTypeContext(),"DamageNonMagical");
-$IF (itm != "-?-?-") {immune = itm;}; $IF (mon != "-?-?-") {immune = mon;};
-$IF (immune == "fire") {$RETURN 0;};
[ComputeSpellDamage] = $VAR spl; $VAR mon; $VAR immune;
-spl = $GET_SPELL_SA($SpellContext(),"DamageNonMagical");
-mon = $GET_MONSTERTYPE_SA($MonsterTypeContext(),"DamageNonMagical");
-$IF (spl != "-?-?-") {immune = spl;}; $IF (mon != "-?-?-") {immune = mon;};
-$IF (immune == "fire") {$RETURN 0;};
\(END)

\(BEGIN)
name = monster_ImmunePetrification
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Petrification"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

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

\(BEGIN)
name = monster_ImmunePsionics
[DoesSpellAttackSucceed] = $IF ($SA_SPELL_GET("DamageMagical") == "psionic"){$RETURN "N";};
\(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_ImmuneSurprise
[AdjustInitiative] = $RETURN -9;
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Immune Surprise"); $SET_HOOK_PARAM( 6,""); $RETURN 1;
\(END)

\(BEGIN)
name = monster_Infravision
\(END)

\(BEGIN)
name = monster_KrakenConstricted
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Held by Giant Squid");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk;
-atk = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(atk) <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"ConstrictLink");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsConstricted");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsConstrictedBothArms");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsConstrictedOneArm");
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = monster_KrakenConstricting
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Consticting");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[OnStartCombatantAction] = $VAR Tgt;
-$VAR dmg;
-Tgt = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(Tgt) ># 0)
-	{
-		dmg = ($RANDOM(4) +# $RANDOM(4) +# $RANDOM(4) +# 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_KrakenConstricting");
-	};
\(END)

\(BEGIN)
name = monster_KrakenConstriction
[InvokeSpellOnTarget] = $VAR atk;
-$VAR tgt;
-$VAR roll;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-roll = $RANDOM(4);
-	$IF ($GET_COMBATANT_SA($TargetContext(),"IsConstricted") == "-?-?-")
-		{
-			$SET_COMBATANT_SA($AttackerContext(),"ConstrictLink",tgt);
-			$SET_COMBATANT_SA($AttackerContext(),"monster_KrakenConstricting",tgt);
-			$SET_COMBATANT_SA($TargetContext(),"monster_KrakenConstricted",atk);
-			$SET_COMBATANT_SA($TargetContext(),"ConstrictLink",atk);
-			$IF (roll ==# 0)
-				{$SET_COMBATANT_SA($TargetContext(),"IsConstricted","");};
-			$IF (roll ==# 3)
-				{$SET_COMBATANT_SA($TargetContext(),"IsConstrictedBothArms","");}
-			$ELSE
-				{$SET_COMBATANT_SA($TargetContext(),"IsConstrictedOneArm","");};
-		};
\(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_LampreyDrain
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[GetNumberOfAttacks] = $RETURN 0;
[OnStartCombatantAction] = $VAR tgt; $VAR nom; $VAR dmg;
-// Test Target and Compute & Apply Drain
-tgt = $GET_COMBATANT_SA($CombatantContext(),"monster_LampreyLink");
-nom = $GET_CHAR_NAME(tgt);
-dmg = "2";
-$IF ($GET_CHAR_STATUS(tgt) ==# 0) 
-  {
-    $SET_CHAR_HITPOINTS(tgt, $GET_CHAR_HITPOINTS(tgt) -# dmg);
-    $IF ($GET_CHAR_HITPOINTS(tgt) <# 1)
-      {
-			$SET_CHAR_STATUS(tgt,1);
-			$DELETE_COMBATANT_SA($CombatantContext(),"monster_LampreyDrain");
-			$DELETE_COMBATANT_SA($CombatantContext(),"monster_LampreyLink");
-			$DELETE_CHARACTER_SA($Name(nom),"IsHugged");
-		};
-  }
-$ELSE
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_LampreyDrain");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_LampreyLink");
-		$DELETE_CHARACTER_SA($Name(nom),"IsHugged");
-	};
\(END)

\(BEGIN)
name = monster_LampreyDrainBlood
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR link;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-// Attacker
-$SET_COMBATANT_SA($AttackerContext(),"monster_LampreyDrain","");
-$SET_COMBATANT_SA($AttackerContext(),"monster_LampreyLink",tgt);
-// Target
-$SET_COMBATANT_SA($TargetContext(),"monster_LampreyDrainee","");
-$SET_COMBATANT_SA($TargetContext(),"IsHugged",1);
-// Link
-link = $GET_COMBATANT_SA($TargetContext(),"monster_LampreyLink");
-$IF (link == "-?-?-"){$SET_COMBATANT_SA($TargetContext(),"monster_LampreyLink","$255$" + atk);}
-$ELSE
-	{
-		link = link + "$" + atk;
-		$SET_COMBATANT_SA($TargetContext(),"monster_LampreyLink",link);
-	};
\(END)

\(BEGIN)
name = monster_LampreyDrainee
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,$SA_PARAM_GET());
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk; $VAR i; $VAR foes; $VAR alive;
-foes = $GET_COMBATANT_SA($Myself(),"monster_LampreyLink");
-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;
-	};
-$IF (alive <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_LampreyDrainee");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_LampreyLink");
-		$DELETE_CHARACTER_SA($Myself(),"IsHugged");
-	};
\(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_MantaRayStun
[InvokeSpellOnTarget] = $VAR rndm; $VAR exp;
-rndm = $RANDOM(4) +# $RANDOM(4) +# 2;
-exp = $GetCombatRound() +# rndm;
-$SET_COMBATANT_SA($TargetContext(),"IsStunned", exp);
\(END)

\(BEGIN)
name = monster_MantaRaySwallow
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR link; $VAR exp;
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-// Attacker
-$SET_COMBATANT_SA($AttackerContext(),"monster_MantaRaySwallower","");
-$SET_COMBATANT_SA($AttackerContext(),"monster_MantaRaySwallowLink",tgt);
-// Target
-$SET_COMBATANT_SA($TargetContext(),"IsManatRaySwallowed",exp);
-$SET_COMBATANT_SA($TargetContext(),"IsHugged","1");
-// Link
-link = $GET_COMBATANT_SA($TargetContext(),"monster_MantaRaySwallowLink");
-$IF (link == "-?-?-"){$SET_COMBATANT_SA($TargetContext(),"monster_MantaRaySwallowLink","$255$" + atk);}
-$ELSE
-	{
-		link = link + "$" + atk;
-		$SET_COMBATANT_SA($TargetContext(),"monster_MantaRaySwallowLink",link);
-	};
\(END)

\(BEGIN)
name = monster_MantaRaySwallower
[GetAdjMaxMovement] = $RETURN 0;
[OnStartCombatantAction] = $VAR tgt; $VAR exp; $VAR par;
-// Test Target and Compute & Apply Swallow
-tgt = $GET_COMBATANT_SA($CombatantContext(),"monster_MantaRaySwallowLink");
-exp = $GetCombatRound();
-par = $SA_PARAM_GET();
-$IF ($GET_CHAR_STATUS(tgt) ==# 0) 
-	{
-		$IF (exp ># par)
-			{
-				$SET_CHAR_STATUS(tgt,1);
-				$DELETE_COMBATANT_SA($CombatantContext(),"monster_MantaRaySwallower");
-				$DELETE_COMBATANT_SA($CombatantContext(),"monster_MantaRaySwallowLink");
-				$DELETE_CHARACTER_SA($Name(tgt),"IsHugged");
-			};
-	}
-$ELSE
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_MantaRaySwallower");
-		$DELETE_COMBATANT_SA($CombatantContext(),"monster_MantaRayLink");
-		$DELETE_CHARACTER_SA($Name(tgt),"IsHugged");
-	};
\(END)

\(BEGIN)
name = monster_MaridColdResistance
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Cold Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;};
-$IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "cold") {$RETURN par5 /# 4 *# 3;};
[DoesAttackSucceed] = $IF (($GET_HOOK_PARAM(5) +# 2) <=# $GET_HOOK_PARAM(6)) {$RETURN "N";};
[DoesSpellAttackSucceed] = $IF (($GET_HOOK_PARAM(5) +# 2) <=# $GET_HOOK_PARAM(6)) {$RETURN "N";};
[GetAdjMaxMovement] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;};
-$IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;};
-$IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (resist == "cold") {$RETURN par5 /# 4 *# 3;};
\(END)

\(BEGIN)
name = monster_MaridFireVulnerability
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Vulnerable to Fire");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR vuln; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical");
-splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {vuln = spell;};
-$IF (splNon != "-?-?-") {vuln = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "fire") {$RETURN par5 /# 4 *# 5;};
[DoesAttackSucceed] = $IF (($GET_HOOK_PARAM(5) -# 1) <=# $GET_HOOK_PARAM(6)) {$RETURN "N";};
[DoesSpellAttackSucceed] = $IF (($GET_HOOK_PARAM(5) -# 1) <=# $GET_HOOK_PARAM(6)) {$RETURN "N";};
[GetAdjMaxMovement] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR vuln; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical");
-monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {vuln = item;};
-$IF (itmNon != "-?-?-") {vuln = itmNon;};
-$IF (monster != "-?-?-") {vuln = monster;};
-$IF (monNon != "-?-?-") {vuln = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (vuln == "fire") {$RETURN par5 /# 4 *# 5;};
\(END)

\(BEGIN)
name = monster_ModronDamageReduction
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical"); itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical"); monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;}; $IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;}; $IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF ((resist == "cold") || (resist == "fire")){$RETURN par5 -# 1;};
[ComputeSpellDamage] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical"); splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;}; $IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF ((resist == "cold") || (resist == "fire")){$RETURN 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_ModronSave
[DoesAttackSucceed] = $VAR item; $VAR itmNon; $VAR monster; $VAR monNon; $VAR resist; $VAR par5;
-item = $SA_ITEM_GET("DamageMagical"); itmNon = $SA_ITEM_GET("DamageNonMagical");
-monster = $SA_MONSTERTYPE_GET("DamageMagical"); monNon = $SA_MONSTERTYPE_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-") && (monster == "-?-?-") && (monNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {resist = item;}; $IF (itmNon != "-?-?-") {resist = itmNon;};
-$IF (monster != "-?-?-") {resist = monster;}; $IF (monNon != "-?-?-") {resist = monNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF ((resist == "acid") || (resist == "fire"))
-	{$RETURN $SkillAdj($CombatantContext(), "Save Vs SP", "modron", "-", "1");};
[DoesSpellAttackSucceed] = $VAR spell; $VAR splNon; $VAR resist; $VAR par5;
-spell = $SA_SPELL_GET("DamageMagical"); splNon = $SA_SPELL_GET("DamageNonMagical");
-$IF ((spell == "-?-?-") && (splNon == "-?-?-")){$RETURN;};
-$IF (spell != "-?-?-") {resist = spell;}; $IF (splNon != "-?-?-") {resist = splNon;};
-par5 = $GET_HOOK_PARAM(5);
-$IF ((resist == "acid") || (resist == "fire"))
-	{$RETURN $SkillAdj($CombatantContext(), "Save Vs SP", "modron", "-", "1");};
\(END)

\(BEGIN)
name = monster_MorkothSpellReflection
[RedirectSpell] = $VAR atk; $VAR tgt; $VAR cName; $VAR tName;
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-cName = $GET_CHAR_NAME (atk); tName = $GET_CHAR_NAME (tgt);
-$SET_HOOK_PARAM(5,atk); $SET_HOOK_PARAM(6, tName + " reflects spell back at " + cName);
\(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_NereidBlind
[InvokeSpellOnTarget] = $VAR rnd; $VAR exp;
-rnd = $GetCombatRound();
-exp = rnd +# $RANDOM(6) +# $RANDOM(6) +# 2;
-$SET_COMBATANT_SA($TargetContext(),"IsNereidBlind",exp);
\(END)

\(BEGIN)
name = monster_NeverSurprised
[AdjustInitiative] = $RETURN "-5";
\(END)

\(BEGIN)
name = monster_NixieCharm
[InvokeSpellOnTarget] = $IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-$SetFriendly($IndexOf($TargetContext()), $GET_COMBATANT_SA($Myself(),"side"));
-$SET_COMBATANT_SA($TargetContext(),"IsCharmed","11");
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel","11");
\(END)

\(BEGIN)
name = monster_NymphCharm
[InvokeSpellOnTarget] = $IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-$SetFriendly($IndexOf($TargetContext()), $GET_COMBATANT_SA($Myself(),"side"));
-$SET_COMBATANT_SA($TargetContext(),"IsCharmed","11");
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel","11");
\(END)

\(BEGIN)
name = monster_PlanetarGateDeva
[InvokeSpellOnTarget] = $VAR rdm; $VAR rd1; $VAR rd2; $VAR rd3;
-rdm = $RANDOM(3); rd1 = $RANDOM(3); rd2 = $RANDOM(4); rd3 = $RANDOM(6);
-$IF (rdm ==# 0){$WHILE (rd1 >=# 0) {$AddCombatant("Astral Deva",0); rd1 = rd1 -# 1;};};
-$IF (rdm ==# 1){$WHILE (rd1 >=# 0) {$AddCombatant("Monadic Deva",0); rd1 = rd1 -# 1;};};
-$IF (rdm ==# 2){$WHILE (rd1 >=# 0) {$AddCombatant("Movanic Deva",0); rd1 = rd1 -# 1;};};
\(END)

\(BEGIN)
name = monster_PlanetarSummonGoodCreature
[InvokeSpellOnTarget] = // not implemented until couatl, baku or androsphinx are added
\(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 ($GET_CHARACTER_SA($TargetContext(),"IsImmunePoison") != "-?-?-"){$RETURN;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsProtectedPoisonCaster") != "-?-?-"){$RETURN;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsProtectedPoisonTarget") != "-?-?-"){$RETURN;};
-$SET_CHARACTER_SA($TargetContext(),"IsPoisoned",time);
-$SET_CHAR_STATUS(tgt,9);
-$SET_CHAR_HITPOINTS(tgt,"-1");
\(END)

\(BEGIN)
name = monster_PrimusPlaneShift
[ComputeDamage] = $VAR tgt;
-tgt = $IndexOf($TargetContext());
-$SET_CHAR_STATUS(tgt,"5");
\(END)

\(BEGIN)
name = monster_ProtectionFromEvil40'Radius
[OnStartCombat] = $VAR me;
-me = $MyIndex();
-$AURA_Create("monster_ProtectionFromEvil40'RadiusAURA",me,"","","");
-$SkillAdj($TargetContext(),"Save Vs BR","monsterProtectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs PP","monsterProtectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs PPDM","monsterProtectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs RSW","monsterProtectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs SP","monsterProtectedEvil","-","2");
\(END)

\(BEGIN)
name = monster_ProtectionFromEvil40'RadiusAURA
[AURA_Create] = $VAR me;
-me = $SA_PARAM_GET();
-$AURA_Attach("Combatant");
-$AURA_Combatant(me);
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,4,0,360);
-$AURA_Spell("ProtectionFromEvil40Radius");
-$AURA_Wavelength("Xray");
[AURA_Enter] = $SET_COMBATANT_SA($CombatantContext(),"IsMonsterProtectedEvil","");
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsMonsterProtectedEvil");
\(END)

\(BEGIN)
name = monster_ProtectionFromEvil70'Radius
[OnStartCombat] = $VAR me;
-me = $MyIndex();
-$AURA_Create("monster_ProtectionFromEvil40'RadiusAURA",me,"","","");
-$SkillAdj($TargetContext(),"Save Vs BR","monsterProtectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs PP","monsterProtectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs PPDM","monsterProtectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs RSW","monsterProtectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs SP","monsterProtectedEvil","-","2");
\(END)

\(BEGIN)
name = monster_ProtectionFromEvil70'RadiusAURA
[AURA_Create] = $VAR me;
-me = $SA_PARAM_GET();
-$AURA_Attach("Combatant");
-$AURA_Combatant(me);
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,7,0,360);
-$AURA_Spell("ProtectionFromEvil70Radius");
-$AURA_Wavelength("Xray");
[AURA_Enter] = $SET_COMBATANT_SA($CombatantContext(),"IsMonsterProtectedEvil","");
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsMonsterProtectedEvil");
\(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_RearClawRakeCat1
[InvokeSpellOnTarget] = $SET_COMBATANT_SA($AttackerContext(),"CombatRoundStart",1);
\(END)

\(BEGIN)
name = monster_RearClawRakeCat2
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR HP; // hit points
-$VAR nom;
-$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);
-		$IF($RANDOM(20) +# 1 >=# TH -# AC)
-			{
-				nom = $GET_CHAR_NAME(atk);
-				$IF (nom == "Cat"){dmg = ($RANDOM(2) +# 1);};
-				$IF (nom == "Wild Cat"){dmg = ($RANDOM(2) +# $RANDOM(2) +# 2);};
-				$IF (nom == "Cheetah"){dmg = ($RANDOM(2) +# $RANDOM(2) +# 2);};
-				$SET_CHAR_HITPOINTS(tgt,HP -# dmg);
-			};
-		$IF (HP<# 1)
-			{
-				$IF (HP <# "-9"){$SET_CHAR_STATUS(tgt,2);}
-				$ELSE{$SET_CHAR_STATUS(tgt,9);};
-			};
-	};
\(END)

\(BEGIN)
name = monster_RedUrchinVenom
[InvokeSpellOnTarget] = $VAR rndm; $VAR exp;
-rndm = $RANDOM(4) +# 1;
-exp = $GetCombatRound() +# rndm;
-$SET_COMBATANT_SA($TargetContext(), "IsRedUrchinSleeping", exp);
\(END)

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

\(BEGIN)
name = monster_ResistantDragonFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Dragon Fire Resistant"); $SET_HOOK_PARAM( 6, ""); $RETURN 1;
[ComputeSpellDamage] = $VAR bw; $VAR p5;
-bw = $SA_SPELL_GET("DragonBreathWeapon");
-p5 = $GET_HOOK_PARAM(5);
-$IF (bw == "fire") {$RETURN p5 /# 2;};
\(END)

\(BEGIN)
name = monster_ResistantMagicalFire
[CharDisplayStatus] = $SET_HOOK_PARAM( 7, "Fire Resistant");
-$SET_HOOK_PARAM( 6, "");
-$RETURN 1;
[ComputeSpellDamage] = $VAR spl; $VAR par5;
-spl = $SA_SPELL_GET("DamageMagical");
-$IF (spl == "-?-?-"){$RETURN;};
-par5 = $GET_HOOK_PARAM(5);
-$IF (spl == "fire") {$RETURN par5 /# 2;};
\(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", "F", "");
-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_SilverUrchinVenom
[InvokeSpellOnTarget] = $VAR rndm; $VAR exp;
-rndm = $RANDOM(3) +# 1;
-exp = $GET_PARTY_DAYS() +# rndm;
-$SET_COMBATANT_SA($TargetContext(), "IsSIlverUrchinCatatonic", exp);
\(END)

\(BEGIN)
name = monster_SirineSong
[InvokeSpellOnTarget] = $IF ($GET_CHARACTER_SA($TargetContext(),"saved")) {$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-$SetFriendly($IndexOf($TargetContext()), $GET_COMBATANT_SA($Myself(),"side"));
-$SET_COMBATANT_SA($TargetContext(),"IsCharmed","40");
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel","40");
\(END)

\(BEGIN)
name = monster_SirineTouch
[InvokeSpellOnTarget] = $VAR tgt; $VAR trib;
-tgt = $IndexOf($TargetContext());
-trib = 2 -# $GET_CHAR_LIMITED_INT(tgt);
-$MODIFY_CHAR_ATTRIBUTE(tgt,"INT", trib, "MINUTES", 999999999, "Idiot", "Sirine's Touch");
\(END)

\(BEGIN)
name = monster_SlaadGateBlueSlaad
[InvokeSpellOnTarget] = $VAR pct; $VAR rdm;
-pct = $RANDOM(100); rdm = $RANDOM(100);
-$IF (pct >=# 40){$RETURN;};
-$IF (rdm <# 35){$AddCombatant("Green Slaad",0);$RETURN;};
-$IF (rdm <# 85){$AddCombatant("Blue Slaad",0);$RETURN;};
-$IF (rdm >=# 85){$AddCombatant("Red Slaad",0);$RETURN;};
\(END)

\(BEGIN)
name = monster_SlaadGateDeathSlaad
[InvokeSpellOnTarget] = $VAR pct; $VAR rdm;
-pct = $RANDOM(100); rdm = $RANDOM(4);
-$IF (pct >=# 90){$RETURN;};
-$IF (rdm ==# 0){$AddCombatant("Green Slaad",0);};
-$IF (rdm ==# 1){$AddCombatant("Grey Slaad",0);};
-$IF (rdm ==# 2){$AddCombatant("Blue Slaad",0);};
-$IF (rdm ==# 3){$AddCombatant("Red Slaad",0);};
\(END)

\(BEGIN)
name = monster_SlaadGateGreenSlaad
[InvokeSpellOnTarget] = $VAR pct; $VAR rdm;
-pct = $RANDOM(100); rdm = $RANDOM(100);
-$IF (pct >=# 50){$RETURN;};
-$IF (rdm <# 35){$AddCombatant("Red Slaad",0);$RETURN;};
-$IF (rdm <# 70){$AddCombatant("Blue Slaad",0);$RETURN;};
-$IF (rdm >=# 70){$AddCombatant("Green Slaad",0);$RETURN;};
\(END)

\(BEGIN)
name = monster_SlaadGateGreySlaad
[InvokeSpellOnTarget] = $VAR pct; $VAR rdm;
-pct = $RANDOM(100); rdm = $RANDOM(3);
-$IF (pct >=# 60){$RETURN;};
-$WHILE (rdm >=# 0){$AddCombatant("Grey Slaad",0);rdm = rdm -# 1;};
\(END)

\(BEGIN)
name = monster_SlaadGateSsendam
[InvokeSpellOnTarget] = $VAR rdm; rdm = $RANDOM(5);
-$IF (rdm ==# 0){$AddCombatant("Blue Slaad",0);};
-$IF (rdm ==# 1){$AddCombatant("Death Slaad",0);};
-$IF (rdm ==# 2){$AddCombatant("Green Slaad",0);};
-$IF (rdm ==# 3){$AddCombatant("Grey Slaad",0);};
-$IF (rdm ==# 4){$AddCombatant("Red Slaad",0);};
\(END)

\(BEGIN)
name = monster_SlaadGateYgorl
[InvokeSpellOnTarget] = $VAR rdm; rdm = $RANDOM(5);
-$IF (rdm ==# 0){$AddCombatant("Blue Slaad",0);};
-$IF (rdm ==# 1){$AddCombatant("Death Slaad",0);};
-$IF (rdm ==# 2){$AddCombatant("Green Slaad",0);};
-$IF (rdm ==# 3){$AddCombatant("Grey Slaad",0);};
-$IF (rdm ==# 4){$AddCombatant("Red Slaad",0);};
\(END)

\(BEGIN)
name = monster_SlaadSummonPhantasmalKiller
[InvokeSpellOnTarget] = $AddCombatant("Phantasmal Killer",0);
\(END)

\(BEGIN)
name = monster_SlaadSummonRedSlaad
[InvokeSpellOnTarget] = $VAR pct; $VAR rdm;
-pct = $RANDOM(100); rdm = $RANDOM(2);
-$IF (pct >=# 35){$RETURN;};
-$WHILE (rdm >=# 0){$AddCombatant("Red Slaad",0);rdm = rdm -# 1;};
\(END)

\(BEGIN)
name = monster_SlimeWeakness
\(END)

\(BEGIN)
name = monster_SolarFirstStrike
[AdjustInitiative] = $RETURN -9;
\(END)

\(BEGIN)
name = monster_SolarGatePlanetarOrDeva
[InvokeSpellOnTarget] = $VAR rdm; $VAR rd1; $VAR rd2; $VAR rd3;
-rdm = $RANDOM(4); rd1 = $RANDOM(3) +# $RANDOM(3) +# 2; rd2 = $RANDOM(4) +# $RANDOM(4) +# 2;
-rd3 = $RANDOM(6) +# $RANDOM(6) +# 2;
-$IF (rdm ==# 0){$AddCombatant("Planetar",0);};
-$IF (rdm ==# 1){$WHILE (rd1 ># 0) {$AddCombatant("Astral Deva",0); rd1 = rd1 -# 1;};};
-$IF (rdm ==# 2){$WHILE (rd1 ># 0) {$AddCombatant("Monadic Deva",0); rd1 = rd1 -# 1;};};
-$IF (rdm ==# 3){$WHILE (rd1 ># 0) {$AddCombatant("Movanic Deva",0); rd1 = rd1 -# 1;};};
\(END)

\(BEGIN)
name = monster_SolarNeverSurprised
[AdjustInitiative] = $RETURN -9;
\(END)

\(BEGIN)
name = monster_SolarSummonGoodCreature
[InvokeSpellOnTarget] = $VAR rdm; $VAR rd1; $VAR rd2;
-rdm = $RANDOM(2); rd1 = $RANDOM(2); rd2 = $RANDOM(2); 
-// for when phoenix is added
-//$IF (rdm ==# 0){$WHILE (rd1 >=# 0){$AddCombatant("Phoenix",0);rd1 = rd1 -# 1;};};
-//$IF (rdm ==# 1){$WHILE (rd2 >=# 0){$AddCombatant("Titan",0);rd2 = rd2 -# 1;};};
-$WHILE (rd2 >=# 0){$AddCombatant("Titan",0);rd2 = rd2 -# 1;};
\(END)

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

\(BEGIN)
name = monster_StingRayPoison
[InvokeSpellOnTarget] = $VAR rnd; $VAR exp; $VAR tgt;
-rnd = $GetCombatRound();
-exp = $RANDOM(4) +# $RANDOM(4) +# $RANDOM(4) +# $RANDOM(4) +# $RANDOM(4) +# 5;
-tgt = $IndexOf($TargetContext());
-$SET_CHAR_HITPOINTS(tgt, $GET_CHAR_HITPOINTS(tgt) -# rnd);
-$SET_COMBATANT_SA($TargetContext(),"IsStingRayParalyzed", rnd *# 8);
\(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_COMBATANT_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_COMBATANT_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_COMBATANT_SA($Myself(),"IsHugged");
-	};
\(END)

\(BEGIN)
name = monster_StrangleWeedConstrict
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR roll; $VAR isw;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-roll = $RANDOM(4);
-isw = $GET_COMBATANT_SA($TargetContext(),"IsStrangleWeeded");
-$IF (isw == "-?-?-")
-	{
-		$SET_COMBATANT_SA($AttackerContext(),"StrangleLink",tgt);
-		$SET_COMBATANT_SA($AttackerContext(),"monster_GiantOctopusConstricting",tgt);
-		$SET_COMBATANT_SA($TargetContext(),"monster_StrangleWeedConstricted",atk);
-		$SET_COMBATANT_SA($TargetContext(),"StrangleLink",atk);
-		$SET_COMBATANT_SA($TargetContext(),"IsStrangleWeeded",roll);
-	}
-$ELSE
-	{
-		$SET_COMBATANT_SA($TargetContext(),"IsStrangleWeeded",isw +# roll);
-	};
\(END)

\(BEGIN)
name = monster_StrangleWeedConstricted
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Held by Strangle Weed");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[OnStartCombatantAction] = $VAR atk;
-atk = $SA_PARAM_GET();
-$IF ($GET_CHAR_HITPOINTS(atk) <# 1)
-	{
-		$DELETE_COMBATANT_SA($CombatantContext(),"StrangleLink");
-		$DELETE_CHARACTER_SA($CombatantContext(),"IsStrangleWeeded");
-		$SA_REMOVE();
-	};
\(END)

\(BEGIN)
name = monster_StrangleWeedConstricting
[CharDisplayStatus] = $SET_HOOK_PARAM( 7,"Consticting");
-$SET_HOOK_PARAM( 6,"");
-$RETURN 1;
[GetAdjMaxMovement] = $RETURN 0;
[OnStartCombatantAction] = $VAR tgt;
-tgt = $SA_PARAM_GET();
-$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_StrangleWeedConstricting");
-		$DELETE_COMBATANT_SA($CombatantContext(),"StrangleLink");
-	};
\(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($CombatantContext());
-currHP = $GET_CHAR_HITPOINTS(tgt);
-round = $GetCombatRound();
-$IF (currHP <# 42)
-	{
-		$IF ($SA_COMBATANT_GET("timeToRegen") == "-?-?-")
-		{
-			$SET_COMBATANT_SA($CombatantContext(),"timeToRegen",round +# 3);
-		};
-	};
-$IF (round ==# $SA_COMBATANT_GET("timeToRegen"))
-	{
-		$RETURN $SET_COMBATANT_SA($CombatantContext(),"monster_Regeneration",$SA_PARAM_GET());
-	};
\(END)

\(BEGIN)
name = monster_Ultravision
\(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)

\(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
[ComputeDamage] = $VAR immun;
-$VAR item;
-$VAR mlev;
-$VAR list;
-immun = $GET_COMBATANT_SA($TargetContext(),"monster_WeaponImmunity");
-item = $SA_ITEM_GET("item_MagicalWeapon");
-$IF (item == "-?-?-"){item = 0;};
-$IF (immun != "-?-?-")
-	{
-		$IF (item ==# 0)
-			{
-				mlev = $GET_COMBATANT_SA($AttackerContext(),"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 <# immun){$RETURN "0";};
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; $VAR par5; $VAR par6;
-tgt = $IndexOf($TargetContext());
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$IF ($GET_MONSTERTYPE_SA($GET_CHAR_NAME(tgt),$SA_NAME()) != "-?-?-" && $SA_ITEM_GET("item_WeaponType") == $SA_PARAM_GET())
-	{$SET_HOOK_PARAM(6,par6 +# 90);};
-$IF (par5 >=# par6){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

\(BEGIN)
name = monster_WeaponImmunityWater
[ComputeDamage] = $VAR item; $VAR itmNon; $VAR immune;
-item = $SA_ITEM_GET("DamageMagical");
-itmNon = $SA_ITEM_GET("DamageNonMagical");
-$IF ((item == "-?-?-") && (itmNon == "-?-?-")) {$RETURN;};
-$IF (item != "-?-?-") {immune = item;};
-$IF (itmNon != "-?-?-") {immune = itmNon;};
-$IF (immune == "water") {$RETURN 0;};
\(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($CombatantContext(),"monster_WeaponResistance", $SA_PARAM_GET());
\(END)

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

\(BEGIN)
name = monster_YellowUrchinVenom
[InvokeSpellOnTarget] = $VAR rndm; $VAR exp;
-rndm = $RANDOM(4) +# 1;
-exp = $GetCombatRound() +# rndm;
-$SET_COMBATANT_SA($TargetContext(), "IsYellowUrchinParalyzed", exp);
\(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;
-chr = $IndexOf($CharacterContext());
-adj = $GET_CHAR_LIMITED_CON(chr) *# 2 /# 7;
-$SkillAdj($CharacterContext(),"Save Vs BR","shortSaveBonus","-",adj);
-$SkillAdj($CharacterContext(),"Save Vs PP","shortSaveBonus","-",adj);
-$SkillAdj($CharacterContext(),"Save Vs PPDM","shortSaveBonus","-",adj);
-$SkillAdj($CharacterContext(),"Save Vs RSW","shortSaveBonus","-",adj);
-$SkillAdj($CharacterContext(),"Save Vs SP","shortSaveBonus","-",adj);
[PostCreateCharacter] = $VAR chr; // character
-$VAR adj;
-chr = $IndexOf($CharacterContext());
-adj = $GET_CHAR_LIMITED_CON(chr) *# 2 /# 7;
-$SkillAdj($CharacterContext(),"Save Vs BR","shortSaveBonus","-",adj);
-$SkillAdj($CharacterContext(),"Save Vs PP","shortSaveBonus","-",adj);
-$SkillAdj($CharacterContext(),"Save Vs PPDM","shortSaveBonus","-",adj);
-$SkillAdj($CharacterContext(),"Save Vs RSW","shortSaveBonus","-",adj);
-$SkillAdj($CharacterContext(),"Save Vs SP","shortSaveBonus","-",adj);
\(END)

\(BEGIN)
name = spell_Aid
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; $VAR cls; $VAR adj; $VAR lvl; $VAR exp;
-$VAR tgt; $VAR rdm; $VAR ohp; $VAR mhp; $VAR dif;
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl +# 1;
-$SET_CHARACTER_SA($TargetContext(),"IsAided",exp);
-tgt = $IndexOf($TargetContext()); rdm = $RANDOM(8) +# 1;
-ohp = $GET_CHAR_HITPOINTS(tgt);
-mhp = $GET_CHAR_MAXHITPOINTS(tgt);
-$SET_CHARACTER_SA($TargetContext(),"tempAidOldHP",ohp);
-$SET_CHAR_HITPOINTS(tgt,ohp + rdm);
-$IF ((ohp +# rdm) ># mhp)
-	{
-		$SET_CHARACTER_SA($TargetContext(),"tempAidOldMaxHP",mhp);
-		$SET_CHAR_MAXHITPOINTS(tgt,ohp +# rdm);
-	};
\(END)

\(BEGIN)
name = spell_Attack
[InvokeSpellOnTarget] = $IF ($GET_CHARACTER_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);
-$SkillAdj($TargetContext(),"Save Vs BR","Barkskin","-","1");
-$SkillAdj($TargetContext(),"Save Vs PP","Barkskin","-","1");
-$SkillAdj($TargetContext(),"Save Vs PPDM","Barkskin","-","1");
-$SkillAdj($TargetContext(),"Save Vs RSW","Barkskin","-","1");
-$SkillAdj($TargetContext(),"Save Vs SP","Barkskin","-","1");
\(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_CHARACTER_SA($AttackerContext(),"side");
-tgt = $IndexOf($TargetContext());
-$IF (mySide != "-?-?-")
-	{
-		$IF (mySide !=# $GET_CHARACTER_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_CHARACTER_SA($AttackerContext(),"side") != "-?-?-")
-	{
-		$SET_CHARACTER_SA($AttackerContext(),"IsBlinking1",1);
-		$SET_CHARACTER_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_CauseFearCleric
[InvokeSpellOnTarget] = $VAR exp;
-exp = $GET_PARTY_TIME() +# 10;
-$SET_COMBATANT_SA($TargetContext(),"IsAfraid",exp);
\(END)

\(BEGIN)
name = spell_ChainLightning
[InvokeSpellOnTarget] = $VAR atk; $VAR cls; $VAR lvl; $VAR hp; $VAR dmg; $VAR next; 
-atk = $IndexOf($AttackerContext()); cls = $GET_CHAR_CLASS(atk); lvl = $GET_CHAR_Lvl(atk,cls) -# 1;
-$WHILE (lvl ># 0)
-	{
-		dmg = ($RANDOM(6) +# 1) *# lvl; next = $IndexOf($NEAREST_TO($TargetContext())); hp = $GET_CHAR_HITPOINTS(next);
-		$SET_CHAR_HITPOINTS(next,hp -# dmg);
-		lvl = lvl -# 1;
-	};
\(END)

\(BEGIN)
name = spell_Charm
[InvokeSpellOnTarget] = $IF ($GET_CHARACTER_SA($TargetContext(),"saved")) {$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-$IF ($GET_COMBATANT_SA($TargetContext(),"monster_ImmuneCharm") != "-?-?-"){$RETURN;};
-$SetFriendly($IndexOf($TargetContext()), $GET_COMBATANT_SA($Myself(),"side"));
-$SET_COMBATANT_SA($TargetContext(),"IsCharmed","11");
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel","11");
\(END)

\(BEGIN)
name = spell_CharmMonster
[InvokeSpellOnTarget] = $VAR side;  // caster's side
-$VAR atk; // attacker/caster
-$VAR tgt; // target
-$VAR cLvl;  // caster level
-$VAR tNom;  // target name
-$VAR tLvl;   // 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;};
-$IF ($GET_COMBATANT_SA($TargetContext(),"monster_ImmuneCharm") != "-?-?-"){$RETURN;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-opr = $GET_COMBATANT_SA($AttackerContext(),"CombatRoundStart");
-$IF (opr == "-?-?-" || opr == 0)
-	{
-		$SET_CHARACTER_SA($AttackerContext(),"CombatRoundStart",5);
-		$SET_CHARACTER_SA($AttackerContext(),"tgtnum",0);
-		$SET_CHARACTER_SA($AttackerContext(),"PointPool",$RANDOM(4) +# $RANDOM(4) +# 2);
-	};
-rnd = $GET_CHARACTER_SA($AttackerContext(), "PointPool");
-$IF (rnd <# 1){$RETURN;};
-cls = $SA_PARAM_GET();
-cLvl = $GET_CHAR_Lvl(atk,cls);
-side = $GET_CHARACTER_SA($AttackerContext(), "side");
-tNom = $GET_CHAR_NAME(tgt);
-mLvl = $GET_MONSTERTYPE_SA(tNom,"monsterLevel");
-$IF (mLvl != "-?-?-"){tLvl = mLvl;}
-$ELSE
-	{
-		tcls = $GetHighestLevelBaseclass(tgt);
-		tLvl = $GetBaseclassLevel(tgt, tcls);
-	};
-$SET_CHARACTER_SA($AttackerContext(), "tgtnum",$GET_COMBATANT_SA($AttackerContext(),"tgtnum") +# 1);
-tgtnum = $GET_CHARACTER_SA($AttackerContext(),"tgtnum");
-$IF (tgtnum != "-?-?-")
-	{
-		$IF (tLvl ># 3)
-			{
-				$SET_CHARACTER_SA($AttackerContext(),"PointPool",0);
-				$SetFriendly(tgt,side);
-				$SET_CHARACTER_SA($TargetContext(),"IsCharmed",cLvl);
-				$RETURN;
-			};
-	};
-$IF (tLvl ># rnd){$RETURN;}
-$ELSE
-	{
-		$SET_CHARACTER_SA($AttackerContext(),"PointPool",rnd -# tLvl);
-		$SetFriendly(tgt,side);
-		$SET_CHARACTER_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(),"monster_ImmuneCharm") != "-?-?-"){$RETURN;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsPerson") == "-?-?-"){$RETURN;};
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SetFriendly(tgt,$GET_COMBATANT_SA($Myself(),"side"));
-$SET_CHARACTER_SA($TargetContext(),"IsCharmed",lvl);
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
\(END)

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

\(BEGIN)
name = spell_CharmPlant
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR tNom; // target name
-$VAR cls;
-$VAR lvl;
-tgt = $IndexOf($TargetContext());
-atk = $IndexOf($AttackerContext());
-tNom = $GET_CHAR_NAME(tgt);
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved" )) {$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) != 1){$RETURN;};
-$IF ($GET_COMBATANT_SA($TargetContext(),"monster_ImmuneCharm") != "-?-?-"){$RETURN;};
-$IF ($GET_MONSTERTYPE_SA(tNom,"monsterLevel") != "-?-?-")
-	{  //  MONSTERTYPE_SA checks go here
-		$IF ($GET_MONSTERTYPE_SA(tNom,"IsPlant") == "-?-?-"){$RETURN;};
-	};
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-$SetFriendly(tgt,$GET_COMBATANT_SA($Myself(),"side"));
-$SET_CHARACTER_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; $VAR cls; $VAR adj; $VAR lvl; $VAR exp;
-atk = $IndexOf($AttackerContext()); cls = $SA_PARAM_GET(); adj = $GET_CHARACTER_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_ColorSpray
[InvokeSpellOnTarget] = $VAR tgt; $VAR atk; $VAR param; $VAR cls; $VAR cstr; $VAR saved; $VAR rndm; $VAR time; $VAR lvl;
-tgt = $IndexOf($TargetContext()); atk = $IndexOf($AttackerContext());
-param = $SA_PARAM_GET(); cstr = $GET_CHAR_Lvl(atk,param);
-$IF ($GET_MONSTERTYPE_SA(tgt,"IsImmuneIllusions") != "-?-?-"){$RETURN;};
-$IF ($GET_MONSTERTYPE_SA(tgt,"monster_ImmuneIllusions") != "-?-?-"){$RETURN;};
-$IF ($GET_MONSTERTYPE_SA(tgt,"monsterLevel") != "-?-?-"){cls = $GET_MONSTERTYPE_SA(tgt,"monsterLevel");};
-$IF ($GET_MONSTERTYPE_SA(tgt,"monsterLevel") == "-?-?-") {cls = $GET_CHAR_CLASS(tgt); lvl = $GET_CHAR_Lvl(tgt,cls);};
-saved = $GET_COMBATANT_SA($TargetContext(),"savedCS");
-$IF (saved != "-?-?-" && (lvl ># cstr || lvl ># 5)){$RETURN $DELETE_COMBATANT_SA($TargetContext(),"savedCS");}
-$ELSE {$DELETE_COMBATANT_SA($TargetContext(),"savedCS");};
-$IF (cstr >=# cls)
-	{rndm = $RANDOM(7) +# 2;time = $GET_PARTY_TIME() +# rndm;$SET_CHARACTER_SA($TargetContext(),"IsColorSleep",time);};
-$IF (cstr +# 2 >= cls)
-	{rndm = $RANDOM(4) +# 1;time = $GET_PARTY_TIME() +# rndm;$SET_CHARACTER_SA($TargetContext(),"IsColorBlind",time);}
-$ELSE {time = $GET_PARTY_TIME() +# 1; $SET_CHARACTER_SA($TargetContext(),"IsColorStun",time);};
\(END)

\(BEGIN)
name = spell_Command
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; $VAR cls; $VAR adj; $VAR lvl;
-$VAR tgt; $VAR eLvl; $VAR sav; $VAR rdm; $VAR eIQ; $VAR eCls;
-atk = $IndexOf($AttackerContext()); cls = $SA_PARAM_GET();
-adj =  $GET_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-tgt = $IndexOf($TargetContext());
-eLvl = $GET_COMBATANT_SA($TargetContext(),"monsterLevel");
-sav = $SkillAdj($CombatantContext(), "Save Vs SP", "", "F", "");
-rdm = $RANDOM(20) +# 1;
-eIQ = $GET_CHAR_LIMITED_INT(tgt);
-eCls = $GET_CHAR_CLASS(tgt);
-$IF ($GET_CHAR_UNDEAD(tgt) != "none") {$RETURN;};
-$IF (eLvl != "-?-?-")
-	{
-		$IF (eLvl ># 6){$IF (rdm >=# sav) {$RETURN;};};
-	}
-$ELSE
-	{
-		eLvl = $GET_CHAR_Lvl(tgt,eCls);
-		$IF (eLvl ># 6){$IF (rdm >=# sav) {$RETURN;};};
-	};
-$IF (eIQ ># 12)
-	{
-		$IF (rdm >=# sav) {$RETURN;};
-	};
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$SET_CHARACTER_SA($TargetContext(),"IsCommanded",atk);
\(END)

\(BEGIN)
name = spell_Confusion
[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();
-$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,"IsConfused") != "-?-?-" ||
-$GET_CHARACTER_SA($TargetContext(),"IsConfused") != "-?-?-"){$RETURN;};
-monLvl = $GET_MONSTERTYPE_SA(monName,"monsterLevel");
-$IF (monLvl != "-?-?-")
-	{
-		$IF (monLvl >=# 1){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 17 );};
-		$IF (monLvl >=# 3){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 16 );};
-		$IF (monLvl >=# 5){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 14 );};
-		$IF (monLvl >=# 7){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 13 );};
-		$IF (monLvl >=# 9){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 11 );};
-		$IF (monLvl >=# 11){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 10 );};
-		$IF (monLvl >=# 13){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 8 );};
-		$IF (monLvl >=# 15){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 7 );};
-		$IF (monLvl >=# 17){$SkillAdj($TargetContext(), "Save Vs SP", "spell", "B", 6 );};
-	};
-opr = $GET_CHARACTER_SA($AttackerContext(), "CombatRoundStart");
-$IF (opr  == "-?-?-")
-	{
-		$SET_CHARACTER_SA( $AttackerContext(), "CombatRoundStart",5);
-		rnd = (($RANDOM(4) +# 1) +# ($RANDOM(4) +# 1));
-		$SET_CHARACTER_SA( $AttackerContext(), "PointPool", rnd);
-	};
-opr = $GET_COMBATANT_SA($AttackerContext(), "CombatRoundStart");
-$IF (opr  <# 2)
-	{
-		$SET_CHARACTER_SA( $AttackerContext(), "CombatRoundStart", 3);
-		rnd = (($RANDOM(4) +# 1) +# ($RANDOM(4) +# 1));
-		$SET_CHARACTER_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", "F", "") ># rnd2)
-	{
-		$SET_CHARACTER_SA($TargetContext(),"IsConfusedExtended",1);
-		$SET_CHARACTER_SA($TargetContext(),"CombatRoundStart",1);
-	};
-rnd = $RANDOM(10) +# 1;
-$IF (rnd ==# 1){$SetFriendly(tgt,1);$RETURN;};
-$IF (rnd <=# 6){$SET_CHARACTER_SA($TargetContext(),"IsConfused","Confused");$RETURN;};
-$IF (rnd ==# 7){$SetFriendly(tgt,1);$RETURN;};
-$IF (rnd ==# 8){$SetFriendly(tgt,2);$RETURN;};
-$SetFriendly(tgt,2);
\(END)

\(BEGIN)
name = spell_ContinualDarknessCleric
[OverrideSpellTargeting] = $VAR p5; $VAR p6; $VAR lst; $VAR loc;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-$SET_HOOK_PARAM(1,"Select one of the following;");
-loc = "$"+p5+"$"+p6;
-lst = "$Map$Combatant";
-$SET_COMBATANT_SA($AttackerContext(),"ContinualDarknessClericTargetXY",loc);
-$RETURN lst;
[ProcessSpellTargetOverride] = $VAR p5; $VAR atk; $VAR tgt;
-p5 = $GET_HOOK_PARAM(5);
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-$AURA_Create("spell_ContinualDarknessClericAURA",p5,atk,tgt,"");
\(END)

\(BEGIN)
name = spell_ContinualDarknessClericAURA
[AURA_Create] = $VAR atk; $VAR tgt; $VAR prm; $VAR pXY; $VAR X; $VAR Y;
-atk = $AURA_GetData(0);
-tgt = $AURA_GetData(1);
-prm = $SA_PARAM_GET();
-pXY = $SA_COMBATANT_GET("ContinualDarknessClericTargetXY");
-X = $DelimitedStringSubstring(pXY,0);
-Y = $DelimitedStringSubstring(pXY,1);
-$IF (prm == "Combatant") {$AURA_Attach("Combatant"); $AURA_Combatant(tgt);};
-$IF (prm == "Map") {$AURA_Attach("XY"); $AURA_Location(X,Y);};
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,6,0,360);
-$AURA_Spell("Continual Darkness|Cleric");
-$AURA_Wavelength("Xray");
-$DELETE_COMBATANT_SA($IndexToActor(atk),"ContinualDarknessClericTargetXY");
[AURA_Enter] = $VAR IR; $VAR UV; $VAR pIR; $VAR pUV;
-IR = $GET_COMBATANT_SA($CombatantContext(),"monster_Infravision");
-UV = $GET_COMBATANT_SA($CombatantContext(),"monster_Ultravision");
-pIR = $SkillAdj($CharacterContext(),"Infravsion" , "", "F", 0 );
-pUV = $SkillAdj($CharacterContext(),"Ultravision" , "", "F", 0 );
-$IF (IR != "-?-?-"){$RETURN;}; $IF (UV != "-?-?-"){$RETURN;};
-$IF (pIR ># 0){$RETURN;}; $IF (pUV ># 0){$RETURN;};
-$SET_COMBATANT_SA($CombatantContext(),"IsDarkBlinded","");
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsDarkBlinded");
[Dispel] = $AURA_Destroy(); $DELETE_COMBATANT_SA($CombatantContext(),"IsDarkBlinded");
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_ContinualLightCleric
[InvokeSpellOnTarget] = $VAR X; $VAR Y; $VAR atk; $VAR tgt;
-X = $GET_HOOK_PARAM(5); Y = $GET_HOOK_PARAM(6);
-$SET_COMBATANT_SA($AttackerContext(),"ContinualLightClericTargetXY","$"+X+"$"+Y);
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-$AURA_Create("spell_ContinualLightClericAURA","",atk,tgt,"");
\(END)

\(BEGIN)
name = spell_ContinualLightClericAURA
[AURA_Create] = $VAR atk; $VAR tgt; $VAR prm; $VAR pXY; $VAR X; $VAR Y;
-atk = $AURA_GetData(0); tgt = $AURA_GetData(1);
-prm = $SA_PARAM_GET();
-pXY = $SA_COMBATANT_GET("ContinualLightClericTargetXY");
-X = $DelimitedStringSubstring(pXY,0); Y = $DelimitedStringSubstring(pXY,1);
-$AURA_Attach("XY");
-$AURA_Location(X,Y);
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,6,0,360);
-$AURA_Spell("Continual Light|Cleric");
-$AURA_Wavelength("Xray");
-$DELETE_COMBATANT_SA($IndexToActor(atk),"ContinualLightClericTargetXY");
[AURA_Enter] = $VAR sus;
-sus = $GET_COMBATANT_SA($CombatantContext(),"monster_LightSusceptible");
-$IF (sus == "-?-?-"){$RETURN;};
-$SET_COMBATANT_SA($CombatantContext(),"IsLightBlinded","");
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsLightBlinded");
[Dispel] = $AURA_Destroy();$DELETE_COMBATANT_SA($CombatantContext(),"IsLightBlinded");
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_ContinualLightMage
[InvokeSpellOnTarget] = $VAR X; $VAR Y; $VAR atk; $VAR tgt;
-X = $GET_HOOK_PARAM(5); Y = $GET_HOOK_PARAM(6);
-$SET_COMBATANT_SA($AttackerContext(),"ContinualLightMageTargetXY","$"+X+"$"+Y);
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-$AURA_Create("spell_ContinualLightMageAURA","",atk,tgt,"");
\(END)

\(BEGIN)
name = spell_ContinualLightMageAURA
[AURA_Create] = $VAR atk; $VAR tgt; $VAR prm; $VAR pXY; $VAR X; $VAR Y;
-atk = $AURA_GetData(0); tgt = $AURA_GetData(1);
-prm = $SA_PARAM_GET();
-pXY = $SA_COMBATANT_GET("ContinualLightMageTargetXY");
-X = $DelimitedStringSubstring(pXY,0); Y = $DelimitedStringSubstring(pXY,1);
-$AURA_Attach("XY");
-$AURA_Location(X,Y);
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,6,0,360);
-$AURA_Spell("Continual Light|MonsterMage");
-$AURA_Wavelength("Xray");
-$DELETE_COMBATANT_SA($IndexToActor(atk),"ContinualLightMageTargetXY");
[AURA_Enter] = $VAR sus;
-sus = $GET_COMBATANT_SA($CombatantContext(),"monster_LightSusceptible");
-$IF (sus == "-?-?-"){$RETURN;};
-$SET_COMBATANT_SA($CombatantContext(),"IsLightBlinded","");
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsLightBlinded");
[Dispel] = $AURA_Destroy();$DELETE_COMBATANT_SA($CombatantContext(),"IsLightBlinded");
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(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_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-exp = $GET_PARTY_TIME() +# (10 *# lvl);
-$SET_CHARACTER_SA($TargetContext(),"IsBestowedCurse",exp);
-$SkillAdj($TargetContext(),"Save Vs BW","BestowCurse","+","4");
-$SkillAdj($TargetContext(),"Save Vs PPDM","BestowCurse","+","4");
-$SkillAdj($TargetContext(),"Save Vs SP","BestowCurse","+","4");
\(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_CHARACTER_SA($AttackerContext(),"side");
-$IF (mySide ==# $GET_CHARACTER_SA($TargetContext(),"side")){$RETURN;};
-$SET_CHARACTER_SA($TargetContext(),"IsCursed",$GET_PARTY_TIME() +# 6);
\(END)

\(BEGIN)
name = spell_Darkness15RadiusMage
[OverrideSpellTargeting] = $VAR p5; $VAR p6; $VAR lst; $VAR loc;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-$SET_HOOK_PARAM(1,"Select one of the following;");
-loc = "$"+p5+"$"+p6;
-lst = "$Map$Combatant";
-$SET_COMBATANT_SA($AttackerContext(),"Darkness15RadiusMageTargetXY",loc);
-$RETURN lst;
[ProcessSpellTargetOverride] = $VAR p5; $VAR atk; $VAR tgt;
-$VAR cls; $VAR lvl; $VAR adj; $VAR exp;
-p5 = $GET_HOOK_PARAM(5);
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-cls = $GET_CHAR_CLASS(atk); lvl = $GET_CHAR_Lvl(atk,cls) +# 10;
-adj = $DelimitedStringSubstring($SA_SPELL_GET("casterLevel"),1);
-exp = $GET_PARTY_TIME() +# lvl -# adj;
-$AURA_Create("spell_Darkness15RadiusMageAURA",p5,atk,tgt,exp);
\(END)

\(BEGIN)
name = spell_Darkness15RadiusMageAURA
[AURA_Create] = $VAR atk; $VAR tgt; $VAR prm; $VAR pXY; $VAR X; $VAR Y;
-$DEBUG ("Light - AURA_Create");
-atk = $AURA_GetData(0);
-tgt = $AURA_GetData(1);
-prm = $SA_PARAM_GET();
-pXY = $SA_COMBATANT_GET("Darkness15RadiusMageTargetXY");
-X = $DelimitedStringSubstring(pXY,0);
-Y = $DelimitedStringSubstring(pXY,1);
-$IF (prm == "Combatant") {$AURA_Attach("Combatant"); $AURA_Combatant(tgt);};
-$IF (prm == "Map") {$AURA_Attach("XY"); $AURA_Location(X,Y);};
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,1,0,360);
-$AURA_Spell("Darkness 15' Radius|Mage");
-$AURA_Wavelength("Xray");
-$DELETE_COMBATANT_SA($IndexToActor(atk),"Darkness15RadiusMageTargetXY");
[AURA_Enter] = $SET_COMBATANT_SA($CombatantContext(),"IsDarkBlinded","");
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsDarkBlinded");
[AURA_Round] = $VAR exp;
-exp = $AURA_GetData(2);
-$IF ($GET_PARTY_TIME() ># exp)
-	{$AURA_Destroy();$DELETE_COMBATANT_SA($CombatantContext(),"IsDarkBlinded");};
[Dispel] = $AURA_Destroy();$DELETE_COMBATANT_SA($CombatantContext(),"IsDarkBlinded");
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_DarknessCleric
[OverrideSpellTargeting] = $VAR p5; $VAR p6; $VAR lst; $VAR loc;
-p5 = $GET_HOOK_PARAM(5); p6 = $GET_HOOK_PARAM(6);
-$SET_HOOK_PARAM(1,"Select one of the following;");
-loc = "$"+p5+"$"+p6;
-lst = "$Map$Combatant";
-$SET_COMBATANT_SA($AttackerContext(),"DarknessClericTargetXY",loc);
-$RETURN lst;
[ProcessSpellTargetOverride] = $VAR p5; $VAR atk; $VAR tgt;
-$VAR cls; $VAR lvl; $VAR adj; $VAR exp;
-p5 = $GET_HOOK_PARAM(5);
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-cls = $GET_CHAR_CLASS(atk); lvl = $GET_CHAR_Lvl(atk,cls) *# 10;
-adj = $DelimitedStringSubstring($SA_SPELL_GET("casterLevel"),1) *# 10;
-exp = $GET_PARTY_TIME() +# lvl -# adj;
-$AURA_Create("spell_DarknessClericAURA",p5,atk,tgt,exp);
\(END)

\(BEGIN)
name = spell_DarknessClericAURA
[AURA_Create] = $VAR atk; $VAR tgt; $VAR prm; $VAR pXY; $VAR X; $VAR Y;
-$DEBUG ("Light - AURA_Create");
-atk = $AURA_GetData(0);
-tgt = $AURA_GetData(1);
-prm = $SA_PARAM_GET();
-pXY = $SA_COMBATANT_GET("DarknessClericTargetXY");
-X = $DelimitedStringSubstring(pXY,0);
-Y = $DelimitedStringSubstring(pXY,1);
-$DEBUG ("choice made = " +prm);
-$IF (prm == "Combatant") {$AURA_Attach("Combatant"); $AURA_Combatant(tgt);};
-$IF (prm == "Map") {$AURA_Attach("XY"); $AURA_Location(X,Y);};
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,2,0,360);
-$AURA_Spell("Darkness|Cleric");
-$AURA_Wavelength("Xray");
-$DELETE_COMBATANT_SA($IndexToActor(atk),"DarknessClericTargetXY");
[AURA_Enter] = $VAR IR; $VAR UV; $VAR pIR; $VAR pUV;
-IR = $GET_COMBATANT_SA($CombatantContext(),"monster_Infravision");
-UV = $GET_COMBATANT_SA($CombatantContext(),"monster_Ultravision");
-pIR = $SkillAdj($CharacterContext(),"Infravsion" , "", "F", 0 );
-pUV = $SkillAdj($CharacterContext(),"Ultravision" , "", "F", 0 );
-$IF (IR != "-?-?-"){$RETURN;};
-$IF (UV != "-?-?-"){$RETURN;};
-$IF (pIR ># 0){$RETURN;};
-$IF (pUV ># 0){$RETURN;};
-$SET_COMBATANT_SA($CombatantContext(),"IsDarkBlinded","");
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsDarkBlinded");
[AURA_Round] = $VAR exp;
-exp = $AURA_GetData(2);
-$IF ($GET_PARTY_TIME() ># exp)
-	{$AURA_Destroy();$DELETE_COMBATANT_SA($CombatantContext(),"IsDarkBlinded");};
[Dispel] = $AURA_Destroy();$DELETE_COMBATANT_SA($CombatantContext(),"IsDarkBlinded");
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)

\(BEGIN)
name = spell_DeathSpell
\(END)

\(BEGIN)
name = spell_DetectCharms
[InvokeSpellOnTarget] = $VAR atk; $VAR cls; $VAR lvl; $VAR dur; $VAR exp;
-atk = $IndexOf($AttackerContext()); cls = $GET_CHAR_CLASS(atk); lvl = $GET_CHAR_Lvl(atk,cls);
-dur = lvl +# 3; exp = $GET_PARTY_TIME() +# dur;
-$SET_CHARACTER_SA($TargetContext(),"IsDetectingCharms",exp);
\(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 = 0;
-$IF (cls == "ranger"){adj = 8;};
-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_DismissElementalEarth
[InvokeSpellOnTarget] = $VAR tgt; $VAR mon;
-tgt = $IndexOf($TargetContext()); mon = $GET_CHAR_NAME(tgt);
-$IF ((mon == "Earth Elemental") || (mon == "Lesser Earth Elemental"))
-	{$SET_CHAR_STATUS(tgt,"5");};
\(END)

\(BEGIN)
name = spell_DismissElementalFire
[InvokeSpellOnTarget] = $VAR tgt; $VAR mon;
-tgt = $IndexOf($TargetContext()); mon = $GET_CHAR_NAME(tgt);
-$IF ((mon == "Fire Elemental") || (mon == "Lesser Fire Elemental"))
-	{$SET_CHAR_STATUS(tgt,"5");};
\(END)

\(BEGIN)
name = spell_Dispel
[InvokeSpellOnTarget] = $VAR atk; // attacker/caster
-$VAR tgt; // target
-$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());
-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_DispelIllusion
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR percent; $VAR rndm; $VAR ill;
-$VAR cls; // caster's class (creator)
-$VAR cLvl; // caster's level (creator)
-$VAR iLvl; // caster's level (item)
-$VAR dLvl; // caster's level (destroyer)
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-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;
-ill = $GET_CHARACTER_SA($TargetContext(),"DamageMagical");
-// spells and spell effects
-$IF (ill != "illusion"){$RETURN;};
-$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; $VAR dLvl; $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_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_CHARACTER_SA($TargetContext(),"enfeebled",100 -# (22 +# lvl));
-$SET_CHARACTER_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") || $GET_MONSTERTYPE_SA($MonsterTypeContext(),"reduced")) != "-?-?-")
-	{$RETURN $RUN_CHAR_SCRIPTS(tgt,"Dispel reduced");};
-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_CHARACTER_SA($TargetContext(),"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_CHARACTER_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_CHARACTER_SA($TargetContext(),"IsEntangled0",exp);}
-$ELSE{$SET_CHARACTER_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_FalseSeeing
[InvokeSpellOnTarget] = $VAR atk; $VAR cls; $VAR lvl; $VAR exp;
-atk = $IndexOf($AttackerContext());
-cls = $GetHighestLevelBaseclass(atk);
-lvl = $GET_CHAR_Lvl(atk,cls);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsFalseSeeing",exp);
\(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_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$SET_CHARACTER_SA($TargetContext(),"IsAfraid",atk);
\(END)

\(BEGIN)
name = spell_FireQuench
[InvokeSpellOnTarget] = $RUN_CHAR_SE_SCRIPTS($CharacterContext(),"Dispel Fire");
[SpellLingeringScripts] = $RETURN "RemoveFireLinger";
\(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_CHARACTER_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_FireStorm
[Dispel Fire] = $REMOVE_SPELL_EFFECT($CharacterContext(), $GET_HOOK_PARAM(5));
[RemoveFireLinger] = $RETURN "AREA";
\(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_CHARACTER_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_Geas
[OverrideSpellSelection] = $RETURN "$Attack Your Enemies|Geas$Flee Combat|Geas";
\(END)

\(BEGIN)
name = spell_GeasAttack
[InvokeSpellOnTarget] = $VAR tgt; $VAR iq;
-tgt = $IndexOf($TargetContext()); iq = $GET_CHAR_LIMITED_INT(tgt);
-$IF (iq ># 1) {$SET_COMBATANT_SA($TargetContext(),"IsGeasAttack","F");};
-$SetFriendly(tgt, $GET_COMBATANT_SA($Myself(),"side"));
\(END)

\(BEGIN)
name = spell_GeasFlee
[InvokeSpellOnTarget] = $VAR tgt; $VAR iq; $VAR me;
-tgt = $IndexOf($TargetContext()); iq = $GET_CHAR_LIMITED_INT(tgt); 
-me = $IndexOf($AttackerContext());
-$IF (iq ># 1) {$SET_COMBATANT_SA($TargetContext(),"IsGeasFlee",me);};
\(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_CHARACTER_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(),"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_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-exp = $GET_PARTY_TIME() +# (lvl *# 2);
-$SET_CHARACTER_SA($TargetContext(),"IsHeld",exp);
\(END)

\(BEGIN)
name = spell_HoldElemental
[InvokeSpellOnTarget] = $VAR tgt; $VAR el; $VAR atk; $VAR cls; $VAR lvl; $VAR exp; 
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved")){$RETURN;};
-el = $MonsterTypeContext();
-$IF ((el != "Air Elemental") || (el != "Earth Elemental") || (el != "Fire Elemental") || (el != "Water Elemental") || (el != "Lesser Air Elemental") || (el != "Lesser Earth Elemental") || (el != "Lesser Fire Elemental") || (el != "Lesser Water Elemental")){$RETURN;};
-atk = $IndexOf($AttackerContext()); cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls); exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_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_CHARACTER_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 nomTgt;
-$VAR type;
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved") ==# 1){$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-nomTgt = $GET_CHAR_NAME(tgt);
-type = $GET_CHAR_TYPE(tgt);
-$IF ((type != "@PC@") && (type != "@NPC@")) {$IF ($GET_MONSTERTYPE_SA(nomTgt,"IsPerson") == "-?-?-")  {$RETURN;};};
-cls = $SA_PARAM_GET();
-adj = $GET_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-exp = $GET_PARTY_TIME() +# 4 +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsHeld",exp);
\(END)

\(BEGIN)
name = spell_HoldPersonMU
[InvokeSpellOnTarget] = $VAR atk; // attacker
-$VAR tgt; // target
-$VAR nomTgt;
-$VAR cls;
-$VAR lvl;
-$VAR exp; // expiration time
-$VAR type;
-$IF ($GET_CHARACTER_SA($TargetContext(),"saved") ==# 1){$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) !=# 1){$RETURN;};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-nomTgt = $GET_CHAR_NAME(tgt);
-type = $GET_CHAR_TYPE(tgt);
-$IF (type != "@PC@" && type != "@NPC@") {$IF ($GET_MONSTERTYPE_SA(nomTgt,"IsPerson") == "-?-?-") {$RETURN;};};
-cls = $SA_PARAM_GET();
-lvl = $GET_CHAR_Lvl(atk,cls);
-exp = $GET_PARTY_TIME() +# (lvl *# 2);
-$SET_CHARACTER_SA($TargetContext(),"IsHeld",exp);
\(END)

\(BEGIN)
name = spell_HolyWord
[InvokeSpellOnTarget] = $VAR pln; $VAR evl; $VAR tgt; $VAR lvl; $VAR rD; $VAR rS; $VAR rP;
-pln = $GET_COMBATANT_SA($TargetContext(),"Summoned");
-evl = $GET_COMBATANT_SA($TargetContext(),"monster_CombatantAlignment");
-$IF (pln != "plane"){$RETURN;};
-$IF (evl != "evil"){$RETURN;};
-tgt = $IndexOf($TargetContext());
-lvl = $GetHighestLevelBaseclass(tgt);
-rD = $RANDOM(4) +# 1;
-rD = $RANDOM(4) +#$RANDOM(4) +# 2;
-rD = ($RANDOM(4) +# 1) *# 10;
-$IF (lvl ># 11){$RETURN $SET_COMBATANT_SA($TargetContext(),"IsHolyDeafened",rD);};
-$IF (lvl ># 7){$RETURN $SET_COMBATANT_SA($TargetContext(),"IsHolyStunned",rS);};
-$IF (lvl ># 3){$RETURN $SET_COMBATANT_SA($TargetContext(),"IsParalyzed",rP);};
-$SET_CHAR_HITPOINTS(tgt,-11); $SET_CHAR_STATUS(tgt,5);
\(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_CHARACTER_SA($TargetContext(),"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_CHARACTER_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_CHARACTER_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(),"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_CHARACTER_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(),"IsImmuneSpellsMinor",exp);
\(END)

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

\(BEGIN)
name = spell_IncendiaryCloud
[Dispel] = $SA_REMOVE(); $RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; $VAR cls; $VAR adj; $VAR lvl; $VAR rnd;
-$IF ($GET_CHARACTER_SA($TargetContext(),"elemental_ImmuneFire") != "-?-?-"){$RETURN;};
-$IF($GET_CHARACTER_SA($TargetContext(),"IsProtectedFireCaster") != "-?-?-"){$RETURN;};
-$IF($GET_CHARACTER_SA($TargetContext(),"IsProtectedFireTarget") != "-?-?-"){$RETURN;};
-atk = $IndexOf($AttackerContext()); cls = $SA_PARAM_GET(); rnd = $GetCombatRound();
-adj = $GET_CHARACTER_SA($AttackerContext(),"casterLevel"); lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$SET_CHARACTER_SA($TargetContext(),"FierySave",$SkillAdj($TargetContext(), "Save Vs Spell", "", "F", ""));
-$SET_CHARACTER_SA($TargetContext(),"IsFieryCloudy",rnd); $SET_CHARACTER_SA($TargetContext(),"FieryLevel",lvl);
[RemoveLinger] = $RETURN "AREA";
[SpellLingerBlockage] = $IF ($GET_CHARACTER_SA($CharacterContext(),"elemental_ImmuneFire") != "-?-?-" || $SA_CHARACTER_GET("IsProtectedFireCaster") != "-?-?-" || $SA_CHARACTER_GET("IsProtectedFireTarget") != "-?-?-"){$RETURN;};
-$IF ($GET_CHARACTER_SA($CombatantContext(),"FierySave") != "-?-?-") {$RETURN "N";};
\(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_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$SET_CHARACTER_SA($TargetContext(),"IsInvisibleSpell",2);
-$SET_CHARACTER_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_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($AttackerContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsInvisibleToAnimals",exp);
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = spell_LightCleric
[InvokeSpellOnTarget] = $VAR X; $VAR Y; $VAR atk; $VAR tgt; $VAR cls; $VAR lvl; $VAR adj; $VAR exp;
-X = $GET_HOOK_PARAM(5); Y = $GET_HOOK_PARAM(6);
-$SET_COMBATANT_SA($AttackerContext(),"LightClericTargetXY","$"+X+"$"+Y);
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-cls = $GET_CHAR_CLASS(atk); lvl = $GET_CHAR_Lvl(atk,cls) *# 10;
-adj = $DelimitedStringSubstring($SA_SPELL_GET("casterLevel"),1) *# 10;
-exp = $GET_PARTY_TIME() +# lvl -# adj;
-$AURA_Create("spell_LightClericAURA","",atk,tgt,exp);
\(END)

\(BEGIN)
name = spell_LightClericAURA
[AURA_Create] = $VAR atk; $VAR tgt; $VAR prm; $VAR pXY; $VAR X; $VAR Y;
-atk = $AURA_GetData(0); tgt = $AURA_GetData(1);
-prm = $SA_PARAM_GET(); pXY = $SA_COMBATANT_GET("LightClericTargetXY");
-X = $DelimitedStringSubstring(pXY,0); Y = $DelimitedStringSubstring(pXY,1);
\(END)

\(BEGIN)
name = spell_LightMage
[InvokeSpellOnTarget] = $VAR X; $VAR Y; $VAR atk; $VAR tgt; $VAR cls; $VAR lvl; $VAR adj; $VAR exp;
-X = $GET_HOOK_PARAM(5); Y = $GET_HOOK_PARAM(6);
-$SET_COMBATANT_SA($AttackerContext(),"LightMageTargetXY","$"+X+"$"+Y);
-atk = $IndexOf($AttackerContext()); tgt = $IndexOf($TargetContext());
-cls = $GET_CHAR_CLASS(atk); lvl = $GET_CHAR_Lvl(atk,cls) *# 10;
-adj = $DelimitedStringSubstring($SA_SPELL_GET("casterLevel"),1) *# 10;
-exp = $GET_PARTY_TIME() +# lvl -# adj;
-$AURA_Create("spell_LightMageAURA","",atk,tgt,exp);
\(END)

\(BEGIN)
name = spell_LightMageAURA
[AURA_Create] = $VAR atk; $VAR tgt; $VAR prm; $VAR pXY; $VAR X; $VAR Y;
-atk = $AURA_GetData(0); tgt = $AURA_GetData(1);
-prm = $SA_PARAM_GET(); pXY = $SA_COMBATANT_GET("LightMageTargetXY");
-X = $DelimitedStringSubstring(pXY,0); Y = $DelimitedStringSubstring(pXY,1);
-$AURA_Attach("XY");
-$AURA_Location(X,Y);
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,2,0,360);
-$AURA_Spell("Light|MonsterMage");
-$AURA_Wavelength("Xray");
-$DELETE_COMBATANT_SA($IndexToActor(atk),"LightMageTargetXY");
[AURA_Enter] = $VAR sus;
-sus = $GET_COMBATANT_SA($CombatantContext(),"monster_LightSusceptible");
-$IF (sus == "-?-?-"){$RETURN;};
-$SET_COMBATANT_SA($CombatantContext(),"IsLightBlinded","");
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsLightBlinded");
[AURA_Round] = $VAR exp;
-exp = $AURA_GetData(2);
-$IF ($GET_PARTY_TIME() ># exp)
-	{$AURA_Destroy();$DELETE_COMBATANT_SA($CombatantContext(),"IsLightBlinded");};
[Dispel] = $AURA_Destroy();$DELETE_COMBATANT_SA($CombatantContext(),"IsLightBlinded");
[SpellDuration] = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(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_CHARACTER_SA($AttackerContext(),"CombatRoundStart");
-$IF (opr == "-?-?-" || opr ==# 0)
-	{
-		$SET_CHARACTER_SA($AttackerContext(),"CombatRoundStart",5);
-		$SET_CHARACTER_SA($AttackerContext(),"PointPool",clvl *# 2);
-	};
-rnd = $GET_CHARACTER_SA($AttackerContext(),"PointPool");
-$IF (rnd <# 1) {$RETURN;};
-$IF ($GET_CANBEHELDORCHARMED($TargetContext()) != 1) {$RETURN;};
-side = $GET_CHARACTER_SA($AttackerContext(), "side");
-$IF ($GET_CHARACTER_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_CHARACTER_SA($AttackerContext(),"PointPool",rnd -# lvl);
-		$IF ($GET_CHARACTER_SA($TargetContext(),"saved" )) {$RETURN;};
-		$SetFriendly(tgt,side);
-		$SET_CHARACTER_SA($TargetContext(),"IsCharmed",clvl);
-	};
\(END)

\(BEGIN)
name = spell_MindBlast
[InvokeSpellOnTarget] = $VAR exp;
-exp = $GetCombatRound() +# $RANDOM(9) +# 4;
-$SET_CHARACTER_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_CHARACTER_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($TargetContext(),"IsMirrored") == "-?-?-")
-  {$SET_CHARACTER_SA($TargetContext(),"IsMirrored",0);};
-// Add new images
-$SET_CHARACTER_SA($TargetContext(),"IsMirrored",$GET_CHARACTER_SA($AttackerContext(),"IsMirrored") +# images);
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = spell_MummyRot
[InvokeSpellOnTarget] = $SET_CHARACTER_SA($CharacterContext(),"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($TargetContext(),"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 ($GET_CHARACTER_SA($TargetContext(),"IsImmunePoison") != "-?-?-"){$RETURN;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsProtectedPoisonCaster") != "-?-?-"){$RETURN;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"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_CHARACTER_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_CHARACTER_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_PrismaticSpray
[InvokeSpellOnTarget] = $VAR rndm; $VAR tgt; $VAR hp; $VAR save; $VAR vsPoison; $VAR vsWand; $VAR vsMagic; $VAR time;
-rndm = $RANDOM(8); 
-tgt = $IndexOf($TargetContext());
-hp = $GET_CHAR_HITPOINTS(tgt);
-save = $RANDOM(20) +# 1;
-vsPoison = $SkillAdj($TargetContext(), "Save Vs PPDM", "", "F", "");
-vsWand = $SkillAdj($TargetContext(), "Save Vs RSW", "", "F", "");
-vsMagic = $SkillAdj($TargetContext(), "Save Vs SP", "", "F", "");
-time = $GET_PARTY_TIME();
-$IF (rndm ==# 0){$SET_CHAR_HITPOINTS(tgt,hp -# 10);};
-$IF (rndm ==# 1){$SET_CHAR_HITPOINTS(tgt,hp -# 20);};
-$IF (rndm ==# 2){$SET_CHAR_HITPOINTS(tgt,hp -# 40);};
-$IF (rndm ==# 3)
-	{
-		$IF (save <# vsPoison)
-			{
-				$SET_COMBATANT_SA($TargetContext(),"IsPoisoned",time);
-				$SET_CHAR_STATUS(tgt,2);$SET_CHAR_HITPOINTS(tgt,"-11");
-			};
-	};
-$IF (rndm ==# 4)
-	{
-		$IF (save <# vsPoison)
-			{$SET_COMBATANT_SA($TargetContext(),"IsPetrified",time);	$SET_CHAR_STATUS(tgt,4);};
-	};
-$IF (rndm ==# 5)
-	{ $IF (save <# vsWand){$SET_COMBATANT_SA($TargetContext(),"IsInsane",time);}; };
-$IF (rndm ==# 6)
-	{ $IF (save <# vsMagic){$SET_CHAR_STATUS(tgt,5);}; };
-$IF (rndm ==# 7)
-	{
-		$SET_CHAR_HITPOINTS(tgt,hp -# 20);
-		$IF (save <# vsWand){$SET_COMBATANT_SA($TargetContext(),"IsInsane",time);};
-	};
\(END)

\(BEGIN)
name = spell_ProtectionFromAcid
[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_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($CharacterContext(),"DispelLevel",lvl);
-exp = $GET_PARTY_TIME() +# lvl *# 10;
-$IF (atk ==# tgt)
-	{
-		$SET_CHARACTER_SA($TargetContext(),"IsProtectedAcidCaster",exp);
-		$SET_CHARACTER_SA($TargetContext(),"AcidPoints",lvl *# 12);
-	}
-$ELSE{$SET_CHARACTER_SA($TargetContext(),"IsProtectedAcidTarget",exp);};
-$SkillAdj($TargetContext(),"Save Vs BR","protectionAcid","-","4");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectionAcid","-","4");
-$SkillAdj($TargetContext(),"Save Vs SP","protectionAcid","-","4");
[RemoveLinger] = $RETURN "TARGETS";
\(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_CHARACTER_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);
-$SkillAdj($TargetContext(),"Save Vs BR","protectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs PP","protectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs PPDM","protectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectedEvil","-","2");
-$SkillAdj($TargetContext(),"Save Vs SP","protectedEvil","-","2");
[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_CHARACTER_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);};
-$SkillAdj($TargetContext(),"Save Vs BR","protectedFire","-","4");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectedFire","-","4");
-$SkillAdj($TargetContext(),"Save Vs SP","protectedFire","-","4");
[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_CHARACTER_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);
-$SkillAdj($TargetContext(),"Save Vs BR","protectedGood","-","2");
-$SkillAdj($TargetContext(),"Save Vs PP","protectedGood","-","2");
-$SkillAdj($TargetContext(),"Save Vs PPDM","protectedGood","-","2");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectedGood","-","2");
-$SkillAdj($TargetContext(),"Save Vs SP","protectedGood","-","2");
\(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_CHARACTER_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(),"LightningPoints",lvl *# 12);
-	}
-$ELSE{$SET_CHARACTER_SA($TargetContext(),"IsProtectedLightningTarget",exp);};
-$SkillAdj($TargetContext(),"Save Vs BR","protectedLightning","-","4");
-$SkillAdj($TargetContext(),"Save Vs RSW","protectedLightning","-","4");
-$SkillAdj($TargetContext(),"Save Vs SP","protectedLightning","-","4");
[RemoveLinger] = $RETURN "TARGETS";
\(END)

\(BEGIN)
name = spell_Pyrotechnics
[InvokeSpellOnTarget] = $VAR atk; $VAR cls; $VAR lvl; $VAR adj;
-atk = $IndexOf($AttackerContext()); cls = $SA_PARAM_GET(); adj = 0;
-$IF (cls == "ranger"){adj = 8;};
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"IsBlindPyrotechnics",$GET_PARTY_TIME() +# lvl);
\(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_CHARACTER_SA($TargetContext(),"mummy") == 1)
-	{ // Mummy Swap
-		$AddCombatant("Ancient Fighter",0);
-		$TeleportCombatant($IndexOf($Name("Ancient Fighter")),$GET_HOOK_PARAM(5),$GET_HOOK_PARAM(6));
-		$DELETE_CHARACTER_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")  != "-?-?-") || ($GET_MONSTERTYPE_SA($MonsterTypeContext(),"enlarged") != "-?-?-"))
-	{$RETURN $RUN_CHAR_SCRIPTS(tgt,"Dispel enlarged");};
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-cls = $SA_PARAM_GET();
-adj = $GET_CHARACTER_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_Regenerate
[InvokeSpellOnTarget] = $VAR tgt; $VAR hp; $VAR maxHp;
-tgt = $IndexOf($TargetContext()); hp = $GET_CHAR_HITPOINTS(tgt); maxHp = $GET_CHAR_MAXHITPOINTS(tgt);
-$IF (hp <# maxHp) {$SET_CHAR_HITPOINTS(tgt,maxHp);};
-$DELETE_CHARACTER_SA($TargetContext(),"IsWithered");
-$DELETE_CHARACTER_SA($TargetContext(),"IsMissingFinger");
\(END)

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

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

\(BEGIN)
name = spell_RemoveFearCleric
[InvokeSpellOnTarget] = $VAR exp; $VAR afr;
-exp = $GET_PARTY_TIME() +# 10;
-afr = $GET_COMBATANT_SA($TargetContext(),"IsAfraid");
-$IF (afr != "-?-?-") {$RETURN $DELETE_COMBATANT_SA($TargetContext(),"IsAfraid");};
-$SET_COMBATANT_SA($TargetContext(),"IsBrave",exp);
\(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($TargetContext(),"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($TargetContext())){$SET_CHAR_AGE(tgt, ($GET_CHAR_AGE(tgt) +# 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_CHARACTER_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_CHARACTER_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_CHARACTER_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(), "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 tgt; // target
-$VAR type;
-$VAR nomTgt;
-$VAR index;
-$VAR lvl;
-$VAR monLvlMon;
-$VAR bCls; // baseclass
-tgt = $IndexOf($TargetContext());
-type = $GET_CHAR_TYPE(tgt);
-nomTgt = $GET_CHAR_NAME(tgt);
-monLvlMon = $GET_MONSTERTYPE_SA(nomTgt,"monsterLevel");
-$IF ($GET_CHAR_STATUS(tgt) != 0){$RETURN;};
-$IF (type != "@PC@" || type != "@NPC@") {$IF ($GET_CHAR_UNDEAD(tgt) != "none") {$RETURN;};};
-$IF ($GET_CHARACTER_SA($TargetContext(),"monster_ImmuneSleep") != "-?-?-") {$RETURN;};
-$IF ($GET_CHARACTER_SA($TargetContext(),"IsSleeping") != "-?-?-") {$RETURN;};
-$IF (monLvlMon != "-?-?-") {lvl = monLvlMon;}
-$ELSE {bCls = $GetHighestLevelBaseclass(tgt);lvl = $GetBaseclassLevel(tgt,bCls);};
-$IF (lvl <# 5) {$SET_CHARACTER_SA($TargetContext(),"IsSleeping","Sleeping");};
\(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_CHARACTER_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_CHARACTER_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_CHARACTER_SA($TargetContext(),"IsSnake") == "-?-?-"){$RETURN;};
-atk = $IndexOf($AttackerContext());
-cls = $SA_PARAM_GET();
-adj = $GET_CHARACTER_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_SpeakWithDead
\(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_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$IF ($GET_CHARACTER_SA($TargetContext(),"StinkingSave") == "-?-?-")
-  {
-   $SET_CHARACTER_SA($TargetContext(),"StinkingSave",$SkillAdj($TargetContext(), "Save Vs PPDM", "", "F", ""));
-   $IF ($GET_CHARACTER_SA($TargetContext(),"StinkingSave") != 1)
-     {$SET_CHARACTER_SA($TargetContext(),"IsStinkingStuck",$GetCombatRound() +# $RANDOM(4) +# 2);};
-  };
-$IF ($GET_CHARACTER_SA($TargetContext(),"StinkingSave") == 1)
-  {$SET_CHARACTER_SA($TargetContext(),"IsStinkingCloudy",$GetCombatRound());};
[RemoveLinger] = $RETURN "AREA";
[SpellLingerBlockage] = $IF ($GET_CHARACTER_SA($CharacterContext(),"IsImmunePoison") != "-?-?-" || $GET_HASPOISONIMMUNITY($CombatantContext()) == 1 || $SA_CHARACTER_GET("IsProtectedPoisonCaster") != "-?-?-" || $SA_CHARACTER_GET("IsProtectedPoisonTarget") != "-?-?-"){$RETURN;};
-$IF ($GET_CHARACTER_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_CHARACTER_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_CHARACTER_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_CHARACTER_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_CHARACTER_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_CHARACTER_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_CHARACTER_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_CHARACTER_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_Symbol
[OverrideSpellSelection] = $RETURN "$Symbol of Hopelessness$Symbol of Pain$Symbol of Persuasion";
\(END)

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

\(BEGIN)
name = spell_TransmuteRockToMud
[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(),"IsStuckInMud","");
[RemoveLinger] = $RETURN "AREA";
[SpellLingerBlockage] = $RETURN "Y";
\(END)

\(BEGIN)
name = spell_TrueSeeing
[InvokeSpellOnTarget] = $VAR atk; $VAR cls; $VAR lvl; $VAR exp;
-atk = $IndexOf($AttackerContext());
-cls = $GetHighestLevelBaseclass(atk);
-lvl = $GET_CHAR_Lvl(atk,cls);
-exp = $GET_PARTY_TIME() +# lvl;
-$SET_CHARACTER_SA($TargetContext(),"IsDetectingCharms",exp);
-$SET_CHARACTER_SA($TargetContext(),"IsDetectingEvil",exp);
-$SET_CHARACTER_SA($TargetContext(),"IsDetectingGood",exp);
-$SET_CHARACTER_SA($TargetContext(),"IsDetectingIllusion",exp);
-$SET_CHARACTER_SA($TargetContext(),"IsDetectingMagic",exp);
-$SET_CHARACTER_SA($TargetContext(),"IsDetectingSecretDoors",exp);
-$SET_CHARACTER_SA($TargetContext(),"IsSeeingAstral",exp);
-$SET_CHARACTER_SA($TargetContext(),"IsSeeingDisplaced",exp);
-$SET_CHARACTER_SA($TargetContext(),"IsSeeingEthereal",exp);
-$SET_CHARACTER_SA($TargetContext(),"IsSeeingInvisible",exp);
\(END)

\(BEGIN)
name = spell_UnholyWord
[InvokeSpellOnTarget] = $VAR pln; $VAR good; $VAR tgt; $VAR lvl; $VAR rD; $VAR rS; $VAR rP;
-pln = $GET_COMBATANT_SA($TargetContext(),"Summoned");
-good = $GET_COMBATANT_SA($TargetContext(),"monster_CombatantAlignment");
-$IF (pln != "plane"){$RETURN;};
-$IF (good != "good"){$RETURN;};
-tgt = $IndexOf($TargetContext());
-lvl = $GetHighestLevelBaseclass(tgt);
-rD = $RANDOM(4) +# 1;
-rD = $RANDOM(4) +#$RANDOM(4) +# 2;
-rD = ($RANDOM(4) +# 1) *# 10;
-$IF (lvl ># 11){$RETURN $SET_COMBATANT_SA($TargetContext(),"IsHolyDeafened",rD);};
-$IF (lvl ># 7){$RETURN $SET_COMBATANT_SA($TargetContext(),"IsHolyStunned",rS);};
-$IF (lvl ># 3){$RETURN $SET_COMBATANT_SA($TargetContext(),"IsParalyzed",rP);};
-$SET_CHAR_HITPOINTS(tgt,-11); $SET_CHAR_STATUS(tgt,5);
\(END)

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

\(BEGIN)
name = spell_WallOfStone
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[RemoveLinger] = $RETURN "AREA";
[SpellLingerBlockage] = $RETURN "Y";
\(END)

\(BEGIN)
name = spell_Web
[Dispel] = $SA_REMOVE();
-$RUN_CHAR_SE_SCRIPTS($TargetContext(),"Dispel SE");
[Dispel SE] = $REMOVE_SPELL_EFFECT($CharacterContext(),$GET_HOOK_PARAM(5));
[InvokeSpellOnTarget] = $VAR atk; $VAR tgt; $VAR cls; $VAR adj; $VAR lvl;
-$VAR exp; $VAR time;
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-cls = $SA_PARAM_GET();
-adj = $GET_CHARACTER_SA($AttackerContext(),"casterLevel");
-lvl = $GET_CHAR_Lvl(atk,cls) -# adj;
-exp = $GET_PARTY_TIME() +# 10;
-time = $GET_PARTY_TIME();
-$SET_CHARACTER_SA($TargetContext(),"DispelLevel",lvl);
-$IF ($GET_CHARACTER_SA($TargetContext(),"webSaveFailed") != "-?-?-")
-	{
-		$SET_CHARACTER_SA($TargetContext(),"IsWebbed",exp);
-		$SET_CHARACTER_SA($TargetContext(),"IsWebbedTime",time);
-		$DELETE_CHARACTER_SA($TargetContext(),"webSaveFailed");
-	};
[RemoveLinger] = $RETURN "AREA";
\(END)

\(BEGIN)
name = spell_Wither
[InvokeSpellOnTarget] = $VAR tgt; $VAR rndm; $VAR hp;
-tgt = $IndexOf($TargetContext()); rndm = $RANDOM(20); hp = $GET_CHAR_HITPOINTS(tgt);
-$IF (rndm ==# 19){$SET_CHAR_HITPOINTS(tgt,"-11");$SET_CHAR_STATUS(tgt,"5");$RETURN;};
-$IF (rndm >=# 9){$SET_CHAR_HITPOINTS(tgt,hp /# 3);$SET_CHAR_STATUS(tgt,"9");$SET_CHARACTER_SA($TargetContext(),"IsWithered","");$RETURN;};
-$SET_CHAR_HITPOINTS(tgt,hp /# 2);$SET_CHAR_STATUS(tgt,"1");
-$RETURN;
\(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 = 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)
