public override bool CheckCast() { if (Caster.Mounted) { Caster.SendLocalizedMessage(1063132); // You cannot use this ability while mounted. return(false); } else if (Caster.Flying) { Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying. return(false); } else if ((Caster.Followers + 1) > Caster.FollowersMax) { Caster.SendLocalizedMessage(1063133); // You cannot summon a mirror image because you have too many followers. return(false); } else if (TransformationSpell.UnderTransformation(Caster, typeof(HorrificBeastSpell))) { Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form. return(false); } return(base.CheckCast()); }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker) || !CheckMana(attacker, true)) { return; } ClearCurrentAbility(attacker); // Necromancers under Lich or Wraith Form are immune to Bleed Attacks. TransformContext context = TransformationSpell.GetContext(defender); if ((context != null && (context.Type == typeof(LichFormSpell) || context.Type == typeof(WraithFormSpell))) || (defender is BaseCreature && ((BaseCreature)defender).BleedImmune)) { attacker.SendLocalizedMessage(1062052); // Your target is not affected by the bleed attack! return; } attacker.SendLocalizedMessage(1060159); // Your target is bleeding! defender.SendLocalizedMessage(1060160); // You are bleeding! if (defender is PlayerMobile) { defender.LocalOverheadMessage(MessageType.Regular, 0x21, 1060757); // You are bleeding profusely defender.NonlocalOverheadMessage(MessageType.Regular, 0x21, 1060758, defender.Name); // ~1_NAME~ is bleeding profusely } defender.PlaySound(0x133); defender.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist); BeginBleed(defender, attacker); }
public override void OnCast() { if (Caster.Mounted) { Caster.SendLocalizedMessage(1063132); // You cannot use this ability while mounted. } else if (Caster.Flying) { Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying. } else if ((Caster.Followers + 1) > Caster.FollowersMax) { Caster.SendLocalizedMessage(1063133); // You cannot summon a mirror image because you have too many followers. } else if (TransformationSpell.UnderTransformation(Caster, typeof(HorrificBeastSpell))) { Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form. } else if (CheckSequence()) { Caster.FixedParticles(0x376A, 1, 14, 0x13B5, EffectLayer.Waist); Caster.PlaySound(0x511); new Clone(Caster).MoveToWorld(Caster.Location, Caster.Map); } FinishSequence(); }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker) || !CheckMana(attacker, true)) { return; } ClearCurrentAbility(attacker); if (defender != null && ((BaseCreature)defender).BleedImmune) { attacker.SendLocalizedMessage(1062052); // Your target is not affected by the bleed attack! return; } TransformContext context = TransformationSpell.GetContext(defender); // Necromancers under Lich Form or Wraith Form are immune to Bleed Attacks. if (context == null || (context.Type != typeof(LichFormSpell) && context.Type != typeof(WraithFormSpell))) { attacker.SendLocalizedMessage(1060159); // Your target is bleeding! defender.SendLocalizedMessage(1060160); // You are bleeding! defender.PlaySound(0x133); defender.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist); BeginBleed(defender, attacker); } else { attacker.SendLocalizedMessage(1062052); // Your target is not affected by the bleed attack! } }
protected override void OnTick() { if ((Core.AOS && m_Poison.Level < 4 && TransformationSpell.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) || (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile))) { if (m_Mobile.CurePoison(m_Mobile)) { m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true, "* You feel yourself resisting the effects of the poison *"); m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true, String.Format("* {0} seems resistant to the poison *", m_Mobile.Name)); Stop(); return; } } if (m_Index++ == m_Poison.m_Count) { m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off. m_Mobile.Poison = null; Stop(); return; } int damage; if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool()) { damage = m_LastDamage; } else { damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar); if (damage < m_Poison.m_Minimum) { damage = m_Poison.m_Minimum; } else if (damage > m_Poison.m_Maximum) { damage = m_Poison.m_Maximum; } m_LastDamage = damage; } AOS.Damage(m_Mobile, damage, 0, 0, 0, 100, 0); if ((m_Index % m_Poison.m_MessageInterval) == 0) { m_Mobile.OnPoisoned(m_Mobile, m_Poison, m_Poison); } }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!IsBladeweaveAttack) { if (!Validate(attacker)) { return; } if (!CheckMana(attacker, true)) { return; } } ClearCurrentAbility(attacker); if (defender is BaseCreature) { if (defender != null && ((BaseCreature)defender).BleedImmune) { attacker.SendLocalizedMessage(1062052); // Your target is not affected by the bleed attack! return; } } TransformContext context = TransformationSpell.GetContext(defender); // Necromancers under Lich Form or Wraith Form are immune to Bleed Attacks. if (context == null || (context.Type != typeof(LichFormSpell) && context.Type != typeof(WraithFormSpell))) { attacker.SendLocalizedMessage(1060159); // Your target is bleeding! defender.SendLocalizedMessage(1060160); // You are bleeding! if (defender is PlayerMobile) { defender.LocalOverheadMessage(MessageType.Regular, 0x21, 1060757); // You are bleeding profusely defender.NonlocalOverheadMessage(MessageType.Regular, 0x21, 1060758, defender.Name); // ~1_NAME~ is bleeding profusely } defender.PlaySound(0x133); defender.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist); TimeSpan duration = ComputeDuration(defender); BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.Bleed, 1075829, duration, defender, String.Format("{0}\t{1}\t{2}", 5, 10, 2))); BeginBleed(defender, attacker, duration); } else { attacker.SendLocalizedMessage(1062052); // Your target is not affected by the bleed attack! } }
public bool ValidateUse(Mobile from) { PlayerMobile pm = from as PlayerMobile; if (!IsChildOf(from.Backpack)) { // That must be in your pack for you to use it. from.SendLocalizedMessage(1042001); } else if (pm == null || pm.NpcGuild != NpcGuild.ThievesGuild) { // Only Members of the thieves guild are trained to use this item. from.SendLocalizedMessage(501702); } else if (Stealing.SuspendOnMurder && pm.Kills > 0) { // You are currently suspended from the thieves guild. They would frown upon your actions. from.SendLocalizedMessage(501703); } else if (!from.CanBeginAction(typeof(IncognitoSpell))) { // You cannot disguise yourself while incognitoed. from.SendLocalizedMessage(501704); } else if (Factions.Sigil.ExistsOn(from)) { from.SendLocalizedMessage(1010465); // You cannot disguise yourself while holding a sigil } else if (TransformationSpell.UnderTransformation(from)) { // You cannot disguise yourself while in that form. from.SendLocalizedMessage(1061634); } else if (from.BodyMod == 183 || from.BodyMod == 184) { // You cannot disguise yourself while wearing body paint from.SendLocalizedMessage(1040002); } else if (!from.CanBeginAction(typeof(PolymorphSpell)) || from.IsBodyMod) { // You cannot disguise yourself while polymorphed. from.SendLocalizedMessage(501705); } else { return(true); } return(false); }
public override void GetCastSkills(out double min, out double max) { if (TransformationSpell.UnderTransformation(Caster, typeof(WraithFormSpell))) { min = max = -1; } else if (m_Book != null) // recall using Runebook charge { min = max = -1; } else { base.GetCastSkills(out min, out max); } }
// Tracking players uses tracking and detect hidden vs. hiding and stealth private static bool CheckDifficulty(Mobile from, Mobile m) { if (!Core.AOS || !m.Player) { return(true); } int tracking = from.Skills[SkillName.Tracking].Fixed; int detectHidden = from.Skills[SkillName.DetectHidden].Fixed; int hiding = m.Skills[SkillName.Hiding].Fixed; int stealth = m.Skills[SkillName.Stealth].Fixed; int divisor = hiding + stealth; // Necromancy forms affect tracking difficulty if (TransformationSpell.UnderTransformation(m, typeof(HorrificBeastSpell))) { divisor -= 200; } else if (TransformationSpell.UnderTransformation(m, typeof(VampiricEmbraceSpell)) && divisor < 500) { divisor = 500; } else if (TransformationSpell.UnderTransformation(m, typeof(WraithFormSpell)) && divisor <= 2000) { divisor += 200; } int chance; if (divisor > 0) { if (Core.SE) { chance = 50 * (tracking * 2 + detectHidden) / divisor; } else { chance = 50 * (tracking + detectHidden + 10 * Utility.RandomMinMax(1, 20)) / divisor; } } else { chance = 100; } return(chance > Utility.Random(100)); }
public bool ValidateUse(Mobile from) { PlayerMobile pm = from as PlayerMobile; TeiravonMobile m_Player = (TeiravonMobile)from; if (pm == null || (!m_Player.HasFeat(TeiravonMobile.Feats.Disguise))) { // Only Members of the thieves guild are trained to use this item. from.SendMessage("You must have the proper training to use disguise kits."); } else if (!IsChildOf(from.Backpack)) { // That must be in your pack for you to use it. from.SendLocalizedMessage(1042001); } else if (!from.CanBeginAction(typeof(IncognitoSpell))) { // You cannot disguise yourself while incognitoed. from.SendLocalizedMessage(501704); } else if (TransformationSpell.UnderTransformation(from)) { // You cannot disguise yourself while in that form. from.SendLocalizedMessage(1061634); } else if (from.BodyMod == 183 || from.BodyMod == 184) { // You cannot disguise yourself while wearing body paint from.SendLocalizedMessage(1040002); } else if (!from.CanBeginAction(typeof(PolymorphSpell)) || from.IsBodyMod) { // You cannot disguise yourself while polymorphed. from.SendLocalizedMessage(501705); } else { return(true); } return(false); }
private bool CheckResistPoison() { double naturalResistChance = PoisonResistance.GetNaturalResistChance(m_Mobile, m_Poison); double temporaryResistChance = PoisonResistance.GetTemporaryResistChance(m_Mobile, m_Poison); if (naturalResistChance + temporaryResistChance > Utility.RandomDouble()) { return(true); } if (m_Poison.Level < 4 && TransformationSpell.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) { return(true); } if (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) { return(true); } return(false); }
private static bool CheckTransform(Mobile m, Type type) { return(TransformationSpell.UnderTransformation(m, type)); }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; object root = toSteal.RootParent; if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } #region Sigils else if (toSteal is Sigil) { PlayerState pl = PlayerState.Find(m_Thief); Faction faction = (pl == null ? null : pl.Faction); Sigil sig = (Sigil)toSteal; if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (root != null) // not on the ground { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (faction != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseGump.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell))) { m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed } else if (TransformationSpell.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (pl.IsLeaving) { m_Thief.SendLocalizedMessage(1005589); // You are currently quitting a faction and cannot steal the town sigil } else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction) { m_Thief.SendLocalizedMessage(1005590); // You cannot steal your own sigil } else if (sig.IsPurifying) { m_Thief.SendLocalizedMessage(1005592); // You cannot steal this sigil until it has been purified } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 80.0, 80.0)) { if (Sigil.ExistsOn(m_Thief)) { m_Thief.SendLocalizedMessage(1010258); // The sigil has gone back to its home location because you already have a sigil. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true)) { m_Thief.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full } else { if (sig.IsBeingCorrupted) { sig.GraceStart = DateTime.Now; // begin grace period } m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, call down now) if (sig.LastMonolith != null) { sig.LastMonolith.Sigil = null; } sig.LastStolen = DateTime.Now; return(sig); } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1005588); // You must join a faction to do that } } #endregion else if (toSteal.Parent == null || !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (Core.AOS && toSteal is Container) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendMessage("That is too heavy to steal."); } else { if (toSteal.Stackable && toSteal.Amount > 1) { int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); if (maxAmount < 1) { maxAmount = 1; } else if (maxAmount > toSteal.Amount) { maxAmount = toSteal.Amount; } int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal; } } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal.Dupe(amount); toSteal.Amount -= amount; } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return(stolen); }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; object root = toSteal.RootParent; if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } #region Sigils else if (toSteal is Sigil) { PlayerState pl = PlayerState.Find(m_Thief); Faction faction = (pl == null ? null : pl.Faction); Sigil sig = (Sigil)toSteal; if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (root != null) // not on the ground { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (faction != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseGump.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell))) { m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed } else if (TransformationSpell.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (pl.IsLeaving) { m_Thief.SendLocalizedMessage(1005589); // You are currently quitting a faction and cannot steal the town sigil } else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction) { m_Thief.SendLocalizedMessage(1005590); // You cannot steal your own sigil } else if (sig.IsPurifying) { m_Thief.SendLocalizedMessage(1005592); // You cannot steal this sigil until it has been purified } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 80.0, 80.0)) { if (Sigil.ExistsOn(m_Thief)) { m_Thief.SendLocalizedMessage(1010258); // The sigil has gone back to its home location because you already have a sigil. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true)) { m_Thief.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full } else { if (sig.IsBeingCorrupted) { sig.GraceStart = DateTime.Now; // begin grace period } m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, call down now) if (sig.LastMonolith != null) { sig.LastMonolith.Sigil = null; } sig.LastStolen = DateTime.Now; return(sig); } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1005588); // You must join a faction to do that } } #endregion //ARTEGORDONMOD // allow stealing of rares on the ground or in containers else if ((toSteal.Parent == null || !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } //ARTEGORDONMOD // allow stealing of containers else if (Core.AOS && toSteal is Container && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendMessage("That is too heavy to steal."); } else { if (toSteal.Stackable && toSteal.Amount > 1) { //ARTEGORDON // fix for zero-weight stackables int maxAmount = toSteal.Amount; if (toSteal.Weight > 0) { maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); } if (maxAmount < 1) { maxAmount = 1; } else if (maxAmount > toSteal.Amount) { maxAmount = toSteal.Amount; } int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal; } } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal.Dupe(amount); toSteal.Amount -= amount; } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; // ARTEGORDONMOD // Begin mod for ArtifactRarity difficulty scaling // add in an additional difficulty factor for objects with ArtifactRarity // with rarity=1 requiring a minimum of 100 stealing, and rarity 12 requiring a minimum of 118 // Note, this is completely independent of weight Type ptype; string value = BaseXmlSpawner.GetBasicPropertyValue(toSteal, "ArtifactRarity", out ptype); if (ptype == typeof(int) && value != null) { int rarity = 0; try{ rarity = int.Parse(value); } catch {} // rarity difficulty scaling if (rarity > 0) { iw = (int)Math.Ceiling(120 + rarity * 1.5); } } // End mod for ArtifactRarity difficulty scaling if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } if (stolen != null) { // ARTEGORDONMOD // Begin mod for stealable rares and other locked down items // set the taken flag to trigger release from any controlling spawner ItemFlags.SetTaken(stolen, true); // clear the stealable flag so that the item can only be stolen once if it is later locked down. ItemFlags.SetStealable(stolen, false); // release it if it was locked down stolen.Movable = true; // End mod for stealable rares and other locked down items m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return(stolen); }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; object root = toSteal.RootParent; StealableArtifactsSpawner.StealableInstance si = null; if (toSteal.Parent == null || !toSteal.Movable) { si = StealableArtifactsSpawner.GetStealableInstance(toSteal); } if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is Mobile && ((Mobile)root).IsPlayer && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).IsPlayer && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || (!toSteal.Stackable && !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } #region Sigils else if (toSteal is Sigil) { PlayerState pl = PlayerState.Find(m_Thief); Faction faction = (pl == null ? null : pl.Faction); Sigil sig = (Sigil)toSteal; if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (root != null) // not on the ground { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (faction != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseGump.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell))) { m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed } else if (TransformationSpell.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (Spells.Ninjitsu.AnimalForm.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1063222); // You cannot steal the sigil while mimicking an animal. } else if (pl.IsLeaving) { m_Thief.SendLocalizedMessage(1005589); // You are currently quitting a faction and cannot steal the town sigil } else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction) { m_Thief.SendLocalizedMessage(1005590); // You cannot steal your own sigil } else if (sig.IsPurifying) { m_Thief.SendLocalizedMessage(1005592); // You cannot steal this sigil until it has been purified } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 80.0, 80.0)) { if (Sigil.ExistsOn(m_Thief)) { m_Thief.SendLocalizedMessage(1010258); // The sigil has gone back to its home location because you already have a sigil. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true)) { m_Thief.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full } else { if (sig.IsBeingCorrupted) { sig.GraceStart = DateTime.Now; // begin grace period } m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, calm down now) if (sig.LastMonolith != null) { sig.LastMonolith.Sigil = null; } sig.LastStolen = DateTime.Now; sig.OnStolen(m_Thief); return(sig); } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1005588); // You must join a faction to do that } } #endregion else if (si == null && (toSteal.Parent == null || !toSteal.Movable)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (toSteal.LootType == LootType.Newbied || (toSteal.CheckBlessed(root) && !(root is FillableContainer))) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (si == null && toSteal is Container) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0) { m_Thief.SendLocalizedMessage(1060025, "", 0x66D); // You're not skilled enough to attempt the theft of this item. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is BaseCreature && ((BaseCreature)root).ControlMaster == null && ((BaseCreature)root).StolenFrom) { m_Thief.SendLocalizedMessage(1094948); // That creature has already been stolen from. There is nothing left to steal. } else if (root is BaseCreature && SpecialDropChance(m_Thief, (BaseCreature)root) > Utility.RandomDouble()) { try { stolen = (Item)Activator.CreateInstance(m_SpecialDrops[Utility.Random(m_SpecialDrops.Length)]); } catch { } if (stolen != null) { m_Thief.SendLocalizedMessage(1094947); // You successfully steal a special item from the creature! ((BaseCreature)root).StolenFrom = true; } } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendMessage("That is too heavy to steal."); } else { if (toSteal.Stackable && toSteal.Amount > 1) { int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); Utility.FixMinMax(ref maxAmount, 1, toSteal.Amount); int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { if (!m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } else { stolen = toSteal; } } } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) { stolen = toSteal; } if (!m_Thief.Backpack.CheckHold(m_Thief, stolen, false, true)) { stolen.Delete(); stolen = null; m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. if (si != null) { toSteal.Movable = true; si.Item = null; } if (root is BaseCreature) { ((BaseCreature)root).StolenFrom = true; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return(stolen); }
public void Target(BaseTalisman talis, Mobile owner, Mobile m) { if (this.Parent == owner) { //Curse Removal if (talis.m_TalismanType == TalismanType.CurseRemoval) { m.PlaySound(0xF6); m.PlaySound(0x1F7); m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head); StatMod mod; mod = m.GetStatMod("[Magic] Str Malus"); if (mod != null && mod.Offset < 0) { m.RemoveStatMod("[Magic] Str Malus"); } mod = m.GetStatMod("[Magic] Dex Malus"); if (mod != null && mod.Offset < 0) { m.RemoveStatMod("[Magic] Dex Malus"); } mod = m.GetStatMod("[Magic] Int Malus"); if (mod != null && mod.Offset < 0) { m.RemoveStatMod("[Magic] Int Malus"); } m.Paralyzed = false; EvilOmenSpell.CheckEffect(m); StrangleSpell.RemoveCurse(m); CorpseSkinSpell.RemoveCurse(m); CurseSpell.RemoveEffect(m); BuffInfo.RemoveBuff(m, BuffIcon.Clumsy); BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind); BuffInfo.RemoveBuff(m, BuffIcon.Weaken); BuffInfo.RemoveBuff(m, BuffIcon.MassCurse); BuffInfo.RemoveBuff(m, BuffIcon.Curse); BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen); StrangleSpell.RemoveCurse(m); CorpseSkinSpell.RemoveCurse(m); if (owner != m) { owner.SendLocalizedMessage(1072409); // Your targets curses have been lifted } m.SendLocalizedMessage(1072408); // Any curses on you have been lifted } //Damage Removal if (talis.m_TalismanType == TalismanType.DamageRemoval) { Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 8); Effects.PlaySound(m, m.Map, 0x201); BleedAttack.EndBleed(m, false); MortalStrike.EndWound(m); m.CurePoison(m); BuffInfo.RemoveBuff(m, BuffIcon.Bleed); BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike); if (owner != m) { owner.SendLocalizedMessage(1072406); // Your Targets lasting damage effects have been removed! } m.SendLocalizedMessage(1072405); // Your lasting damage effects have been removed! } //Ward Removal if (talis.m_TalismanType == TalismanType.WardRemoval) { Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 8); Effects.PlaySound(m, m.Map, 0x201); ProtectionSpell.RemoveWard(m); ReactiveArmorSpell.RemoveWard(m); MagicReflectSpell.RemoveWard(m); TransformationSpell.RemoveContext(m, true); ReaperFormSpell.RemoveEffects(m); if (StoneFormSpell.UnderEffect(m)) { StoneFormSpell.RemoveEffects(m); } if (owner != m) { owner.SendLocalizedMessage(1072403); // Your target's wards have been removed! } m.SendLocalizedMessage(1072402); // Your wards have been removed! } //Wildfire Removal if (talis.m_TalismanType == TalismanType.WildfireRemoval) { owner.SendLocalizedMessage(1042753, "Wildfire Removal"); // ~1_SOMETHING~ has been temporarily disabled. } //CARGE TIMER ChargeTimeLeft = 1200; m_ChargeTimer = new ChargeTimeLeftTimer(this); m_ChargeTimer.Start(); m_ChargeTimeLeft3 = DateTime.Now; } else if (m_TalismanType != 0) { m.SendLocalizedMessage(502641); // You must equip this item to use it. } }
public override void OnCast() { if (CheckSequence()) { ArrayList targets = new ArrayList(); foreach (Mobile m in Caster.GetMobilesInRange(8)) { if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { targets.Add(m); } } Caster.PlaySound(0x299); Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head); int dispelSkill = ComputePowerValue(2); double chiv = Caster.Skills.Chivalry.Value; for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; BaseCreature bc = m as BaseCreature; if (bc != null) { bool dispellable = bc.Summoned && !bc.IsAnimatedDead; if (dispellable) { double dispelChance = (50.0 + ((100 * (chiv - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100; dispelChance *= dispelSkill / 100.0; if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); m.Delete(); continue; } } bool evil = !bc.Controled && bc.Karma < 0; if (evil) { // TODO: Is this right? double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill; fleeChance /= 1000000; if (fleeChance > Utility.RandomDouble()) { // guide says 2 seconds, it's longer bc.BeginFlee(TimeSpan.FromSeconds(30.0)); } } } if (TransformationSpell.GetContext(m) != null) { // transformed .. double drainChance = 0.5 * (Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1)); if (drainChance > Utility.RandomDouble()) { int drain = (5 * dispelSkill) / 100; m.Stam -= drain; m.Mana -= drain; } } } } FinishSequence(); }