private static bool IsTrapDetectedBy(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint detector) { if (trap.Detected) { return false; } if(!IsInArea(s, trap, detector)) { return false; } if (s.GetDetectMode(detector) == FALSE) { s.DelayCommand(6.0f, delegate { DetectHeartBeat(s, trap, detector); }); return false; } if (trap.DetectDC > 20 && s.GetLevelByClass(CLASS_TYPE_ROGUE, detector) == FALSE && s.GetHasSpellEffect(SPELL_FIND_TRAPS, detector) == FALSE) { s.DelayCommand(6.0f, delegate { DetectHeartBeat(s, trap, detector); }); return false; } int searchBonus = s.GetSkillRank(SKILL_SEARCH, detector, FALSE); int roll = s.d20(1); int finalDice = roll + searchBonus; if (trap.DetectDC <= finalDice) { return true; } s.DelayCommand(6.0f, delegate { DetectHeartBeat(s, trap, detector); }); return false; }
public static void SortLists(CLRScriptBase script) { if(!ALFA.Shared.Modules.InfoStore.WaitForResourcesLoaded(false)) { script.DelayCommand(6.0f, delegate { SortLists(script); }); return; } if (ALFA.Shared.Modules.InfoStore.ActiveAreas == null) { script.DelayCommand(2.0f, delegate { SortLists(script); }); return; } AreaList = ALFA.Shared.Modules.InfoStore.ActiveAreas.Values.ToList<ALFA.Shared.ActiveArea>(); AreaList.Sort(); }
public static void WaitForResources(CLRScriptBase script, IBackgroundLoadedResource resource) { if (resource.WaitForResourcesLoaded(false) == true) { DrawListBox(script, (resource as IDrawableList).ListBox); return; } else { // TODO: Display the 'thinking' animation. script.DelayCommand(0.5f, delegate() { WaitForResources(script, resource); }); return; } }
public static void WaitForNavigator(CLRScriptBase script, Navigator nav) { if (nav.WaitForResourcesLoaded(false) == true) { DrawNavigatorCategory(script, nav.bottomCategory); return; } else { script.SendMessageToPC(script.OBJECT_SELF, "loading..."); script.DelayCommand(0.5f, delegate() { WaitForNavigator(script, nav); }); return; } }
public static void Disable(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint disabler) { if (trap.Disabler == 0) { // no one is currently working on this trap. s.SendMessageToPC(disabler, "<c=#98FFFF>You begin to disable the trap...</c>"); trap.Disabler = disabler; trap.Helpers = new List<uint>(); } else { if (trap.Disabler == disabler) { s.SendMessageToPC(disabler, "<c=#98FFFF>Error: You are already disabling this device.</c>"); } else if (trap.Helpers.Contains(disabler)) { s.SendMessageToPC(disabler, "<c=#98FFFF>Disable Device: * Failure * You have already given aid to this attempt.</c>"); return; } else { trap.Helpers.Add(disabler); if (IsDisableSuccessful(s, trap, 10, disabler) == DisableResult.Success) { s.SendMessageToPC(disabler, String.Format("<c=#98FFFF>Disable Device: You grant {0} useful assistance with the trap.</c>", s.GetName(trap.Disabler))); trap.TotalHelp += 2; return; } else { s.SendMessageToPC(disabler, String.Format("<c=#98FFFF>Disable Device: You are unable to grant {0} useful assistance with the trap.</c>", s.GetName(trap.Disabler))); return; } } } if (s.GetIsDM(disabler) == TRUE && s.GetIsDMPossessed(disabler) == FALSE) { RemoveTrap(s, trap); s.SendMessageToPC(disabler, String.Format("<c=#98FFFF>Removing trap {0}</c>", trap.Tag)); return; } float neededTime = s.d4(2) * 6.0f; NWLocation oldLoc = s.GetLocation(disabler); s.DelayCommand(2.0f, delegate { StallForTime(s, trap, disabler, neededTime, oldLoc); }); }
public static void LoadAreas(CLRScriptBase s) { if (!ACR_Candlekeep.ArchivesInstance.WaitForResourcesLoaded(false)) { s.DelayCommand(6.0f, delegate { LoadAreas(s); }); return; } ALFA.Shared.Modules.InfoStore.ActiveAreas = new Dictionary<uint, ALFA.Shared.ActiveArea>(); List<uint> areas = new List<uint>(); foreach (uint area in s.GetAreas()) { ALFA.Shared.ActiveArea activeArea = new ALFA.Shared.ActiveArea(); activeArea.Id = area; activeArea.Name = s.GetName(area).Trim(); activeArea.Tag = s.GetTag(area); activeArea.GlobalQuests.Add("Infestation", s.GetLocalInt(area, "ACR_QST_MAX_INFESTATION")); ALFA.Shared.Modules.InfoStore.ActiveAreas.Add(area, activeArea); areas.Add(area); } int count = 0; foreach(KeyValuePair<string, string> keyValue in ALFA.Shared.Modules.InfoStore.AreaNames) { ALFA.Shared.Modules.InfoStore.ActiveAreas[areas[count]].LocalizedName = keyValue.Value; ALFA.Shared.Modules.InfoStore.ActiveAreas[areas[count]].ConfigureDisplayName(); s.SetLocalString(areas[count], "ACR_AREA_RESREF", keyValue.Key); count++; } foreach (ALFA.Shared.ActiveArea activeArea in ALFA.Shared.Modules.InfoStore.ActiveAreas.Values) { foreach (uint thing in s.GetObjectsInArea(activeArea.Id)) { uint target = s.GetTransitionTarget(thing); if (s.GetIsObjectValid(target) != FALSE) { ALFA.Shared.ActiveTransition activeTransition = new ALFA.Shared.ActiveTransition(); activeTransition.AreaTarget = ALFA.Shared.Modules.InfoStore.ActiveAreas[s.GetArea(target)]; activeTransition.Id = thing; activeTransition.Target = target; activeArea.ExitTransitions.Add(activeTransition, activeTransition.AreaTarget); } } } }
public static void AdjustPrice(CLRScriptBase script, uint target, int adjustBy) { if (script.GetObjectType(target) != OBJECT_TYPE_ITEM) return; if (adjustBy == 0) return; string itemKey = PriceChangeVarName + target.ToString(); if (script.GetItemStackSize(target) > 1) { stackSizes.Add(itemKey, script.GetItemStackSize(target)); script.SetItemStackSize(target, 1, FALSE); } script.StoreCampaignObject(ItemChangeDBName, itemKey, target, script.OBJECT_SELF); if (ALFA.Shared.Modules.InfoStore.ModifiedGff.Keys.Contains(itemKey)) { int currentModifyCost = 0; currentModifyCost = ALFA.Shared.Modules.InfoStore.ModifiedGff[itemKey].TopLevelStruct["ModifyCost"].ValueInt + adjustBy; ALFA.Shared.Modules.InfoStore.ModifiedGff[itemKey].TopLevelStruct["ModifyCost"].ValueInt = currentModifyCost; script.DestroyObject(target, 0.0f, FALSE); script.DelayCommand(0.1f, delegate() { uint newObject = script.RetrieveCampaignObject(ItemChangeDBName, itemKey, script.GetLocation(script.OBJECT_SELF), script.OBJECT_SELF, script.OBJECT_SELF); if (stackSizes.Keys.Contains(itemKey)) { script.SetItemStackSize(newObject, stackSizes[itemKey], FALSE); stackSizes.Remove(itemKey); } if (script.GetObjectType(script.OBJECT_SELF) != OBJECT_TYPE_PLACEABLE) { script.CopyItem(newObject, script.OBJECT_SELF, TRUE); script.DestroyObject(newObject, 0.0f, FALSE); } }); } }
public static void WaitForSearch(CLRScriptBase script, User currentUser, ACR_ChooserCreator.ACR_CreatorCommand currentTab, CreatorSearch awaitedSearch) { if (awaitedSearch == null) { // Search has been removed. Abort. return; } if (awaitedSearch.CancellationPending) { // Search has been canceled. Abort. return; } if (currentUser.openCommand != currentTab) { // User has switched tabs. Kill the search. return; } if (currentUser.CreatorSearchResponse != null) { // Looks like we've finished. Draw a list! CreatorSearch oldSearch = currentUser.CurrentSearch; currentUser.CurrentSearch = null; oldSearch.Dispose(); Waiter.DrawNavigatorCategory(script, currentUser.CreatorSearchResponse); switch (currentUser.openCommand) { case ACR_ChooserCreator.ACR_CreatorCommand.ACR_CHOOSERCREATOR_FOCUS_CREATURE_TAB: currentUser.CurrentCreatureCategory = currentUser.CreatorSearchResponse; break; case ACR_ChooserCreator.ACR_CreatorCommand.ACR_CHOOSERCREATOR_FOCUS_ITEM_TAB: currentUser.CurrentItemCategory = currentUser.CreatorSearchResponse; break; case ACR_ChooserCreator.ACR_CreatorCommand.ACR_CHOOSERCREATOR_FOCUS_LIGHTS_TAB: currentUser.CurrentLightCategory = currentUser.CreatorSearchResponse; break; case ACR_ChooserCreator.ACR_CreatorCommand.ACR_CHOOSERCREATOR_FOCUS_PLACEABLE_TAB: currentUser.CurrentPlaceableCategory = currentUser.CreatorSearchResponse; break; case ACR_ChooserCreator.ACR_CreatorCommand.ACR_CHOOSERCREATOR_FOCUS_TRAP_TAB: currentUser.CurrentTrapCategory = currentUser.CreatorSearchResponse; break; case ACR_ChooserCreator.ACR_CreatorCommand.ACR_CHOOSERCREATOR_FOCUS_VFX_TAB: currentUser.CurrentVisualEffectCategory = currentUser.CreatorSearchResponse; break; case ACR_ChooserCreator.ACR_CreatorCommand.ACR_CHOOSERCREATOR_FOCUS_WAYPOINT_TAB: currentUser.CurrentWaypointCategory = currentUser.CreatorSearchResponse; break; } return; } script.DelayCommand(1.0f, delegate { WaitForSearch(script, currentUser, currentTab, awaitedSearch); }); }
private static int GetArmorPrice(CLRScriptBase script, uint target) { #region Initialize commonly-used variables int rulesType = script.GetArmorRulesType(target); int value = ArmorRulesTypeValues[rulesType]; int itemType = script.GetBaseItemType(target); int enchantmentPenalty = 0; int specialMat = script.GetItemBaseMaterialType(target); #endregion #region Load item properties into the price calculation collection List<PricedItemProperty> itProps = new List<PricedItemProperty>(); foreach (NWItemProperty prop in script.GetItemPropertiesOnItem(target)) { if (script.GetItemPropertyDurationType(prop) == DURATION_TYPE_PERMANENT) { itProps.Add(new PricedItemProperty() { Property = prop, Price = 0 }); } } #endregion #region Check for Mundane Items if (itProps.Count == 0 && (specialMat == GMATERIAL_METAL_IRON || specialMat == GMATERIAL_NONSPECIFIC)) { // No item properties. This is just worth the base item. return value; } #endregion #region Check for Rules Type Mismatches if (rulesType == ARMOR_RULES_TYPE_SHIELD_HEAVY || rulesType == ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD || rulesType == ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK || rulesType == ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON || rulesType == ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL) { if (itemType != BASE_ITEM_LARGESHIELD) { return -1; } } else if (rulesType == ARMOR_RULES_TYPE_SHIELD_LIGHT || rulesType == ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD || rulesType == ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK || rulesType == ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON || rulesType == ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL) { if (itemType != BASE_ITEM_SMALLSHIELD) { return -1; } } else if (rulesType == ARMOR_RULES_TYPE_SHIELD_TOWER || rulesType == ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD || rulesType == ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK || rulesType == ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON || rulesType == ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL) { if (itemType != BASE_ITEM_TOWERSHIELD) { return -1; } } else { if (itemType != BASE_ITEM_ARMOR) { return -1; } } #endregion #region Correct Armor Rules Types and Properties for Materials switch (specialMat) { #region Adamantine case GMATERIAL_METAL_ADAMANTINE: { int damageReduction = 1; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = 15000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; damageReduction = 3; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value = 15000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; damageReduction = 3; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; damageReduction = 2; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; damageReduction = 2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; damageReduction = 2; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; damageReduction = 2; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = 15000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; damageReduction = 3; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value = 15000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; damageReduction = 3; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = 15000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; damageReduction = 3; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value = 15000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; damageReduction = 3; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; damageReduction = 2; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; damageReduction = 2; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = 15000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value = 15000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; damageReduction = 1; break; } case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { return -1; } } script.StoreCampaignObject(ItemChangeDBName, PriceChangeVarName, target, script.OBJECT_SELF); if (ALFA.Shared.Modules.InfoStore.ModifiedGff.Keys.Contains(PriceChangeVarName)) { int dmgRedctMembers = ALFA.Shared.Modules.InfoStore.ModifiedGff[PriceChangeVarName].TopLevelStruct["DmgReduction"].ValueList.StructList.Count; GFFShortField DmgRedctFlags = new GFFShortField(); GFFShortField DmgRedctAmt = new GFFShortField(); GFFShortField DmgRedctType = new GFFShortField(); GFFShortField DmgRedctSubType = new GFFShortField(); DmgRedctFlags.ValueInt = 0; DmgRedctFlags.StringLabel = "DmgRedctFlags"; DmgRedctAmt.ValueInt = damageReduction; DmgRedctAmt.StringLabel = "DmgRedctAmt"; DmgRedctType.ValueInt = 0; DmgRedctType.StringLabel = "DmgRedctType"; DmgRedctSubType.ValueInt = 0; DmgRedctSubType.StringLabel = "DmgRedctSubType"; GFFStruct dmgRedct = new GFFStruct(); dmgRedct.StructType = 2; dmgRedct.Fields.Add("DmgRedctFlags", DmgRedctFlags); dmgRedct.Fields.Add("DmgRedctAmt", DmgRedctAmt); GFFListField dmgRedctTypeList = new GFFListField(); GFFList dmgRedctType = new GFFList(); GFFStruct dmgRedctTypeStruct = new GFFStruct(); dmgRedctTypeStruct.StructType = 2; dmgRedctType.StructList.Add(dmgRedctTypeStruct); dmgRedctType[0].Fields.Add("DmgRedctType", DmgRedctType); dmgRedctType[0].Fields.Add("DmgRedctSubType", DmgRedctSubType); dmgRedctTypeList.ValueList = dmgRedctType; dmgRedctTypeList.StringLabel = "DmgRedctSubList"; dmgRedct.Fields.Add("DmgRedctSubList", dmgRedctTypeList); if (dmgRedctMembers == 0) { ALFA.Shared.Modules.InfoStore.ModifiedGff[PriceChangeVarName].TopLevelStruct["DmgReduction"].ValueList.StructList.Add(dmgRedct); script.DestroyObject(target, 0.0f, FALSE); target = script.RetrieveCampaignObject(ItemChangeDBName, PriceChangeVarName, script.GetLocation(script.OBJECT_SELF), script.OBJECT_SELF, script.OBJECT_SELF); if (script.GetObjectType(script.OBJECT_SELF) != OBJECT_TYPE_PLACEABLE) { script.DelayCommand(0.5f, delegate() { script.CopyItem(target, script.OBJECT_SELF, TRUE); }); } } else { if (dmgRedctMembers > 1) { for (int count = 1; count < dmgRedctMembers; count++) { ALFA.Shared.Modules.InfoStore.ModifiedGff[PriceChangeVarName].TopLevelStruct["DmgReduction"].ValueList.StructList.Remove(count); } } if (ALFA.Shared.Modules.InfoStore.ModifiedGff[PriceChangeVarName].TopLevelStruct["DmgReduction"].ValueList[0]["DmgRedctAmt"].ValueInt != damageReduction) { ALFA.Shared.Modules.InfoStore.ModifiedGff[PriceChangeVarName].TopLevelStruct["DmgReduction"].ValueList[0] = dmgRedct; script.DestroyObject(target, 0.0f, FALSE); target = script.RetrieveCampaignObject(ItemChangeDBName, PriceChangeVarName, script.GetLocation(script.OBJECT_SELF), script.OBJECT_SELF, script.OBJECT_SELF); if (script.GetObjectType(script.OBJECT_SELF) != OBJECT_TYPE_PLACEABLE) { script.DelayCommand(0.5f, delegate() { script.CopyItem(target, script.OBJECT_SELF, TRUE); }); } } } } List<PricedItemProperty> removingProps = new List<PricedItemProperty>(); foreach (PricedItemProperty prop in itProps) { if (script.GetItemPropertyType(prop.Property) == ITEM_PROPERTY_DAMAGE_REDUCTION) { script.RemoveItemProperty(target, prop.Property); removingProps.Add(prop); } } foreach (PricedItemProperty prop in removingProps) { itProps.Remove(prop); } break; } #endregion #region Arandur case GMATERIAL_ARANDUR: { int resistQuantity = IP_CONST_DAMAGERESIST_2; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { // Arandur is a metal. return -1; } } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_SONIC, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SONIC, resistQuantity), target, 0.0f); } break; } #endregion #region Bluewood case GMATERIAL_BLUEWOOD: { switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = 1200 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value = 1200 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = 600 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value = 600 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 600 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 600 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = 1200 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value = 1200 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = 1200 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value = 1200 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = 600 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value = 600 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = 1200 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value = 1200 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { // Bluewood emulates metal. return -1; } } if (!GetIsHalfWeight(script, itProps)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyWeightReduction(IP_CONST_REDUCEDWEIGHT_50_PERCENT), target, 0.0f); } break; } #endregion #region Cold Iron case GMATERIAL_METAL_COLD_IRON: { int saveBonus = 1; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = 9000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; saveBonus = 3; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value = 9000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; saveBonus = 3; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = 4000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; saveBonus = 2; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value = 4000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; saveBonus = 2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 1000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; saveBonus = 1; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 1000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; saveBonus = 1; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 4000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; saveBonus = 2; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 4000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; saveBonus = 2; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = 9000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; saveBonus = 3; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value = 9000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; saveBonus = 3; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = 9000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; saveBonus = 3; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value = 9000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; saveBonus = 3; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = 4000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; saveBonus = 2; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value = 4000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; saveBonus = 2; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 1000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; saveBonus = 1; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 1000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; saveBonus = 1; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 1000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; saveBonus = 1; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 1000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; saveBonus = 1; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 1000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; saveBonus = 1; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 1000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; saveBonus = 1; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = 4000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; saveBonus = 2; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value = 4000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; saveBonus = 2; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { return -1; } } enchantmentPenalty = 2000; if (!GetHasSavingThrowBonus(script, itProps, saveBonus)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, saveBonus), target, 0.0f); } break; } #endregion #region Copper case GMATERIAL_COPPER: { switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { return -1; } } if (!GetHasSpecificSavingThrowBonus(script, itProps, IP_CONST_SAVEVS_POISON, 2)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_POISON, 2), target, 0.0f); } if (!GetHasSpecificSavingThrowBonus(script, itProps, IP_CONST_SAVEVS_DISEASE, 2)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_DISEASE, 2), target, 0.0f); } if (!GetHasSpecificSavingThrowPenalty(script, itProps, IP_CONST_SAVEVS_ELECTRICAL, 2)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyReducedSavingThrowVsX(IP_CONST_SAVEVS_ELECTRICAL, 2), target, 0.0f); } break; } #endregion #region Darksteel case GMATERIAL_METAL_DARKSTEEL: { int resistQuantity = IP_CONST_DAMAGERESIST_2; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { // Darksteel is a metal. return -1; } } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_ACID, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID, resistQuantity), target, 0.0f); } break; } #endregion #region Dlarun case GMATERIAL_DLARUN: { int resistQuantity = IP_CONST_DAMAGERESIST_2; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { // Dlarun is a metal. return -1; } } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_FIRE, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE, resistQuantity), target, 0.0f); } break; } #endregion #region Black, Green, or Copper Dragon case GMATERIAL_CREATURE_BLACK_DRAGON: case GMATERIAL_CREATURE_GREEN_DRAGON: case GMATERIAL_CREATURE_COPPER_DRAGON: { bool shield = false; switch(rulesType) { case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { shield = true; break; } case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MASTERWORK: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_DRAGON]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HIDE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HIDE_DRAGON]; break; } case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_DRAGON]; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON]; break; } case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_PADDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_PADDED_DRAGON]; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MASTERWORK: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_DRAGON]; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_DRAGON]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: case ARMOR_RULES_TYPE_CLOTH: { return -1; } } if (shield) { if (!GetHasSpecificSavingThrowBonus(script, itProps, IP_CONST_SAVEVS_ACID, 2)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_ACID, 2), target, 0.0f); } } else { if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_ACID, IP_CONST_DAMAGERESIST_5)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID, IP_CONST_DAMAGERESIST_5), target, 0.0f); } } break; } #endregion #region Blue or Brass Dragon case GMATERIAL_CREATURE_BLUE_DRAGON: case GMATERIAL_CREATURE_BRONZE_DRAGON: { bool shield = false; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { shield = true; break; } case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MASTERWORK: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_DRAGON]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HIDE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HIDE_DRAGON]; break; } case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_DRAGON]; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON]; break; } case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_PADDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_PADDED_DRAGON]; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MASTERWORK: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_DRAGON]; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_DRAGON]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: case ARMOR_RULES_TYPE_CLOTH: { return -1; } } if (shield) { if (!GetHasSpecificSavingThrowBonus(script, itProps, IP_CONST_SAVEVS_ELECTRICAL, 2)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_ELECTRICAL, 2), target, 0.0f); } } else { if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_ELECTRICAL, IP_CONST_DAMAGERESIST_5)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ELECTRICAL, IP_CONST_DAMAGERESIST_5), target, 0.0f); } } break; } #endregion #region Red, Brass, or Gold Dragon case GMATERIAL_CREATURE_RED_DRAGON: case GMATERIAL_CREATURE_BRASS_DRAGON: case GMATERIAL_CREATURE_GOLD_DRAGON: { bool shield = false; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { shield = true; break; } case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MASTERWORK: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_DRAGON]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HIDE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HIDE_DRAGON]; break; } case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_DRAGON]; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON]; break; } case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_PADDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_PADDED_DRAGON]; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MASTERWORK: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_DRAGON]; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_DRAGON]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: case ARMOR_RULES_TYPE_CLOTH: { return -1; } } if (shield) { if (!GetHasSpecificSavingThrowBonus(script, itProps, IP_CONST_SAVEVS_FIRE, 2)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_FIRE, 2), target, 0.0f); } } else { if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGERESIST_5)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGERESIST_5), target, 0.0f); } } break; } #endregion #region White or Silver Dragon case GMATERIAL_CREATURE_WHITE_DRAGON: case GMATERIAL_CREATURE_SILVER_DRAGON: { bool shield = false; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { shield = true; break; } case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MASTERWORK: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_DRAGON]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_DRAGON]; break; } case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HIDE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HIDE_DRAGON]; break; } case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_DRAGON]; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON]; break; } case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_PADDED_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_PADDED_DRAGON]; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MASTERWORK: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_DRAGON]; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_DRAGON]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON]; shield = true; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: case ARMOR_RULES_TYPE_CLOTH: { return -1; } } if (shield) { if (!GetHasSpecificSavingThrowBonus(script, itProps, IP_CONST_SAVEVS_COLD, 2)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_COLD, 2), target, 0.0f); } } else { if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGERESIST_5)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGERESIST_5), target, 0.0f); } } break; } #endregion #region Duskwood case GMATERIAL_WOOD_DUSKWOOD: { switch (rulesType) { case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 300 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK]; break; } default: { return -1; } } break; } #endregion #region Fever Iron case GMATERIAL_FEVER_IRON: { int resistQuantity = IP_CONST_DAMAGERESIST_2; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { // Fever iron is a metal. return -1; } } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_COLD, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_COLD, resistQuantity), target, 0.0f); } break; } #endregion #region Gold case GMATERIAL_GOLD: { int resistQuantity = IP_CONST_DAMAGERESIST_2; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_MASTERWORK: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_HEAVYMETAL); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL); value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: { value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL); value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: { value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_MASTERWORK: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_HEAVYMETAL); value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: { value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { // Darksteel is a metal. return -1; } } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_ACID, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID, resistQuantity), target, 0.0f); } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_FIRE, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE, resistQuantity), target, 0.0f); } break; } #endregion #region Hizagkuur case GMATERIAL_HIZAGKUUR: { int resistQuantity = IP_CONST_DAMAGERESIST_2; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { // Fever iron is a metal. return -1; } } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_ELECTRICAL, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ELECTRICAL, resistQuantity), target, 0.0f); } break; } #endregion #region Living Metal case GMATERIAL_LIVING_METAL: { switch (rulesType) { case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SPLINT_LIVING: { break; } case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MASTERWORK: case ARMOR_RULES_TYPE_BANDED_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_LIVING); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_LIVING]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_LIVING); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_LIVING]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING]; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_LIVING); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL_LIVING]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_LIVING); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_LIVING]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_LIVING); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_LIVING]; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MASTERWORK: case ARMOR_RULES_TYPE_SCALE_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_LIVING); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_LIVING]; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_DRAGON: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_LIVING); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_LIVING]; break; } default: { return -1; } } break; } #endregion #region Mithral case GMATERIAL_METAL_MITHRAL: { switch (rulesType) { case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: { break; } case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MASTERWORK: case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BANDED_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_MITHRAL]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL]; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL]; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MASTERWORK: case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SCALE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_MITHRAL]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL]; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL]; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL]; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: case ARMOR_RULES_TYPE_SPLINT_DRAGON: case ARMOR_RULES_TYPE_SPLINT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MITHREAL); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_MITHREAL]; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { return -1; } } break; } #endregion #region Platinum case GMATERIAL_PLATINUM: { int resistQuantity = IP_CONST_DAMAGERESIST_2; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_MASTERWORK: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BANDED_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_HEAVYMETAL); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL); value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: { value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL); value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: { value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_MASTERWORK: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SCALE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_HEAVYMETAL); value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: { value = 6000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_DRAGON: case ARMOR_RULES_TYPE_SPLINT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL); value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: { value = 10000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { // Darksteel is a metal. return -1; } } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_COLD, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_COLD, resistQuantity), target, 0.0f); } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_SONIC, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SONIC, resistQuantity), target, 0.0f); } break; } #endregion #region Silver case GMATERIAL_METAL_ALCHEMICAL_SILVER: { int resistQuantity = IP_CONST_DAMAGERESIST_2; switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: case ARMOR_RULES_TYPE_BANDED_MASTERWORK: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BANDED_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_HEAVYMETAL); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_BREASTPLATE: case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL); value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: { value = 1500 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; resistQuantity = IP_CONST_DAMAGERESIST_2; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_FULL_PLATE: case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE: case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SCALE: case ARMOR_RULES_TYPE_SCALE_MASTERWORK: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SCALE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_HEAVYMETAL); value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: { value = 3000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; resistQuantity = IP_CONST_DAMAGERESIST_4; break; } case ARMOR_RULES_TYPE_SPLINT: case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_DRAGON: case ARMOR_RULES_TYPE_SPLINT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL); value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: { value = 5000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; resistQuantity = IP_CONST_DAMAGERESIST_6; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { // Darksteel is a metal. return -1; } } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_ELECTRICAL, resistQuantity)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ELECTRICAL, resistQuantity), target, 0.0f); } break; } #endregion #region Sondarr case GMATERIAL_SONDARR: { switch (rulesType) { case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_MITHRAL: case ARMOR_RULES_TYPE_BANDED_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_MASTERWORK]; break; } case ARMOR_RULES_TYPE_BANDED: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED]; break; } case ARMOR_RULES_TYPE_BANDED_MASTERWORK: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_MASTERWORK]; break; } case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE]; break; } case ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK]; break; } case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK]; break; } case ARMOR_RULES_TYPE_CHAINMAIL: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK]; break; } case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE]; break; } case ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE]; break; } case ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_MITHRAL: case ARMOR_RULES_TYPE_SCALE_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SCALE: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE]; break; } case ARMOR_RULES_TYPE_SCALE_MASTERWORK: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SPLINT_DRAGON: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SPLINT: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT]; break; } case ARMOR_RULES_TYPE_SPLINT_MASTERWORK: { value += 2000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_MASTERWORK]; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: case ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: case ARMOR_RULES_TYPE_HIDE: case ARMOR_RULES_TYPE_HIDE_DRAGON: case ARMOR_RULES_TYPE_HIDE_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER: case ARMOR_RULES_TYPE_LEATHER_DRAGON: case ARMOR_RULES_TYPE_LEATHER_MASTERWORK: case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: case ARMOR_RULES_TYPE_PADDED: case ARMOR_RULES_TYPE_PADDED_DRAGON: case ARMOR_RULES_TYPE_PADDED_MASTERWORK: case ARMOR_RULES_TYPE_CLOTH: { return -1; } } break; } #endregion #region Suzailian Chainweave case GMATERIAL_SUZAILLIAN_CHAINWEAVE: { switch (rulesType) { case ARMOR_RULES_TYPE_CHAIN_SHIRT: case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = 28000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK: { value = 28000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT]; break; } case ARMOR_RULES_TYPE_CHAINMAIL: case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = 35000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; break; } case ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK: { value = 35000 + ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL]; break; } default: { return -1; } } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_BLUDGEONING, IP_CONST_DAMAGERESIST_2)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_BLUDGEONING, IP_CONST_DAMAGERESIST_2), target, 0.0f); } if (!GetHasElementalArmorBonus(script, itProps, IP_CONST_DAMAGETYPE_SLASHING, IP_CONST_DAMAGERESIST_2)) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SLASHING, IP_CONST_DAMAGERESIST_2), target, 0.0f); } break; } #endregion #region Zalantar case GMATERIAL_WOOD_DARKWOOD: { switch (rulesType) { case ARMOR_RULES_TYPE_SHIELD_HEAVY: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: { break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD]; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: { break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: case ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD]; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: { break; } default: { return -1; } } break; } #endregion #region Banned Materials case GMATERIAL_FIENDBONE: case GMATERIAL_FRYSTALLINE: { return -1; } #endregion } #endregion #region Check for early return, if the item is only masterwork or special material if (itProps.Count == 0) { return value; } #endregion #region Check for Use Restriction bool IsClassRestricted = GetIsUseRestrictedByClass(script, itProps); #endregion #region Calculate Magical Bonuses float effectivePlus = 0.0f; int ACvsEveryone = 0; int spellFoci = 0; #region Properties that are Indiscriminate foreach (PricedItemProperty prop in itProps) { int propType = script.GetItemPropertyType(prop.Property); switch (propType) { #region Ability Bonus case ITEM_PROPERTY_ABILITY_BONUS: { prop.Price = (script.GetItemPropertyCostTableValue(prop.Property) * script.GetItemPropertyCostTableValue(prop.Property) * 1000); break; } #endregion #region AC Bonus case ITEM_PROPERTY_AC_BONUS: { if (script.GetItemPropertyCostTableValue(prop.Property) > ACvsEveryone) { ACvsEveryone = script.GetItemPropertyCostTableValue(prop.Property); effectivePlus += script.GetItemPropertyCostTableValue(prop.Property); } break; } #endregion #region Arcane Spell Failure Reduction case ITEM_PROPERTY_ARCANE_SPELL_FAILURE: { switch (script.GetItemPropertyCostTableValue(prop.Property)) { case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_5_PERCENT: { effectivePlus += 0.5f; break; } case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_10_PERCENT: { effectivePlus += 1.0f; break; } case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_15_PERCENT: { effectivePlus += 1.5f; break; } case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_20_PERCENT: { effectivePlus += 2.0f; break; } case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_25_PERCENT: { effectivePlus += 2.5f; break; } case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_30_PERCENT: { effectivePlus += 3.0f; break; } case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_35_PERCENT: { effectivePlus += 3.5f; break; } case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_40_PERCENT: { effectivePlus += 4.0f; break; } case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_45_PERCENT: { effectivePlus += 4.5f; break; } case IP_CONST_ARCANE_SPELL_FAILURE_MINUS_50_PERCENT: { effectivePlus += 5.0f; break; } default: { // the others are all penalties; No influence on price. break; } } break; } #endregion #region Bonus Feat case ITEM_PROPERTY_BONUS_FEAT: { switch (script.GetItemPropertySubType(prop.Property)) { case IP_CONST_FEAT_COMBAT_CASTING: { effectivePlus += 1.0f; break; } case IP_CONST_FEAT_DEFLECT_ARROWS: { effectivePlus += 2.0f; break; } case IP_CONST_FEAT_DODGE: { effectivePlus += 1.0f; break; } case IP_CONST_FEAT_EXTRA_TURNING: { effectivePlus += 1.0f; break; } case IP_CONST_FEAT_SPELLFOCUSABJ: case IP_CONST_FEAT_SPELLFOCUSCON: case IP_CONST_FEAT_SPELLFOCUSDIV: case IP_CONST_FEAT_SPELLFOCUSENC: case IP_CONST_FEAT_SPELLFOCUSEVO: case IP_CONST_FEAT_SPELLFOCUSILL: case IP_CONST_FEAT_SPELLFOCUSNEC: { switch (spellFoci) { case 0: effectivePlus += 1.0f; break; case 1: effectivePlus += 0.5f; break; case 2: effectivePlus += 0.5f; break; default: return -1; } break; } case IP_CONST_FEAT_SPELLPENETRATION: { effectivePlus += 1.5f; break; } } break; } #endregion #region Bonus Spell Slot case ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N: { int level = script.GetItemPropertyCostTableValue(prop.Property); if (level == 0) { prop.Price = 500; } else { prop.Price = level * level * 1000; } break; } #endregion #region Cast Spell case ITEM_PROPERTY_CAST_SPELL: { int spell = script.GetItemPropertySubType(prop.Property); if (spell == IP_CONST_CASTSPELL_ACTIVATE_ITEM || spell == IP_CONST_CASTSPELL_UNIQUE_POWER || spell == IP_CONST_CASTSPELL_UNIQUE_POWER_SELF_ONLY) { // We can't price these, as their powers are custom scripted. return -2; } float spellLevel = 0.0f; float casterLevel = 0.0f; float.TryParse(script.Get2DAString("iprp_spells", "InnateLvl", spell), out spellLevel); float.TryParse(script.Get2DAString("iprp_spells", "CasterLvl", spell), out casterLevel); if (spellLevel < 0.5f) { spellLevel = 0.5f; } if (casterLevel < 1.0f) { casterLevel = 1.0f; } float multiplier = spellLevel * casterLevel; switch (script.GetItemPropertyCostTableValue(prop.Property)) { case IP_CONST_CASTSPELL_NUMUSES_0_CHARGES_PER_USE: { return -1; } case IP_CONST_CASTSPELL_NUMUSES_1_CHARGE_PER_USE: { prop.ChargedPrice = (int)(multiplier * 36); break; } case IP_CONST_CASTSPELL_NUMUSES_1_USE_PER_DAY: { prop.Price = (int)(multiplier * 360); break; } case IP_CONST_CASTSPELL_NUMUSES_2_CHARGES_PER_USE: { prop.ChargedPrice = (int)(multiplier * 18); break; } case IP_CONST_CASTSPELL_NUMUSES_2_USES_PER_DAY: { prop.Price = (int)(multiplier * 720); break; } case IP_CONST_CASTSPELL_NUMUSES_3_CHARGES_PER_USE: { prop.ChargedPrice = (int)(multiplier * 12); break; } case IP_CONST_CASTSPELL_NUMUSES_3_USES_PER_DAY: { prop.Price = (int)(multiplier * 1080); break; } case IP_CONST_CASTSPELL_NUMUSES_4_CHARGES_PER_USE: { prop.ChargedPrice = (int)(multiplier * 9); break; } case IP_CONST_CASTSPELL_NUMUSES_4_USES_PER_DAY: { prop.Price = (int)(multiplier * 1440); break; } case IP_CONST_CASTSPELL_NUMUSES_5_CHARGES_PER_USE: { prop.ChargedPrice = (int)(multiplier * 7); break; } case IP_CONST_CASTSPELL_NUMUSES_5_USES_PER_DAY: { prop.Price = (int)(multiplier * 1800); break; } case IP_CONST_CASTSPELL_NUMUSES_SINGLE_USE: { if (script.GetItemCharges(target) > 0) { if (IsClassRestricted) { prop.ChargedPrice = (int)((multiplier * 25) / script.GetItemCharges(target)); } else { prop.ChargedPrice = (int)((multiplier * 50) / script.GetItemCharges(target)); } } else { if (IsClassRestricted) { prop.Price = (int)(multiplier * 25); } else { prop.Price = (int)(multiplier * 50); } } break; } case IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE: { return -1; } } break; } #endregion #region Damage Resistance case ITEM_PROPERTY_DAMAGE_RESISTANCE: { switch (script.GetItemPropertySubType(prop.Property)) { case IP_CONST_DAMAGETYPE_ACID: case IP_CONST_DAMAGETYPE_COLD: case IP_CONST_DAMAGETYPE_ELECTRICAL: case IP_CONST_DAMAGETYPE_FIRE: case IP_CONST_DAMAGETYPE_SONIC: { switch (script.GetItemPropertyCostTableValue(prop.Property)) { case IP_CONST_DAMAGERESIST_5: { prop.Price = 4000; break; } case IP_CONST_DAMAGERESIST_10: { prop.Price = 12000; break; } case IP_CONST_DAMAGERESIST_15: { prop.Price = 20000; break; } case IP_CONST_DAMAGERESIST_20: { prop.Price = 28000; break; } case IP_CONST_DAMAGERESIST_25: { prop.Price = 36000; break; } case IP_CONST_DAMAGERESIST_30: { prop.Price = 44000; break; } default: { return -1; } } break; } case IP_CONST_DAMAGETYPE_NEGATIVE: { switch (script.GetItemPropertyCostTableValue(prop.Property)) { case IP_CONST_DAMAGERESIST_5: { prop.Price = 6000; break; } case IP_CONST_DAMAGERESIST_10: { prop.Price = 18000; break; } case IP_CONST_DAMAGERESIST_15: { prop.Price = 30000; break; } case IP_CONST_DAMAGERESIST_20: { prop.Price = 42000; break; } case IP_CONST_DAMAGERESIST_25: { prop.Price = 54000; break; } case IP_CONST_DAMAGERESIST_30: { prop.Price = 66000; break; } } break; } default: { return -1; } } break; } #endregion #region Freeom of Movement case ITEM_PROPERTY_FREEDOM_OF_MOVEMENT: { prop.Price = 40000; break; } #endregion #region Immunities case ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS: { switch (script.GetItemPropertySubType(prop.Property)) { case IP_CONST_IMMUNITYMISC_DEATH_MAGIC: { prop.Price = 80000; break; } case IP_CONST_IMMUNITYMISC_DISEASE: { prop.Price = 7500; break; } case IP_CONST_IMMUNITYMISC_FEAR: { prop.Price = 10000; break; } case IP_CONST_IMMUNITYMISC_KNOCKDOWN: { prop.Price = 22500; break; } case IP_CONST_IMMUNITYMISC_LEVEL_ABIL_DRAIN: { prop.Price = 40000; break; } case IP_CONST_IMMUNITYMISC_PARALYSIS: { prop.Price = 15000; break; } case IP_CONST_IMMUNITYMISC_POISON: { prop.Price = 25000; break; } default: { return -1; } } break; } #endregion #region Spell Immunities case ITEM_PROPERTY_IMMUNITY_SPECIFIC_SPELL: { float spellLevel = 0.0f; float.TryParse(script.Get2DAString("spells", "Innate", script.GetItemPropertyCostTableValue(prop.Property)), out spellLevel); if (spellLevel < 0.5f) { spellLevel = 0.5f; } prop.Price = (int)(((spellLevel * spellLevel) + 1) * 1000); break; } #endregion #region Light case ITEM_PROPERTY_LIGHT: { prop.Price = script.GetItemPropertyCostTableValue(prop.Property) * 100; break; } #endregion #region Saving Throws case ITEM_PROPERTY_SAVING_THROW_BONUS: { int val = script.GetItemPropertyCostTableValue(prop.Property); if (val > 5) { return -1; } if (script.GetItemPropertySubType(prop.Property) == IP_CONST_SAVEVS_UNIVERSAL) { prop.Price = (val * val) * 1000; } else if (script.GetItemPropertyCostTableValue(prop.Property) == IP_CONST_SAVEVS_MINDAFFECTING) { prop.Price = (val * val) * 500; } else { prop.Price = (val * val) * 250; } break; } #endregion #region Specific Saving Throws case ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC: { int val = script.GetItemPropertyCostTableValue(prop.Property); if (val > 5) { return -1; } prop.Price = (val * val) * 250; break; } #endregion #region Skill Bonuses case ITEM_PROPERTY_SKILL_BONUS: { int val = script.GetItemPropertyCostTableValue(prop.Property); prop.Price = (val * val) * 100; break; } #endregion #region Spell Resistance case ITEM_PROPERTY_SPELL_RESISTANCE: { switch (script.GetItemPropertyCostTableValue(prop.Property)) { case IP_CONST_SPELLRESISTANCEBONUS_12: { effectivePlus += 2.0f; break; } case IP_CONST_SPELLRESISTANCEBONUS_14: { effectivePlus += 3.0f; break; } case IP_CONST_SPELLRESISTANCEBONUS_16: { effectivePlus += 4.0f; break; } case IP_CONST_SPELLRESISTANCEBONUS_18: { effectivePlus += 5.0f; break; } default: { return -1; } } break; } #endregion #region Non-Price-Adjusting Properties case ITEM_PROPERTY_WEIGHT_INCREASE: case ITEM_PROPERTY_VISUALEFFECT: case ITEM_PROPERTY_USE_LIMITATION_SPECIFIC_ALIGNMENT: case ITEM_PROPERTY_USE_LIMITATION_RACIAL_TYPE: case ITEM_PROPERTY_USE_LIMITATION_CLASS: case ITEM_PROPERTY_USE_LIMITATION_ALIGNMENT_GROUP: case ITEM_PROPERTY_DECREASED_ABILITY_SCORE: case ITEM_PROPERTY_DECREASED_AC: case ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER: case ITEM_PROPERTY_DECREASED_DAMAGE: case ITEM_PROPERTY_DECREASED_ENHANCEMENT_MODIFIER: case ITEM_PROPERTY_DECREASED_SAVING_THROWS: case ITEM_PROPERTY_DECREASED_SAVING_THROWS_SPECIFIC: case ITEM_PROPERTY_DECREASED_SKILL_MODIFIER: case ITEM_PROPERTY_DAMAGE_VULNERABILITY: case ITEM_PROPERTY_DAMAGE_REDUCTION_DEPRECATED: { // penalties don't change prices. break; } #endregion #region Illegal or Untoolable Properties case ITEM_PROPERTY_UNLIMITED_AMMUNITION: case ITEM_PROPERTY_TURN_RESISTANCE: case ITEM_PROPERTY_TRUE_SEEING: case ITEM_PROPERTY_TRAP: case ITEM_PROPERTY_THIEVES_TOOLS: case ITEM_PROPERTY_SPECIAL_WALK: case ITEM_PROPERTY_REGENERATION_VAMPIRIC: case ITEM_PROPERTY_REGENERATION: case ITEM_PROPERTY_POISON: case ITEM_PROPERTY_ONHITCASTSPELL: case ITEM_PROPERTY_ON_MONSTER_HIT: case ITEM_PROPERTY_ON_HIT_PROPERTIES: case ITEM_PROPERTY_NO_DAMAGE: case ITEM_PROPERTY_MONSTER_DAMAGE: case ITEM_PROPERTY_MIND_BLANK: case ITEM_PROPERTY_MIGHTY: case ITEM_PROPERTY_MASSIVE_CRITICALS: case ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL: case ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL: case ITEM_PROPERTY_IMPROVED_EVASION: case ITEM_PROPERTY_KEEN: case ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE: case ITEM_PROPERTY_HOLY_AVENGER: case ITEM_PROPERTY_HEALERS_KIT: case ITEM_PROPERTY_HASTE: case ITEM_PROPERTY_ENHANCEMENT_BONUS: case ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_ALIGNMENT_GROUP: case ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_RACIAL_GROUP: case ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_SPECIFIC_ALIGNEMENT: case ITEM_PROPERTY_EXTRA_MELEE_DAMAGE_TYPE: case ITEM_PROPERTY_EXTRA_RANGED_DAMAGE_TYPE: case ITEM_PROPERTY_ENHANCED_CONTAINER_REDUCED_WEIGHT: case ITEM_PROPERTY_DARKVISION: case ITEM_PROPERTY_DAMAGE_REDUCTION: case ITEM_PROPERTY_DAMAGE_BONUS: case ITEM_PROPERTY_DAMAGE_BONUS_VS_ALIGNMENT_GROUP: case ITEM_PROPERTY_DAMAGE_BONUS_VS_RACIAL_GROUP: case ITEM_PROPERTY_DAMAGE_BONUS_VS_SPECIFIC_ALIGNMENT: case ITEM_PROPERTY_BONUS_HITPOINTS: case ITEM_PROPERTY_BASE_ITEM_WEIGHT_REDUCTION: case ITEM_PROPERTY_ATTACK_BONUS: case ITEM_PROPERTY_ATTACK_BONUS_VS_ALIGNMENT_GROUP: case ITEM_PROPERTY_ATTACK_BONUS_VS_RACIAL_GROUP: case ITEM_PROPERTY_ATTACK_BONUS_VS_SPECIFIC_ALIGNMENT: { return -1; } #endregion } } #endregion #region Properties that are vs. Specifics foreach (PricedItemProperty prop in itProps) { int propType = script.GetItemPropertyType(prop.Property); switch (propType) { #region AC Bonus vs. Alignement Group case ITEM_PROPERTY_AC_BONUS_VS_ALIGNMENT_GROUP: { int ACvsGroup = script.GetItemPropertyCostTableValue(prop.Property); if (ACvsGroup > ACvsEveryone) { float multiplier = 0.40f; if (script.GetItemPropertySubType(prop.Property) == IP_CONST_ALIGNMENTGROUP_NEUTRAL) { multiplier = 2.0f / 3.0f; } if (script.GetItemPropertySubType(prop.Property) == IP_CONST_ALIGNMENTGROUP_EVIL) { multiplier = 0.50f; } float effectiveBonus = (ACvsGroup - ACvsEveryone) * multiplier; effectivePlus += effectiveBonus; } break; } #endregion #region AC Bonus vs. Damage Type case ITEM_PROPERTY_AC_BONUS_VS_DAMAGE_TYPE: { int ACvsGroup = script.GetItemPropertyCostTableValue(prop.Property); if (ACvsGroup > ACvsEveryone) { float multiplier = 1.0f / 3.0f; float effectiveBonus = (ACvsGroup - ACvsEveryone) * multiplier; effectivePlus += effectiveBonus; } break; } #endregion #region AC Bonus vs. Racial Type case ITEM_PROPERTY_AC_BONUS_VS_RACIAL_GROUP: { int ACvsGroup = script.GetItemPropertyCostTableValue(prop.Property); if (ACvsGroup > ACvsEveryone) { float multiplier = 1.0f / 3.0f; float effectiveBonus = (ACvsGroup - ACvsEveryone) * multiplier; effectivePlus += effectiveBonus; } break; } #endregion #region AC Bonus vs. Specific Alignment case ITEM_PROPERTY_AC_BONUS_VS_SPECIFIC_ALIGNMENT: { int ACvsGroup = script.GetItemPropertyCostTableValue(prop.Property); if (ACvsGroup > ACvsEveryone) { float multiplier = 1.0f / 6.0f; float effectiveBonus = (ACvsGroup - ACvsEveryone) * multiplier; effectivePlus += effectiveBonus; } break; } #endregion } } #endregion #endregion #region Correct for Magical Armor That Should be Masterwork, and Special Mat Rules on Mundane Mats if (specialMat == GMATERIAL_NONSPECIFIC || specialMat == GMATERIAL_METAL_IRON || specialMat == GMATERIAL_SONDARR) { switch (rulesType) { case ARMOR_RULES_TYPE_BANDED: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_BANDED_DRAGON: case ARMOR_RULES_TYPE_BANDED_HEAVYMETAL: case ARMOR_RULES_TYPE_BANDED_LIVING: case ARMOR_RULES_TYPE_BANDED_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BANDED_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BANDED_MASTERWORK]; break; } case ARMOR_RULES_TYPE_BREASTPLATE: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_BREASTPLATE_DRAGON: case ARMOR_RULES_TYPE_BREASTPLATE_DUSKWOOD: case ARMOR_RULES_TYPE_BREASTPLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_BREASTPLATE_LIVING: case ARMOR_RULES_TYPE_BREASTPLATE_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_CHAIN_SHIRT_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAIN_SHIRT_LIVING: case ARMOR_RULES_TYPE_CHAIN_SHIRT_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK]; break; } case ARMOR_RULES_TYPE_CHAINMAIL: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_CHAINMAIL_HEAVYMETAL: case ARMOR_RULES_TYPE_CHAINMAIL_LIVING: case ARMOR_RULES_TYPE_CHAINMAIL_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK]; break; } case ARMOR_RULES_TYPE_FULL_PLATE: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_FULL_PLATE_DRAGON: case ARMOR_RULES_TYPE_FULL_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_FULL_PLATE_LIVING: case ARMOR_RULES_TYPE_FULL_PLATE_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_HALF_PLATE: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_HALF_PLATE_DRAGON: case ARMOR_RULES_TYPE_HALF_PLATE_HEAVYMETAL: case ARMOR_RULES_TYPE_HALF_PLATE_LIVING: case ARMOR_RULES_TYPE_HALF_PLATE_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_HIDE: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HIDE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HIDE_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_HIDE_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_HIDE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_HIDE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_LEATHER: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_LEATHER_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_LEATHER_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_LEATHER_MASTERWORK]; break; } case ARMOR_RULES_TYPE_PADDED: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_PADDED_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_PADDED_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_PADDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_PADDED_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_PADDED_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SCALE: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_SCALE_DRAGON: case ARMOR_RULES_TYPE_SCALE_HEAVYMETAL: case ARMOR_RULES_TYPE_SCALE_LIVING: case ARMOR_RULES_TYPE_SCALE_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SCALE_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SCALE_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_SHIELD_HEAVY_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_HEAVY_DRAGON: case ARMOR_RULES_TYPE_SHIELD_HEAVY_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_SHIELD_LIGHT_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_LIGHT_DRAGON: case ARMOR_RULES_TYPE_SHIELD_LIGHT_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SHIELD_TOWER: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_SHIELD_TOWER_DARKWOOD: case ARMOR_RULES_TYPE_SHIELD_TOWER_DRAGON: case ARMOR_RULES_TYPE_SHIELD_TOWER_MITHRAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK]; break; } case ARMOR_RULES_TYPE_SPLINT: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_SPLINT_DRAGON: case ARMOR_RULES_TYPE_SPLINT_HEAVYMETAL: case ARMOR_RULES_TYPE_SPLINT_LIVING: case ARMOR_RULES_TYPE_SPLINT_MITHREAL: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_SPLINT_MASTERWORK]; break; } case ARMOR_RULES_TYPE_STUDDED_LEATHER: { if (ACvsEveryone > 0) { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK]; } break; } case ARMOR_RULES_TYPE_LEATHER_STUDDED_DRAGON: { script.SetArmorRulesType(target, ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK); value = ArmorRulesTypeValues[ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK]; break; } } } #endregion #region Sum Calculated Values #region Permanent Properties value += enchantmentPenalty; bool allSecondary = false; if (effectivePlus >= 0.05f) { allSecondary = true; if (effectivePlus >= 1.0f) { if (ACvsEveryone < 0.99) { return -1; } value += (int)((effectivePlus * effectivePlus) * 1000); } else { value += (int)(effectivePlus * 1000); } } int costliestProp = 0; int propsPrice = 0; PricedItemProperty costliestCharge = null; PricedItemProperty secondCostliestCharge = null; foreach (PricedItemProperty prop in itProps) { value += prop.Price; propsPrice += prop.Price; if (costliestProp < prop.Price) { costliestProp = prop.Price; } if (prop.ChargedPrice > 0) { if (costliestCharge == null) { costliestCharge = prop; } else if (prop.ChargedPrice > costliestCharge.ChargedPrice) { secondCostliestCharge = costliestCharge; costliestCharge = prop; } else if (secondCostliestCharge == null) { secondCostliestCharge = prop; } else if (prop.ChargedPrice > secondCostliestCharge.ChargedPrice) { secondCostliestCharge = prop; } } } if (allSecondary) { value += (propsPrice / 2); } else { // If the costliest prop is the only prop, 0/2 = 0. // otherwise, all secondary props cost 50% more. value += ((propsPrice - costliestProp) / 2); } #endregion #region Charge-Consuming Properties int chargesCost = 0; if (costliestCharge != null) { if (secondCostliestCharge == null) { chargesCost += costliestCharge.ChargedPrice * script.GetItemCharges(target); value += costliestCharge.ChargedPrice * script.GetItemCharges(target); } else { foreach (PricedItemProperty prop in itProps) { if (costliestCharge == prop) { chargesCost += prop.ChargedPrice * script.GetItemCharges(target); value += prop.ChargedPrice * script.GetItemCharges(target); } else if (secondCostliestCharge == prop) { chargesCost += (prop.ChargedPrice * script.GetItemCharges(target) * 3) / 4; value += (prop.ChargedPrice * script.GetItemCharges(target) * 3) / 4; } else { chargesCost += (prop.ChargedPrice * script.GetItemCharges(target)) / 2; value += (prop.ChargedPrice * script.GetItemCharges(target)) / 2; } } } } if (IsClassRestricted) { value -= (chargesCost - ((chargesCost * 750) / 1800)); } #endregion #endregion return value; }
public static void StallForTime(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint disabler, float delay, NWLocation loc) { delay -= 2.0f; if (delay <= 0.5f) { DisableResult result = IsDisableSuccessful(s, trap, trap.DisarmDC, disabler); if (result == DisableResult.Success) { RemoveTrap(s, trap); s.SendMessageToPC(disabler, "<c=#98FFFF>This trap is now gone, and needs no more work from you.</c>"); return; } else if (result == DisableResult.CriticalFailure) { trap.Disabler = 0; trap.Helpers = new List<uint>(); trap.TotalHelp = 0; TrapTrigger.Fire(s, trap, disabler); s.SendMessageToPC(disabler, "<c=#98FFFF>Your disable attempt has backfired, causing you to cease work.</c>"); return; } else { trap.Disabler = 0; trap.Helpers = new List<uint>(); trap.TotalHelp = 0; s.SendMessageToPC(disabler, "<c=#98FFFF>Your disable attempt has failed. You may retry if you like.</c>"); return; } } else { Vector3 oldPos = s.GetPositionFromLocation(loc); NWLocation newLoc = s.GetLocation(disabler); Vector3 newPos = s.GetPosition(disabler); if (Math.Abs(oldPos.x - newPos.x) > DisarmMovementThreshhold || Math.Abs(oldPos.y - newPos.y) > DisarmMovementThreshhold) { // The disabler has moved. Interpret as canceling. trap.Disabler = 0; trap.Helpers = new List<uint>(); trap.TotalHelp = 0; s.SendMessageToPC(disabler, "<c=#98FFFF>You stop working on the trap, due to having moved from your workspace.</c>"); return; } int action = s.GetCurrentAction(disabler); if (action == ACTION_ANIMALEMPATHY || action == ACTION_ATTACKOBJECT || action == ACTION_CASTSPELL || action == ACTION_CLOSEDOOR || action == ACTION_COUNTERSPELL || action == ACTION_DIALOGOBJECT || action == ACTION_DROPITEM || action == ACTION_EXAMINETRAP || action == ACTION_FLAGTRAP || action == ACTION_FOLLOW || action == ACTION_HEAL || action == ACTION_ITEMCASTSPELL || action == ACTION_KIDAMAGE || action == ACTION_LOCK || action == ACTION_MOVETOPOINT || action == ACTION_OPENDOOR || action == ACTION_OPENLOCK || action == ACTION_PICKPOCKET || action == ACTION_PICKUPITEM || action == ACTION_RANDOMWALK || action == ACTION_RECOVERTRAP || action == ACTION_REST || action == ACTION_SETTRAP || action == ACTION_SIT || action == ACTION_SMITEGOOD || action == ACTION_TAUNT || action == ACTION_USEOBJECT) { // Disabler isn't working on the trap any more. Abort. trap.Disabler = 0; trap.Helpers = new List<uint>(); trap.TotalHelp = 0; s.SendMessageToPC(disabler, "<c=#98FFFF>You stop working on the trap, due to having begun another task.</c>"); return; } s.SendMessageToPC(disabler, "<c=#98FFFF>You continue work on the trap...</c>"); s.PlayAnimation(ANIMATION_FIREFORGET_KNEELFIDGET, 1.0f, 2.0f); s.DelayCommand(2.0f, delegate { StallForTime(s, trap, disabler, delay, newLoc); }); } }
public static void Fire(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint specialTarget) { List<uint> targets = new List<uint>(); if (s.GetIsObjectValid(specialTarget) == TRUE) { targets.Add(specialTarget); } foreach (uint contents in s.GetObjectsInPersistentObject(s.GetObjectByTag(trap.Tag, 0), OBJECT_TYPE_CREATURE, 0)) { if (FitsTrapTargetRestriction(s, trap, contents)) { targets.Add(contents); } } if (targets.Count == 0) { // Might be that they all left. In any case // we have nothing to shoot trap.IsFiring = false; return; } uint target; if (targets.Count == 1) { target = targets[0]; } else { target = targets[s.Random(targets.Count)]; } uint caster; if (s.GetIsObjectValid(trap.TrapOrigin) == FALSE) { caster = s.GetObjectByTag(trap.Tag, 0); } else { caster = trap.TrapOrigin; } if (trap.SpellTrap) { // It's a spell-- guess this is simple. s.AssignCommand(caster, delegate { s.ActionCastSpellAtObject(trap.SpellId, target, METAMAGIC_NONE, TRUE, 0, 0, 1); }); } else { foreach (uint victim in s.GetObjectsInShape(trap.EffectArea, trap.EffectSize, s.GetLocation(target), false, OBJECT_TYPE_CREATURE, s.GetPosition(caster))) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, GetTrapEffect(s, trap, victim), victim, 0.0f); _doSoloVFX(s, trap, victim); } _doGroupVFX(s, trap, s.GetLocation(target)); } if (trap.NumberOfShots > -1) { if (trap.NumberOfShots < 2) { TrapDisable.RemoveTrap(s, trap); return; } else { trap.NumberOfShots--; } } trap.IsFiring = true; s.DelayCommand(6.0f, delegate { Fire(s, trap); }); }
private static void RidingHeartbeat(CLRScriptBase script, uint Character) { // Character has dismounted if (!isWarhorse.ContainsKey(Character)) return; script.DelayCommand(6.0f, delegate { RidingHeartbeat(script, Character); }); }
public static void ActivateLongTermBuffs(uint oCaster, CLRScriptBase s) { // Cast protection from good/evil based on alignment. if (s.GetAlignmentGoodEvil(oCaster) == CLRScriptBase.ALIGNMENT_EVIL) { _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_GOOD, s); } else { _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_EVIL, s); } // Buff armor, if the creature has any. uint oItem = s.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_CHEST, s.OBJECT_SELF); if (oItem != CLRScriptBase.OBJECT_INVALID) { _QuickBuff(oCaster, CLRScriptBase.SPELL_MAGIC_VESTMENT, s, oItem); } // Buff the shield, if the creature has one. uint oLeftHandItem = s.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_LEFTHAND, oCaster); uint oRightHandItem = s.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_RIGHTHAND, oCaster); int nLeftItemType = s.GetBaseItemType(oLeftHandItem); int nRightItemType = s.GetBaseItemType(oRightHandItem); if (GetIsItemShield(oLeftHandItem, s) != CLRScriptBase.FALSE) { _QuickBuff(oCaster, CLRScriptBase.SPELL_MAGIC_VESTMENT, s, oLeftHandItem); } // FIX ME!! Weapon-buffing should be more intelligent. But we need to be // able to tell what a weapon is. _QuickBuff(oCaster, CLRScriptBase.SPELL_KEEN_EDGE, s); if (s.GetHasSpell(CLRScriptBase.SPELL_GREATER_MAGIC_WEAPON, oCaster) != CLRScriptBase.FALSE) _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_MAGIC_WEAPON, s); else _QuickBuff(oCaster, CLRScriptBase.SPELL_MAGIC_WEAPON, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_WEAPON_OF_IMPACT, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_BARKSKIN, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_SPIDERSKIN, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_CONVICTION, s); if (s.GetHasSpell(CLRScriptBase.SPELL_PROTECTION_FROM_ENERGY, oCaster) != CLRScriptBase.FALSE) _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_ENERGY, s); else _QuickBuff(oCaster, CLRScriptBase.SPELL_ENDURE_ELEMENTS, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_FREEDOM_OF_MOVEMENT, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_HEROISM, s); if (s.GetHasSpell(CLRScriptBase.SPELL_IMPROVED_MAGE_ARMOR, oCaster) != CLRScriptBase.FALSE) _QuickBuff(oCaster, CLRScriptBase.SPELL_IMPROVED_MAGE_ARMOR, s); else _QuickBuff(oCaster, CLRScriptBase.SPELL_MAGE_ARMOR, s); if (s.GetHasSpell(CLRScriptBase.SPELL_GREATER_PLANAR_BINDING, oCaster) != CLRScriptBase.FALSE) _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_PLANAR_BINDING, s); else if (s.GetHasSpell(CLRScriptBase.SPELL_PLANAR_BINDING, oCaster) != CLRScriptBase.FALSE) _QuickBuff(oCaster, CLRScriptBase.SPELL_PLANAR_BINDING, s); else if (s.GetHasSpell(CLRScriptBase.SPELL_PLANAR_ALLY, oCaster) != CLRScriptBase.FALSE) _QuickBuff(oCaster, CLRScriptBase.SPELL_PLANAR_ALLY, s); else _QuickBuff(oCaster, CLRScriptBase.SPELL_LESSER_PLANAR_BINDING, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_RESISTANCE, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_MIND_BLANK, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_ONE_WITH_THE_LAND, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_PREMONITION, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_SPELLS, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_ARROWS, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_BULLS_STRENGTH, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_CATS_GRACE, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_EAGLE_SPLENDOR, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_BEARS_ENDURANCE, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_FOXS_CUNNING, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_OWLS_WISDOM, s); _QuickBuff(oCaster, CLRScriptBase.SPELL_SEE_INVISIBILITY, s); if (s.GetHasSpell(CLRScriptBase.SPELL_PREMONITION, oCaster) != CLRScriptBase.FALSE) _QuickBuff(oCaster, CLRScriptBase.SPELL_PREMONITION, s); else if (s.GetHasSpell(CLRScriptBase.SPELL_GREATER_STONESKIN, oCaster) != CLRScriptBase.FALSE) _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_STONESKIN, s); else _QuickBuff(oCaster, CLRScriptBase.SPELL_STONESKIN, s); // Delay party buffs a bit in case this guy has buddies spawning in next to him. s.DelayCommand(6.0f, delegate { _QuickBuff(oCaster, CLRScriptBase.SPELL_MASS_CAMOFLAGE, s); }); }
public static void DrawObjects(CLRScriptBase script, User currentUser, uint currentArea) { float fDelay = 0.1f; List<uint> ChooserAoEs = new List<uint>(); List<uint> ChooserCreatures = new List<uint>(); List<uint> ChooserDoors = new List<uint>(); List<uint> ChooserItems = new List<uint>(); List<uint> ChooserLights = new List<uint>(); List<uint> ChooserPlaceables = new List<uint>(); List<uint> ChooserPlacedEffects = new List<uint>(); List<uint> ChooserStores = new List<uint>(); List<uint> ChooserTriggers = new List<uint>(); List<uint> ChooserWaypoints = new List<uint>(); script.DelayCommand(fDelay, delegate { foreach (uint thing in script.GetObjectsInArea(currentArea)) { int objectType = script.GetObjectType(thing); switch (objectType) { case OBJECT_TYPE_AREA_OF_EFFECT: ChooserAoEs.Add(thing); break; case OBJECT_TYPE_CREATURE: ChooserCreatures.Add(thing); break; case OBJECT_TYPE_DOOR: ChooserDoors.Add(thing); break; case OBJECT_TYPE_ITEM: ChooserItems.Add(thing); break; case OBJECT_TYPE_LIGHT: ChooserLights.Add(thing); break; case OBJECT_TYPE_PLACEABLE: ChooserPlaceables.Add(thing); break; case OBJECT_TYPE_PLACED_EFFECT: ChooserPlacedEffects.Add(thing); break; case OBJECT_TYPE_STORE: ChooserStores.Add(thing); break; case OBJECT_TYPE_TRIGGER: ChooserTriggers.Add(thing); break; case OBJECT_TYPE_WAYPOINT: ChooserWaypoints.Add(thing); break; } } script.ClearListBox(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS"); if (ChooserAoEs.Count > 0 && currentUser.ChooserShowAOE) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserAoEs) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetTag(thing), "LISTBOX_ITEM_ICON=trap.tga", "5="+thing.ToString(), ""); } }); } if (ChooserCreatures.Count > 0 && currentUser.ChooserShowCreature) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserCreatures) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetName(thing), "LISTBOX_ITEM_ICON=creature.tga", "5=" + thing.ToString(), ""); } }); } if (ChooserDoors.Count > 0 && currentUser.ChooserShowDoor) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserDoors) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetName(thing), "LISTBOX_ITEM_ICON=door.tga", "5=" + thing.ToString(), ""); } }); } if (ChooserItems.Count > 0 && currentUser.ChooserShowItem) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserItems) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetName(thing), "LISTBOX_ITEM_ICON=item.tga", "5=" + thing.ToString(), ""); } }); } if (ChooserLights.Count > 0 && currentUser.ChooserShowLight) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserLights) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetName(thing) + ";LISTBOX_ITEM_TEXT2= Light", "LISTBOX_ITEM_ICON=light.tga", "5=" + thing.ToString(), ""); } }); } if (ChooserPlaceables.Count > 0 && currentUser.ChooserShowPlaceable) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserPlaceables) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetName(thing) + ";LISTBOX_ITEM_TEXT2= Placeable", "LISTBOX_ITEM_ICON=placeable.tga", "5=" + thing.ToString(), ""); } }); } if (ChooserPlacedEffects.Count > 0 && currentUser.ChooserShowPlacedEffect) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserPlacedEffects) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetName(thing) + ";LISTBOX_ITEM_TEXT2= Placed Effect", "LISTBOX_ITEM_ICON=vfx.tga", "5=" + thing.ToString(), ""); } }); } if (ChooserStores.Count > 0 && currentUser.ChooserShowStore) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserStores) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetName(thing) + ";LISTBOX_ITEM_TEXT2= Store", "LISTBOX_ITEM_ICON=store.tga", "5=" + thing.ToString(), ""); } }); } if (ChooserTriggers.Count > 0 && currentUser.ChooserShowTrigger) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserTriggers) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetName(thing) + ";LISTBOX_ITEM_TEXT2= Trigger", "LISTBOX_ITEM_ICON=trigger.tga", "5=" + thing.ToString(), ""); } }); } if (ChooserWaypoints.Count > 0 && currentUser.ChooserShowWaypoint) { fDelay += 0.1f; script.DelayCommand(fDelay, delegate { foreach (uint thing in ChooserWaypoints) { script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_OBJECTS", thing.ToString(), "LISTBOX_ITEM_TEXT= " + script.GetName(thing) + ";LISTBOX_ITEM_TEXT2= Waypoint", "LISTBOX_ITEM_ICON=waypoint.tga", "5=" + thing.ToString(), ""); } }); } }); }
private static void SwimHeartbeat(CLRScriptBase script, uint Creature) { uint Trigger = AppearanceTypes.currentSwimTrigger[Creature]; foreach(uint contents in script.GetObjectsInPersistentObject(Trigger, CLRScriptBase.OBJECT_TYPE_CREATURE, CLRScriptBase.PERSISTENT_ZONE_ACTIVE)) { if(contents == Creature) { if (script.GetSubRace(Creature) != CLRScriptBase.RACIAL_SUBTYPE_WATER_GENASI && script.GetLocalInt(Creature, ACR_CREATURE_AQUATIC) == 0) { int SwimDC = script.GetLocalInt(Trigger, ACR_SWIM_DC); int SinkDC = SwimDC - 5; int NoAir = script.GetLocalInt(Trigger, ACR_NO_AIR); int Roll = script.d20(1); int Bonus = script.GetSkillRank(CLRScriptBase.SKILL_SWIM, Creature, CLRScriptBase.FALSE); ProcessWaterEffects(script, Creature, Trigger); if (10 + Bonus >= SwimDC) { // Can take 10 here. Roll = 10; } if (Roll + Bonus >= SwimDC) { script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_TEMPORARY, script.ExtraordinaryEffect(script.EffectMovementSpeedDecrease(50)), Creature, 6.0f); script.SendMessageToPC(Creature, String.Format("*Swim: {0} + {1} = {2} v. DC {3} :: Success!*", Roll, Bonus, Roll+Bonus, SwimDC)); if(NoAir == CLRScriptBase.FALSE) { CurrentDrownStatus.Remove(Creature); CurrentDrownDC.Remove(Creature); } else { ProcessNoAir(script, Creature); } } else if (Roll + Bonus >= SinkDC) { script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_TEMPORARY, script.ExtraordinaryEffect(script.EffectMovementSpeedDecrease(75)), Creature, 6.0f); script.SendMessageToPC(Creature, String.Format("*Swim: {0} + {1} = {2} v. DC {3} :: Failure!*", Roll, Bonus, Roll + Bonus, SwimDC)); script.SendMessageToPC(Creature, String.Format("You struggle to move through the water.")); if (NoAir == CLRScriptBase.FALSE) { CurrentDrownStatus.Remove(Creature); CurrentDrownDC.Remove(Creature); } else { ProcessNoAir(script, Creature); } } else { script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_TEMPORARY, script.ExtraordinaryEffect(script.EffectMovementSpeedDecrease(75)), Creature, 6.0f); // TODO: Find a way to apply this penalty without completely screwing the PC's AC. //script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_TEMPORARY, script.ExtraordinaryEffect(script.EffectACDecrease(2, CLRScriptBase.AC_DODGE_BONUS, CLRScriptBase.DAMAGE_TYPE_ALL)), Creature, 6.0f); script.SendMessageToPC(Creature, String.Format("*Swim: {0} + {1} = {2} v. DC {3} :: Failure!*", Roll, Bonus, Roll + Bonus, SwimDC)); script.SendMessageToPC(Creature, String.Format("You're completely overwhelmed by the pull of the water!")); ProcessNoAir(script, Creature); } } else { script.SendMessageToPC(Creature, "Your swim speed and capacity to breathe water allows you to move easily through the water."); return; } script.DelayCommand(6.0f, delegate { SwimHeartbeat(script, Creature); }); return; } } AppearanceTypes.currentSwimTrigger[Creature] = CLRScriptBase.OBJECT_INVALID; AppearanceTypes.characterMovement[Creature] = AppearanceTypes.MovementType.Walking; if (Swimming.CurrentDrownStatus.ContainsKey(Creature)) Swimming.CurrentDrownStatus.Remove(Creature); AppearanceTypes.RecalculateMovement(script, Creature); }
private static void _doSoloVFX(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint target) { if (trap.EffectSize < 2.0f) { if (s.GetArea(trap.TrapOrigin) == s.GetArea(s.GetObjectByTag(trap.Tag, 0))) { if ((trap.DamageType & DAMAGE_TYPE_ACID) == DAMAGE_TYPE_ACID) { s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_ACID, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f); } if ((trap.DamageType & DAMAGE_TYPE_BLUDGEONING) == DAMAGE_TYPE_BLUDGEONING) { s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_SLING, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0); float fShotDelay = 0.1f; int c = 1; while (c < trap.DiceNumber) { s.DelayCommand(fShotDelay, delegate { s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_SLING, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0); }); fShotDelay += 0.1f; c++; } } if ((trap.DamageType & DAMAGE_TYPE_COLD) == DAMAGE_TYPE_COLD) { s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_ICE, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f); } if ((trap.DamageType & DAMAGE_TYPE_DIVINE) == DAMAGE_TYPE_DIVINE) { s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_HOLY, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f); } if ((trap.DamageType & DAMAGE_TYPE_ELECTRICAL) == DAMAGE_TYPE_ELECTRICAL) { s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_LIGHTNING, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f); } if ((trap.DamageType & DAMAGE_TYPE_FIRE) == DAMAGE_TYPE_FIRE) { s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_FIRE, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f); } if ((trap.DamageType & DAMAGE_TYPE_MAGICAL) == DAMAGE_TYPE_MAGICAL) { s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_MAGIC, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f); } if ((trap.DamageType & DAMAGE_TYPE_NEGATIVE) == DAMAGE_TYPE_NEGATIVE) { s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_EVIL, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f); } if ((trap.DamageType & DAMAGE_TYPE_PIERCING) == DAMAGE_TYPE_PIERCING) { s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_DART, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0); float fShotDelay = 0.1f; int c = 1; while (c < trap.DiceNumber) { s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_DART, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0); fShotDelay += 0.1f; c++; } } if ((trap.DamageType & DAMAGE_TYPE_POSITIVE) == DAMAGE_TYPE_POSITIVE) { s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_HOLY, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f); } if ((trap.DamageType & DAMAGE_TYPE_SLASHING) == DAMAGE_TYPE_SLASHING) { s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_THROWINGAXE, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0); float fShotDelay = 0.1f; int c = 1; while (c < trap.DiceNumber) { s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_THROWINGAXE, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0); fShotDelay += 0.1f; c++; } } if ((trap.DamageType & DAMAGE_TYPE_SONIC) == DAMAGE_TYPE_SONIC) { s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_SONIC, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f); } } else { // These are pretty much single-target effects. if ((trap.DamageType & DAMAGE_TYPE_ACID) == DAMAGE_TYPE_ACID) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_ACID_S, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_BLUDGEONING) == DAMAGE_TYPE_BLUDGEONING) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_COLD) == DAMAGE_TYPE_COLD) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_FROST_L, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_DIVINE) == DAMAGE_TYPE_DIVINE) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_ELECTRICAL) == DAMAGE_TYPE_ELECTRICAL) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_LIGHTNING_S, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_FIRE) == DAMAGE_TYPE_FIRE) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_FLAME_S, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_MAGICAL) == DAMAGE_TYPE_MAGICAL) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_MAGBLUE, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_NEGATIVE) == DAMAGE_TYPE_NEGATIVE) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_PIERCING) == DAMAGE_TYPE_PIERCING) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_SPIKE_TRAP, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_POSITIVE) == DAMAGE_TYPE_POSITIVE) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_SUNSTRIKE, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_SLASHING) == DAMAGE_TYPE_SLASHING) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE), target, 0.0f); } if ((trap.DamageType & DAMAGE_TYPE_SONIC) == DAMAGE_TYPE_SONIC) { s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_SONIC, FALSE), target, 0.0f); } } } else { return; } }
public static void MountHorse(CLRScriptBase script, uint Character, uint Horse) { if (!isWarhorse.ContainsKey(Character)) isWarhorse.Add(Character, true); string cloakResRef; switch(script.GetTag(Horse)) { case "abr_cr_an_horse01": cloakResRef = "acr_ooc_horse01"; isWarhorse[Character] = true; break; case "abr_cr_an_horse02": cloakResRef = "acr_ooc_horse02"; isWarhorse[Character] = true; break; case "abr_cr_an_horse03": cloakResRef = "acr_ooc_horse03"; isWarhorse[Character] = true; break; default: cloakResRef = "acr_ooc_horse03"; isWarhorse[Character] = true; break; } uint horseCloak = script.CreateItemOnObject(cloakResRef, Character, 1, "", CLRScriptBase.FALSE); if (script.GetLocalInt(Horse, ACR_IS_WARHORSE) == 1) { script.RemoveHenchman(Character, Horse); script.SetLocalInt(horseCloak, ACR_IS_WARHORSE, 1); } script.SetLocalInt(horseCloak, ACR_HORSE_ID, script.GetLocalInt(Horse, ACR_HORSE_ID)); script.SetLocalInt(horseCloak, ACR_HORSE_HP, script.GetCurrentHitPoints(Horse)); uint equippedCloak = script.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_CLOAK, Character); if (script.GetIsObjectValid(equippedCloak) == CLRScriptBase.TRUE) { foreach (NWItemProperty prop in script.GetItemPropertiesOnItem(equippedCloak)) { // copying property duration type prevents us from turning temporary properties into // permanent ones. But because we don't know how long the non-permanent ones have left, // we pretty much have to assign them with the expectation that they immediately expire. script.AddItemProperty(script.GetItemPropertyDurationType(prop), prop, horseCloak, 0.0f); } script.SetFirstName(horseCloak, script.GetName(equippedCloak) + "(( Horse Appearance ))"); script.AddItemProperty(CLRScriptBase.DURATION_TYPE_PERMANENT, script.ItemPropertyWeightReduction(CLRScriptBase.IP_CONST_REDUCEDWEIGHT_80_PERCENT), horseCloak, 0.0f); } script.SetPlotFlag(horseCloak, CLRScriptBase.TRUE); script.SetPlotFlag(Horse, CLRScriptBase.FALSE); script.AssignCommand(Horse, delegate { script.SetIsDestroyable(CLRScriptBase.TRUE, CLRScriptBase.FALSE, CLRScriptBase.FALSE); }); script.AssignCommand(Horse, delegate { script.DestroyObject(Horse, 0.0f, CLRScriptBase.FALSE); }); script.AssignCommand(Character, delegate { script.ActionEquipItem(horseCloak, CLRScriptBase.INVENTORY_SLOT_CLOAK); }); if (!isWarhorse[Character]) script.DelayCommand(6.0f, delegate { RidingHeartbeat(script, Character); }); }