protected override void OnTarget(Mobile from, object o) { if (o is Mobile) { Mobile m = (Mobile)o; BaseCreature bc = m as BaseCreature; if (!from.CanSee(m)) { from.SendLocalizedMessage(500237); // Target can not be seen. } else if (TransformationSpellHelper.UnderTransformation(m)) { double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Necromancy.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); from.DoHarmful(m); TransformationSpellHelper.RemoveContext(m, true); } else { m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! from.DoHarmful(m); } } else if (!m.CanBeginAction(typeof(PolymorphSpell))) { double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Magery.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); //TransformationSpellHelper.RemoveContext(m, true); PolymorphSpell.EndPolymorph(m); from.DoHarmful(m); } else { m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (AnimalForm.UnderTransformation(m)) { double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Ninjitsu.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); AnimalForm.RemoveContext(m, true); from.DoHarmful(m); } else { from.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (TransformationSpellHelper.GetContext(m) != null) { double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Spellweaving.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { from.DoHarmful(m); Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); TransformationSpellHelper.RemoveContext(m, true); } else { from.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (bc == null || !bc.IsDispellable) { from.SendLocalizedMessage(1005049); // That cannot be dispelled. } else if (m_Owner.CheckHSequence(m)) { SpellHelper.Turn(from, m); double dispelChance = (50.0 + ((100 * (from.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100; 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(); } else { m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } } }
public bool CanDispel(Mobile m) { return((TransformationSpellHelper.GetContext(m) != null) || !m.CanBeginAction(typeof(PolymorphSpell)) || AnimalForm.UnderTransformation(m) || TransformationSpellHelper.UnderTransformation(m) || (m is BaseCreature && ((BaseCreature)m).Summoned && m_Mobile.CanBeHarmful(m, false) && !((BaseCreature)m).IsAnimatedDead)); }
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.SendAsciiMessage("Both hands must be free to steal."); // 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.SendAsciiMessage("You must be in the thieves guild to steal from other players."); // 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.SendAsciiMessage("You are currently suspended from the thieves guild."); // You are currently suspended from the thieves guild. } /*else if ( root is BaseVendor && ((BaseVendor)root).IsInvulnerable ) * { * m_Thief.SendAsciiMessage("You can't steal from shopkeepers."); // You can't steal from shopkeepers. * }*/ else if (root is PlayerVendor) { m_Thief.SendAsciiMessage("You can't steal from vendors."); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendAsciiMessage("Target can not be seen."); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendAsciiMessage("Your backpack can't hold anything else."); // 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 (DisguiseTimers.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 (TransformationSpellHelper.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (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; 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.SendAsciiMessage("You can't steal that!"); // You can't steal that! } else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) { m_Thief.SendAsciiMessage("You can't steal that!"); // You can't steal that! } else if (Core.AOS && si == null && toSteal is Container) { m_Thief.SendAsciiMessage("You can't steal that!"); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendAsciiMessage("You must be standing next to an item to steal it."); // 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.SendAsciiMessage(1060025, "", 0x66D); // You're not skilled enough to attempt the theft of this item. * }*/ else if (toSteal.Parent is Mobile && !(toSteal.Parent is Santa)) { m_Thief.SendAsciiMessage("You cannot steal items which are equiped."); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendAsciiMessage("You catch yourself red-handed."); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player) { m_Thief.SendAsciiMessage("You can't steal that!"); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { } else if (root is Corpse) { m_Thief.SendAsciiMessage("You can't steal that!"); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendAsciiMessage("This item is too heavy to steal from someone's backpack."); } 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 = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) { stolen = toSteal; } } } } 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.SendAsciiMessage("You succesfully steal the item."); // You succesfully steal the item. if (si != null) { toSteal.Movable = true; si.Item = null; } } else { m_Thief.SendAsciiMessage("You fail to steal the item."); // You fail to steal the item. } caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return(stolen); }
public static bool AniSafe(Mobile m) { return(m != null && !TransformationSpellHelper.UnderTransformation(m) && m.BodyMod == 0 && m.Alive); }
private static bool CheckTransform(Mobile m, Type type) { return(TransformationSpellHelper.UnderTransformation(m, type)); }
public static void WipeMods(Mobile m) { PlayerMobile pm = m as PlayerMobile; m.DisruptiveAction(); foreach (StatType Stat in Enum.GetValues(typeof(StatType))) { string name = String.Format("[Magic] {0} Offset", Stat); if (m.GetStatMod(name) != null) { m.RemoveStatMod(name); } } if (TransformationSpellHelper.UnderTransformation(m)) { TransformationSpellHelper.RemoveContext(m, true); } m.HueMod = -1; m.NameMod = null; PolymorphSpell.StopTimer(m); IncognitoSpell.StopTimer(m); DisguiseGump.StopTimer(m); foreach (Type T in DispelActions) { m.EndAction(T); } m.BodyMod = 0; m.HueMod = -1; if (pm != null) { if (pm.BuffTable != null) { List <BuffInfo> list = new List <BuffInfo>(); foreach (BuffInfo buff in pm.BuffTable.Values) { if (!buff.RetainThroughDeath) { list.Add(buff); } } for (int i = 0; i < list.Count; i++) { pm.RemoveBuff(list[i]); } } pm.SavagePaintExpiration = TimeSpan.Zero; pm.SetHairMods(-1, -1); pm.ResendBuffs(); } m.VirtualArmorMod = 0; BaseArmor.ValidateMobile(m); BaseClothing.ValidateMobile(m); }
public static int MobileNotoriety(Mobile source, Mobile target) { if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; Mobile master = bc.GetMaster(); if (master != null && master.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } if (target.Kills >= 5 || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is ArcaneFey) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (sourceGuild != null && targetGuild != null) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !TransformationSpellHelper.UnderTransformation(target) && !AnimalForm.UnderTransformation(target)) { return(Notoriety.CanBeAttacked); } } if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } } if (source is BaseCreature) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); if (master != null && CheckAggressor(master.Aggressors, target)) { return(Notoriety.CanBeAttacked); } } return(Notoriety.Innocent); }
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 = toSteal is AddonComponent?StealableArtifactsSpawner.GetStealableInstance(((AddonComponent)toSteal).Addon) : 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).Player && !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. } else if (toSteal is VvVSigil && ViceVsVirtueSystem.Instance != null) { VvVPlayerEntry entry = ViceVsVirtueSystem.Instance.GetPlayerEntry <VvVPlayerEntry>(m_Thief); VvVSigil sig = (VvVSigil)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 (entry != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseTimers.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 (TransformationSpellHelper.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (AnimalForm.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1063222); // You cannot steal the sigil while mimicking an animal. } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 100.0, 120.0)) { 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 { m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, calm down now) sig.OnStolen(entry); return(sig); } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1155415); // Only participants in Vice vs Virtue may use this item. } } else if (si == null && (toSteal.Parent == null || !toSteal.Movable) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (si == null && 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 (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).IsStaff()) { 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 = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) { stolen = toSteal; } } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } // Non-movable stealable (not in fillable container) items cannot result in the stealer getting caught if (stolen != null && (root is FillableContainer || stolen.Movable)) { double skillValue = m_Thief.Skills[SkillName.Stealing].Value; if (root is FillableContainer) { caught = (Utility.Random((int)(skillValue / 2.5)) == 0); // 1 of 48 chance at 120 } else { caught = (skillValue < Utility.Random(150)); } } else { caught = false; } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. ItemFlags.SetTaken(stolen, true); ItemFlags.SetStealable(stolen, false); stolen.Movable = true; InvokeItemStoken(new ItemStolenEventArgs(stolen, m_Thief)); if (si != null) { toSteal.Movable = true; si.Item = null; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } } } return(stolen); }
public override void OnCast() { if (SphereSpellTarget is BaseWand) { BaseWand bw = SphereSpellTarget as BaseWand; bw.RechargeWand(Caster, this); } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form. } else if (DisguiseTimers.IsDisguised(Caster)) { Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. } else if (Caster.BodyMod == 183 || Caster.BodyMod == 184) { Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint } /* * else if ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) ) * { * DoFizzle(); * }*/ else if (CheckSequence()) { StopTimer(Caster); //Reset polymorph spell if (Caster.BeginAction(typeof(PolymorphSpell))) { if (m_PolymorphEntry.BodyID != 0) { if (!((Body)m_PolymorphEntry.BodyID).IsHuman) { IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } if (m_PolymorphEntry.BodyID == 0x3B) //Dragon, two different body IDs { Caster.BodyMod = Utility.RandomList(0x3B, 0xC); } else { Caster.BodyMod = m_PolymorphEntry.BodyID; } Caster.PlaySound(Sound); StopTimer(Caster); Timer t = new InternalTimer(Caster, m_PolymorphEntry); m_Timers.Add(Caster, t); t.Start(); BaseArmor.ValidateMobile(Caster); BaseWeapon.ValidateMobile(Caster); if (Caster.NameMod != null) //Caster has incognito, need to update name { Caster.NameMod = IncognitoSpell.GetNameMod(Caster.BodyValue); } } } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } FinishSequence(); }
public override void OnCast() { if (!Caster.CanBeginAction(typeof(PolymorphSpell))) { Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed. } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1063219); // You cannot mimic an animal while in that form. } else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || (Caster.IsBodyMod && AnimalForm.GetContext(Caster) == null)) { DoFizzle(); } else if (CheckSequence()) { AnimalFormContext context = AnimalForm.GetContext(Caster); int mana = ScaleMana(RequiredMana); AnimalForm.AddLastAnimalForm(Caster, 16); if (mana > Caster.Mana) { Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability. } else if (context != null) { AnimalForm.RemoveContext(Caster, context, true); Caster.Mana -= mana; BuffInfo.RemoveBuff(Caster, BuffIcon.WhiteTigerForm); FinishSequence(); return; } else { double ninjitsu = Caster.Skills.Ninjitsu.Value; if (ninjitsu < RequiredSkill + 37.5) { double chance = (ninjitsu - RequiredSkill) / 37.5; if (chance < Utility.RandomDouble()) { DoFizzle(); FinishSequence(); return; } } } Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist); Caster.Mana -= mana; Caster.CheckSkill(SkillName.Ninjitsu, 0.0, 90.0); BaseMount.Dismount(Caster); int bodyMod = Caster.Female ? 1255 : 1254; int hueMod = 2500; Caster.BodyMod = bodyMod; Caster.HueMod = hueMod; Caster.SendSpeedControl(SpeedControlType.MountSpeed); Timer timer = new AnimalFormTimer(Caster, bodyMod, hueMod); timer.Start(); int skills = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value + (GetMasteryLevel() * 40)) / 3); AnimalForm.AddContext(Caster, new AnimalFormContext(timer, null, true, typeof(WildWhiteTiger), null)); Caster.CheckStatTimers(); int bleedMod = (int)(((Caster.Skills[SkillName.Ninjitsu].Value + Caster.Skills[SkillName.Stealth].Value + (GetMasteryLevel() * 40)) / 3) / 10); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.WhiteTigerForm, 1155911, 1156060, String.Format("{0}\t{1}\t{2}\t{3}", "20", "5", "", bleedMod.ToString()))); // +~1_ARG~ Defense Chance Increase.<br>+~2_ARG~ Max Defense Chance Increase Cap.<br> Chance to evade attacks.<br>Applies bleed to victim with a max damage of ~4_ARG~. Caster.Delta(MobileDelta.WeaponDamage); } FinishSequence(); }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (m.Alive && !m.IsDeadBondedPet && m.AccessLevel == AccessLevel.Player && !m.Hidden && !TransformationSpellHelper.UnderTransformation(m, typeof(EtherealVoyageSpell))) { if (0.2 > Utility.RandomDouble() && !m_TangleCooldown.Contains(m) && InRange(m, 6) && !FountainOfFortune.UnderProtection(m)) { m.Frozen = true; m.MoveToWorld(Location, Map); m.PlaySound(0x1FE); m.SendLocalizedMessage(1111641); // You become entangled in the acid drenched roots. m_TangleCooldown.Add(m); Timer.DelayCall(TimeSpan.FromSeconds(Utility.RandomMinMax(3, 6)), new TimerStateCallback <Mobile>(Untangle), m); Timer.DelayCall(TimeSpan.FromSeconds(15.0), new TimerStateCallback <Mobile>(RemoveCooldown), m); } if (m.InRange(this, 1) && !m_DamageTable.ContainsKey(m)) { // Should start the timer m_DamageTable[m] = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.0), new TimerStateCallback <Mobile>(DoDamage), m); } } }
public override void OnCast() { if (Caster.Flying) { Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying. } else if (!Caster.CanBeginAction(typeof(PolymorphSpell))) { EndPolymorph(Caster); } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form. } else if (DisguiseTimers.IsDisguised(Caster)) { Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. } else if (Caster.BodyMod == 183 || Caster.BodyMod == 184) { Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint } else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(PolymorphSpell))) { if (m_NewBody != 0) { if (!((Body)m_NewBody).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } Caster.BodyMod = m_NewBody; if (m_NewBody == 400 || m_NewBody == 401) { Caster.HueMod = Utility.RandomSkinHue(); } else { Caster.HueMod = 0; } BaseArmor.ValidateMobile(Caster); BaseClothing.ValidateMobile(Caster); } } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } FinishSequence(); }
public override void OnCast() { if (KinPaint.IsWearingKinPaint(Caster)) { Caster.SendMessage("You cannot polymorph while wearing kin paint"); } else if (!Caster.CanBeginAction(typeof(PolymorphSpell))) { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form. } else if (DisguiseTimers.IsDisguised(Caster)) { Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. } else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(PolymorphSpell))) { if (m_NewBody != 0) { if (!((Body)m_NewBody).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } Caster.BodyMod = m_NewBody; if (m_NewBody == 400 || m_NewBody == 401) { Caster.HueMod = Utility.RandomSkinHue(); } else { Caster.HueMod = 0; } BaseArmor.ValidateMobile(Caster); StopTimer(Caster); Timer t = new InternalTimer(Caster); m_Timers[Caster] = t; t.Start(); } } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } FinishSequence(); }
public static int MobileNotoriety(Mobile source, Mobile target) { if (Core.AOS && (target.Blessed || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } if (source is BaseGuard && !(target is BaseGuard)) { return(Notoriety.CanBeAttacked); } #region Dueling if (source is PlayerMobile && target is PlayerMobile) { PlayerMobile pmFrom = (PlayerMobile)source; PlayerMobile pmTarg = (PlayerMobile)target; // only check this if one of them hasn't been eliminated if ((pmFrom.DuelPlayer != null && !pmFrom.DuelPlayer.Eliminated) || (pmTarg.DuelPlayer != null && !pmTarg.DuelPlayer.Eliminated)) { if (pmFrom.DuelContext != null && pmFrom.DuelContext.StartedBeginCountdown && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext) { return(pmFrom.DuelContext.IsAlly(pmFrom, pmTarg) ? Notoriety.Ally : Notoriety.Enemy); } } } #endregion if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } if (target.Kills >= 5 || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (sourceGuild != null && targetGuild != null) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !TransformationSpellHelper.UnderTransformation(target) && !AnimalForm.UnderTransformation(target)) { return(Notoriety.CanBeAttacked); } } if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } // make all vendors on buc's be red if (target is BaseVendor) { if ((bc.Home == Point3D.Zero && target.Region.Name == "Buccaneer's Den") || Region.Find(((BaseVendor)target).Home, target.Map).Name == "Buccaneer's Den") { return(Notoriety.Murderer); } } } if (source is BaseCreature) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); if (master != null && CheckAggressor(master.Aggressors, target)) { return(Notoriety.CanBeAttacked); } } return(Notoriety.Innocent); }
protected override void OnTick() { #region Mondain's Legacy if ((Core.AOS && this.m_Poison.RealLevel < 4 && TransformationSpellHelper.UnderTransformation(this.m_Mobile, typeof(VampiricEmbraceSpell))) || (this.m_Poison.RealLevel < 3 && OrangePetals.UnderEffect(this.m_Mobile)) || AnimalForm.UnderTransformation(this.m_Mobile, typeof(Unicorn))) { if (this.m_Mobile.CurePoison(this.m_Mobile)) { this.m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true, "* You feel yourself resisting the effects of the poison *"); this.m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true, String.Format("* {0} seems resistant to the poison *", this.m_Mobile.Name)); this.Stop(); return; } } #endregion if (this.m_Index++ == this.m_Poison.m_Count) { this.m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off. this.m_Mobile.Poison = null; this.Stop(); return; } int damage; if (!Core.AOS && this.m_LastDamage != 0 && Utility.RandomBool()) { damage = this.m_LastDamage; } else { damage = 1 + (int)(this.m_Mobile.Hits * this.m_Poison.m_Scalar); if (damage < this.m_Poison.m_Minimum) { damage = this.m_Poison.m_Minimum; } else if (damage > this.m_Poison.m_Maximum) { damage = this.m_Poison.m_Maximum; } this.m_LastDamage = damage; } if (this.m_From != null) { this.m_From.DoHarmful(this.m_Mobile, true); } IHonorTarget honorTarget = this.m_Mobile as IHonorTarget; if (honorTarget != null && honorTarget.ReceivedHonorContext != null) { honorTarget.ReceivedHonorContext.OnTargetPoisoned(); } #region Mondain's Legacy if (Core.ML) { if (this.m_From != null && this.m_Mobile != this.m_From && !this.m_From.InRange(this.m_Mobile.Location, 1) && this.m_Poison.m_Level >= 10 && this.m_Poison.m_Level <= 13) // darkglow { this.m_From.SendLocalizedMessage(1072850); // Darkglow poison increases your damage! damage = (int)Math.Floor(damage * 1.1); } if (this.m_From != null && this.m_Mobile != this.m_From && this.m_From.InRange(this.m_Mobile.Location, 1) && this.m_Poison.m_Level >= 14 && this.m_Poison.m_Level <= 18) // parasitic { int toHeal = Math.Min(this.m_From.HitsMax - this.m_From.Hits, damage); if (toHeal > 0) { this.m_From.SendLocalizedMessage(1060203, toHeal.ToString()); // You have had ~1_HEALED_AMOUNT~ hit points of damage healed. this.m_From.Heal(toHeal, this.m_Mobile, false); } } } #endregion AOS.Damage(this.m_Mobile, this.m_From, damage, 0, 0, 0, 100, 0); if (0.60 <= Utility.RandomDouble()) // OSI: randomly revealed between first and third damage tick, guessing 60% chance { this.m_Mobile.RevealingAction(); } if ((this.m_Index % this.m_Poison.m_MessageInterval) == 0) { this.m_Mobile.OnPoisoned(this.m_From, this.m_Poison, this.m_Poison); } }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8); foreach (Mobile m in eable) { if ((m is BaseCreature) && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful(m, false) || TransformationSpellHelper.UnderTransformation(m) || !m.CanBeginAction(typeof(PolymorphSpell)) || AnimalForm.UnderTransformation(Caster) || (TransformationSpellHelper.GetContext(m) != null)) { targets.Add(m); } } eable.Free(); } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; BaseCreature bc = m as BaseCreature; if (TransformationSpellHelper.UnderTransformation(m)) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Necromancy.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); Caster.DoHarmful(m); TransformationSpellHelper.RemoveContext(m, true); } else { m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! Caster.DoHarmful(m); } } else if (!m.CanBeginAction(typeof(PolymorphSpell))) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Magery.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); PolymorphSpell.EndPolymorph(m); //TransformationSpellHelper.RemoveContext(m, true); Caster.DoHarmful(m); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (AnimalForm.UnderTransformation(Caster)) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Ninjitsu.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); AnimalForm.RemoveContext(m, true); Caster.DoHarmful(m); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (TransformationSpellHelper.GetContext(m) != null) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Spellweaving.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Caster.DoHarmful(m); Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); TransformationSpellHelper.RemoveContext(m, true); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else { if (bc == null) { continue; } double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100; 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(); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); } } } } FinishSequence(); }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is Mobile) { if (targeted is BaseCreature) { BaseCreature creature = (BaseCreature)targeted; if (!creature.Tamable) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState); // That creature cannot be tamed. } else if (creature.Controlled) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState); // That animal looks tame already. } else if (from.Female && !creature.AllowFemaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState); // That creature can only be tamed by males. } else if (!from.Female && !creature.AllowMaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState); // That creature can only be tamed by females. } else if (creature is CuSidhe && from.Race != Race.Elf) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502801, from.NetState); // You can't tame that! } else if (from.Followers + creature.ControlSlots > from.FollowersMax) { from.SendLocalizedMessage(1049611); // You have too many followers to tame that creature. } else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState); // This animal has had too many owners and is too upset for you to tame. } else if (MustBeSubdued(creature)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState); // You must subdue this creature before you can tame it! } else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.CurrentTameSkill) { FactionWarHorse warHorse = creature as FactionWarHorse; if (warHorse != null) { Faction faction = Faction.Find(from); if (faction == null || faction != warHorse.Faction) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042590, from.NetState); // You cannot tame this creature. return; } } if (m_BeingTamed.Contains(targeted)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState); // Someone else is already taming this. } else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble()) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState); // You seem to anger the beast! creature.PlaySound(creature.GetAngerSound()); creature.Direction = creature.GetDirectionTo(from); if (!Core.SA) { if (creature.BardPacified && Utility.RandomDouble() > .24) { Timer.DelayCall(TimeSpan.FromSeconds(2.0), () => creature.BardPacified = true); } else { creature.BardEndTime = DateTime.UtcNow; } creature.BardPacified = false; } if (creature.AIObject != null) { creature.AIObject.DoMove(creature.Direction); } if (from is PlayerMobile && !(((PlayerMobile)from).HonorActive || TransformationSpellHelper.UnderTransformation(from, typeof(EtherealVoyageSpell)))) { creature.Combatant = from; } } else { m_SetSkillTime = false; m_BeingTamed[targeted] = from; from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597); // You start to tame the creature. from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598); // *begins taming a creature.* new InternalTimer(from, creature, Utility.Random(3, 2)).Start(); } } else { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState); // You have no chance of taming this creature. } } else { ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState); // That being cannot be tamed. } } else { from.SendLocalizedMessage(502801); // You can't tame that! } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is Mobile) { if (targeted is BaseCreature) { BaseCreature creature = (BaseCreature)targeted; if (!creature.Tamable) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cette créature ne peut être apprivoisée", from.NetState); // That creature cannot be tamed. } else if (creature.Controlled) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a déjà un maître", from.NetState); // That animal looks tame already. } else if (from.Female && !creature.AllowFemaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Seul un homme peut approcher cette créature", from.NetState); // That creature can only be tamed by males. } else if (!from.Female && !creature.AllowMaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Seule une femme peut approcher cette créature", from.NetState); // That creature can only be tamed by females. } else if (creature is CuSidhe && from.Race != Race.Elf) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous ne pouvez apprivoiser cela!", from.NetState); // You can't tame that! } else if (from.Followers + creature.ControlSlots > from.FollowersMax) { from.SendMessage("Vous avez trop d'animaux domestiques pour en apprivoiser un nouveau"); // You have too many followers to tame that creature. } else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a eu suffisamment de maître dans le passé et souhaite qu'on le laisse tranquille", from.NetState); // This animal has had too many owners and is too upset for you to tame. } else if (MustBeSubdued(creature)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous devez assujetir cette créature avant de l'apprivoiser", from.NetState); // You must subdue this creature before you can tame it! } else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill) { FactionWarHorse warHorse = creature as FactionWarHorse; if (warHorse != null) { Faction faction = Faction.Find(from); if (faction == null || faction != warHorse.Faction) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous ne pouvez apprivoiser cette créature", from.NetState); // You cannot tame this creature. return; } } if (m_BeingTamed.Contains(targeted)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Quelqu'un tente déjà de l'apprivoiser", from.NetState); // Someone else is already taming this. } else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble()) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous irritez la créature!", from.NetState); // You seem to anger the beast! creature.PlaySound(creature.GetAngerSound()); creature.Direction = creature.GetDirectionTo(from); if (creature.BardPacified && Utility.RandomDouble() > .24) { Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ResetPacify), creature); } else { creature.BardEndTime = DateTime.Now; } creature.BardPacified = false; if (creature.AIObject != null) { creature.AIObject.DoMove(creature.Direction); } if (from is PlayerMobile && !(((PlayerMobile)from).HonorActive || TransformationSpellHelper.UnderTransformation(from, typeof(EtherealVoyageSpell)))) { creature.Combatant = from; } } else { m_BeingTamed[targeted] = from; from.LocalOverheadMessage(MessageType.Emote, 0x59, false, "Vous tentez d'apprivoiser la créature"); // You start to tame the creature. from.NonlocalOverheadMessage(MessageType.Emote, 0x59, false, "*tente d'apprivoiser une créature*"); // *begins taming a creature.* new InternalTimer(from, creature, Utility.Random(3, 2)).Start(); m_SetSkillTime = false; } } else { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous n'avez aucune chance d'apprivoiser cette créature", from.NetState); // You have no chance of taming this creature. } } else { ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cela ne peut être apprivoisé", from.NetState); // That being cannot be tamed. } } else { from.SendMessage("Vous ne pouvez apprivoiser cela!"); // You can't tame that! } }
protected override void OnTick() { if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) || (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) || AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn))) { 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; } if (m_From != null) { m_From.DoHarmful(m_Mobile, true); } IHonorTarget honorTarget = m_Mobile as IHonorTarget; if (honorTarget != null && honorTarget.ReceivedHonorContext != null) { honorTarget.ReceivedHonorContext.OnTargetPoisoned(); } // Genova: suporte ao UO:ML. #region Mondain's Legacy if (m_Mobile != m_From && m_From.InRange(m_Mobile.Location, 1) && Utility.InsensitiveCompare(m_Poison.Name, "Parasitic") == 0) { m_From.Heal((int)(damage * 0.4)); // TODO check } #endregion AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0); if ((m_Index % m_Poison.m_MessageInterval) == 0) { m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison); } }
protected override void OnTick() { bool usingPetals = OrangePetals.UnderEffect(m_Mobile); if (Core.SA && usingPetals && m_Poison.RealLevel >= 3 && 0.25 > Utility.RandomDouble()) { OrangePetals.RemoveContext(m_Mobile); usingPetals = false; m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x3F, 1053093); // * The strength of the poison overcomes your resistance! * } if ((Core.AOS && m_Poison.RealLevel < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) || (m_Poison.RealLevel <= 3 && usingPetals) || AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn))) { if (m_Mobile.CurePoison(m_Mobile)) { m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, 1053092); // * You feel yourself resisting the effects of the poison * m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, 1114442, m_Mobile.Name); // * ~1_NAME~ seems resistant to the poison * Stop(); return; } } if (m_Index++ == m_Poison.m_Count) { m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off. m_Mobile.Poison = null; if (m_Mobile is PlayerMobile) { BuffInfo.RemoveBuff((PlayerMobile)m_Mobile, BuffIcon.Poison); } 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; } if (m_From != null) { if (m_From is BaseCreature && ((BaseCreature)m_From).RecentSetControl && ((BaseCreature)m_From).GetMaster() == m_Mobile) { m_From = null; } else { m_From.DoHarmful(m_Mobile, true); } } IHonorTarget honorTarget = m_Mobile as IHonorTarget; if (honorTarget != null && honorTarget.ReceivedHonorContext != null) { honorTarget.ReceivedHonorContext.OnTargetPoisoned(); } #region Mondain's Legacy if (Core.ML) { if (m_From != null && m_Mobile != m_From && !m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 10 && m_Poison.m_Level <= 13) // darkglow { m_From.SendLocalizedMessage(1072850); // Darkglow poison increases your damage! damage = (int)Math.Floor(damage * 1.1); } if (m_From != null && m_Mobile != m_From && m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 14 && m_Poison.m_Level <= 18) // parasitic { int toHeal = Math.Min(m_From.HitsMax - m_From.Hits, damage); if (toHeal > 0) { m_From.SendLocalizedMessage(1060203, toHeal.ToString()); // You have had ~1_HEALED_AMOUNT~ hit points of damage healed. m_From.Heal(toHeal, m_Mobile, false); } } } #endregion AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0); if ((m_Index % m_Poison.m_MessageInterval) == 0) { m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison); } }
protected override void OnTarget(object o) { if (o is IDamageable m) { if (CheckHSequence(m)) { IDamageable target = m; IDamageable source = Caster; SpellHelper.Turn(Caster, target); if (SpellHelper.CheckReflect(this, ref source, ref target)) { Server.Timer.DelayCall(TimeSpan.FromSeconds(.5), () => { source.MovingParticles(target, 0x9BB5, 7, 0, false, true, 9502, 4019, 0x160); source.PlaySound(0x5CE); }); } double skill = (Caster.Skills[CastSkill].Value + GetWeaponSkill() + (GetMasteryLevel() * 40)) / 3; double damage = skill + (double)Caster.Karma / 1000; damage += Utility.RandomMinMax(0, 5); if (m is BaseCreature bc && IsUndead(bc)) { damage *= 1.5; } else if (m is PlayerMobile) { damage = Math.Min(35, damage); } Caster.MovingParticles(m, 0x9BB5, 7, 0, false, true, 9502, 4019, 0x160); Caster.PlaySound(0x5CE); if (m is Mobile mobile) { damage *= GetDamageScalar(mobile); } int sdiBonus = SpellHelper.GetSpellDamageBonus(Caster, m, CastSkill, m is Mobile pm && Caster.Player && pm.Player); damage *= (100 + sdiBonus); damage /= 100; SpellHelper.Damage(this, target, damage, 0, 0, 0, 0, 100); if (target is Mobile mob && !CheckResisted(mob) && mob.NetState != null) { if (!TransformationSpellHelper.UnderTransformation(mob, typeof(AnimalForm))) { mob.SendSpeedControl(SpeedControlType.WalkSpeed); } Server.Timer.DelayCall(TimeSpan.FromSeconds(skill / 60), () => { if (!TransformationSpellHelper.UnderTransformation(mob, typeof(AnimalForm))) { mob.SendSpeedControl(SpeedControlType.Disable); } }); } } }
public bool Cast() { m_StartCastTime = Core.TickCount; if (Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing) { ((Spell)m_Caster.Spell).Disturb(DisturbType.NewCast); } if (!m_Caster.CheckAlive()) { return(false); } else if (m_Scroll is BaseWand && m_Caster.Spell != null && m_Caster.Spell.IsCasting) { m_Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen. } else if (m_Caster.Spell != null && m_Caster.Spell.IsCasting) { m_Caster.SendLocalizedMessage(502642); // You are already casting a spell. } else if (BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)) || (BlockedByAnimalForm && AnimalForm.UnderTransformation(m_Caster))) { m_Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form. } else if (!(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen)) { m_Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen. } else if (CheckNextSpellTime && Core.TickCount - m_Caster.NextSpellTime < 0) { m_Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell. } else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. } #region Dueling else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast(m_Caster, this)) { } #endregion else if (m_Caster.Mana >= ScaleMana(GetMana())) { if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this)) { m_State = SpellState.Casting; m_Caster.Spell = this; if (!(m_Scroll is BaseWand) && RevealOnCast) { m_Caster.RevealingAction(); } SayMantra(); TimeSpan castDelay = this.GetCastDelay(); if (ShowHandMovement && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster))) { int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds); if (count != 0) { m_AnimTimer = new AnimTimer(this, count); m_AnimTimer.Start(); } if (m_Info.LeftHandEffect > 0) { Caster.FixedParticles(0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand); } if (m_Info.RightHandEffect > 0) { Caster.FixedParticles(0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand); } } if (ClearHandsOnCast) { m_Caster.ClearHands(); } if (Core.ML) { WeaponAbility.ClearCurrentAbility(m_Caster); } m_CastTimer = new CastTimer(this, castDelay); //m_CastTimer.Start(); OnBeginCast(); if (castDelay > TimeSpan.Zero) { m_CastTimer.Start(); } else { m_CastTimer.Tick(); } return(true); } else { return(false); } } else { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana } return(false); }
public override void OnCast() { /*if ( Caster.Mounted ) * { * Caster.SendLocalizedMessage( 1042561 ); //Please dismount first. * } * else */ if (Factions.Sigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil } else if (!Caster.CanBeginAction(typeof(PolymorphSpell))) { if (Core.ML) { EndPolymorph(Caster); } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form. } else if (DisguiseTimers.IsDisguised(Caster)) { Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. } else if (Caster.BodyMod == 183 || Caster.BodyMod == 184) { Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint } else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(PolymorphSpell))) { if (m_NewBody != 0) { if (!((Body)m_NewBody).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } Caster.BodyMod = m_NewBody; if (m_NewBody == 400 || m_NewBody == 401) { Caster.HueMod = Utility.RandomSkinHue(); } else { Caster.HueMod = 0; } BaseArmor.ValidateMobile(Caster); BaseClothing.ValidateMobile(Caster); if (!Core.ML) { StopTimer(Caster); Timer t = new InternalTimer(Caster); m_Timers[Caster] = t; t.Start(); } } } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } FinishSequence(); }
public virtual bool CheckSequence() { int mana = ScaleMana(GetMana()); if (m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing) { DoFizzle(); } else if (m_Scroll != null && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster || (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster)))) { DoFizzle(); } else if (!ConsumeReagents()) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502630); // More reagents are needed for this spell. } else if (m_Caster.Mana < mana) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana for this spell. } else if (Core.AOS && (m_Caster.Frozen || m_Caster.Paralyzed)) { m_Caster.SendLocalizedMessage(502646); // You cannot cast a spell while frozen. DoFizzle(); } else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. DoFizzle(); } else if (CheckFizzle()) { m_Caster.Mana -= mana; if (m_Scroll is SpellScroll) { m_Scroll.Consume(); } else if (m_Scroll is BaseWand) { ((BaseWand)m_Scroll).ConsumeCharge(m_Caster); m_Caster.RevealingAction(); } if (m_Scroll is BaseWand) { bool m = m_Scroll.Movable; m_Scroll.Movable = false; if (ClearHandsOnCast) { m_Caster.ClearHands(); } m_Scroll.Movable = m; } else { if (ClearHandsOnCast) { m_Caster.ClearHands(); } } int karma = ComputeKarmaAward(); if (karma != 0) { Misc.Titles.AwardKarma(Caster, karma, true); } if (TransformationSpellHelper.UnderTransformation(m_Caster, typeof(VampiricEmbraceSpell))) { bool garlic = false; for (int i = 0; !garlic && i < m_Info.Reagents.Length; ++i) { garlic = (m_Info.Reagents[i] == Reagent.Garlic); } if (garlic) { m_Caster.SendLocalizedMessage(1061651); // The garlic burns you! AOS.Damage(m_Caster, Utility.RandomMinMax(17, 23), 100, 0, 0, 0, 0); } } return(true); } else { DoFizzle(); } return(false); }
public override void OnCast() { if (Caster.Flying) { Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying. } else if (Factions.Sigil.ExistsOn(this.Caster)) { this.Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil } else if (!this.Caster.CanBeginAction(typeof(PolymorphSpell))) { if (Core.ML) EndPolymorph(this.Caster); else this.Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } else if (TransformationSpellHelper.UnderTransformation(this.Caster)) { this.Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form. } else if (DisguiseTimers.IsDisguised(this.Caster)) { this.Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. } else if (this.Caster.BodyMod == 183 || this.Caster.BodyMod == 184) { this.Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint } else if (!this.Caster.CanBeginAction(typeof(IncognitoSpell)) || this.Caster.IsBodyMod) { this.DoFizzle(); } else if (this.CheckSequence()) { if (this.Caster.BeginAction(typeof(PolymorphSpell))) { if (this.m_NewBody != 0) { if (!((Body)this.m_NewBody).IsHuman) { Mobiles.IMount mt = this.Caster.Mount; if (mt != null) mt.Rider = null; } this.Caster.BodyMod = this.m_NewBody; if (this.m_NewBody == 400 || this.m_NewBody == 401) this.Caster.HueMod = Utility.RandomSkinHue(); else this.Caster.HueMod = 0; BaseArmor.ValidateMobile(this.Caster); BaseClothing.ValidateMobile(this.Caster); if (!Core.ML) { StopTimer(this.Caster); Timer t = new InternalTimer(this.Caster); m_Timers[this.Caster] = t; BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Polymorph, 1075824, 1075823, t.Delay, Caster, String.Format("{0}\t{1}", GetArticleCliloc(m_NewBody), GetFormCliloc(m_NewBody)))); t.Start(); } } } else { this.Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } this.FinishSequence(); }
public override void OnThink() { base.OnThink(); if (Blessed && _Controller != null && _Controller.MasterBlessCheck(this)) { for (int i = 1; i < 4; i++) { Timer.DelayCall(TimeSpan.FromMilliseconds(i * 50), o => { Geometry.Circle2D(Location, Map, o, (pnt, map) => { Effects.SendLocationEffect(pnt, map, 0x36B0, 14, 14, 2053, 0); }); }, i); } Blessed = false; } if (!Hidden && 0.1 > Utility.RandomDouble() && (_Specialty == MasterTitle.Rogue || _Specialty == MasterTitle.Assassin)) { HideSelf(); } if (Combatant == null) { return; } if (!Utility.InRange(Location, Home, 20)) { Timer.DelayCall(TimeSpan.FromSeconds(5), () => { Location = Home; }); } if (0.3 > Utility.RandomDouble() && _NextSpecial < DateTime.UtcNow) { switch (_Specialty) { case MasterTitle.Macer: Teleport(); break; case MasterTitle.Fencer: case MasterTitle.Swordsman: ChangeWeapon(); break; case MasterTitle.Wizard: if (0.5 > Utility.RandomDouble()) { DoNuke(Location); } else { DoDismount((Mobile)Combatant); } break; } _NextSpecial = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60)); } else if (_Specialty == MasterTitle.Sampire) { if (0.1 > Utility.RandomDouble() && Weapon is BaseWeapon && !CurseWeaponSpell.IsCursed(this, (BaseWeapon)Weapon)) { CurseWeaponSpell spell = new CurseWeaponSpell(this, null); spell.Cast(); } else if (!TransformationSpellHelper.UnderTransformation(this, typeof(VampiricEmbraceSpell))) { VampiricEmbraceSpell spell = new VampiricEmbraceSpell(this, null); spell.Cast(); } } }
public override void OnCast() { if (!Caster.CanBeginAction(typeof(PolymorphSpell))) { Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed. } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1063219); // You cannot mimic an animal while in that form. } else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || (Caster.IsBodyMod && GetContext(Caster) == null)) { DoFizzle(); } else if (CheckSequence()) { AnimalFormContext context = GetContext(Caster); int mana = ScaleMana(RequiredMana); if (mana > Caster.Mana) { Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability. } else if (context != null) { RemoveContext(Caster, context, true); Caster.Mana -= mana; } else if (Caster is PlayerMobile) { bool skipGump = (m_WasMoving || CasterIsMoving()); if (GetLastAnimalForm(Caster) == -1 || !skipGump) { Caster.CloseGump(typeof(AnimalFormGump)); Caster.SendGump(new AnimalFormGump(Caster, m_Entries, this)); } else { if (Morph(Caster, GetLastAnimalForm(Caster)) == MorphResult.Fail) { DoFizzle(); } else { Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist); Caster.Mana -= mana; } } } else { if (Morph(Caster, GetLastAnimalForm(Caster)) == MorphResult.Fail) { DoFizzle(); } else { Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist); Caster.Mana -= mana; } } } FinishSequence(); }
public static int MobileNotoriety(Mobile source, Mobile target) { if (target is PlayerVendor) { return(Notoriety.CanBeAttacked); } if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } // MODIFICATIONS FOR Capture the Flag / Double Dom games Server.Items.CTFTeam ft = Server.Items.CTFGame.FindTeamFor(source); if (ft != null) { Server.Items.CTFTeam tt = Server.Items.CTFGame.FindTeamFor(target); if (tt != null && ft.Game == tt.Game) { return(ft == tt ? Notoriety.Ally : Notoriety.Enemy); } } if (source != null && source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } if (target is BaseCreature && (target.Body.IsMonster || ((BaseCreature)target).AlwaysMurderer)) { if (!IsPet(target as BaseCreature)) { if (target.Body.IsMonster && !IsSummoned(target as BaseCreature) && !(target is PlayerMobile) && target.Karma < 0 || ((BaseCreature)target).AlwaysMurderer) { return(Notoriety.Murderer); } else { return(Notoriety.CanBeAttacked); } } else if (IsSummoned(target as BaseCreature) && target.Body.IsMonster) { return(Notoriety.Murderer); } if (((BaseCreature)target).AlwaysMurderer) { return(Notoriety.Murderer); } } if (target is BaseCreature && !(target.Body.IsMonster) && IsSummoned(target as BaseCreature)) { BaseCreature bc = target as BaseCreature; Mobile master = bc.GetMaster(); if (master != null) { return(MobileNotoriety(source, master)); } } if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } //Old Style Karma Checks if (target.Karma < -59 && target is PlayerMobile) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } //Old Style Karma Checks if (((target.Karma < -39) && (target.Karma > -60)) && target is PlayerMobile) { return(Notoriety.Criminal); } /*Kills don't matter * if (IsPet(target as BaseCreature)) * { * } * else * { * if ( ((target.Body.IsMonster) && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is ArcaneFey) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead))) * return Notoriety.Murderer; * }*/ Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (sourceGuild != null && targetGuild != null) { /*if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) ) * return Notoriety.Ally; * else */if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !TransformationSpellHelper.UnderTransformation(target) && !AnimalForm.UnderTransformation(target)) { return(Notoriety.CanBeAttacked); } } if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; Mobile master = bc.GetMaster(); if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } else if (IsPet(target as BaseCreature) && master != null && !IsSummoned(target as BaseCreature)) { if (master is PlayerMobile) { return(MobileNotoriety(source, master)); } } } if (source is BaseCreature) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); if (master != null && CheckAggressor(master.Aggressors, target)) { return(Notoriety.CanBeAttacked); } } return(Notoriety.Innocent); }
protected override void OnTick() { if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) || (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) || AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn))) { 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; } if (From != null) { From.DoHarmful(m_Mobile, true); } IHonorTarget honorTarget = m_Mobile as IHonorTarget; if (honorTarget != null && honorTarget.ReceivedHonorContext != null) { honorTarget.ReceivedHonorContext.OnTargetPoisoned(); } AOS.Damage(m_Mobile, From, damage, 0, 0, 0, 100, 0); if (0.60 <= Utility.RandomDouble()) // OSI: randomly revealed between first and third damage tick, guessing 60% chance { m_Mobile.RevealingAction(); } if ((m_Index % m_Poison.m_MessageInterval) == 0) { m_Mobile.OnPoisoned(From, m_Poison, m_Poison); } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is Mobile mobile) { if (mobile is BaseCreature creature) { if (!creature.Tamable) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState); // That creature cannot be tamed. } else if (creature.Controlled) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState); // That animal looks tame already. } else if (from.Female && !creature.AllowFemaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState); // That creature can only be tamed by males. } else if (!from.Female && !creature.AllowMaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState); // That creature can only be tamed by females. } else if (creature is CuSidhe && from.Race != Race.Elf) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502801, from.NetState); // You can't tame that! } else if (from.Followers + creature.ControlSlots > from.FollowersMax) { from.SendLocalizedMessage(1049611); // You have too many followers to tame that creature. } else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState); // This animal has had too many owners and is too upset for you to tame. } else if (MustBeSubdued(creature)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState); // You must subdue this creature before you can tame it! } else if (creature.Totem != null && !creature.Totem.Deleted && !creature.Totem.IsGuildOrParty(from)) { from.SendLocalizedMessage(1157549); // You cannot currently tame that creature. } else if (DarkWolfFamiliar.CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.CurrentTameSkill) { if (m_BeingTamed.Contains(mobile)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState); // Someone else is already taming this. } else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble()) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState); // You seem to anger the beast! creature.PlaySound(creature.GetAngerSound()); creature.Direction = creature.GetDirectionTo(from); if (creature.AIObject != null) { creature.AIObject.DoMove(creature.Direction); } if (from is PlayerMobile pm && !(pm.HonorActive || TransformationSpellHelper.UnderTransformation(pm, typeof(EtherealVoyageSpell)))) { creature.Combatant = from; } } else { m_SetSkillTime = false; m_BeingTamed[mobile] = from; from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597); // You start to tame the creature. from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598); // *begins taming a creature.* new InternalTimer(from, creature, Utility.Random(3, 2)).Start(); } } else { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState); // You have no chance of taming this creature. } } else { mobile.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState); // That being cannot be tamed. } } else { from.SendLocalizedMessage(502801); // You can't tame that! } }