private static bool AssignArmorLevel_New(WorldObject wo, TreasureDeath profile, TreasureRoll roll) { // retail was only divied up into a few different mutation scripts here // anything with ArmorLevel ran these mutation scripts // anything that covered extremities (head / hand / foot wear) started with a slightly higher base AL, // but otherwise used the same mutation as anything that covered non-extremities // shields also had their own mutation script // only exceptions found: covenant armor, olthoi armor, metal cap if (!roll.HasArmorLevel(wo)) { return(false); } var scriptName = GetMutationScript_ArmorLevel(wo, roll); if (scriptName == null) { log.Error($"AssignArmorLevel_New({wo.Name}, {profile.TreasureType}, {roll.ItemType}) - unknown item type"); return(false); } //Console.WriteLine($"Mutating {wo.Name} with {scriptName}"); var mutationFilter = MutationCache.GetMutation(scriptName); return(mutationFilter.TryMutate(wo, profile.Tier)); }
private static List <SpellId> RollItemSpells(WorldObject wo, TreasureDeath profile, TreasureRoll roll) { List <SpellId> spells = null; //if (roll.IsArmor || roll.IsArmorClothing(wo)) if (roll.HasArmorLevel(wo)) { spells = ArmorSpells.Roll(profile); } else if (roll.IsMeleeWeapon) { spells = MeleeSpells.Roll(profile); } else if (roll.IsMissileWeapon) { spells = MissileSpells.Roll(profile); } else if (roll.IsCaster) { spells = WandSpells.Roll(wo, profile); } else { log.Error($"RollItemSpells({wo.Name}) - item is not clothing / armor / weapon"); return(null); } return(RollSpellLevels(wo, profile, spells)); }
private static SpellId RollCantrip(WorldObject wo, TreasureDeath profile, TreasureRoll roll) { if (roll.HasArmorLevel(wo) || roll.IsClothing) { // armor / clothing cantrip // this table also applies to crowns (treasureitemtype.jewelry w/ al) return(ArmorCantrips.Roll()); } if (roll.IsMeleeWeapon) { // melee cantrip var meleeCantrip = MeleeCantrips.Roll(); // adjust for weapon skill if (meleeCantrip == SpellId.CANTRIPLIGHTWEAPONSAPTITUDE1) { meleeCantrip = AdjustForWeaponMastery(wo); } return(meleeCantrip); } else if (roll.IsMissileWeapon) { // missile cantrip return(MissileCantrips.Roll()); } else if (roll.IsCaster) { // caster cantrip var casterCantrip = WandCantrips.Roll(); if (casterCantrip == SpellId.CANTRIPWARMAGICAPTITUDE1) { casterCantrip = AdjustForDamageType(wo, casterCantrip); } return(casterCantrip); } else if (roll.IsJewelry) { // jewelry cantrip return(JewelryCantrips.Roll()); } else { log.Error($"RollCantrip({wo.Name}, {profile.TreasureType}, {roll.ItemType}) - unknown item type"); return(SpellId.Undef); } }
private static bool AssignArmorLevel_New(WorldObject wo, TreasureDeath profile, TreasureRoll roll, LootTables.ArmorType armorType) { // retail was only divied up into a few different mutation scripts here // anything with ArmorLevel ran these mutation scripts // anything that covered extremities (head / hand / foot wear) started with a slightly higher base AL, // but otherwise used the same mutation as anything that covered non-extremities // shields also had their own mutation script // only exceptions found: covenant armor, olthoi armor, metal cap if (!roll.HasArmorLevel(wo)) { return(false); } var scriptName = GetMutationScript_ArmorLevel(wo, roll); if (scriptName == null) { log.Error($"AssignArmorLevel_New({wo.Name}, {profile.TreasureType}, {roll.ItemType}) - unknown item type"); return(false); } // persist original values for society armor var wieldRequirements = wo.WieldRequirements; var wieldSkillType = wo.WieldSkillType; var wieldDifficulty = wo.WieldDifficulty; //Console.WriteLine($"Mutating {wo.Name} with {scriptName}"); var mutationFilter = MutationCache.GetMutation(scriptName); var success = mutationFilter.TryMutate(wo, profile.Tier); if (armorType == LootTables.ArmorType.SocietyArmor) { wo.WieldRequirements = wieldRequirements; wo.WieldSkillType = wieldSkillType; wo.WieldDifficulty = wieldDifficulty; } return(success); }
private static List <SpellId> RollSpells(WorldObject wo, TreasureDeath profile, TreasureRoll roll) { var spells = new List <SpellId>(); // crowns, which are classified as TreasureItemType.Jewelry, should also be getting item spells // perhaps replace this with wo.ArmorLevel check? //if (roll.IsArmor || roll.IsArmorClothing(wo) || roll.IsWeapon) if (roll.HasArmorLevel(wo) || roll.IsWeapon) { var itemSpells = RollItemSpells(wo, profile, roll); if (itemSpells != null) { spells.AddRange(itemSpells); } } var enchantments = RollEnchantments(wo, profile, roll); if (enchantments != null) { spells.AddRange(enchantments); roll.ItemDifficulty += RollEnchantmentDifficulty(enchantments); } var cantrips = RollCantrips(wo, profile, roll); if (cantrips != null) { spells.AddRange(cantrips); roll.ItemDifficulty += RollCantripDifficulty(cantrips); } return(spells); }
/// <summary> /// An alternate method to using the SpellSelectionCode from PropertyInt.TSysMutationdata /// </summary> private static int GetSpellSelectionCode_Dynamic(WorldObject wo, TreasureRoll roll) { if (wo is Gem) { return(1); } else if (roll.ItemType == TreasureItemType_Orig.Jewelry) { if (!roll.HasArmorLevel(wo)) { return(2); } else { return(3); } } else if (roll.Wcid == Enum.WeenieClassName.orb) { return(4); } else if (roll.IsCaster && wo.W_DamageType != DamageType.Nether) { return(5); } else if (roll.IsMeleeWeapon && wo.WeaponSkill != Skill.TwoHandedCombat) { return(6); } else if ((roll.IsArmor || roll.IsClothing) && !wo.IsShield) { return(GetSpellCode_Dynamic_ClothingArmor(wo, roll)); } else if (wo.IsShield) { return(8); } else if (roll.IsDinnerware) { if (roll.Wcid == Enum.WeenieClassName.flasksimple) { return(0); } else { return(16); } } else if (roll.IsMissileWeapon || wo.WeaponSkill == Skill.TwoHandedCombat) { return(17); } else if (roll.IsCaster && wo.W_DamageType == DamageType.Nether) { return(19); } log.Error($"GetSpellCode_Dynamic({wo.Name}) - couldn't determine spell selection code"); return(0); }