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); } #region Mondain's Legacy else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).Peaced) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. } #endregion 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(); } 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); }
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 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(); } #region SA else if (m_Scroll is SpellStone) { // The SpellScroll check above isn't removing the SpellStones for some reason. m_Scroll.Delete(); } #endregion 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) { 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 bool CheckCast() { if (!CheckFlyingAllowed(Caster, true)) { return(false); } if (!Caster.Alive) { Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1113082); // You may not fly while dead. } else if (!Caster.CanBeginAction(typeof(Seventh.PolymorphSpell))) { Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1112453); // You can't fly in your current form! } else if (Ninjitsu.AnimalForm.UnderTransformation(Caster) || Mysticism.StoneFormSpell.IsEffected(Caster) || (TransformationSpellHelper.UnderTransformation(Caster) && !TransformationSpellHelper.UnderTransformation(Caster, typeof(Necromancy.VampiricEmbraceSpell))) || (Caster.IsBodyMod && !Caster.Body.IsHuman)) { Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1112453); // You can't fly in your current form! } else if (Caster.Region.OnBeginSpellCast(Caster, this) && Mobiles.BaseMount.CheckMountAllowed(Caster, true, true)) { Caster.Flying = true; BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Fly, 1112193, 1112567)); // Flying & You are flying. Caster.Animate(AnimationType.TakeOff, 0); return(true); } return(false); }
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 BaseMagicStaff) && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != 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 BloodPactScroll || m_Scroll is GhostlyImagesScroll || m_Scroll is GhostPhaseScroll || m_Scroll is GraveyardGatewayScroll || m_Scroll is HellsBrandScroll || m_Scroll is HellsGateScroll || m_Scroll is ManaLeechScroll || m_Scroll is NecroCurePoisonScroll || m_Scroll is NecroPoisonScroll || m_Scroll is NecroUnlockScroll || m_Scroll is PhantasmScroll || m_Scroll is RetchedAirScroll || m_Scroll is SpectreShadowScroll || m_Scroll is UndeadEyesScroll || m_Scroll is VampireGiftScroll || m_Scroll is WallOfSpikesScroll) { m_Scroll.Consume(); m_Caster.AddToBackpack(new Bottle()); } else if (m_Scroll is ShieldOfEarthPotion || m_Scroll is WoodlandProtectionPotion || m_Scroll is ProtectiveFairyPotion || m_Scroll is HerbalHealingPotion || m_Scroll is GraspingRootsPotion || m_Scroll is BlendWithForestPotion || m_Scroll is SwarmOfInsectsPotion || m_Scroll is VolcanicEruptionPotion || m_Scroll is TreefellowPotion || m_Scroll is StoneCirclePotion || m_Scroll is DruidicRunePotion || m_Scroll is LureStonePotion || m_Scroll is NaturesPassagePotion || m_Scroll is MushroomGatewayPotion || m_Scroll is RestorativeSoilPotion || m_Scroll is FireflyPotion) { m_Scroll.Consume(); m_Caster.AddToBackpack(new Bottle()); } else if (m_Scroll is SpellScroll) { m_Scroll.Consume(); } if (MagicCastingItem.CastNoSkill(m_Scroll) == true) // DO NOT REMOVE WAND FROM HANDS { } 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 virtual bool CheckSequence() { //06AUG2007 Pre-Casting Unequip, Cast, Reequip *** START *** Item item1; //06AUG2007 Pre-Casting Unequip, Cast, Reequip *** END *** 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 (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); } if (m_Scroll is BaseWand) { bool m = m_Scroll.Movable; m_Scroll.Movable = false; //06AUG2007 Pre-Casting Unequip, Cast, Reequip *** START *** if (ClearHandsOnCast) { item1 = m_Caster.FindItemOnLayer(Layer.TwoHanded); m_Caster.Backpack.DropItem(item1); m_Caster.SendMessage("Stash your stuff"); m_Caster.ClearHands(); m_Caster.SendMessage("Gulp Gulp Ahh!"); m_Caster.EquipItem(item1); } //06AUG2007 Pre-Casting Unequip, Cast, Reequip *** END *** m_Scroll.Movable = m; } else { //25JAN2007 Pre-casting *** START **** //When target cursor comes up, they can equipt an item. Then can target the spell and still hold the item as the spell effect/dmg/heal is finished. //if ( ClearHandsOnCast ) // m_Caster.ClearHands(); //25JAN2007 Pre-casting *** END **** } 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 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); }
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)) || (m_Scroll is BaseJewel && (((BaseJewel)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster)) || (m_Scroll is GnarledStaff && (((GnarledStaff)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster)) || (m_Scroll is BaseStationary && (((BaseStationary)m_Scroll).Charges <= 0 || m_Caster.Backpack != null && m_Scroll.Parent != m_Caster.Backpack)))) { DoFizzle(); } else if (!ConsumeReagents()) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, true, "More reagents are needed for this spell."); // More reagents are needed for this spell. } else if (m_Caster.Mana < mana) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, true, "Insufficient mana for this spell."); // Insufficient mana for this spell. } else if (Core.AOS && (m_Caster.Frozen || m_Caster.Paralyzed)) { m_Caster.SendAsciiMessage("You cannot cast a spell while frozen."); // You cannot cast a spell while frozen. DoFizzle(); } else if (!(m_Scroll is BaseJewel) && (m_Caster.FindItemOnLayer(Layer.OneHanded) != null && !(m_Scroll is BaseWand) && !(m_Caster.FindItemOnLayer(Layer.OneHanded) is Spellbook)) || (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 (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); } else if (m_Scroll is BaseJewel) { ((BaseJewel)m_Scroll).ConsumeCharge(m_Caster); } else if (m_Scroll is GnarledStaff) { ((GnarledStaff)m_Scroll).ConsumeCharge(m_Caster); } else if (m_Scroll is BaseStationary) { ((BaseStationary)m_Scroll).ConsumeCharge(m_Caster); } if (m_Scroll is BaseWand || m_Scroll is BaseJewel || m_Scroll is GnarledStaff || m_Scroll is BaseStationary) { bool m = m_Scroll.Movable; m_Scroll.Movable = false; if (ClearHandsOnCast) { m_Caster.ClearHands(); } else { } 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); } } m_Caster.RevealingAction(); m_Caster.Skills[CastSkill].LastUsed = DateTime.Now; return(true); } else { DoFizzle(); } return(false); }
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); }
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 ( !CheckHandsFree() ) //{ // m_Caster.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate. //} else if (!CheckHandsFree() && m_Caster.AccessLevel == AccessLevel.Player) { m_Caster.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate. } 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); } 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); }