public virtual double GetSlayerDamageScalar(Mobile defender) { Spellbook atkBook = Spellbook.FindEquippedSpellbook(m_Caster); double scalar = 1.0; if (atkBook != null) { SlayerEntry atkSlayer = SlayerGroup.GetEntryByName(atkBook.Slayer); SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName(atkBook.Slayer2); if (atkSlayer == null && atkSlayer2 == null) { atkSlayer = SlayerGroup.GetEntryByName(SlayerSocket.GetSlayer(atkBook)); } if (atkSlayer != null && atkSlayer.Slays(defender) || atkSlayer2 != null && atkSlayer2.Slays(defender)) { defender.FixedEffect(0x37B9, 10, 5); bool isSuper = false; if (atkSlayer != null && atkSlayer == atkSlayer.Group.Super) { isSuper = true; } else if (atkSlayer2 != null && atkSlayer2 == atkSlayer2.Group.Super) { isSuper = true; } scalar = isSuper ? 2.0 : 3.0; } TransformContext context = TransformationSpellHelper.GetContext(defender); if ((atkBook.Slayer == SlayerName.Silver || atkBook.Slayer2 == SlayerName.Silver) && context != null && context.Type != typeof(HorrificBeastSpell)) { scalar += .25; // Every necromancer transformation other than horrific beast take an additional 25% damage } if (scalar != 1.0) { return(scalar); } } ISlayer defISlayer = Spellbook.FindEquippedSpellbook(defender); if (defISlayer == null) { defISlayer = defender.Weapon as ISlayer; } if (defISlayer != null) { SlayerEntry defSlayer = SlayerGroup.GetEntryByName(defISlayer.Slayer); SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName(defISlayer.Slayer2); if (defSlayer != null && defSlayer.Group.OppositionSuperSlays(m_Caster) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays(m_Caster)) { scalar = 2.0; } } return(scalar); }
protected override void OnTarget(Mobile from, object o) { int number = -1; Item origItem = o as Item; SkillName skill = m_System.MainSkill; double value = from.Skills[skill].Value; AlterableAttribute alterInfo = GetAlterableAttribute(o, false); if (alterInfo == null) { alterInfo = GetAlterableAttribute(o, true); } if (origItem == null || !origItem.IsChildOf(from.Backpack)) { number = 1094729; // The item must be in your backpack for you to alter it. } else if (origItem is BlankScroll) { if (m_Contract == null) { if (value >= 100.0) { Item contract = null; if (skill == SkillName.Blacksmith) { contract = new AlterContract(RepairSkillType.Smithing, from); } else if (skill == SkillName.Carpentry) { contract = new AlterContract(RepairSkillType.Carpentry, from); } else if (skill == SkillName.Tailoring) { contract = new AlterContract(RepairSkillType.Tailoring, from); } else if (skill == SkillName.Tinkering) { contract = new AlterContract(RepairSkillType.Tinkering, from); } if (contract != null) { from.AddToBackpack(contract); number = 1044154; // You create the item. // Consume a blank scroll origItem.Consume(); } } else { number = 1111869; // You must be at least grandmaster level to create an alter service contract. } } else { number = 1094728; // You may not alter that item. } } else if (alterInfo == null) { number = 1094728; // You may not alter that item. } else if (!IsAlterable(origItem)) { number = 1094728; // You may not alter that item. } else if (alterInfo.CraftSystem != m_System.GetType()) { if (m_Tool != null) { // You may not alter that item. number = 1094728; } else { // You cannot alter that item with this type of alter contract. number = 1094793; } } else if (!Server.SkillHandlers.Imbuing.CheckSoulForge(from, 2, false, false)) { number = 1111867; // You must be near a soulforge to alter an item. } else if (m_Contract == null && value < 100.0) { number = 1111870; // You must be at least grandmaster level to alter an item. } else if (origItem is BaseWeapon && ((BaseWeapon)origItem).EnchantedWeilder != null) { number = 1111849; // You cannot alter an item that is currently enchanted. } else if (origItem.HasSocket <SlayerSocket>()) { SlayerSocket socket = origItem.GetSocket <SlayerSocket>(); if (socket.Slayer == SlayerName.Silver) { number = 1155681; // You cannot alter an item that has been treated with Tincture of Silver. } else { number = 1111849; // You cannot alter an item that is currently enchanted. } } else { Item newitem = Activator.CreateInstance(alterInfo.AlteredType) as Item; if (newitem == null) { return; } if (origItem is BaseWeapon && newitem is BaseWeapon) { BaseWeapon oldweapon = (BaseWeapon)origItem; BaseWeapon newweapon = (BaseWeapon)newitem; newweapon.Slayer = oldweapon.Slayer; newweapon.Slayer2 = oldweapon.Slayer2; newweapon.Slayer3 = oldweapon.Slayer3; newweapon.Resource = oldweapon.Resource; if (oldweapon.PlayerConstructed) { newweapon.PlayerConstructed = true; newweapon.Crafter = oldweapon.Crafter; newweapon.Quality = oldweapon.Quality; } newweapon.Altered = true; } else if (origItem is BaseArmor && newitem is BaseArmor) { BaseArmor oldarmor = (BaseArmor)origItem; BaseArmor newarmor = (BaseArmor)newitem; if (oldarmor.PlayerConstructed) { newarmor.PlayerConstructed = true; newarmor.Crafter = oldarmor.Crafter; newarmor.Quality = oldarmor.Quality; } newarmor.Resource = oldarmor.Resource; newarmor.PhysicalBonus = oldarmor.PhysicalBonus; newarmor.FireBonus = oldarmor.FireBonus; newarmor.ColdBonus = oldarmor.ColdBonus; newarmor.PoisonBonus = oldarmor.PoisonBonus; newarmor.EnergyBonus = oldarmor.EnergyBonus; newarmor.Altered = true; } else if (origItem is BaseClothing && newitem is BaseClothing) { BaseClothing oldcloth = (BaseClothing)origItem; BaseClothing newcloth = (BaseClothing)newitem; if (oldcloth.PlayerConstructed) { newcloth.PlayerConstructed = true; newcloth.Crafter = oldcloth.Crafter; newcloth.Quality = oldcloth.Quality; } newcloth.Altered = true; } else if (origItem is BaseClothing && newitem is BaseArmor) { BaseClothing oldcloth = (BaseClothing)origItem; BaseArmor newarmor = (BaseArmor)newitem; if (oldcloth.PlayerConstructed) { int qual = (int)oldcloth.Quality; newarmor.PlayerConstructed = true; newarmor.Crafter = oldcloth.Crafter; newarmor.Quality = (ItemQuality)qual; } newarmor.Altered = true; } else if (origItem is BaseQuiver && newitem is BaseArmor) { ((BaseArmor)newitem).Altered = true; } else { return; } if (origItem.Name != null) { newitem.Name = origItem.Name; } else if (Server.Engines.VendorSearching.VendorSearch.StringList != null) { if (origItem.LabelNumber > 0 && RetainsName(origItem)) { newitem.Name = Server.Engines.VendorSearching.VendorSearch.StringList.GetString(origItem.LabelNumber); } } AlterResists(newitem, origItem); newitem.Hue = origItem.Hue; newitem.LootType = origItem.LootType; newitem.Insured = origItem.Insured; origItem.OnAfterDuped(newitem); newitem.Parent = null; if (origItem is IDurability && newitem is IDurability) { ((IDurability)newitem).MaxHitPoints = ((IDurability)origItem).MaxHitPoints; ((IDurability)newitem).HitPoints = ((IDurability)origItem).HitPoints; } if (from.Backpack == null) { newitem.MoveToWorld(from.Location, from.Map); } else { from.Backpack.DropItem(newitem); } newitem.InvalidateProperties(); if (m_Contract != null) { m_Contract.Delete(); } origItem.Delete(); EventSink.InvokeAlterItem(new AlterItemEventArgs(from, m_Tool is Item ? (Item)m_Tool : m_Contract, origItem, newitem)); number = 1094727; // You have altered the item. } if (m_Tool != null) { from.SendGump(new CraftGump(from, m_System, m_Tool, number)); } else { from.SendLocalizedMessage(number); } }