Inheritance: CLRScriptFramework.CLRScriptBase
 private static void SetPersonalityProperties(CLRScriptBase script, uint armor, Generation.Theme theme, int baseEnhancement, ref double effectivePlusRemaining, ref double currentEffectivePlus)
 {
     switch (theme)
     {
         case Generation.Theme.Acid:
         case Generation.Theme.Cold:
         case Generation.Theme.Fire:
         case Generation.Theme.Electricity:
         case Generation.Theme.Sound:
             {
                 if (effectivePlusRemaining >= (1.0 / 3.0))
                 {
                     int vsElementalAC = 0;
                     if (effectivePlusRemaining >= (4.0 / 3.0))
                     {
                         vsElementalAC = baseEnhancement + 4;
                     }
                     else if (effectivePlusRemaining >= 1.0)
                     {
                         vsElementalAC = baseEnhancement + 3;
                     }
                     else if (effectivePlusRemaining >= (2.0 / 3.0))
                     {
                         vsElementalAC = baseEnhancement + 2;
                     }
                     else
                     {
                         vsElementalAC = baseEnhancement + 1;
                     }
                     if (vsElementalAC > 5) vsElementalAC = 5;
                     if (vsElementalAC > baseEnhancement)
                     {
                         script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonusVsRace(IP_CONST_RACIALTYPE_ELEMENTAL, vsElementalAC), armor, 0.0f);
                         script.SetFirstName(armor, String.Format("{0} of Elementalwarding", script.GetName(armor)));
                         effectivePlusRemaining -= ((double)(vsElementalAC - baseEnhancement)) / 3.0;
                         currentEffectivePlus += ((double)(vsElementalAC - baseEnhancement)) / 3.0;
                         return;
                     }
                 }
                 return;
             }
         case Generation.Theme.ConstructSlaying:
             {
                 if (effectivePlusRemaining >= (1.0 / 3.0))
                 {
                     int vsConstructAC = 0;
                     if (effectivePlusRemaining >= (4.0 / 3.0))
                     {
                         vsConstructAC = baseEnhancement + 4;
                     }
                     else if (effectivePlusRemaining >= 1.0)
                     {
                         vsConstructAC = baseEnhancement + 3;
                     }
                     else if (effectivePlusRemaining >= (2.0 / 3.0))
                     {
                         vsConstructAC = baseEnhancement + 2;
                     }
                     else
                     {
                         vsConstructAC = baseEnhancement + 1;
                     }
                     if (vsConstructAC > 5) vsConstructAC = 5;
                     if (vsConstructAC > baseEnhancement)
                     {
                         script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonusVsRace(IP_CONST_RACIALTYPE_CONSTRUCT, vsConstructAC), armor, 0.0f);
                         script.SetFirstName(armor, String.Format("{0} of Golemwarding", script.GetName(armor)));
                         effectivePlusRemaining -= ((double)(vsConstructAC - baseEnhancement)) / 3.0;
                         currentEffectivePlus += ((double)(vsConstructAC - baseEnhancement)) / 3.0;
                         return;
                     }
                 }
                 return;
             }
         case Generation.Theme.DemonSlaying:
         case Generation.Theme.DevilSlaying:
             {
                 if (effectivePlusRemaining >= (1.0 / 3.0))
                 {
                     int vsOutsiderAC = 0;
                     if (effectivePlusRemaining >= (4.0 / 3.0))
                     {
                         vsOutsiderAC = baseEnhancement + 4;
                     }
                     else if (effectivePlusRemaining >= 1.0)
                     {
                         vsOutsiderAC = baseEnhancement + 3;
                     }
                     else if (effectivePlusRemaining >= (2.0 / 3.0))
                     {
                         vsOutsiderAC = baseEnhancement + 2;
                     }
                     else
                     {
                         vsOutsiderAC = baseEnhancement + 1;
                     }
                     if (vsOutsiderAC > 5) vsOutsiderAC = 5;
                     if (vsOutsiderAC > baseEnhancement)
                     {
                         script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonusVsRace(IP_CONST_RACIALTYPE_OUTSIDER, vsOutsiderAC), armor, 0.0f);
                         script.SetFirstName(armor, String.Format("{0} of Fiendwarding", script.GetName(armor)));
                         effectivePlusRemaining -= ((double)(vsOutsiderAC - baseEnhancement)) / 3.0;
                         currentEffectivePlus += ((double)(vsOutsiderAC - baseEnhancement)) / 3.0;
                         return;
                     }
                 }
                 return;
             }
         case Generation.Theme.DragonSlaying:
             {
                 if (effectivePlusRemaining >= (1.0 / 3.0))
                 {
                     int vsDragonAC = 0;
                     if (effectivePlusRemaining >= (4.0 / 3.0))
                     {
                         vsDragonAC = baseEnhancement + 4;
                     }
                     else if (effectivePlusRemaining >= 1.0)
                     {
                         vsDragonAC = baseEnhancement + 3;
                     }
                     else if (effectivePlusRemaining >= (2.0 / 3.0))
                     {
                         vsDragonAC = baseEnhancement + 2;
                     }
                     else
                     {
                         vsDragonAC = baseEnhancement + 1;
                     }
                     if (vsDragonAC > 5) vsDragonAC = 5;
                     if (vsDragonAC > baseEnhancement)
                     {
                         script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonusVsRace(IP_CONST_RACIALTYPE_DRAGON, vsDragonAC), armor, 0.0f);
                         script.SetFirstName(armor, String.Format("{0} of Dragonwarding", script.GetName(armor)));
                         effectivePlusRemaining -= ((double)(vsDragonAC - baseEnhancement)) / 3.0;
                         currentEffectivePlus += ((double)(vsDragonAC - baseEnhancement)) / 3.0;
                         return;
                     }
                 }
                 return;
             }
         case Generation.Theme.FeySlaying:
             {
                 if (effectivePlusRemaining >= (1.0 / 3.0))
                 {
                     int vsFeyAC = 0;
                     if (effectivePlusRemaining >= (4.0 / 3.0))
                     {
                         vsFeyAC = baseEnhancement + 4;
                     }
                     else if (effectivePlusRemaining >= 1.0)
                     {
                         vsFeyAC = baseEnhancement + 3;
                     }
                     else if (effectivePlusRemaining >= (2.0 / 3.0))
                     {
                         vsFeyAC = baseEnhancement + 2;
                     }
                     else
                     {
                         vsFeyAC = baseEnhancement + 1;
                     }
                     if (vsFeyAC > 5) vsFeyAC = 5;
                     if (vsFeyAC > baseEnhancement)
                     {
                         script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonusVsRace(IP_CONST_RACIALTYPE_FEY, vsFeyAC), armor, 0.0f);
                         script.SetFirstName(armor, String.Format("{0} of Feywarding", script.GetName(armor)));
                         effectivePlusRemaining -= ((double)(vsFeyAC - baseEnhancement)) / 3.0;
                         currentEffectivePlus += ((double)(vsFeyAC - baseEnhancement)) / 3.0;
                         return;
                     }
                 }
                 return;
             }
         case Generation.Theme.GiantSlaying:
             {
                 if (effectivePlusRemaining >= (1.0 / 3.0))
                 {
                     int vsGiantAC = 0;
                     if (effectivePlusRemaining >= (4.0 / 3.0))
                     {
                         vsGiantAC = baseEnhancement + 4;
                     }
                     else if (effectivePlusRemaining >= 1.0)
                     {
                         vsGiantAC = baseEnhancement + 3;
                     }
                     else if (effectivePlusRemaining >= (2.0 / 3.0))
                     {
                         vsGiantAC = baseEnhancement + 2;
                     }
                     else
                     {
                         vsGiantAC = baseEnhancement + 1;
                     }
                     if (vsGiantAC > 5) vsGiantAC = 5;
                     if (vsGiantAC > baseEnhancement)
                     {
                         script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonusVsRace(IP_CONST_RACIALTYPE_GIANT, vsGiantAC), armor, 0.0f);
                         script.SetFirstName(armor, String.Format("{0} of Giantwarding", script.GetName(armor)));
                         effectivePlusRemaining -= ((double)(vsGiantAC - baseEnhancement)) / 3.0;
                         currentEffectivePlus += ((double)(vsGiantAC - baseEnhancement)) / 3.0;
                         return;
                     }
                 }
                 return;
             }
         case Generation.Theme.Holy:
             {
                 if (effectivePlusRemaining >= 0.5)
                 {
                     int vsEvilAC = 0;
                     if (effectivePlusRemaining >= 2.0)
                     {
                         vsEvilAC = baseEnhancement + 4;
                     }
                     else if (effectivePlusRemaining >= 1.5)
                     {
                         vsEvilAC = baseEnhancement + 3;
                     }
                     else if (effectivePlusRemaining >= 1.0)
                     {
                         vsEvilAC = baseEnhancement + 2;
                     }
                     else if (effectivePlusRemaining >= 0.5)
                     {
                         vsEvilAC = baseEnhancement + 1;
                     }
                     if (vsEvilAC > 5) vsEvilAC = 5;
                     if (vsEvilAC > baseEnhancement)
                     {
                         script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonusVsAlign(IP_CONST_ALIGNMENTGROUP_EVIL, vsEvilAC), armor, 0.0f);
                         script.SetFirstName(armor, String.Format("Holy {0}", script.GetName(armor)));
                         effectivePlusRemaining -= ((double)(vsEvilAC - baseEnhancement)) / 2.0;
                         currentEffectivePlus += ((double)(vsEvilAC - baseEnhancement)) / 2.0;
                         return;
                     }
                 }
                 return;
             }
         case Generation.Theme.Themeless:
             {
                 // Not much we can do with no theme. Return a less-than-max-value item
                 return;
             }
         case Generation.Theme.UndeadSlaying:
             {
                 if (effectivePlusRemaining >= (1.0 / 3.0))
                 {
                     int vsUndeadAC = 0;
                     if (effectivePlusRemaining >= (4.0 / 3.0))
                     {
                         vsUndeadAC = baseEnhancement + 4;
                     }
                     else if (effectivePlusRemaining >= 1.0)
                     {
                         vsUndeadAC = baseEnhancement + 3;
                     }
                     else if (effectivePlusRemaining >= (2.0 / 3.0))
                     {
                         vsUndeadAC = baseEnhancement + 2;
                     }
                     else
                     {
                         vsUndeadAC = baseEnhancement + 1;
                     }
                     if (vsUndeadAC > 5) vsUndeadAC = 5;
                     if (vsUndeadAC > baseEnhancement)
                     {
                         script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonusVsRace(IP_CONST_RACIALTYPE_UNDEAD, vsUndeadAC), armor, 0.0f);
                         script.SetFirstName(armor, String.Format("{0} of Undeadwarding", script.GetName(armor)));
                         effectivePlusRemaining -= ((double)(vsUndeadAC - baseEnhancement)) / 3.0;
                         currentEffectivePlus += ((double)(vsUndeadAC - baseEnhancement)) / 3.0;
                         return;
                     }
                 }
                 return;
             }
         case Generation.Theme.Unholy:
             {
                 if (effectivePlusRemaining >= 0.5)
                 {
                     int vsGoodAC = 0;
                     if (effectivePlusRemaining >= 1.6)
                     {
                         vsGoodAC = baseEnhancement + 4;
                     }
                     else if (effectivePlusRemaining >= 1.2)
                     {
                         vsGoodAC = baseEnhancement + 3;
                     }
                     else if (effectivePlusRemaining >= 0.8)
                     {
                         vsGoodAC = baseEnhancement + 2;
                     }
                     else if (effectivePlusRemaining >= 0.4)
                     {
                         vsGoodAC = baseEnhancement + 1;
                     }
                     if (vsGoodAC > 5) vsGoodAC = 5;
                     if (vsGoodAC > baseEnhancement)
                     {
                         script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonusVsAlign(IP_CONST_ALIGNMENTGROUP_GOOD, vsGoodAC), armor, 0.0f);
                         script.SetFirstName(armor, String.Format("Unholy {0}", script.GetName(armor)));
                         effectivePlusRemaining -= ((double)(vsGoodAC - baseEnhancement)) * 2.0 / 5.0;
                         currentEffectivePlus += ((double)(vsGoodAC - baseEnhancement)) * 2.0 / 5.0;
                         return;
                     }
                 }
                 return;
             }
     }
 }