public virtual bool Validate(Mobile from) { if (!from.Player) { return(true); } NetState state = from.NetState; if (state == null) { return(false); } if (RequiresSE && !state.SupportsExpansion(Expansion.SE)) { from.SendLocalizedMessage(1063456); // You must upgrade to Samurai Empire in order to use that ability. return(false); } if (HonorableExecution.IsUnderPenalty(from) || AnimalForm.UnderTransformation(from)) { from.SendLocalizedMessage(1063024); // You cannot perform this special move right now. return(false); } if (Core.ML && from.Spell != null) { from.SendLocalizedMessage(1063024); // You cannot perform this special move right now. return(false); } #region Dueling string option = null; if (this is ArmorIgnore) { option = "Armor Ignore"; } else if (this is BleedAttack) { option = "Bleed Attack"; } else if (this is ConcussionBlow) { option = "Concussion Blow"; } else if (this is CrushingBlow) { option = "Crushing Blow"; } else if (this is Disarm) { option = "Disarm"; } else if (this is Dismount) { option = "Dismount"; } else if (this is DoubleStrike) { option = "Double Strike"; } else if (this is InfectiousStrike) { option = "Infectious Strike"; } else if (this is MortalStrike) { option = "Mortal Strike"; } else if (this is MovingShot) { option = "Moving Shot"; } else if (this is ParalyzingBlow) { option = "Paralyzing Blow"; } else if (this is ShadowStrike) { option = "Shadow Strike"; } else if (this is WhirlwindAttack) { option = "Whirlwind Attack"; } else if (this is RidingSwipe) { option = "Riding Swipe"; } else if (this is FrenziedWhirlwind) { option = "Frenzied Whirlwind"; } else if (this is Block) { option = "Block"; } else if (this is DefenseMastery) { option = "Defense Mastery"; } else if (this is NerveStrike) { option = "Nerve Strike"; } else if (this is TalonStrike) { option = "Talon Strike"; } else if (this is Feint) { option = "Feint"; } else if (this is DualWield) { option = "Dual Wield"; } else if (this is DoubleShot) { option = "Double Shot"; } else if (this is ArmorPierce) { option = "Armor Pierce"; } if (option != null && !DuelContext.AllowSpecialAbility(from, option, true)) { return(false); } #endregion return(CheckSkills(from) && CheckMana(from, false)); }
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); } }
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.SendAsciiMessage("The poison seems to have worn off."); // The poison seems to have worn off. m_Mobile.Poison = null; Stop(); return; } int damage; if (!Core.AOS && m_LastDamage != 0 && Utility.RandomMinMax(1, 3) != 1) { damage = m_LastDamage; } else { //damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar); damage = 2 + (int)(m_Mobile.Hits * m_Poison.m_Scalar); m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison); /*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(); } 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 ); }
public bool Cast() { m_StartCastTime = DateTime.Now; if (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_Caster.Spell != null && m_Caster.Spell.IsCasting) { m_Caster.SendLocalizedMessage(502642); // You are already casting a spell. } else if (BlockedByHorrificBeast && TransformationSpell.UnderTransformation(m_Caster, typeof(HorrificBeastSpell))) { m_Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form. } else if (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 && DateTime.Now < m_Caster.NextSpellTime) { m_Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell. } else if (BaseBardCreature.IsCalmed(m_Caster)) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. } 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 (RevealOnCast) { m_Caster.RevealingAction(); } SayMantra(); TimeSpan castDelay = this.GetCastDelay(); /* * OSI cast delay is computed with a global timer based on ticks. There is * one tick per 0.25 seconds, so every tick the timer computes all the * spells ready to cast. This introduces a random additional delay of 0-0.25 * seconds due to fact that the first tick is always incomplete. We add this * manually here to enhance the gameplay to get the real OSI feeling. */ castDelay += TimeSpan.FromSeconds(0.25 * Utility.RandomDouble()); if (ShowHandMovement && m_Caster.Body.IsHuman && !(m_Scroll is SpellStone)) { 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(); } m_CastTimer = new CastTimer(this, castDelay); m_CastTimer.Start(); SpecialMove.ClearCurrentMove(m_Caster); WeaponAbility.ClearCurrentAbility(m_Caster); OnBeginCast(); return(true); } else { return(false); } } else { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana } return(false); }
private static bool CombatCheck(Mobile attacker, Mobile defender) /* mod'd from baseweapon */ { BaseWeapon defWeapon = defender.Weapon as BaseWeapon; Skill atkSkill = defender.Skills.Ninjitsu; Skill defSkill = defender.Skills[defWeapon.Skill]; double atSkillValue = attacker.Skills.Ninjitsu.Value; double defSkillValue = defWeapon.GetDefendSkillValue(attacker, defender); double attackValue = AosAttributes.GetValue(attacker, AosAttribute.AttackChance); if (defSkillValue <= -20.0) { defSkillValue = -19.9; } if (Spells.Chivalry.DivineFurySpell.UnderEffect(attacker)) { attackValue += 10; } if (AnimalForm.UnderTransformation(attacker, typeof(GreyWolf)) || AnimalForm.UnderTransformation(attacker, typeof(BakeKitsune))) { attackValue += 20; } if (HitLower.IsUnderAttackEffect(attacker)) { attackValue -= 25; } if (attackValue > 45) { attackValue = 45; } attackValue = (atSkillValue + 20.0) * (100 + attackValue); double defenseValue = AosAttributes.GetValue(defender, AosAttribute.DefendChance); if (Spells.Chivalry.DivineFurySpell.UnderEffect(defender)) { defenseValue -= 20; } if (HitLower.IsUnderDefenseEffect(defender)) { defenseValue -= 25; } int refBonus = 0; if (Block.GetBonus(defender, ref refBonus)) { defenseValue += refBonus; } if (SkillHandlers.Discordance.GetEffect(attacker, ref refBonus)) { defenseValue -= refBonus; } if (defenseValue > 45) { defenseValue = 45; } defenseValue = (defSkillValue + 20.0) * (100 + defenseValue); double chance = attackValue / (defenseValue * 2.0); if (chance < 0.02) { chance = 0.02; } return(attacker.CheckSkill(atkSkill.SkillName, chance)); }
public static bool OnCast(Mobile caster, Spell spell) { ITransformationSpell transformSpell = spell as ITransformationSpell; if (transformSpell == null) { return(false); } if (Factions.Sigil.ExistsOn(caster)) { caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (!caster.CanBeginAction(typeof(PolymorphSpell))) { caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed. } else if (DisguiseTimers.IsDisguised(caster)) { caster.SendLocalizedMessage(1061631); // You can't do that while disguised. return(false); } else if (AnimalForm.UnderTransformation(caster)) { caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form. } else if (!caster.CanBeginAction(typeof(IncognitoSpell)) || (caster.IsBodyMod && GetContext(caster) == null)) { spell.DoFizzle(); } else if (spell.CheckSequence()) { TransformContext context = GetContext(caster); Type ourType = spell.GetType(); bool wasTransformed = (context != null); bool ourTransform = (wasTransformed && context.Type == ourType); if (wasTransformed) { RemoveContext(caster, context, ourTransform); if (ourTransform) { caster.PlaySound(0xFA); caster.FixedParticles(0x3728, 1, 13, 5042, EffectLayer.Waist); } } if (!ourTransform) { List <ResistanceMod> mods = new List <ResistanceMod>(); if (transformSpell.PhysResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Physical, transformSpell.PhysResistOffset)); } if (transformSpell.FireResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Fire, transformSpell.FireResistOffset)); } if (transformSpell.ColdResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Cold, transformSpell.ColdResistOffset)); } if (transformSpell.PoisResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Poison, transformSpell.PoisResistOffset)); } if (transformSpell.NrgyResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Energy, transformSpell.NrgyResistOffset)); } if (!((Body)transformSpell.Body).IsHuman) { Mobiles.IMount mt = caster.Mount; if (mt != null) { mt.Rider = null; } } caster.BodyMod = transformSpell.Body; caster.HueMod = transformSpell.Hue; for (int i = 0; i < mods.Count; ++i) { caster.AddResistanceMod(mods[i]); } transformSpell.DoEffect(caster); Timer timer = new TransformTimer(caster, transformSpell); timer.Start(); AddContext(caster, new TransformContext(timer, mods, ourType, transformSpell)); return(true); } } return(false); }
private static bool CheckAnimal(Mobile m, Type type) { return(AnimalForm.UnderTransformation(m, type)); }
public bool Cast() { m_StartCastTime = DateTime.Now; 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_Caster.Spell != null && m_Caster.Spell.IsCasting) { m_Caster.SendAsciiMessage("You are already casting a spell."); // You are already casting a spell. } else if (BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)) || (BlockedByAnimalForm && AnimalForm.UnderTransformation(m_Caster))) { m_Caster.SendAsciiMessage("You cannot cast that spell in this form."); // You cannot cast that spell in this form. } else if (!(m_Scroll is BaseWand || m_Scroll is GnarledStaff || m_Scroll is BaseJewel || m_Scroll is BaseStationary) && (m_Caster.Paralyzed || m_Caster.Frozen)) { m_Caster.SendAsciiMessage("You can not cast a spell while frozen."); // You can not cast a spell while frozen. } else if (CheckNextSpellTime && DateTime.Now < m_Caster.NextSpellTime) { m_Caster.SendAsciiMessage("You have not yet recovered from casting a spell."); // You have not yet recovered from casting a spell. } else if (!(m_Scroll is BaseJewel) && (m_Caster.FindItemOnLayer(Layer.OneHanded) != null && !(m_Caster.FindItemOnLayer(Layer.OneHanded) is Spellbook) && !(m_Scroll is BaseWand)) || (m_Caster.FindItemOnLayer(Layer.TwoHanded) != null && (!(m_Caster.FindItemOnLayer(Layer.TwoHanded) is OrderShield) && !(m_Scroll is GnarledStaff) && !(m_Caster.FindItemOnLayer(Layer.TwoHanded) is ChaosShield)))) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, true, "Your hands must be free to cast spells."); //m_Caster.SendAsciiMessage("Your hands must be free to cast spells."); } 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 (RevealOnCast) { m_Caster.RevealingAction(); } SayMantra(); TimeSpan castDelay = this.GetCastDelay(); if (ShowHandMovement && m_Caster.Body.IsHuman) { int count = (int)Math.Ceiling(castDelay.TotalSeconds); //(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(); } m_CastTimer = new CastTimer(this, castDelay); m_CastTimer.Start(); OnBeginCast(); return(true); } else { return(false); } } else { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, true, "Insufficient mana for this spell."); // Insufficient mana } return(false); }
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); }
private static bool CanChange(PlayerMobile from, Race targetRace) { if (from.Deleted) { return(false); } if (from.Race == targetRace) { from.SendLocalizedMessage(1111918); // You are already that race. } else if (!MondainsLegacy.CheckML(from, false)) { from.SendLocalizedMessage(1073651); // You must have Mondain's Legacy before proceeding... } else if (!from.Alive) { from.SendLocalizedMessage(1073646); // Only the living may proceed... } else if (from.Mounted) { from.SendLocalizedMessage(1073647); // You may not continue while mounted... } else if (!from.CanBeginAction(typeof(PolymorphSpell)) || DisguiseTimers.IsDisguised(from) || AnimalForm.UnderTransformation(from) || !from.CanBeginAction(typeof(IncognitoSpell)) || from.IsBodyMod) // TODO: Does this cover everything? { from.SendLocalizedMessage(1073648); // You may only proceed while in your original state... } else if (from.Spell != null && from.Spell.IsCasting) { from.SendLocalizedMessage(1073649); // One may not proceed while embracing magic... } else if (from.Poisoned) { from.SendLocalizedMessage(1073652); // You must be healthy to proceed... } else if (IsWearingEquipment(from)) { from.SendLocalizedMessage(1073650); // To proceed you must be unburdened by equipment... } else { return(true); } return(false); }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker) || !CheckMana(attacker, true)) { return; } if (defender is ChaosDragoon || defender is ChaosDragoonElite) { return; } // TODO: Should there be a message here? if (attacker.Mounted && (attacker.Weapon is not Lance || defender.Weapon is not Lance)) { return; } ClearCurrentAbility(attacker); var mount = defender.Mount; if (mount == null && !AnimalForm.UnderTransformation(defender)) { attacker.SendLocalizedMessage(1060848); // This attack only works on mounted targets return; } if (Core.ML && attacker is LesserHiryu && Utility.RandomDouble() <= 0.8) { return; // Lesser Hiryu have an 80% chance of missing this attack } attacker.SendLocalizedMessage(1060082); // The force of your attack has dislodged them from their mount! if (attacker.Mounted) { defender.SendLocalizedMessage(1062315); // You fall off your mount! } else { defender.SendLocalizedMessage(1060083); // You fall off of your mount and take damage! } defender.PlaySound(0x140); defender.FixedParticles(0x3728, 10, 15, 9955, EffectLayer.Waist); if (defender is PlayerMobile mobile) { if (AnimalForm.UnderTransformation(mobile)) { mobile.SendLocalizedMessage(1114066, attacker.Name); // ~1_NAME~ knocked you out of animal form! } else if (mobile.Mounted) { mobile.SendLocalizedMessage(1040023); // You have been knocked off of your mount! } mobile.SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds(10), true); } else { defender.Mount.Rider = null; } if (attacker is PlayerMobile playerMobile) { playerMobile.SetMountBlock(BlockMountType.DismountRecovery, RemountDelay, true); } else if (Core.ML && attacker is BaseCreature { ControlMaster : PlayerMobile pm })
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 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! } } } }
protected override void OnTarget(Mobile from, object obj) { if (m_Bola.Deleted) { return; } if ((obj is Item)) { ((Item)obj).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049628, from.NetState); // You have no reason to throw a bola at that. return; } if (obj is Mobile) { Mobile to = (Mobile)obj; if (!m_Bola.IsChildOf(from.Backpack)) { m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1040019, from.NetState); // The bola must be in your pack to use it. } else if (from.Mounted) { m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1042053, from.NetState); // You can't use this while on a mount! } else if (from.Flying) { m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1113414, from.NetState); // You can't use this while flying! } else if (from == to) { from.SendLocalizedMessage(1005576); // You can't throw this at yourself. } else if (AnimalForm.UnderTransformation(from)) { from.PrivateOverheadMessage(MessageType.Regular, 946, 1070902, from.NetState); // You can't use this while in an animal form! } else if (!to.Mounted && !to.Flying && !AnimalForm.UnderTransformation(to)) { to.PrivateOverheadMessage(MessageType.Regular, 946, 1049628, from.NetState); // You have no reason to throw a bola at that. } else if (!from.CanBeHarmful(to)) { } else if (from.BeginAction(typeof(Bola))) { from.RevealingAction(); EtherealMount.StopMounting(from); Item one = from.FindItemOnLayer(Layer.OneHanded); Item two = from.FindItemOnLayer(Layer.TwoHanded); if (one != null) { from.AddToBackpack(one); } if (two != null) { from.AddToBackpack(two); } from.DoHarmful(to); BaseMount.SetMountPrevention(from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0)); Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(ReleaseBolaLock), from); Timer.DelayCall(TimeSpan.FromSeconds(3.0), new TimerStateCallback(FinishThrow), new object[] { from, to, m_Bola }); } else { m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1049624, from.NetState); // You have to wait a few moments before you can use another bola! } } }
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_Caster is PlayerMobile && ((PlayerMobile)m_Caster).Peaced) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. } 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())) { #region Stygian Abyss if (m_Caster.Race == Race.Gargoyle && m_Caster.Flying) { var tiles = Caster.Map.Tiles.GetStaticTiles(Caster.X, Caster.Y, true); ItemData itemData; bool cancast = true; for (int i = 0; i < tiles.Length && cancast; ++i) { itemData = TileData.ItemTable[tiles[i].ID & TileData.MaxItemValue]; cancast = !(itemData.Name == "hover over"); } if (!cancast) { if (m_Caster.IsPlayer()) { m_Caster.SendLocalizedMessage(1113750); // You may not cast spells while flying over such precarious terrain. return(false); } else { m_Caster.SendMessage("Your staff level allows you to cast while flying over precarious terrain."); } } } #endregion 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 = 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 virtual bool Cast() { if (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_Caster is PlayerMobile && ((PlayerMobile)m_Caster).Peaced) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. } 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 (SkillHandlers.SpiritSpeak.IsInSpiritSpeak(m_Caster) || (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 (!CheckManaBeforeCast || m_Caster.Mana >= ScaleMana(GetMana())) { #region Stygian Abyss if (m_Caster.Race == Race.Gargoyle && m_Caster.Flying) { if (BaseMount.OnFlightPath(m_Caster)) { if (m_Caster.IsPlayer()) { m_Caster.SendLocalizedMessage(1113750); // You may not cast spells while flying over such precarious terrain. return(false); } else { m_Caster.SendMessage("Your staff level allows you to cast while flying over precarious terrain."); } } } #endregion 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; Caster.Delta(MobileDelta.Flags); if (!(m_Scroll is BaseWand) && RevealOnCast) { m_Caster.RevealingAction(); } SayMantra(); TimeSpan castDelay = GetCastDelay(); if (ShowHandMovement && !(m_Scroll is SpellStone) && (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(); } WeaponAbility.ClearCurrentAbility(m_Caster); m_CastTime = Core.TickCount + (long)castDelay.TotalMilliseconds; CastTimer.AddTimer(this); OnBeginCast(); return(true); } else { return(false); } } else { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625, ScaleMana(GetMana()).ToString()); // Insufficient mana. You must have at least ~1_MANA_REQUIREMENT~ Mana to use this spell. } return(false); }
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); } }
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(); }
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); }
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(); } AOS.Damage(m_Mobile, 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 { m_Mobile.RevealingAction(); } if ((m_Index % m_Poison.m_MessageInterval) == 0) { m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison); } }
public bool Cast() { m_StartCastTime = DateTime.Now; 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_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 && DateTime.Now < m_Caster.NextSpellTime) { m_Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell. } 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 (RevealOnCast) { m_Caster.RevealingAction(); } SayMantra(); TimeSpan castDelay = this.GetCastDelay(); if (ShowHandMovement && m_Caster.Body.IsHuman) { 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(); return(true); } else { return(false); } } else { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana } return(false); }
private static bool CheckAnimal(Mobile m, Type type) => AnimalForm.UnderTransformation(m, type);
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); }
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)); }
public virtual bool Validate(Mobile from) { if (!from.Player) { return(true); } if (HonorableExecution.IsUnderPenalty(from)) { from.SendLocalizedMessage(1063024); // You cannot perform this special move right now. return(false); } if (AnimalForm.UnderTransformation(from)) { from.SendLocalizedMessage(1063024); // You cannot perform this special move right now. return(false); } #region Dueling string option = null; if (this is Backstab) { option = "Backstab"; } else if (this is DeathStrike) { option = "Death Strike"; } else if (this is FocusAttack) { option = "Focus Attack"; } else if (this is KiAttack) { option = "Ki Attack"; } else if (this is SurpriseAttack) { option = "Surprise Attack"; } else if (this is HonorableExecution) { option = "Honorable Execution"; } else if (this is LightningStrike) { option = "Lightning Strike"; } else if (this is MomentumStrike) { option = "Momentum Strike"; } if (option != null && !DuelContext.AllowSpecialMove(from, option, this)) { return(false); } #endregion return(CheckSkills(from) && CheckMana(from, false)); }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (attacker is LesserHiryu && 0.2 < Utility.RandomDouble()) { return; } if (!Validate(attacker)) { return; } if (attacker.Mounted && !(defender.Weapon is Lance)) // TODO: Should there be a message here? { return; } ClearCurrentAbility(attacker); if (defender is Neira || defender is ChaosDragoonElite) { attacker.SendLocalizedMessage(1042047); // You fail to knock the rider from its mount. return; } if (AnimalForm.UnderTransformation(attacker)) { attacker.SendLocalizedMessage(1070902); // You can't use this while in an animal form! return; } IMount mount = defender.Mount; if (mount == null && !AnimalForm.UnderTransformation(defender) && !defender.Flying) { attacker.SendLocalizedMessage(1060848); // This attack only works on mounted or flying targets return; } if (!CheckMana(attacker, true)) { return; } attacker.SendLocalizedMessage(1060082); // The force of your attack has dislodged them from their mount! if (attacker.Mounted) { defender.SendLocalizedMessage(1062315); // You fall off your mount! } else { defender.SendLocalizedMessage(1060083); // You fall off of your mount and take damage! } defender.PlaySound(0x140); defender.FixedParticles(0x3728, 10, 15, 9955, EffectLayer.Waist); if (mount != null) { mount.Rider = null; } else if (defender.Flying) { defender.Flying = false; } else { AnimalForm.RemoveContext(defender, true); } BaseMount.SetMountPrevention(defender, BlockMountType.Dazed, DefenderRemountDelay); BaseMount.SetMountPrevention(attacker, BlockMountType.DismountRecovery, AttackerRemountDelay); if (!attacker.Mounted) { AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0); } }
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).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 (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.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.SendLocalizedMessage(502710); // You can't steal that! } else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (Core.AOS && 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 { 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; } } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. if (si != null) { toSteal.Movable = true; si.Item = null; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return(stolen); }
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(); } #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); } }