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 int NewWand(CLRScriptBase script, int maxValue) { if (maxValue < 375) { return 0; } int wandValue = 0; uint scrollSource = OBJECT_INVALID; if (maxValue >= 21000) { switch (Generation.rand.Next(5)) { case 0: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level4Scrolls[Generation.rand.Next(GenerateScroll.Level4Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 21000; break; case 1: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level3Scrolls[Generation.rand.Next(GenerateScroll.Level3Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 11250; break; case 2: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level2Scrolls[Generation.rand.Next(GenerateScroll.Level2Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 4500; break; case 3: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level1Scrolls[Generation.rand.Next(GenerateScroll.Level1Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 750; break; case 4: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level0Scrolls[Generation.rand.Next(GenerateScroll.Level0Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 375; break; } } else if (maxValue >= 11250) { switch (Generation.rand.Next(4)) { case 0: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level3Scrolls[Generation.rand.Next(GenerateScroll.Level3Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 11250; break; case 1: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level2Scrolls[Generation.rand.Next(GenerateScroll.Level2Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 4500; break; case 2: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level1Scrolls[Generation.rand.Next(GenerateScroll.Level1Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 750; break; case 3: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level0Scrolls[Generation.rand.Next(GenerateScroll.Level0Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 375; break; } } else if (maxValue >= 4500) { switch (Generation.rand.Next(3)) { case 0: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level2Scrolls[Generation.rand.Next(GenerateScroll.Level2Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 4500; break; case 1: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level1Scrolls[Generation.rand.Next(GenerateScroll.Level1Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 750; break; case 2: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level0Scrolls[Generation.rand.Next(GenerateScroll.Level0Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 375; break; } } else if (maxValue >= 750) { switch (Generation.rand.Next(2)) { case 0: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level1Scrolls[Generation.rand.Next(GenerateScroll.Level1Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 750; break; case 1: wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level0Scrolls[Generation.rand.Next(GenerateScroll.Level0Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 375; break; } } else if (maxValue >= 375) { wandNumber++; scrollSource = script.CreateItemOnObject(GenerateScroll.Level0Scrolls[Generation.rand.Next(GenerateScroll.Level0Scrolls.Count)], script.OBJECT_SELF, 1, "soonwand" + wandNumber.ToString(), FALSE); wandValue = 375; } uint wandItem = script.CreateItemOnObject(wandResRef, script.OBJECT_SELF, 1, script.GetTag(scrollSource) + wandNumber.ToString(), FALSE); script.SetItemCharges(wandItem, 50); string wandName = script.GetFirstName(scrollSource); wandName.Replace("Scroll", "Wand"); script.SetFirstName(wandItem, wandName); foreach (NWItemProperty prop in script.GetItemPropertiesOnItem(scrollSource)) { if (script.GetItemPropertyType(prop) == ITEM_PROPERTY_CAST_SPELL) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyCastSpell(script.GetItemPropertySubType(prop), IP_CONST_CASTSPELL_NUMUSES_1_CHARGE_PER_USE), wandItem, 0.0f); } else if (script.GetItemPropertyType(prop) == ITEM_PROPERTY_USE_LIMITATION_CLASS) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyLimitUseByClass(script.GetItemPropertySubType(prop)), wandItem, 0.0f); } } script.DestroyObject(scrollSource, 0.0f, FALSE); return wandValue; }
public static int NewBelt(CLRScriptBase script, int maxValue) { List<int> selectableAbilities = new List<int>(); foreach (KeyValuePair<int, int> prop in PrimaryAmuletAbility) { if (prop.Value <= maxValue) { selectableAbilities.Add(prop.Key); } } if (selectableAbilities.Count == 0) { return 0; } int selectedAbility = selectableAbilities[Generation.rand.Next(selectableAbilities.Count)]; uint belt = script.CreateItemOnObject("zitem_belt", script.OBJECT_SELF, 1, "", FALSE); switch (selectedAbility) { #region Belt of Shielding case ITEM_PROPERTY_AC_BONUS: { if (maxValue >= 50000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(5), belt, 0.0f); script.SetFirstName(belt, "Belt of Shielding +5"); Pricing.CalculatePrice(script, belt); return 50000; } else if (maxValue >= 32000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(4), belt, 0.0f); script.SetFirstName(belt, "Belt of Shielding +4"); Pricing.CalculatePrice(script, belt); return 32000; } else if (maxValue >= 18000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(3), belt, 0.0f); script.SetFirstName(belt, "Belt of Shielding +3"); Pricing.CalculatePrice(script, belt); return 18000; } else if (maxValue >= 8000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(2), belt, 0.0f); script.SetFirstName(belt, "Belt of Shielding +2"); Pricing.CalculatePrice(script, belt); return 8000; } else if (maxValue >= 2000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(1), belt, 0.0f); script.SetFirstName(belt, "Belt of Shielding +1"); Pricing.CalculatePrice(script, belt); return 2000; } else { return 0; } } #endregion #region Ability Bonus case ITEM_PROPERTY_ABILITY_BONUS: { int ability = AbilityScores[Generation.rand.Next(AbilityScores.Count)]; if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(ability, 6), belt, 0.0f); script.SetFirstName(belt, AbilityScoreNames[ability] + " +6"); Pricing.CalculatePrice(script, belt); return 36000; } else if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(ability, 5), belt, 0.0f); script.SetFirstName(belt, AbilityScoreNames[ability] + " +5"); Pricing.CalculatePrice(script, belt); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(ability, 4), belt, 0.0f); script.SetFirstName(belt, AbilityScoreNames[ability] + " +4"); Pricing.CalculatePrice(script, belt); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(ability, 3), belt, 0.0f); script.SetFirstName(belt, AbilityScoreNames[ability] + " +3"); Pricing.CalculatePrice(script, belt); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(ability, 2), belt, 0.0f); script.SetFirstName(belt, AbilityScoreNames[ability] + " +2"); Pricing.CalculatePrice(script, belt); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(ability, 1), belt, 0.0f); script.SetFirstName(belt, AbilityScoreNames[ability] + " +1"); Pricing.CalculatePrice(script, belt); return 1000; } else { return 0; } } #endregion #region Immunities case ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS: { List<int> possibleImmunities = new List<int>(); foreach (KeyValuePair<int, int> immunity in AvailableImmunities) { if (immunity.Value <= maxValue) { possibleImmunities.Add(immunity.Key); } } if (possibleImmunities.Count == 0) { return 0; } int selectedImmunity = possibleImmunities[Generation.rand.Next(possibleImmunities.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyImmunityMisc(selectedImmunity), belt, 0.0f); script.SetFirstName(belt, ImmunityNames[selectedImmunity]); Pricing.CalculatePrice(script, belt); return AvailableImmunities[selectedImmunity]; } #endregion #region Skill Bonuses case ITEM_PROPERTY_SKILL_BONUS: { int skillBonus = AvailableSkills[Generation.rand.Next(AvailableSkills.Count)]; script.SetFirstName(belt, SkillNames[skillBonus]); if (maxValue >= 10000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 10), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +10"); Pricing.CalculatePrice(script, belt); return 10000; } else if (maxValue >= 8100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 9), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +9"); Pricing.CalculatePrice(script, belt); return 8100; } else if (maxValue >= 6400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 8), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +8"); Pricing.CalculatePrice(script, belt); return 6400; } else if (maxValue >= 4900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 7), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +7"); Pricing.CalculatePrice(script, belt); return 4900; } else if (maxValue >= 3600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 6), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +6"); Pricing.CalculatePrice(script, belt); return 3600; } else if (maxValue >= 2500) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 5), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +5"); Pricing.CalculatePrice(script, belt); return 2500; } else if (maxValue >= 1600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 4), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +4"); Pricing.CalculatePrice(script, belt); return 1600; } else if (maxValue >= 900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 3), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +3"); Pricing.CalculatePrice(script, belt); return 900; } else if (maxValue >= 400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 2), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +2"); Pricing.CalculatePrice(script, belt); return 400; } else if (maxValue >= 100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 1), belt, 0.0f); script.SetFirstName(belt, script.GetName(belt) + " +1"); Pricing.CalculatePrice(script, belt); return 100; } break; } #endregion } script.DestroyObject(belt, 0.0f, FALSE); return 0; }
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 bool recalculate(CLRScriptBase script) { // Ensure that both our hide and our creature are still valid. if (script.GetIsObjectValid(m_oCreature) == CLRScriptBase.FALSE || script.GetIsObjectValid(m_oCreature) == CLRScriptBase.FALSE) { return false; } // Recreate the hide. script.AssignCommand(m_oCreature, delegate { script.ClearAllActions(CLRScriptBase.FALSE); }); uint oOldHide = getHide(script); m_oHide = script.CreateItemOnObject("acr_pchide", m_oCreature, 1, "acr_pchide", CLRScriptBase.FALSE); // Temp variables to store bonuses, to allow stacking from different sources. Dictionary<int, int> saveBonuses = new Dictionary<int, int>(); Dictionary<int, int> skillBonuses = new Dictionary<int, int>(); Dictionary<string, int> otherBonuses = new Dictionary<string, int>(); // Initialize dictionaries. for (int i = 0; i < 68; i++) { skillBonuses.Add(i, 0); } for (int i = 0; i < 4; i++) { saveBonuses.Add(i, 0); } #region Skill Focus feats // Handle all new shiny skill focus feats. if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_BALANCE, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_BALANCE] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_CLIMB, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_CLIMB] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_CRFT_ALCH, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_CRAFT_ALCHEMY] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_CRFT_ARM, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_CRAFT_ARMORSMITHING] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_CRFT_BOW, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_CRAFT_BOWMAKING] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_CRFT_WPN, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_CRAFT_WEAPONSMITHING] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_DECIPHER, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_DECIPHER_SCRIPT] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_DISGUISE, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_DISGUISE] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_ESC_ART, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_ESCAPE_ARTIST] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_HAND_ANIM, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_HANDLE_ANIMAL] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_JUMP, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_JUMP] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_ARC, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_ARCANA] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_DUNG, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_DUNGEONEERING] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_ENG, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_ENGINEERING] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_GEO, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_GEOGRAPHY] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_HIST, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_HISTORY] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_LOC, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_LOCAL] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_NATR, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_NATURE] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_NOBL, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_NOBILITY] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_PLAN, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_THE_PLANES] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_KNOW_RELG, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_RELIGION] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PERF_ACT, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PERFORM_ACT] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PERF_COMD, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PERFORM_COMEDY] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PERF_DANC, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PERFORM_DANCE] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PERF_KEYB, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PERFORM_KEYBOARD] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PERF_ORAT, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PERFORM_ORATORY] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PERF_PERC, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PERFORM_PERCUSSION] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PERF_SING, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PERFORM_SING] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PERF_STRG, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PERFORM_STRING_INSTRUMENTS] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PERF_WIND, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PERFORM_WIND_INSTRUMENTS] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_PROF, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_PROFESSION] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_RIDE, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_RIDE] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_SENS_MOTV, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_SPEAK_LANGUAGE] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_SPK_LANG, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_KNOWLEDGE_LOCAL] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_SWIM, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_SWIM] += 3; if (script.GetHasFeat((int)FEATS.FEAT_SKILL_FOCUS_USE_ROPE, m_oCreature, 1) == CLRScriptBase.TRUE) skillBonuses[(int)SKILLS.SKILL_USE_ROPE] += 3; #endregion // Artist is one bad-ass feat. if (script.GetHasFeat(CLRScriptBase.FEAT_ARTIST, m_oCreature, 1) == CLRScriptBase.TRUE) { // Previously: +2 perform, +2 diplomacy // Currently: +2 perform (all), 3 extra bardic music uses per day skillBonuses[CLRScriptBase.SKILL_DIPLOMACY] -= 2; skillBonuses[(int)SKILLS.SKILL_PERFORM_ACT] += 2; skillBonuses[(int)SKILLS.SKILL_PERFORM_COMEDY] += 2; skillBonuses[(int)SKILLS.SKILL_PERFORM_DANCE] += 2; skillBonuses[(int)SKILLS.SKILL_PERFORM_KEYBOARD] += 2; skillBonuses[(int)SKILLS.SKILL_PERFORM_ORATORY] += 2; skillBonuses[(int)SKILLS.SKILL_PERFORM_PERCUSSION] += 2; skillBonuses[(int)SKILLS.SKILL_PERFORM_SING] += 2; skillBonuses[(int)SKILLS.SKILL_PERFORM_STRING_INSTRUMENTS] += 2; skillBonuses[(int)SKILLS.SKILL_PERFORM_WIND_INSTRUMENTS] += 2; } // Add skill bonuses to item. foreach (int skill in skillBonuses.Keys) { if (skillBonuses[skill] == 0) { continue; } else if (skillBonuses[skill] > 0) { script.AddItemProperty(CLRScriptBase.DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skill, skillBonuses[skill]), m_oHide, 0.0f); } else if (skillBonuses[skill] < 0) { script.AddItemProperty(CLRScriptBase.DURATION_TYPE_PERMANENT, script.ItemPropertyDecreaseSkill(skill, Math.Abs(skillBonuses[skill])), m_oHide, 0.0f); } } // Add save bonuses to item. foreach (int save in saveBonuses.Keys) { if (saveBonuses[save] == 0) { continue; } else if (saveBonuses[save] > 0) { script.AddItemProperty(CLRScriptBase.DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrow(save, saveBonuses[save]), m_oHide, 0.0f); } else if (saveBonuses[save] < 0) { script.AddItemProperty(CLRScriptBase.DURATION_TYPE_PERMANENT, script.ItemPropertyReducedSavingThrow(save, Math.Abs(saveBonuses[save])), m_oHide, 0.0f); } } // Make the person equip the new item. script.AssignCommand(m_oCreature, delegate { script.ClearAllActions(CLRScriptBase.FALSE); }); script.AssignCommand(m_oCreature, delegate { script.ActionEquipItem(m_oHide, CLRScriptBase.INVENTORY_SLOT_CARMOUR); }); script.DestroyObject(oOldHide, 0.0f, CLRScriptBase.FALSE); script.SendMessageToPC(m_oCreature, "PC Hide refreshed."); // Everything looks fine, return our success. return true; }
public void ClearArea(CLRScriptBase script) { foreach(uint obj in script.GetObjectsInArea(AreaId)) { if(script.GetObjectType(obj) == CLRScriptBase.OBJECT_TYPE_CREATURE || script.GetObjectType(obj) == CLRScriptBase.OBJECT_TYPE_AREA_OF_EFFECT) { script.DestroyObject(obj, 0.0f, CLRScriptBase.FALSE); } } }
public static void RemoveTrap(CLRScriptBase s, ALFA.Shared.ActiveTrap trap) { uint triggerAOE = s.GetObjectByTag(trap.Tag, 0); uint detectAOE = s.GetObjectByTag(trap.DetectTag, 0); uint disarmPlaceable = s.GetObjectByTag(trap.Tag + "_", 0); s.DestroyObject(triggerAOE, 0.0f, FALSE); s.DestroyObject(detectAOE, 0.0f, FALSE); s.DestroyObject(disarmPlaceable, 0.0f, FALSE); }
public static int NewBoots(CLRScriptBase script, int maxValue) { List<int> potentialAbilities = new List<int>(); foreach (KeyValuePair<int, int> ability in AvailableAbilities) { if (ability.Value <= maxValue) { potentialAbilities.Add(ability.Key); } } if (potentialAbilities.Count == 0) { return 0; } int selectedAbility = potentialAbilities[Generation.rand.Next(potentialAbilities.Count)]; uint Boots = script.CreateItemOnObject("zitem_boot2", script.OBJECT_SELF, 1, "", FALSE); switch (selectedAbility) { #region Boots of Ability Boosts case ITEM_PROPERTY_ABILITY_BONUS: { int abilityScore = AvailableAbilityScores[Generation.rand.Next(AvailableAbilityScores.Count)]; string name = AbilityScoreNames[abilityScore]; if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 6), Boots, 0.0f); script.SetFirstName(Boots, name + " +6"); Pricing.CalculatePrice(script, Boots); return 36000; } else if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 5), Boots, 0.0f); script.SetFirstName(Boots, name + " +5"); Pricing.CalculatePrice(script, Boots); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 4), Boots, 0.0f); script.SetFirstName(Boots, name + " +4"); Pricing.CalculatePrice(script, Boots); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 3), Boots, 0.0f); script.SetFirstName(Boots, name + " +3"); Pricing.CalculatePrice(script, Boots); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 2), Boots, 0.0f); script.SetFirstName(Boots, name + " +2"); Pricing.CalculatePrice(script, Boots); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 1), Boots, 0.0f); script.SetFirstName(Boots, name + " +1"); Pricing.CalculatePrice(script, Boots); return 1000; } else { return 0; } } #endregion #region Freedom of Movement case ITEM_PROPERTY_FREEDOM_OF_MOVEMENT: { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyFreeAction(), Boots, 0.0f); script.SetFirstName(Boots, "Boots of Freedom"); Pricing.CalculatePrice(script, Boots); return 40000; } #endregion #region Immunities case ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS: { List<int> possibleImmunities = new List<int>(); foreach (KeyValuePair<int, int> immunity in AvailableImmunities) { if (immunity.Value <= maxValue) { possibleImmunities.Add(immunity.Key); } } if (possibleImmunities.Count == 0) { return 0; } int selectedImmunity = possibleImmunities[Generation.rand.Next(possibleImmunities.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyImmunityMisc(selectedImmunity), Boots, 0.0f); script.SetFirstName(Boots, ImmunityNames[selectedImmunity]); Pricing.CalculatePrice(script, Boots); return AvailableImmunities[selectedImmunity]; } #endregion #region Skill Bonus case ITEM_PROPERTY_SKILL_BONUS: { int skillBonus = AvailableSkills[Generation.rand.Next(AvailableSkills.Count)]; script.SetFirstName(Boots, SkillNames[skillBonus]); if (maxValue >= 10000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 10), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +10"); Pricing.CalculatePrice(script, Boots); return 10000; } else if (maxValue >= 8100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 9), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +9"); Pricing.CalculatePrice(script, Boots); return 8100; } else if (maxValue >= 6400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 8), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +8"); Pricing.CalculatePrice(script, Boots); return 6400; } else if (maxValue >= 4900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 7), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +7"); Pricing.CalculatePrice(script, Boots); return 4900; } else if (maxValue >= 3600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 6), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +6"); Pricing.CalculatePrice(script, Boots); return 3600; } else if (maxValue >= 2500) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 5), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +5"); Pricing.CalculatePrice(script, Boots); return 2500; } else if (maxValue >= 1600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 4), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +4"); Pricing.CalculatePrice(script, Boots); return 1600; } else if (maxValue >= 900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 3), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +3"); Pricing.CalculatePrice(script, Boots); return 900; } else if (maxValue >= 400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 2), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +2"); Pricing.CalculatePrice(script, Boots); return 400; } else if (maxValue >= 100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 1), Boots, 0.0f); script.SetFirstName(Boots, script.GetName(Boots) + " +1"); Pricing.CalculatePrice(script, Boots); return 100; } else { return 0; } } #endregion } script.DestroyObject(Boots, 0.0f, FALSE); return 0; }
public static int NewHelmet(CLRScriptBase script, int maxValue) { List<int> potentialAbilities = new List<int>(); foreach (KeyValuePair<int, int> ability in AvailableAbilities) { if (ability.Value <= maxValue) { potentialAbilities.Add(ability.Key); } } if (potentialAbilities.Count == 0) { return 0; } int selectedAbility = potentialAbilities[Generation.rand.Next(potentialAbilities.Count)]; uint helmet = script.CreateItemOnObject("zitem_helm2", script.OBJECT_SELF, 1, "", FALSE); switch (selectedAbility) { #region Helmets of Ability Scores case ITEM_PROPERTY_ABILITY_BONUS: { int abilityScore = AvailableAbilityScores[Generation.rand.Next(AvailableAbilityScores.Count)]; string name = AbilityScoreNames[abilityScore]; if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 6), helmet, 0.0f); script.SetFirstName(helmet, name + " +6"); Pricing.CalculatePrice(script, helmet); return 36000; } else if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 5), helmet, 0.0f); script.SetFirstName(helmet, name + " +5"); Pricing.CalculatePrice(script, helmet); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 4), helmet, 0.0f); script.SetFirstName(helmet, name + " +4"); Pricing.CalculatePrice(script, helmet); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 3), helmet, 0.0f); script.SetFirstName(helmet, name + " +3"); Pricing.CalculatePrice(script, helmet); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 2), helmet, 0.0f); script.SetFirstName(helmet, name + " +2"); Pricing.CalculatePrice(script, helmet); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 1), helmet, 0.0f); script.SetFirstName(helmet, name + " +1"); Pricing.CalculatePrice(script, helmet); return 1000; } else { return 0; } } #endregion #region Helmets with Bonus Feats case ITEM_PROPERTY_BONUS_FEAT: { List<int> possibleFeats = new List<int>(); foreach (KeyValuePair<int, int> feat in AvailableFeats) { if (feat.Value <= maxValue) { possibleFeats.Add(feat.Key); } } if (possibleFeats.Count == 0) { return 0; } int selectedFeat = possibleFeats[Generation.rand.Next(possibleFeats.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(selectedFeat), helmet, 0.0f); script.SetFirstName(helmet, FeatNames[selectedFeat]); Pricing.CalculatePrice(script, helmet); return AvailableFeats[selectedFeat]; } #endregion #region Bonus Spell Slots case ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N: { int bonusType = AvailableBonusSpells[Generation.rand.Next(AvailableBonusSpells.Count)]; string name = BonusSpellNames[bonusType]; if (maxValue >= 81000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_9), helmet, 0.0f); script.SetFirstName(helmet, name + " IX"); Pricing.CalculatePrice(script, helmet); return 81000; } else if (maxValue >= 64000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_8), helmet, 0.0f); script.SetFirstName(helmet, name + " VIII"); Pricing.CalculatePrice(script, helmet); return 64000; } else if (maxValue >= 49000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_7), helmet, 0.0f); script.SetFirstName(helmet, name + " VII"); Pricing.CalculatePrice(script, helmet); return 49000; } else if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_6), helmet, 0.0f); script.SetFirstName(helmet, name + " VI"); Pricing.CalculatePrice(script, helmet); return 36000; } else if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_5), helmet, 0.0f); script.SetFirstName(helmet, name + " V"); Pricing.CalculatePrice(script, helmet); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_4), helmet, 0.0f); script.SetFirstName(helmet, name + " IV"); Pricing.CalculatePrice(script, helmet); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_3), helmet, 0.0f); script.SetFirstName(helmet, name + " III"); Pricing.CalculatePrice(script, helmet); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_2), helmet, 0.0f); script.SetFirstName(helmet, name + " II"); Pricing.CalculatePrice(script, helmet); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_1), helmet, 0.0f); script.SetFirstName(helmet, name + " I"); Pricing.CalculatePrice(script, helmet); return 1000; } else if (maxValue >= 500) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_0), helmet, 0.0f); script.SetFirstName(helmet, name + " 0"); Pricing.CalculatePrice(script, helmet); return 500; } else { return 0; } } #endregion #region Immunities case ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS: { List<int> possibleImmunities = new List<int>(); foreach (KeyValuePair<int, int> immunity in AvailableImmunities) { if (immunity.Value <= maxValue) { possibleImmunities.Add(immunity.Key); } } if (possibleImmunities.Count == 0) { return 0; } int selectedImmunity = possibleImmunities[Generation.rand.Next(possibleImmunities.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyImmunityMisc(selectedImmunity), helmet, 0.0f); script.SetFirstName(helmet, ImmunityNames[selectedImmunity]); Pricing.CalculatePrice(script, helmet); return AvailableImmunities[selectedImmunity]; } #endregion #region Saving Throws vs. Specific case ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC: { int saveType = AvailableSaveTypes[Generation.rand.Next(AvailableSaveTypes.Count)]; script.SetFirstName(helmet, SaveTypeNames[saveType]); if (maxValue >= 6250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 5), helmet, 0.0f); script.SetFirstName(helmet, String.Format("{0} +5", script.GetName(helmet))); Pricing.CalculatePrice(script, helmet); return 6250; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 4), helmet, 0.0f); script.SetFirstName(helmet, String.Format("{0} +4", script.GetName(helmet))); Pricing.CalculatePrice(script, helmet); return 4000; } else if (maxValue >= 2250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 3), helmet, 0.0f); script.SetFirstName(helmet, String.Format("{0} +3", script.GetName(helmet))); Pricing.CalculatePrice(script, helmet); return 2250; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 2), helmet, 0.0f); script.SetFirstName(helmet, String.Format("{0} +2", script.GetName(helmet))); Pricing.CalculatePrice(script, helmet); return 1000; } else if (maxValue >= 250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 1), helmet, 0.0f); script.SetFirstName(helmet, String.Format("{0} +1", script.GetName(helmet))); Pricing.CalculatePrice(script, helmet); return 250; } break; } #endregion #region Skill Bonus case ITEM_PROPERTY_SKILL_BONUS: { int skillBonus = AvailableSkills[Generation.rand.Next(AvailableSkills.Count)]; script.SetFirstName(helmet, SkillNames[skillBonus]); if (maxValue >= 10000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 10), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +10"); Pricing.CalculatePrice(script, helmet); return 10000; } else if (maxValue >= 8100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 9), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +9"); Pricing.CalculatePrice(script, helmet); return 8100; } else if (maxValue >= 6400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 8), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +8"); Pricing.CalculatePrice(script, helmet); return 6400; } else if (maxValue >= 4900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 7), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +7"); Pricing.CalculatePrice(script, helmet); return 4900; } else if (maxValue >= 3600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 6), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +6"); Pricing.CalculatePrice(script, helmet); return 3600; } else if (maxValue >= 2500) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 5), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +5"); Pricing.CalculatePrice(script, helmet); return 2500; } else if (maxValue >= 1600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 4), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +4"); Pricing.CalculatePrice(script, helmet); return 1600; } else if (maxValue >= 900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 3), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +3"); Pricing.CalculatePrice(script, helmet); return 900; } else if (maxValue >= 400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 2), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +2"); Pricing.CalculatePrice(script, helmet); return 400; } else if (maxValue >= 100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 1), helmet, 0.0f); script.SetFirstName(helmet, script.GetName(helmet) + " +1"); Pricing.CalculatePrice(script, helmet); return 100; } else { return 0; } } #endregion } script.DestroyObject(helmet, 0.0f, FALSE); return 0; }
public static int NewRing(CLRScriptBase script, int maxValue) { List<int> potentialAbilities = new List<int>(); foreach (KeyValuePair<int, int> ability in AvailableAbilities) { if (ability.Value <= maxValue) { potentialAbilities.Add(ability.Key); } } if (potentialAbilities.Count == 0) { return 0; } int selectedAbility = potentialAbilities[Generation.rand.Next(potentialAbilities.Count)]; uint ring = script.CreateItemOnObject("nw_it_mring021", script.OBJECT_SELF, 1, "", FALSE); switch (selectedAbility) { #region Rings of Deflection case ITEM_PROPERTY_AC_BONUS: { string name = AbilityNames[selectedAbility]; if (maxValue >= 50000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(5), ring, 0.0f); script.SetFirstName(ring, name + " +5"); Pricing.CalculatePrice(script, ring); return 50000; } else if (maxValue >= 32000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(4), ring, 0.0f); script.SetFirstName(ring, name + " +4"); Pricing.CalculatePrice(script, ring); return 32000; } else if (maxValue >= 18000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(3), ring, 0.0f); script.SetFirstName(ring, name + " +3"); Pricing.CalculatePrice(script, ring); return 18000; } else if (maxValue >= 8000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(2), ring, 0.0f); script.SetFirstName(ring, name + " +2"); Pricing.CalculatePrice(script, ring); return 8000; } else if (maxValue >= 2000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(1), ring, 0.0f); script.SetFirstName(ring, name + " +1"); Pricing.CalculatePrice(script, ring); return 2000; } else { return 0; } } #endregion #region Rings of Ability Scores case ITEM_PROPERTY_ABILITY_BONUS: { int abilityScore = AvailableAbilityScores[Generation.rand.Next(AvailableAbilityScores.Count)]; string name = AbilityScoreNames[abilityScore]; if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 6), ring, 0.0f); script.SetFirstName(ring, name + " +6"); Pricing.CalculatePrice(script, ring); return 36000; } else if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 5), ring, 0.0f); script.SetFirstName(ring, name + " +5"); Pricing.CalculatePrice(script, ring); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 4), ring, 0.0f); script.SetFirstName(ring, name + " +4"); Pricing.CalculatePrice(script, ring); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 3), ring, 0.0f); script.SetFirstName(ring, name + " +3"); Pricing.CalculatePrice(script, ring); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 2), ring, 0.0f); script.SetFirstName(ring, name + " +2"); Pricing.CalculatePrice(script, ring); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 1), ring, 0.0f); script.SetFirstName(ring, name + " +1"); Pricing.CalculatePrice(script, ring); return 1000; } else { return 0; } } #endregion #region Rings with Bonus Feats case ITEM_PROPERTY_BONUS_FEAT: { List<int> possibleFeats = new List<int>(); foreach (KeyValuePair<int, int> feat in AvailableFeats) { if (feat.Value <= maxValue) { possibleFeats.Add(feat.Key); } } if (possibleFeats.Count == 0) { return 0; } int selectedFeat = possibleFeats[Generation.rand.Next(possibleFeats.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(selectedFeat), ring, 0.0f); script.SetFirstName(ring, FeatNames[selectedFeat]); Pricing.CalculatePrice(script, ring); return AvailableFeats[selectedFeat]; } #endregion #region Bonus Spell Slots case ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N: { int bonusType = AvailableBonusSpells[Generation.rand.Next(AvailableBonusSpells.Count)]; string name = BonusSpellNames[bonusType]; if (maxValue >= 81000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_9), ring, 0.0f); script.SetFirstName(ring, name + " IX"); Pricing.CalculatePrice(script, ring); return 81000; } else if (maxValue >= 64000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_8), ring, 0.0f); script.SetFirstName(ring, name + " VIII"); Pricing.CalculatePrice(script, ring); return 64000; } else if (maxValue >= 49000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_7), ring, 0.0f); script.SetFirstName(ring, name + " VII"); Pricing.CalculatePrice(script, ring); return 49000; } else if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_6), ring, 0.0f); script.SetFirstName(ring, name + " VI"); Pricing.CalculatePrice(script, ring); return 36000; } else if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_5), ring, 0.0f); script.SetFirstName(ring, name + " V"); Pricing.CalculatePrice(script, ring); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_4), ring, 0.0f); script.SetFirstName(ring, name + " IV"); Pricing.CalculatePrice(script, ring); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_3), ring, 0.0f); script.SetFirstName(ring, name + " III"); Pricing.CalculatePrice(script, ring); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_2), ring, 0.0f); script.SetFirstName(ring, name + " II"); Pricing.CalculatePrice(script, ring); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_1), ring, 0.0f); script.SetFirstName(ring, name + " I"); Pricing.CalculatePrice(script, ring); return 1000; } else if (maxValue >= 500) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusLevelSpell(bonusType, IP_CONST_SPELLLEVEL_0), ring, 0.0f); script.SetFirstName(ring, name + " 0"); Pricing.CalculatePrice(script, ring); return 500; } else { return 0; } } #endregion #region Damage Resistance case ITEM_PROPERTY_DAMAGE_RESISTANCE: { int damageResistType = DamageResistances[Generation.rand.Next(DamageResistances.Count)]; if (damageResistType == IP_CONST_DAMAGETYPE_NEGATIVE && maxValue < 6000) { int attempts = 0; while (damageResistType == IP_CONST_DAMAGETYPE_NEGATIVE) { damageResistType = DamageResistances[Generation.rand.Next(DamageResistances.Count)]; attempts++; if (attempts == 10) { // something is wrong. Break out and just go with fire or something. damageResistType = IP_CONST_DAMAGETYPE_FIRE; break; } } } if (damageResistType == IP_CONST_DAMAGETYPE_NEGATIVE) { if (maxValue >= 66000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_30), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 30"); Pricing.CalculatePrice(script, ring); return 66000; } else if (maxValue >= 54000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_25), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 25"); Pricing.CalculatePrice(script, ring); return 54000; } else if (maxValue >= 42000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_20), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 20"); Pricing.CalculatePrice(script, ring); return 42000; } else if (maxValue >= 30000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_15), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 15"); Pricing.CalculatePrice(script, ring); return 30000; } else if (maxValue >= 18000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_10), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 10"); Pricing.CalculatePrice(script, ring); return 18000; } else if (maxValue >= 6000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_5), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 5"); Pricing.CalculatePrice(script, ring); return 6000; } } else { if (maxValue >= 44000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_30), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 30"); Pricing.CalculatePrice(script, ring); return 44000; } else if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_25), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 25"); Pricing.CalculatePrice(script, ring); return 36000; } else if (maxValue >= 28000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_20), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 20"); Pricing.CalculatePrice(script, ring); return 28000; } else if (maxValue >= 20000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_15), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 15"); Pricing.CalculatePrice(script, ring); return 20000; } else if (maxValue >= 12000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_10), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 10"); Pricing.CalculatePrice(script, ring); return 12000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_5), ring, 0.0f); script.SetFirstName(ring, DamageResistanceNames[damageResistType] + ", 5"); Pricing.CalculatePrice(script, ring); return 4000; } } break; } #endregion #region Freedom of Movement case ITEM_PROPERTY_FREEDOM_OF_MOVEMENT: { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyFreeAction(), ring, 0.0f); script.SetFirstName(ring, "Ring of Freedom"); Pricing.CalculatePrice(script, ring); return 40000; } #endregion #region Immunities case ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS: { List<int> possibleImmunities = new List<int>(); foreach (KeyValuePair<int, int> immunity in AvailableImmunities) { if (immunity.Value <= maxValue) { possibleImmunities.Add(immunity.Key); } } if (possibleImmunities.Count == 0) { return 0; } int selectedImmunity = possibleImmunities[Generation.rand.Next(possibleImmunities.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyImmunityMisc(selectedImmunity), ring, 0.0f); script.SetFirstName(ring, ImmunityNames[selectedImmunity]); Pricing.CalculatePrice(script, ring); return AvailableImmunities[selectedImmunity]; } #endregion #region Light case ITEM_PROPERTY_LIGHT: { int lightColor = LightColors[Generation.rand.Next(LightColors.Count)]; ; script.SetFirstName(ring, AbilityNames[selectedAbility]); if (maxValue >= 400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyLight(IP_CONST_LIGHTBRIGHTNESS_BRIGHT, lightColor), ring, 0.0f); Pricing.CalculatePrice(script, ring); return 400; } else if (maxValue >= 300) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyLight(IP_CONST_LIGHTBRIGHTNESS_NORMAL, lightColor), ring, 0.0f); Pricing.CalculatePrice(script, ring); return 300; } else if (maxValue >= 200) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyLight(IP_CONST_LIGHTBRIGHTNESS_LOW, lightColor), ring, 0.0f); Pricing.CalculatePrice(script, ring); return 200; } else if (maxValue >= 100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyLight(IP_CONST_LIGHTBRIGHTNESS_DIM, lightColor), ring, 0.0f); Pricing.CalculatePrice(script, ring); return 100; } else { return 0; } } #endregion #region Saving Throws case ITEM_PROPERTY_SAVING_THROW_BONUS: { if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 5), ring, 0.0f); script.SetFirstName(ring, "Ring of Resistance +5"); Pricing.CalculatePrice(script, ring); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 4), ring, 0.0f); script.SetFirstName(ring, "Ring of Resistance +4"); Pricing.CalculatePrice(script, ring); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 3), ring, 0.0f); script.SetFirstName(ring, "Ring of Resistance +3"); Pricing.CalculatePrice(script, ring); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 2), ring, 0.0f); script.SetFirstName(ring, "Ring of Resistance +2"); Pricing.CalculatePrice(script, ring); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 1), ring, 0.0f); script.SetFirstName(ring, "Ring of Resistance +1"); Pricing.CalculatePrice(script, ring); return 1000; } else { return 0; } } #endregion #region Saving Throws vs. Specific case ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC: { int saveType = AvailableSaveTypes[Generation.rand.Next(AvailableSaveTypes.Count)]; script.SetFirstName(ring, SaveTypeNames[saveType]); if (maxValue >= 6250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 5), ring, 0.0f); script.SetFirstName(ring, String.Format("{0} +5", script.GetName(ring))); Pricing.CalculatePrice(script, ring); return 6250; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 4), ring, 0.0f); script.SetFirstName(ring, String.Format("{0} +4", script.GetName(ring))); Pricing.CalculatePrice(script, ring); return 4000; } else if (maxValue >= 2250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 3), ring, 0.0f); script.SetFirstName(ring, String.Format("{0} +3", script.GetName(ring))); Pricing.CalculatePrice(script, ring); return 2250; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 2), ring, 0.0f); script.SetFirstName(ring, String.Format("{0} +2", script.GetName(ring))); Pricing.CalculatePrice(script, ring); return 1000; } else if (maxValue >= 250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 1), ring, 0.0f); script.SetFirstName(ring, String.Format("{0} +1", script.GetName(ring))); Pricing.CalculatePrice(script, ring); return 250; } break; } #endregion #region Skill Bonus case ITEM_PROPERTY_SKILL_BONUS: { int skillBonus = AvailableSkills[Generation.rand.Next(AvailableSkills.Count)]; script.SetFirstName(ring, SkillNames[skillBonus]); if (maxValue >= 10000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 10), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +10"); Pricing.CalculatePrice(script, ring); return 10000; } else if (maxValue >= 8100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 9), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +9"); Pricing.CalculatePrice(script, ring); return 8100; } else if (maxValue >= 6400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 8), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +8"); Pricing.CalculatePrice(script, ring); return 6400; } else if (maxValue >= 4900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 7), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +7"); Pricing.CalculatePrice(script, ring); return 4900; } else if (maxValue >= 3600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 6), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +6"); Pricing.CalculatePrice(script, ring); return 3600; } else if (maxValue >= 2500) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 5), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +5"); Pricing.CalculatePrice(script, ring); return 2500; } else if (maxValue >= 1600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 4), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +4"); Pricing.CalculatePrice(script, ring); return 1600; } else if (maxValue >= 900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 3), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +3"); Pricing.CalculatePrice(script, ring); return 900; } else if (maxValue >= 400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 2), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +2"); Pricing.CalculatePrice(script, ring); return 400; } else if (maxValue >= 100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 1), ring, 0.0f); script.SetFirstName(ring, script.GetName(ring) + " +1"); Pricing.CalculatePrice(script, ring); return 100; } else { return 0; } } #endregion #region Spell Resistance case ITEM_PROPERTY_SPELL_RESISTANCE: { if (maxValue >= 140000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_26), ring, 0.0f); script.SetFirstName(ring, "Ring of Spell Resistance, 26"); Pricing.CalculatePrice(script, ring); return 140000; } else if (maxValue >= 120000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_24), ring, 0.0f); script.SetFirstName(ring, "Ring of Spell Resistance, 24"); Pricing.CalculatePrice(script, ring); return 120000; } else if (maxValue >= 100000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_22), ring, 0.0f); script.SetFirstName(ring, "Ring of Spell Resistance, 22"); Pricing.CalculatePrice(script, ring); return 100000; } else if (maxValue >= 80000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_20), ring, 0.0f); script.SetFirstName(ring, "Ring of Spell Resistance, 20"); Pricing.CalculatePrice(script, ring); return 80000; } else if (maxValue >= 60000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_18), ring, 0.0f); script.SetFirstName(ring, "Ring of Spell Resistance, 18"); Pricing.CalculatePrice(script, ring); return 60000; } else if (maxValue >= 40000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_16), ring, 0.0f); script.SetFirstName(ring, "Ring of Spell Resistance, 16"); Pricing.CalculatePrice(script, ring); return 40000; } else if (maxValue >= 20000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_14), ring, 0.0f); script.SetFirstName(ring, "Ring of Spell Resistance, 14"); Pricing.CalculatePrice(script, ring); return 20000; } else if (maxValue >= 10000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_12), ring, 0.0f); script.SetFirstName(ring, "Ring of Spell Resistance, 12"); Pricing.CalculatePrice(script, ring); return 10000; } else if (maxValue >= 6000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_10), ring, 0.0f); script.SetFirstName(ring, "Ring of Spell Resistance, 10"); Pricing.CalculatePrice(script, ring); return 6000; } else { return 0; } } #endregion } script.DestroyObject(ring, 0.0f, FALSE); return 0; }
public static int NewArmor(CLRScriptBase script, int maxValue) { #region Calculate Armor Type List<int> possibleBaseItems = new List<int>(); foreach (int armorType in ArmorResRefs.Keys) { if (Pricing.ArmorRulesTypeValues[armorType] <= maxValue) { possibleBaseItems.Add(armorType); } } if (possibleBaseItems.Count == 0) { // Can't afford any armor. What are we doing here? return 0; } int selectedArmorType = possibleBaseItems[Generation.rand.Next(possibleBaseItems.Count)]; int armorValue = Pricing.ArmorRulesTypeValues[selectedArmorType]; maxValue -= armorValue; uint armor = script.CreateItemOnObject(ArmorResRefs[selectedArmorType], script.OBJECT_SELF, 1, "", FALSE); #endregion #region Armor Appearance Generation.Theme armorTheme = Generation.GetEnchantmentTheme(); if (script.GetBaseItemType(armor) == BASE_ITEM_ARMOR) { script.StoreCampaignObject(ACR_Items.ItemChangeDBName, ACR_Items.ModelChangeVarName, armor, script.OBJECT_SELF); ArmorSet set = null; switch (selectedArmorType) { case ARMOR_RULES_TYPE_BANDED: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Banded][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Banded].Count)]; break; case ARMOR_RULES_TYPE_BREASTPLATE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Breastplate][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Breastplate].Count)]; break; case ARMOR_RULES_TYPE_CHAIN_SHIRT: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.ChainShirt][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.ChainShirt].Count)]; break; case ARMOR_RULES_TYPE_CHAINMAIL: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Chainmail][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Chainmail].Count)]; break; case ARMOR_RULES_TYPE_CLOTH: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Cloth][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Cloth].Count)]; break; case ARMOR_RULES_TYPE_FULL_PLATE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.FullPlate][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.FullPlate].Count)]; break; case ARMOR_RULES_TYPE_HALF_PLATE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.HalfPlate][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.HalfPlate].Count)]; break; case ARMOR_RULES_TYPE_HIDE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Hide][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Hide].Count)]; break; case ARMOR_RULES_TYPE_LEATHER: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Leather][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Leather].Count)]; break; case ARMOR_RULES_TYPE_PADDED: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Padded][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Padded].Count)]; break; case ARMOR_RULES_TYPE_SCALE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Scale][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Scale].Count)]; break; case ARMOR_RULES_TYPE_STUDDED_LEATHER: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.StuddedLeather][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.StuddedLeather].Count)]; break; } if (set != null) { ItemModels.TakeArmorStyle(ALFA.Shared.Modules.InfoStore.ModifiedGff[ACR_Items.ModelChangeVarName], set); } ColorPair color = GeneratedColors.ColorPairs[armorTheme][Generation.rand.Next(GeneratedColors.ColorPairs[armorTheme].Count)]; ItemColors.SetColorThemes(ALFA.Shared.Modules.InfoStore.ModifiedGff[ACR_Items.ModelChangeVarName], color.Primary, color.Accent); script.DestroyObject(armor, 0.0f, TRUE); armor = script.RetrieveCampaignObject(ACR_Items.ItemChangeDBName, ACR_Items.ModelChangeVarName, script.GetLocation(script.OBJECT_SELF), script.OBJECT_SELF, script.OBJECT_SELF); } #endregion #region See if We Want This to be Masterwork if (maxValue >= 150) { switch (selectedArmorType) { case ARMOR_RULES_TYPE_BANDED: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_BANDED_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_BREASTPLATE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_CHAIN_SHIRT: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_CHAINMAIL: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_FULL_PLATE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_HALF_PLATE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_HIDE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_HIDE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_LEATHER: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_LEATHER_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_PADDED: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_PADDED_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SCALE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SCALE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SHIELD_HEAVY: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SHIELD_LIGHT: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SHIELD_TOWER: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SPLINT: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_STUDDED_LEATHER: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK); armorValue += 150; maxValue -= 150; break; } } else { // We can't even afford masterwork. Carry on. return armorValue; } #endregion #region Calculate Effective Plus double effectivePlusRemaining = Math.Sqrt((double)(maxValue / 1000)); // we cast after the division because we're going to turn this into an int later. double currentEffectivePlus = 0.0; #endregion #region Set Base Properties int enhancementBonus = 0; if (effectivePlusRemaining >= 1.0) { enhancementBonus = 1; effectivePlusRemaining -= 1; currentEffectivePlus = 1; bool quirkAdded = false; while (effectivePlusRemaining >= 1) { if (Generation.rand.Next(100) > 95) { // The remainder of the enchantment will // be personality heavy. break; } if (!quirkAdded && Generation.rand.Next(100) < 75) { enhancementBonus += 1; effectivePlusRemaining -= 1; currentEffectivePlus += 1; } else { List<EnhancementTypes> quirks = BuildBaseEnchantmentPossibilities(script.GetBaseItemType(armor), effectivePlusRemaining); if (quirks.Count > 0) { EnhancementTypes quirk = quirks[Generation.rand.Next(quirks.Count)]; if (selectedArmorType == ARMOR_RULES_TYPE_CLOTH && quirk == EnhancementTypes.Twilight) { quirk = EnhancementTypes.SpellFocus; } switch (quirk) { case EnhancementTypes.CombatCasting: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_COMBAT_CASTING), armor, 0.0f); script.SetFirstName(armor, String.Format("Battlemage's {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; break; case EnhancementTypes.DeflectArrows: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_DEFLECT_ARROWS), armor, 0.0f); script.SetFirstName(armor, String.Format("Arrowcatching {0}", script.GetName(armor))); effectivePlusRemaining -= 2; currentEffectivePlus += 2; break; case EnhancementTypes.Dodge: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_DODGE), armor, 0.0f); script.SetFirstName(armor, String.Format("Nimble {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; break; case EnhancementTypes.ExtraTurning: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_EXTRA_TURNING), armor, 0.0f); script.SetFirstName(armor, String.Format("Turning {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; break; case EnhancementTypes.SpellFocus: int primarySchool = Generation.SpellSchoolFocus[Generation.rand.Next(Generation.SpellSchoolFocus.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(primarySchool), armor, 0.0f); script.SetFirstName(armor, String.Format("Mage's {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; if (effectivePlusRemaining >= 0.5) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(Generation.SpellFocusLeft[primarySchool]), armor, 0.0f); effectivePlusRemaining -= 0.5; currentEffectivePlus += 0.5; } if (effectivePlusRemaining >= 0.5) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(Generation.SpellFocusRight[primarySchool]), armor, 0.0f); effectivePlusRemaining -= 0.5; currentEffectivePlus += 0.5; } break; case EnhancementTypes.SpellPenetration: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLPENETRATION), armor, 0.0f); script.SetFirstName(armor, String.Format("Mage's {0}", script.GetName(armor))); effectivePlusRemaining -= 1.5; currentEffectivePlus += 1.5; break; case EnhancementTypes.SR12: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_12), armor, 0.0f); script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor))); effectivePlusRemaining -= 2; currentEffectivePlus += 2; break; case EnhancementTypes.SR14: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_14), armor, 0.0f); script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor))); effectivePlusRemaining -= 3; currentEffectivePlus += 3; break; case EnhancementTypes.SR16: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_16), armor, 0.0f); script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor))); effectivePlusRemaining -= 4; currentEffectivePlus += 4; break; case EnhancementTypes.SR18: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_18), armor, 0.0f); script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor))); effectivePlusRemaining -= 5; currentEffectivePlus += 5; break; case EnhancementTypes.Twilight: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyArcaneSpellFailure(IP_CONST_ARCANE_SPELL_FAILURE_MINUS_10_PERCENT), armor, 0.0f); script.SetFirstName(armor, String.Format("Twilight {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; break; } } quirkAdded = true; } } script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(enhancementBonus), armor, 0.0f); script.SetFirstName(armor, String.Format("{0} +{1}", script.GetName(armor), enhancementBonus)); } #endregion #region Armor Personality SetPersonalityProperties(script, armor, armorTheme, enhancementBonus, ref effectivePlusRemaining, ref currentEffectivePlus); armorValue += (int)(currentEffectivePlus * currentEffectivePlus * 1000); Pricing.CalculatePrice(script, armor); return armorValue; #endregion }
public static int NewCloak(CLRScriptBase script, int maxValue) { List<int> potentialAbilities = new List<int>(); foreach (KeyValuePair<int, int> ability in AvailableAbilities) { if (ability.Value <= maxValue) { potentialAbilities.Add(ability.Key); } } if (potentialAbilities.Count == 0) { return 0; } int selectedAbility = potentialAbilities[Generation.rand.Next(potentialAbilities.Count)]; uint cloak = script.CreateItemOnObject("zitem_cloak", script.OBJECT_SELF, 1, "", FALSE); switch (selectedAbility) { #region Cloaks of Deflection case ITEM_PROPERTY_AC_BONUS: { string name = AbilityNames[selectedAbility]; if (maxValue >= 50000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(5), cloak, 0.0f); script.SetFirstName(cloak, name + " +5"); Pricing.CalculatePrice(script, cloak); return 50000; } else if (maxValue >= 32000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(4), cloak, 0.0f); script.SetFirstName(cloak, name + " +4"); Pricing.CalculatePrice(script, cloak); return 32000; } else if (maxValue >= 18000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(3), cloak, 0.0f); script.SetFirstName(cloak, name + " +3"); Pricing.CalculatePrice(script, cloak); return 18000; } else if (maxValue >= 8000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(2), cloak, 0.0f); script.SetFirstName(cloak, name + " +2"); Pricing.CalculatePrice(script, cloak); return 8000; } else if (maxValue >= 2000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(1), cloak, 0.0f); script.SetFirstName(cloak, name + " +1"); Pricing.CalculatePrice(script, cloak); return 2000; } else { return 0; } } #endregion #region Cloaks of Ability Scores case ITEM_PROPERTY_ABILITY_BONUS: { int abilityScore = AvailableAbilityScores[Generation.rand.Next(AvailableAbilityScores.Count)]; string name = AbilityScoreNames[abilityScore]; if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 6), cloak, 0.0f); script.SetFirstName(cloak, name + " +6"); Pricing.CalculatePrice(script, cloak); return 36000; } else if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 5), cloak, 0.0f); script.SetFirstName(cloak, name + " +5"); Pricing.CalculatePrice(script, cloak); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 4), cloak, 0.0f); script.SetFirstName(cloak, name + " +4"); Pricing.CalculatePrice(script, cloak); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 3), cloak, 0.0f); script.SetFirstName(cloak, name + " +3"); Pricing.CalculatePrice(script, cloak); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 2), cloak, 0.0f); script.SetFirstName(cloak, name + " +2"); Pricing.CalculatePrice(script, cloak); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 1), cloak, 0.0f); script.SetFirstName(cloak, name + " +1"); Pricing.CalculatePrice(script, cloak); return 1000; } else { return 0; } } #endregion #region Damage Resistance case ITEM_PROPERTY_DAMAGE_RESISTANCE: { int damageResistType = DamageResistances[Generation.rand.Next(DamageResistances.Count)]; if (damageResistType == IP_CONST_DAMAGETYPE_NEGATIVE && maxValue < 6000) { int attempts = 0; while (damageResistType == IP_CONST_DAMAGETYPE_NEGATIVE) { damageResistType = DamageResistances[Generation.rand.Next(DamageResistances.Count)]; attempts++; if (attempts == 10) { // something is wrong. Break out and just go with fire or something. damageResistType = IP_CONST_DAMAGETYPE_FIRE; break; } } } if (damageResistType == IP_CONST_DAMAGETYPE_NEGATIVE) { if (maxValue >= 66000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_30), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 30"); Pricing.CalculatePrice(script, cloak); return 66000; } else if (maxValue >= 54000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_25), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 25"); Pricing.CalculatePrice(script, cloak); return 54000; } else if (maxValue >= 42000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_20), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 20"); Pricing.CalculatePrice(script, cloak); return 42000; } else if (maxValue >= 30000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_15), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 15"); Pricing.CalculatePrice(script, cloak); return 30000; } else if (maxValue >= 18000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_10), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 10"); Pricing.CalculatePrice(script, cloak); return 18000; } else if (maxValue >= 6000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_5), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 5"); Pricing.CalculatePrice(script, cloak); return 6000; } } else { if (maxValue >= 44000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_30), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 30"); Pricing.CalculatePrice(script, cloak); return 44000; } else if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_25), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 25"); Pricing.CalculatePrice(script, cloak); return 36000; } else if (maxValue >= 28000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_20), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 20"); Pricing.CalculatePrice(script, cloak); return 28000; } else if (maxValue >= 20000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_15), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 15"); Pricing.CalculatePrice(script, cloak); return 20000; } else if (maxValue >= 12000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_10), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 10"); Pricing.CalculatePrice(script, cloak); return 12000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_5), cloak, 0.0f); script.SetFirstName(cloak, DamageResistanceNames[damageResistType] + ", 5"); Pricing.CalculatePrice(script, cloak); return 4000; } } break; } #endregion #region Immunities case ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS: { List<int> possibleImmunities = new List<int>(); foreach (KeyValuePair<int, int> immunity in AvailableImmunities) { if (immunity.Value <= maxValue) { possibleImmunities.Add(immunity.Key); } } if (possibleImmunities.Count == 0) { return 0; } int selectedImmunity = possibleImmunities[Generation.rand.Next(possibleImmunities.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyImmunityMisc(selectedImmunity), cloak, 0.0f); script.SetFirstName(cloak, ImmunityNames[selectedImmunity]); Pricing.CalculatePrice(script, cloak); return AvailableImmunities[selectedImmunity]; } #endregion #region Saving Throws case ITEM_PROPERTY_SAVING_THROW_BONUS: { if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 5), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Resistance +5"); Pricing.CalculatePrice(script, cloak); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 4), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Resistance +4"); Pricing.CalculatePrice(script, cloak); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 3), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Resistance +3"); Pricing.CalculatePrice(script, cloak); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 2), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Resistance +2"); Pricing.CalculatePrice(script, cloak); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 1), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Resistance +1"); Pricing.CalculatePrice(script, cloak); return 1000; } else { return 0; } } #endregion #region Saving Throws vs. Specific case ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC: { int saveType = AvailableSaveTypes[Generation.rand.Next(AvailableSaveTypes.Count)]; script.SetFirstName(cloak, SaveTypeNames[saveType]); if (maxValue >= 6250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 5), cloak, 0.0f); script.SetFirstName(cloak, String.Format("{0} +5", script.GetName(cloak))); Pricing.CalculatePrice(script, cloak); return 6250; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 4), cloak, 0.0f); script.SetFirstName(cloak, String.Format("{0} +4", script.GetName(cloak))); Pricing.CalculatePrice(script, cloak); return 4000; } else if (maxValue >= 2250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 3), cloak, 0.0f); script.SetFirstName(cloak, String.Format("{0} +3", script.GetName(cloak))); Pricing.CalculatePrice(script, cloak); return 2250; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 2), cloak, 0.0f); script.SetFirstName(cloak, String.Format("{0} +2", script.GetName(cloak))); Pricing.CalculatePrice(script, cloak); return 1000; } else if (maxValue >= 250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 1), cloak, 0.0f); script.SetFirstName(cloak, String.Format("{0} +1", script.GetName(cloak))); Pricing.CalculatePrice(script, cloak); return 250; } break; } #endregion #region Skill Bonus case ITEM_PROPERTY_SKILL_BONUS: { int skillBonus = AvailableSkills[Generation.rand.Next(AvailableSkills.Count)]; script.SetFirstName(cloak, SkillNames[skillBonus]); if (maxValue >= 10000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 10), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +10"); Pricing.CalculatePrice(script, cloak); return 10000; } else if (maxValue >= 8100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 9), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +9"); Pricing.CalculatePrice(script, cloak); return 8100; } else if (maxValue >= 6400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 8), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +8"); Pricing.CalculatePrice(script, cloak); return 6400; } else if (maxValue >= 4900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 7), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +7"); Pricing.CalculatePrice(script, cloak); return 4900; } else if (maxValue >= 3600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 6), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +6"); Pricing.CalculatePrice(script, cloak); return 3600; } else if (maxValue >= 2500) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 5), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +5"); Pricing.CalculatePrice(script, cloak); return 2500; } else if (maxValue >= 1600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 4), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +4"); Pricing.CalculatePrice(script, cloak); return 1600; } else if (maxValue >= 900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 3), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +3"); Pricing.CalculatePrice(script, cloak); return 900; } else if (maxValue >= 400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 2), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +2"); Pricing.CalculatePrice(script, cloak); return 400; } else if (maxValue >= 100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 1), cloak, 0.0f); script.SetFirstName(cloak, script.GetName(cloak) + " +1"); Pricing.CalculatePrice(script, cloak); return 100; } else { return 0; } } #endregion #region Spell Resistance case ITEM_PROPERTY_SPELL_RESISTANCE: { if (maxValue >= 140000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_26), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Spell Resistance, 26"); Pricing.CalculatePrice(script, cloak); return 140000; } else if (maxValue >= 120000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_24), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Spell Resistance, 24"); Pricing.CalculatePrice(script, cloak); return 120000; } else if (maxValue >= 100000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_22), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Spell Resistance, 22"); Pricing.CalculatePrice(script, cloak); return 100000; } else if (maxValue >= 80000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_20), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Spell Resistance, 20"); Pricing.CalculatePrice(script, cloak); return 80000; } else if (maxValue >= 60000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_18), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Spell Resistance, 18"); Pricing.CalculatePrice(script, cloak); return 60000; } else if (maxValue >= 40000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_16), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Spell Resistance, 16"); Pricing.CalculatePrice(script, cloak); return 40000; } else if (maxValue >= 20000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_14), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Spell Resistance, 14"); Pricing.CalculatePrice(script, cloak); return 20000; } else if (maxValue >= 10000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_12), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Spell Resistance, 12"); Pricing.CalculatePrice(script, cloak); return 10000; } else if (maxValue >= 6000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_10), cloak, 0.0f); script.SetFirstName(cloak, "Cloak of Spell Resistance, 10"); Pricing.CalculatePrice(script, cloak); return 6000; } else { return 0; } } #endregion } script.DestroyObject(cloak, 0.0f, FALSE); return 0; }
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); }); }
public static void Dismount(CLRScriptBase script, uint Character, uint Cloak, NWLocation Location) { string resRef = ""; if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1) { resRef = "abr_cr_an_horse_pal_"; int nPalLevel = script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_PALADIN, Character); if (nPalLevel >= 15) resRef += "15"; else if (nPalLevel >= 11) resRef += "11"; else if (nPalLevel >= 8) resRef += "8"; else if (nPalLevel >= 5) resRef += "5"; else resRef = "abr_cr_an_horse03"; } else { switch (script.GetTag(Cloak)) { case "acr_ooc_horse01": resRef = "abr_cr_an_horse01"; break; case "acr_ooc_horse02": resRef = "abr_cr_an_horse02"; break; case "acr_ooc_horse03": resRef = "abr_cr_an_horse03"; break; default: // Looks like we're not actually dismounting a horse. return; } } uint Horse = script.CreateObject(CLRScriptBase.OBJECT_TYPE_CREATURE, resRef, Location, CLRScriptBase.FALSE, ""); script.SetLocalInt(Horse, ACR_HORSE_OWNER, script.GetLocalInt(Character, ACR_CID)); script.SetLocalInt(Horse, ACR_HORSE_ID, script.GetLocalInt(Cloak, ACR_HORSE_ID)); int damage = script.GetCurrentHitPoints(Horse) - script.GetLocalInt(Cloak, ACR_HORSE_HP); if(damage > 0) { script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_INSTANT, script.EffectDamage(damage, CLRScriptBase.DAMAGE_TYPE_MAGICAL, CLRScriptBase.DAMAGE_POWER_PLUS_TWENTY, CLRScriptBase.TRUE), Horse, 0.0f); } if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1) { script.AddHenchman(Character, Horse); script.SetLocalInt(Horse, ACR_IS_WARHORSE, 1); script.SetLocalObject(Character, ACR_PAL_WARHORSE, Horse); } uint Item = GetOwnershipItemById(script, Character, script.GetLocalInt(Cloak, ACR_HORSE_ID)); script.SetLocalObject(Item , ACR_HORSE_OBJECT, Horse); script.SetLocalObject(Horse, ACR_HORSE_OBJECT, Character); script.SetLocalString(Item, ACR_HORSE_PERS_LOC_AREA, script.GetTag(script.GetArea(Horse))); script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_X, script.GetPosition(Horse).x); script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Y, script.GetPosition(Horse).y); script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Z, script.GetPosition(Horse).z); script.SetPlotFlag(Cloak, CLRScriptBase.FALSE); script.DestroyObject(Cloak, 0.0f, CLRScriptBase.FALSE); isWarhorse.Remove(Character); }
public static int NewAmulet(CLRScriptBase script, int maxValue) { List<int> potentialAbilities = new List<int>(); foreach (KeyValuePair<int, int> ability in PrimaryAmuletAbility) { if (ability.Value <= maxValue) { potentialAbilities.Add(ability.Key); } } if (potentialAbilities.Count == 0) { return 0; } int selectedAbility = potentialAbilities[Generation.rand.Next(potentialAbilities.Count)]; uint amulet = script.CreateItemOnObject("nw_it_mneck020", script.OBJECT_SELF, 1, "", FALSE); switch (selectedAbility) { #region Amulets of Natural Armor case ITEM_PROPERTY_AC_BONUS: { if (maxValue >= 50000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(5), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Natural Armor +5"); Pricing.CalculatePrice(script, amulet); return 50000; } else if (maxValue >= 32000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(4), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Natural Armor +4"); Pricing.CalculatePrice(script, amulet); return 32000; } else if (maxValue >= 18000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(3), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Natural Armor +3"); Pricing.CalculatePrice(script, amulet); return 18000; } else if (maxValue >= 8000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(2), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Natural Armor +2"); Pricing.CalculatePrice(script, amulet); return 8000; } else if (maxValue >= 2000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(1), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Natural Armor +1"); Pricing.CalculatePrice(script, amulet); return 2000; } else { return 0; } } #endregion #region Amulets of Health and Wisdom case ITEM_PROPERTY_ABILITY_BONUS: { int abilityScore = IP_CONST_ABILITY_CON; string name = "Amulet of Health"; if (script.d2(1) == 1) { abilityScore = IP_CONST_ABILITY_WIS; name = "Amulet of Wisdom"; } if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 6), amulet, 0.0f); script.SetFirstName(amulet, name + " +6"); Pricing.CalculatePrice(script, amulet); return 36000; } else if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 5), amulet, 0.0f); script.SetFirstName(amulet, name + " +5"); Pricing.CalculatePrice(script, amulet); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 4), amulet, 0.0f); script.SetFirstName(amulet, name + " +4"); Pricing.CalculatePrice(script, amulet); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 3), amulet, 0.0f); script.SetFirstName(amulet, name + " +3"); Pricing.CalculatePrice(script, amulet); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 2), amulet, 0.0f); script.SetFirstName(amulet, name + " +2"); Pricing.CalculatePrice(script, amulet); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyAbilityBonus(abilityScore, 1), amulet, 0.0f); script.SetFirstName(amulet, name + " +1"); Pricing.CalculatePrice(script, amulet); return 1000; } else { return 0; } } #endregion #region Amulets with Bonus Feats case ITEM_PROPERTY_BONUS_FEAT: { List<int> possibleFeats = new List<int>(); foreach (KeyValuePair<int, int> feat in AvailableFeats) { if (feat.Value <= maxValue) { possibleFeats.Add(feat.Key); } } if (possibleFeats.Count == 0) { return 0; } int selectedFeat = possibleFeats[Generation.rand.Next(possibleFeats.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(selectedFeat), amulet, 0.0f); switch (selectedFeat) { case IP_CONST_FEAT_COMBAT_CASTING: script.SetFirstName(amulet, "Amulet of the Battlemage"); break; case IP_CONST_FEAT_EXTRA_TURNING: script.SetFirstName(amulet, "Amulet of Turning"); break; case IP_CONST_FEAT_DARKVISION: script.SetFirstName(amulet, "Amulet of Darkvision"); break; } Pricing.CalculatePrice(script, amulet); return AvailableFeats[selectedFeat]; } #endregion #region Damage Resistance case ITEM_PROPERTY_DAMAGE_RESISTANCE: { int damageResistType = DamageResistances[Generation.rand.Next(DamageResistances.Count)]; if (damageResistType == IP_CONST_DAMAGETYPE_NEGATIVE && maxValue < 6000) { int attempts = 0; while (damageResistType == IP_CONST_DAMAGETYPE_NEGATIVE) { damageResistType = DamageResistances[Generation.rand.Next(DamageResistances.Count)]; attempts++; if (attempts == 10) { // something is wrong. Break out and just go with fire or something. damageResistType = IP_CONST_DAMAGETYPE_FIRE; break; } } } if (damageResistType == IP_CONST_DAMAGETYPE_NEGATIVE) { if (maxValue >= 66000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_30), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 30"); Pricing.CalculatePrice(script, amulet); return 66000; } else if (maxValue >= 54000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_25), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 25"); Pricing.CalculatePrice(script, amulet); return 54000; } else if (maxValue >= 42000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_20), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 20"); Pricing.CalculatePrice(script, amulet); return 42000; } else if (maxValue >= 30000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_15), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 15"); Pricing.CalculatePrice(script, amulet); return 30000; } else if (maxValue >= 18000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_10), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 10"); Pricing.CalculatePrice(script, amulet); return 18000; } else if (maxValue >= 6000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_5), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 5"); Pricing.CalculatePrice(script, amulet); return 6000; } } else { if (maxValue >= 44000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_30), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 30"); Pricing.CalculatePrice(script, amulet); return 44000; } else if (maxValue >= 36000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_25), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 25"); Pricing.CalculatePrice(script, amulet); return 36000; } else if (maxValue >= 28000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_20), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 20"); Pricing.CalculatePrice(script, amulet); return 28000; } else if (maxValue >= 20000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_15), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 15"); Pricing.CalculatePrice(script, amulet); return 20000; } else if (maxValue >= 12000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_10), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 10"); Pricing.CalculatePrice(script, amulet); return 12000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyDamageResistance(damageResistType, IP_CONST_DAMAGERESIST_5), amulet, 0.0f); script.SetFirstName(amulet, DamageResistanceNames[damageResistType] + ", 5"); Pricing.CalculatePrice(script, amulet); return 4000; } } break; } #endregion #region Freedom of Movement case ITEM_PROPERTY_FREEDOM_OF_MOVEMENT: { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyFreeAction(), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Freedom"); Pricing.CalculatePrice(script, amulet); return 40000; } #endregion #region Immunities case ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS: { List<int> possibleImmunities = new List<int>(); foreach (KeyValuePair<int, int> immunity in AvailableImmunities) { if (immunity.Value <= maxValue) { possibleImmunities.Add(immunity.Key); } } if (possibleImmunities.Count == 0) { return 0; } int selectedImmunity = possibleImmunities[Generation.rand.Next(possibleImmunities.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyImmunityMisc(selectedImmunity), amulet, 0.0f); switch (selectedImmunity) { case IP_CONST_IMMUNITYMISC_DEATH_MAGIC: script.SetFirstName(amulet, "Amulet of Lifeshielding"); break; case IP_CONST_IMMUNITYMISC_DISEASE: script.SetFirstName(amulet, "Amulet of Good Health"); break; case IP_CONST_IMMUNITYMISC_FEAR: script.SetFirstName(amulet, "Amulet of Fearlessness"); break; case IP_CONST_IMMUNITYMISC_KNOCKDOWN: script.SetFirstName(amulet, "Amulet of Stability"); break; case IP_CONST_IMMUNITYMISC_LEVEL_ABIL_DRAIN: script.SetFirstName(amulet, "Amulet of Undeath's Deflection"); break; case IP_CONST_IMMUNITYMISC_PARALYSIS: script.SetFirstName(amulet, "Amulet of Mobility"); break; case IP_CONST_IMMUNITYMISC_POISON: script.SetFirstName(amulet, "Amulet of Antivenom"); break; } Pricing.CalculatePrice(script, amulet); return AvailableImmunities[selectedImmunity]; } #endregion #region Saving Throws case ITEM_PROPERTY_SAVING_THROW_BONUS: { if (maxValue >= 25000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 5), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Resistance +5"); Pricing.CalculatePrice(script, amulet); return 25000; } else if (maxValue >= 16000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 4), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Resistance +4"); Pricing.CalculatePrice(script, amulet); return 16000; } else if (maxValue >= 9000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 3), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Resistance +3"); Pricing.CalculatePrice(script, amulet); return 9000; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 2), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Resistance +2"); Pricing.CalculatePrice(script, amulet); return 4000; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, 1), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Resistance +1"); Pricing.CalculatePrice(script, amulet); return 1000; } else { return 0; } } #endregion #region Saving Throws vs. Specific case ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC: { int saveType = AvailableSaveTypes[Generation.rand.Next(AvailableSaveTypes.Count)]; script.SetFirstName(amulet, SaveTypeNames[saveType]); if (maxValue >= 6250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 5), amulet, 0.0f); script.SetFirstName(amulet, String.Format("{0} +5", script.GetName(amulet))); Pricing.CalculatePrice(script, amulet); return 6250; } else if (maxValue >= 4000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 4), amulet, 0.0f); script.SetFirstName(amulet, String.Format("{0} +4", script.GetName(amulet))); Pricing.CalculatePrice(script, amulet); return 4000; } else if (maxValue >= 2250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 3), amulet, 0.0f); script.SetFirstName(amulet, String.Format("{0} +3", script.GetName(amulet))); Pricing.CalculatePrice(script, amulet); return 2250; } else if (maxValue >= 1000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 2), amulet, 0.0f); script.SetFirstName(amulet, String.Format("{0} +2", script.GetName(amulet))); Pricing.CalculatePrice(script, amulet); return 1000; } else if (maxValue >= 250) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSavingThrowVsX(saveType, 1), amulet, 0.0f); script.SetFirstName(amulet, String.Format("{0} +1", script.GetName(amulet))); Pricing.CalculatePrice(script, amulet); return 250; } break; } #endregion #region Skill Bonus case ITEM_PROPERTY_SKILL_BONUS: { int skillBonus = AvailableSkills[Generation.rand.Next(AvailableSkills.Count)]; script.SetFirstName(amulet, SkillNames[skillBonus]); if (maxValue >= 10000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 10), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +10"); Pricing.CalculatePrice(script, amulet); return 10000; } else if (maxValue >= 8100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 9), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +9"); Pricing.CalculatePrice(script, amulet); return 8100; } else if (maxValue >= 6400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 8), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +8"); Pricing.CalculatePrice(script, amulet); return 6400; } else if (maxValue >= 4900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 7), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +7"); Pricing.CalculatePrice(script, amulet); return 4900; } else if (maxValue >= 3600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 6), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +6"); Pricing.CalculatePrice(script, amulet); return 3600; } else if (maxValue >= 2500) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 5), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +5"); Pricing.CalculatePrice(script, amulet); return 2500; } else if (maxValue >= 1600) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 4), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +4"); Pricing.CalculatePrice(script, amulet); return 1600; } else if (maxValue >= 900) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 3), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +3"); Pricing.CalculatePrice(script, amulet); return 900; } else if (maxValue >= 400) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 2), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +2"); Pricing.CalculatePrice(script, amulet); return 400; } else if (maxValue >= 100) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertySkillBonus(skillBonus, 1), amulet, 0.0f); script.SetFirstName(amulet, script.GetName(amulet) + " +1"); Pricing.CalculatePrice(script, amulet); return 100; } else { return 0; } } #endregion #region Spell Resistance case ITEM_PROPERTY_SPELL_RESISTANCE: { if (maxValue >= 140000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_26), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Spell Resistance, 26"); Pricing.CalculatePrice(script, amulet); return 140000; } else if (maxValue >= 120000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_24), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Spell Resistance, 24"); Pricing.CalculatePrice(script, amulet); return 120000; } else if (maxValue >= 100000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_22), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Spell Resistance, 22"); Pricing.CalculatePrice(script, amulet); return 100000; } else if (maxValue >= 80000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_20), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Spell Resistance, 20"); Pricing.CalculatePrice(script, amulet); return 80000; } else if (maxValue >= 60000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_18), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Spell Resistance, 18"); Pricing.CalculatePrice(script, amulet); return 60000; } else if (maxValue >= 40000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_16), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Spell Resistance, 16"); Pricing.CalculatePrice(script, amulet); return 40000; } else if (maxValue >= 20000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_14), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Spell Resistance, 14"); Pricing.CalculatePrice(script, amulet); return 20000; } else if (maxValue >= 10000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_12), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Spell Resistance, 12"); Pricing.CalculatePrice(script, amulet); return 10000; } else if (maxValue >= 6000) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_10), amulet, 0.0f); script.SetFirstName(amulet, "Amulet of Spell Resistance, 10"); Pricing.CalculatePrice(script, amulet); return 6000; } else { return 0; } } #endregion } // Something has gone wrong. Nuke that amulet before it spreads the plague. script.DestroyObject(amulet, 0.0f, FALSE); return 0; }