private static void BuildSpells() { for (var i = 0; i < spells.Count; i++) { Table[i] = new SpellId[NumLevels]; } for (var i = 0; i < spells.Count; i++) { var spell = spells[i]; var spellLevels = SpellLevelProgression.GetSpellLevels(spell); if (spellLevels == null) { log.Error($"ArmorCantrips - couldn't find {spell}"); continue; } if (spellLevels.Count != NumLevels) { log.Error($"ArmorCantrips - expected {NumLevels} levels for {spell}, found {spellLevels.Count}"); continue; } for (var j = 0; j < NumLevels; j++) { Table[i][j] = spellLevels[j]; } } }
private static float RollCantripDifficulty(List <SpellId> cantripIds) { var itemDifficulty = 0.0f; foreach (var cantripId in cantripIds) { var cantripLevels = SpellLevelProgression.GetSpellLevels(cantripId); if (cantripLevels == null || cantripLevels.Count != 4) { log.Error($"RollCantripDifficulty({cantripId}) - unknown cantrip"); continue; } var cantripLevel = cantripLevels.IndexOf(cantripId); if (cantripLevel == 0) { itemDifficulty += (float)ThreadSafeRandom.Next(5.0f, 10.0f); } else { itemDifficulty += (float)ThreadSafeRandom.Next(10.0f, 20.0f); } } return(itemDifficulty); }
private static void BuildSpells(List <SpellId> spells, SpellId[][] matrix) { for (var i = 0; i < NumTiers; i++) { matrix[i] = new SpellId[spells.Count]; } for (var i = 0; i < spells.Count; i++) { var spell = spells[i]; var spellLevels = SpellLevelProgression.GetSpellLevels(spell); if (spellLevels == null) { log.Error($"GemSpells - couldn't find {spell}"); continue; } if (spellLevels.Count != NumTiers) { log.Error($"GemSpells - expected {NumTiers} levels for {spell}, found {spellLevels.Count}"); continue; } for (var j = 0; j < NumTiers; j++) { matrix[j][i] = spellLevels[j]; } } }
private static void MutateCaster_SpellDID(WorldObject wo, TreasureDeath profile) { var firstSpell = CasterSlotSpells.Roll(wo); var spellLevels = SpellLevelProgression.GetSpellLevels(firstSpell); if (spellLevels == null) { log.Error($"MutateCaster_SpellDID: couldn't find {firstSpell}"); return; } if (spellLevels.Count != 8) { log.Error($"MutateCaster_SpellDID: found {spellLevels.Count} spell levels for {firstSpell}, expected 8"); return; } var spellLevel = SpellLevelChance.Roll(profile.Tier); wo.SpellDID = (uint)spellLevels[spellLevel - 1]; var spell = new Server.Entity.Spell(wo.SpellDID.Value); var castableMod = CasterSlotSpells.IsOrb(wo) ? 5.0f : 2.5f; wo.ItemManaCost = (int)(spell.BaseMana * castableMod); wo.ItemUseable = Usable.SourceWieldedTargetRemoteNeverWalk; }
private static bool AssignMagic_Gem_New(WorldObject wo, TreasureDeath profile, TreasureRoll roll) { // TODO: move to standard AssignMagic() pipeline var spell = SpellSelectionTable.Roll(1); var spellLevel = SpellLevelChance.Roll(profile.Tier); var spellLevels = SpellLevelProgression.GetSpellLevels(spell); if (spellLevels == null || spellLevels.Count != 8) { log.Error($"AssignMagic_Gem_New({wo.Name}, {profile.TreasureType}, {roll.ItemType}) - unknown spell {spell}"); return(false); } var finalSpellId = spellLevels[spellLevel - 1]; wo.SpellDID = (uint)finalSpellId; var _spell = new Server.Entity.Spell(finalSpellId); // retail spellcraft was capped at 370 wo.ItemSpellcraft = Math.Min((int)_spell.Power, 370); var castableMana = (int)_spell.BaseMana * 5; wo.ItemMaxMana = RollItemMaxMana_New(wo, roll, castableMana); wo.ItemCurMana = wo.ItemMaxMana; // verified wo.ItemManaCost = castableMana; return(true); }
private static int AddSpells(List <SpellId> spells, int startIdx) { for (var i = 0; i < spells.Count; i++) { var spell = spells[i]; var spellLevels = SpellLevelProgression.GetSpellLevels(spell); if (spellLevels == null) { log.Error($"ScrollSpells - couldn't find {spell}"); continue; } if (spellLevels.Count != MaxLevels) { log.Error($"ScrollSpells - expected {MaxLevels} levels for {spell}, found {spellLevels.Count}"); continue; } for (var j = 0; j < NumLevels; j++) { Table[startIdx + i][j] = spellLevels[j]; } } return(spells.Count); }
private static void MutateCaster_SpellDID(WorldObject wo, TreasureDeath profile) { var firstSpell = CasterSlotSpells.Roll(wo); var spellLevels = SpellLevelProgression.GetSpellLevels(firstSpell); if (spellLevels == null) { log.Error($"MutateCaster_SpellDID: couldn't find {firstSpell}"); return; } if (spellLevels.Count != 8) { log.Error($"MutateCaster_SpellDID: found {spellLevels.Count} spell levels for {firstSpell}, expected 8"); return; } int minSpellLevel = GetLowSpellTier(profile.Tier); int maxSpellLevel = GetHighSpellTier(profile.Tier); var spellLevel = ThreadSafeRandom.Next(minSpellLevel, maxSpellLevel); wo.SpellDID = (uint)spellLevels[spellLevel - 1]; var spell = new Server.Entity.Spell(wo.SpellDID.Value); wo.ItemManaCost = (int)spell.BaseMana * 5; wo.ItemUseable = Usable.SourceWieldedTargetRemoteNeverWalk; }
private static void BuildSpells() { for (var i = 0; i < spells.Count; i++) { Table[i] = new SpellId[NumTiers]; } for (var i = 0; i < spells.Count; i++) { var spell = spells[i]; var spellLevels = SpellLevelProgression.GetSpellLevels(spell); if (spellLevels == null) { log.Error($"ArmorSpells - couldn't find {spell}"); continue; } if (spellLevels.Count != NumTiers) { log.Error($"ArmorSpells - expected {NumTiers} levels for {spell}, found {spellLevels.Count}"); continue; } for (var j = 0; j < NumTiers; j++) { Table[i][j] = spellLevels[j]; } // build a version of this table w/out item spells switch (spell) { case SpellId.Impenetrability1: case SpellId.BladeBane1: case SpellId.PiercingBane1: case SpellId.BludgeonBane1: case SpellId.FlameBane1: case SpellId.FrostBane1: case SpellId.AcidBane1: case SpellId.LightningBane1: break; default: CreatureLifeTable.Add(spell); break; } } }
private static List <SpellId> RollCantrips(WorldObject wo, TreasureDeath profile, TreasureRoll roll) { // no cantrips on dinnerware? if (roll.ItemType == TreasureItemType_Orig.ArtObject) { return(null); } var numCantrips = CantripChance.RollNumCantrips(profile); if (numCantrips == 0) { return(null); } var numAttempts = numCantrips * 3; var cantrips = new HashSet <SpellId>(); for (var i = 0; i < numAttempts && cantrips.Count < numCantrips; i++) { var cantrip = RollCantrip(wo, profile, roll); cantrip = AdjustForWeaponMastery(wo, cantrip); if (cantrip != SpellId.Undef) { cantrips.Add(cantrip); } } var finalCantrips = new List <SpellId>(); foreach (var cantrip in cantrips) { var cantripLevel = CantripChance.RollCantripLevel(profile); var cantripLevels = SpellLevelProgression.GetSpellLevels(cantrip); if (cantripLevels.Count != 4) { log.Error($"RollCantrips({wo.Name}, {profile.TreasureType}, {roll.ItemType}) - {cantrip} has {cantripLevels.Count} cantrip levels, expected 4"); continue; } finalCantrips.Add(cantripLevels[cantripLevel - 1]); } return(finalCantrips); }
private static void BuildSpells() { for (var i = 0; i < spells.Count; i++) { Table[i] = new SpellId[NumTiers]; } for (var i = 0; i < spells.Count; i++) { var spell = spells[i]; var spellLevels = SpellLevelProgression.GetSpellLevels(spell); if (spellLevels == null) { log.Error($"MeleeSpells - couldn't find {spell}"); continue; } if (spellLevels.Count != NumTiers) { log.Error($"MeleeSpells - expected {NumTiers} levels for {spell}, found {spellLevels.Count}"); continue; } for (var j = 0; j < NumTiers; j++) { Table[i][j] = spellLevels[j]; } // build a version of this table w/out item spells switch (spell) { case SpellId.BloodDrinkerSelf1: case SpellId.DefenderSelf1: case SpellId.HeartSeekerSelf1: case SpellId.SwiftKillerSelf1: break; default: CreatureLifeTable.Add(spell); break; } } }
private static List <SpellId> RollSpellLevels(WorldObject wo, TreasureDeath profile, IEnumerable <SpellId> spells) { var finalSpells = new List <SpellId>(); foreach (var spell in spells) { var spellLevel = SpellLevelChance.Roll(profile.Tier); var spellLevels = SpellLevelProgression.GetSpellLevels(spell); if (spellLevels.Count != 8) { log.Error($"RollSpellLevels({wo.Name}, {spell}) - spell level progression returned {spellLevels.Count}, expected 8"); continue; } finalSpells.Add(spellLevels[spellLevel - 1]); } return(finalSpells); }
private static List <SpellId> RollCantrips(WorldObject wo, TreasureDeath profile, TreasureRoll roll) { // no cantrips on dinnerware? if (roll.ItemType == TreasureItemType_Orig.ArtObject) { return(null); } var numCantrips = CantripChance.RollNumCantrips(profile); if (numCantrips == 0) { return(null); } var numAttempts = numCantrips * 3; var cantrips = new HashSet <SpellId>(); for (var i = 0; i < numAttempts && cantrips.Count < numCantrips; i++) { var cantrip = RollCantrip(wo, profile, roll); if (cantrip != SpellId.Undef) { cantrips.Add(cantrip); } } var finalCantrips = new List <SpellId>(); var hasLegendary = false; foreach (var cantrip in cantrips) { var cantripLevel = CantripChance.RollCantripLevel(profile); var cantripLevels = SpellLevelProgression.GetSpellLevels(cantrip); if (cantripLevels.Count != 4) { log.Error($"RollCantrips({wo.Name}, {profile.TreasureType}, {roll.ItemType}) - {cantrip} has {cantripLevels.Count} cantrip levels, expected 4"); continue; } finalCantrips.Add(cantripLevels[cantripLevel - 1]); if (cantripLevel == 4) { hasLegendary = true; } } // if a legendary cantrip dropped on this item if (hasLegendary) { // and if the item has a level requirement, ensure the level requirement is at least 180 // if the item does not already contain a level requirement, don't add one? if (wo.WieldRequirements == WieldRequirement.Level && wo.WieldDifficulty < 180) { wo.WieldDifficulty = 180; } if (wo.WieldRequirements2 == WieldRequirement.Level && wo.WieldDifficulty2 < 180) { wo.WieldDifficulty2 = 180; } } return(finalCantrips); }