Exemple #1
0
        private void frm_Game_Load(object sender, EventArgs e)
        {
            //Setup misc
            NewGame   = false; // make sure this is turned off until user chooses to turn it on again
            this.Text = "Russian Roulette - Welcome " + frm_PlayerProfile.profileName;

            //reset variables
            Game_CurrentScore = 0;
            Bullet            = 0;
            BulletLoad        = false;
            Chambers          = new int[6] {
                0, 0, 0, 0, 0, 0
            };
            CurrentChamber   = 0;
            PointAwayChances = 2;
            PointingAway     = false;
            Hammer           = false;
            Triggered        = false;
            Game_Saved       = false;
            //cheats
            GodMode     = false;
            ExtraLife   = false;
            ExtraChance = false;

            GameAnimations.ResetAll();
            GameAnimations.SetAllLoop(false);
            StateOfTheGame = GameStates.Intro;

            //handle cheats
            if (Cheating)
            {
                foreach (string cheat in GameCheats)
                {
                    switch (cheat)
                    {
                    case "Extra Chance":
                        ExtraChance      = true;
                        PointAwayChances = 3;
                        break;

                    case "Extra Life":
                        ExtraLife = true;
                        break;

                    case "God Mode":
                        GodMode = true;
                        break;

                    default:
                        break;
                    }
                }
            }

            //Init start of game
            AnimTimer.Interval = 40; //fps of around 25
            AnimTimer.Start();
            IntroTimer.Start();
            Anim_Intro.Loop = true;
        }
 private void PlayCheckbox_CheckedChanged(object sender, EventArgs e)
 {
     if (PlayCheckbox.Checked)
     {
         txtEffectTotalTime.Enabled   = txtEffectFrameCount.Enabled = FrameNumTextBox.Enabled = false;
         RemapAnimationButton.Enabled = FrameSpinner.Enabled = false;
         if (clip.Clip.NumFrames < 0)
         {
             return;
         }
         //Ah, the horribly imprecise timer. Oh well
         AnimTimer.Interval = (int)(1000.0 * clip.Clip.FrameTime);
         if (AnimTimer.Interval < 10)
         {
             AnimTimer.Interval = 10;
         }
         AnimTimer.Start();
     }
     else
     {
         txtEffectTotalTime.Enabled   = txtEffectFrameCount.Enabled = FrameNumTextBox.Enabled = true;
         RemapAnimationButton.Enabled = FrameSpinner.Enabled = true;
         AnimTimer.Stop();
     }
 }
 public UIContextMenu()
 {
     this.m_state     = 0;
     this.m_items     = (int[])null;
     this.m_actions   = (int[])null;
     this.m_commandId = -1;
     this.m_animTimer = new AnimTimer();
 }
Exemple #4
0
        public virtual bool Cast()
        {
            m_StartCastTime = DateTime.Now;

            if (canCast())
            {
                State        = SpellState.Casting;
                Caster.Spell = this;

                if (RevealOnCast)
                {
                    Caster.RevealingAction();
                }

                SayMantra();

                TimeSpan castTime = Info.castTime;

                double time = castTime.TotalSeconds;

                castTime = TimeSpan.FromSeconds(Vitesse.instance.CalculerVitesse(Caster, time));

                if (Caster.Body.IsHuman)
                {
                    int count = (int)Math.Ceiling(castTime.TotalSeconds / AnimateDelay.TotalSeconds);

                    if (count != 0 && AnimateOnCast)
                    {
                        m_AnimTimer = new AnimTimer(this, count);
                        m_AnimTimer.Start();
                    }

                    if (m_Info.LeftHandEffect > 0)
                    {
                        Effects.SendTargetParticles(Caster, 0, 10, 5, Info.LeftHandEffect, EffectLayer.LeftHand);
                    }

                    if (m_Info.RightHandEffect > 0)
                    {
                        Effects.SendTargetParticles(Caster, 0, 10, 5, Info.RightHandEffect, EffectLayer.RightHand);
                    }
                }

                if (ClearHandsOnCast)
                {
                    Caster.ClearHands();
                }

                m_CastTimer = new CastTimer(this, castTime);
                m_CastTimer.Start();

                OnBeginCast();

                return(true);
            }

            return(false);
        }
Exemple #5
0
 private void StopButton_Click(object sender, EventArgs e)
 {
     AnimTimer.Stop();
     StopButton.Enabled = false;
     PlayButton.Enabled = true;
     UpdateLabels();
     FrameTracker.Enabled = true;
     AnimPanel.Invalidate();
 }
Exemple #6
0
    public UIList(int listId)
    {
        this.m_listId            = listId;
        this.m_state             = 0;
        this.m_swipeList         = false;
        this.m_enabled           = true;
        this.m_posX              = 0;
        this.m_posY              = 0;
        this.m_width             = 0;
        this.m_height            = 0;
        this.m_clipPosX          = 0;
        this.m_clipPosY          = 0;
        this.m_clipWidth         = 0;
        this.m_clipHeight        = 0;
        this.m_stringChunk       = 0;
        this.m_itemSelected      = 0;
        this.m_startSelection    = -1;
        this.m_itemNum           = 0;
        this.m_itemNumX          = 0;
        this.m_itemNumY          = 0;
        this.m_itemW             = 0;
        this.m_itemH             = 0;
        this.m_offsetCol         = 0;
        this.m_selectPreSend     = false;
        this.m_selectionResult   = 0;
        this.m_selectAnim        = 0;
        this.m_animTimer         = new AnimTimer();
        this.m_objectPreviews    = (UIObjectPreview[])null;
        this.m_previewToIndexMap = (int[])null;
        this.m_lastMid           = -1;
        this.m_lastDir           = 1;
        this.m_soundId           = -1;
        switch (listId)
        {
        case 0:
            this.m_swipeList = true;
            this.m_soundId   = 21;
            break;

        case 1:
            this.m_swipeList = true;
            break;

        case 8:
            this.m_swipeList         = true;
            this.m_objectPreviews    = new UIObjectPreview[5];
            this.m_previewToIndexMap = new int[5];
            break;

        case 10:
        case 11:
        case 12:
        case 13:
            this.m_swipeList = true;
            break;
        }
    }
Exemple #7
0
 private void PlayButton_Click(object sender, EventArgs e)
 {
     if (_dir.Frames.Count > 1)
     {
         AnimTimer.Start();
         PlayButton.Enabled   = false;
         StopButton.Enabled   = true;
         FrameTracker.Enabled = false;
     }
 }
Exemple #8
0
 public UIOptionMenu()
 {
     this.m_state       = 0;
     this.m_items       = (int[])null;
     this.m_itemStrings = new string[0];
     this.m_cursor      = -1;
     this.m_itemsPosX   = 0;
     this.m_itemsPosY   = 0;
     this.m_animTimer   = new AnimTimer();
 }
Exemple #9
0
 private void ButtonStop_Click(object sender, EventArgs e)
 {
     AnimTimer.Stop();
     scene.ExpIsRunning = false;
     scene.ExpIsPaused  = false;
     scene.render();
     ExpTimer.Reset();
     //timer_label.Text = "0.00 с";
     ButtonPause.Text = "ПАУЗА";
     UnlockInterface();
 }
 public UIPauseMenu()
 {
     this.m_state        = 0;
     this.m_enabled      = true;
     this.m_showBack     = true;
     this.m_posX         = 0;
     this.m_posY         = 0;
     this.m_width        = 0;
     this.m_height       = 0;
     this.m_items        = (int[])null;
     this.m_animTimer    = new AnimTimer();
     this.m_storeBGTimer = 0;
 }
Exemple #11
0
 private void Auto_CheckedChanged(object sender, EventArgs e)
 {
     if (CenterAuto.Checked && !start) //старт таймера
     {
         AnimTimer.Start();
         AnimTimer.Enabled = true;
         start             = true;
     }
     else //стоп таймера
     {
         AnimTimer.Stop();
         AnimTimer.Enabled = false;
         start             = false;
     }
 }
Exemple #12
0
 public UIMessageBox()
 {
     this.m_state                = 1;
     this.m_type                 = 0;
     this.m_animTimer            = new AnimTimer();
     this.m_messageStringId      = -1;
     this.m_titleStringId        = -1;
     this.m_messagePanelId       = -1;
     this.m_commandTop           = -1;
     this.m_commandLeft          = -1;
     this.m_commandRight         = -1;
     this.m_popupWidth           = 0;
     this.m_contentWidth         = 0;
     this.m_contentHeight        = 0;
     this.m_contentHeightVisible = 0;
 }
Exemple #13
0
 private void ButtonPause_Click(object sender, EventArgs e)
 {
     if (scene.ExpIsPaused)
     {
         AnimTimer.Start();
         ExpTimer.Start();
         scene.ExpIsPaused = false;
         ButtonPause.Text  = "ПАУЗА";
     }
     else
     {
         AnimTimer.Stop();
         ExpTimer.Stop();
         double time = ExpTimer.ElapsedMilliseconds / 1000.0;
         scene.wave1.t = time;
         scene.wave2.t = time;
         scene.wave3.t = time;
         scene.render();
         scene.ExpIsPaused = true;
         ButtonPause.Text  = "ПРОД.";
     }
 }
Exemple #14
0
        public bool Cast()
        {
            m_StartCastTime = DateTime.Now;

            if (!m_Caster.CheckAlive())
            {
                return(false);
            }
            else if (m_Scroll is BaseWand && m_Caster.Spell != null && m_Caster.Spell.IsCasting)
            {
                m_Caster.SendLocalizedMessage(502643);                   // You can not cast a spell while frozen.
            }
            else if (m_Caster.Spell != null && m_Caster.Spell.IsCasting)
            {
                m_Caster.SendLocalizedMessage(502642);                   // You are already casting a spell.
            }
            else if (!(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 is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.Now)
            {
                m_Caster.SendLocalizedMessage(1072060);                   // You cannot cast a spell while calmed.
            }
            else if (m_Caster.Mana >= GetMana())
            {
                if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                {
                    m_State        = SpellState.Casting;
                    m_Caster.Spell = this;

                    if (!(m_Scroll is BaseWand) && RevealOnCast)
                    {
                        m_Caster.RevealingAction();
                    }

                    SayMantra();

                    TimeSpan castDelay = this.GetCastDelay();

                    if (ShowHandMovement && (m_Caster.Body.IsHuman || m_Caster.Player && m_Caster.Body.IsMonster))
                    {
                        int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);

                        if (count != 0)
                        {
                            m_AnimTimer = new AnimTimer(this, count);
                            m_AnimTimer.Start();
                        }

                        if (m_Info.LeftHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand);
                        }

                        if (m_Info.RightHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand);
                        }
                    }

                    if (ClearHandsOnCast)
                    {
                        m_Caster.ClearHands();
                    }

                    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);
        }
Exemple #15
0
        public bool Cast()
        {
            m_StartCastTime = DateTime.Now;

            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 ( 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 must wait for that spell to have an effect.
            }
            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 ( 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;
        }
Exemple #16
0
        public bool DirectCast() //Mobile 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;
            }
            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_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 is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.Now)
            {
                m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
            }
            //Taran: Tacky fix for checking range and LoS for NPC's, I don't know where the NPC spell targeting method is so I'm using Combatant instead.
            else if (m_Caster is BaseCreature && m_Caster.Combatant != null && (!m_Caster.InLOS(m_Caster.Combatant) || !m_Caster.InRange(m_Caster.Combatant, 12) || !m_Caster.CanSee(m_Caster.Combatant)))
            {
                m_Caster.SendAsciiMessage("You cannot see your target");
            }
            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)
                    {
                        if (m_Caster is PlayerMobile)
                        {
                            if (!((PlayerMobile)m_Caster).HiddenWithSpell)
                                m_Caster.RevealingAction();
                        }
                        else
                            m_Caster.RevealingAction();
                    }

                    SayMantra();

                    var castDelay = GetCastDelay();

                    if (ShowHandMovement && m_Caster.Body.IsHuman)
                    {
                        var count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);

                        if (count != 0)
                        {
                            m_AnimTimer = new AnimTimer(this, 1);
                            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 (m_Caster is PlayerMobile && ClearHandsOnCast) //Mobiles don't need to disarm
                        m_Caster.ClearHands();

                    m_CastTimer = new CastTimer(this, castDelay);
                    m_CastTimer.Start();

                    OnBeginCast();

                    return true;
                }
                return false;
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana
            }

            return false;
        }
Exemple #17
0
        public bool Cast()
        {
            m_StartCastTime = DateTime.Now;
            Spellbook book = Caster.FindItemOnLayer( Layer.OneHanded ) as Spellbook;

            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." );
            }
            else if ( BlockedByHorrificBeast && TransformationSpell.UnderTransformation( m_Caster, typeof( HorrificBeastSpell ) ) )
            {
                m_Caster.SendAsciiMessage( "You cannot cast that spell in this form." );
            }
            else if ( !(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen) )
            {
                m_Caster.SendAsciiMessage( "You can not cast a spell while frozen." );
            }
            else if ( CheckNextSpellTime && DateTime.Now < m_Caster.NextSpellTime )
            {
                m_Caster.SendAsciiMessage( "You must wait for that spell to have an effect." );
            }
            else if ( m_Caster.Mana >= ScaleMana( GetMana() ) )
            {
                if ( m_Caster.Spell == null && m_Caster.CheckSpellCast( this ) && CheckCast() && m_Caster.Region.OnBeginSpellCast( m_Caster, this ) )
                {
                    if ( Caster.Player == true && book != null && CheckSpellbook == true || Caster.Player == false || CheckSpellbook == false || ( m_Scroll is BaseWand ) || ( m_Scroll is Items.IceStaff ) || ( m_Scroll is Runebook ) )
                    {
                        m_State = SpellState.Casting;
                        m_Caster.Spell = this;

                        if ( RevealOnCast )
                            m_Caster.RevealingAction();

                        SayMantra();

                        TimeSpan castDelay = this.GetCastDelay();

                        if ( 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 if ( Caster.Player == true )
                    {
                          			Container backpack = Caster.Backpack;

                           			Spellbook spbook = (Spellbook) backpack.FindItemByType( typeof( Spellbook ) );
                        if ( spbook != null )
                        {
                            m_Caster.ClearHands();
                            Caster.EquipItem( spbook );
                            Cast();
                        }
                    }
                }
                else
                {
                    return false;
                }
            }
            else
            {
                m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana
            }

            return false;
        }
Exemple #18
0
		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;
		}
Exemple #19
0
        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;
        }
Exemple #20
0
        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;
        }
Exemple #21
0
        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()
      {
         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 && TransformationSpell.UnderTransformation( m_Caster, typeof( HorrificBeastSpell ) ) )
         {
            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 ( !(m_Scroll is BaseWand) && DateTime.Now < m_Caster.NextSpellTime )
         {
            m_Caster.SendLocalizedMessage( 502642 ); // You must wait for that spell to have an effect.
         }
            //ADDED FOR STAFF ENDLESS MANA
         else if (m_Caster.Mana >= ScaleMana(GetMana()) || m_Caster.AccessLevel > AccessLevel.Player)
         {
            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 ( 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();

               m_CastStartTime = DateTime.Now;

               OnBeginCast();

               return true;
            }
            else
            {
               return false;
            }
         }
         else
         {
            m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana
         }

         return false;
      }
Exemple #23
0
        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 && TransformationSpell.UnderTransformation( m_Caster, typeof( HorrificBeastSpell ) ) )
            //{
            //	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 )
            else if (DateTime.Now < m_Caster.NextSpellTime)
            {
                m_Caster.SendLocalizedMessage(502644);                 // You must wait for that spell to have an effect.
            }
            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();

                    // -- casting speed --
                    // ---- Individual spell timing alterations ----

                    // For FC ----
                    // adam: reverting MB to standard 5th circle casting speed.
                    //	see damage-scale  modifications to the spell
                    //if ( m_Info.Name == "Mind Blast" )
                    //castDelay = this.GetCastDelay() + TimeSpan.FromSeconds( 0.45 );
                    if (m_Info.Name == "Cure")
                    {
                        castDelay = this.GetCastDelay() + TimeSpan.FromSeconds(0.02);
                    }

                    // For FCR ----
                    if (m_Info.Name == "Heal")
                    {
                        NextSpellDelay = TimeSpan.FromSeconds(0.95);
                    }
                    else
                    {
                        NextSpellDelay = TimeSpan.FromSeconds(0.80);
                    }
                    // ----

                    if (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 (m_Scroll == null && EquipSpellbookOnCast)
                        {
                            Item item = m_Caster.FindItemOnLayer(Layer.OneHanded);
                            if (item is Spellbook == false)
                            {
                                //m_Caster.SendMessage("Equipping spell book.");
                                if (m_Caster.Backpack != null)
                                {
                                    Item spellbook = m_Caster.Backpack.FindItemByType(typeof(Spellbook), false);
                                    if (spellbook != null)
                                    {
                                        m_Caster.EquipItem(spellbook);
                                    }
                                }
                            }
                        }
                    }

                    m_CastTimer = new CastTimer(this, castDelay);
                    m_CastTimer.Start();

                    OnBeginCast();

                    // If the caster is a staffmember, log the spellcasting.
                    if (m_Caster.AccessLevel > AccessLevel.Player)
                    {
                        Server.Commands.CommandLogging.LogCastSpell(m_Caster, this.Name);
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                 // Insufficient mana
            }

            return(false);
        }
Exemple #24
0
        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);
        }
Exemple #25
0
        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( !(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 is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.Now )
            {
                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) )
                {
                    if( m_Caster.Player )
                    {
                        SpellCastEventArgs args = new SpellCastEventArgs((Player)Caster, this);
                        EventDispatcher.InvokeSpellCast(args);

                        if( args.Blocked )
                            return false;
                    }

                    m_State = SpellState.Casting;
                    m_Caster.Spell = this;

                    if( !(m_Scroll is BaseWand) && RevealOnCast )
                        m_Caster.RevealingAction();

                    SayMantra();

                    TimeSpan castDelay = this.GetCastDelay();

                    if( ShowHandMovement && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster)) )
                    {
                        int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);
                        bool animate = true;

                        if (m_Caster is Player)
                        {
                            Arcanite arc = Perk.GetByType<Arcanite>((Player)m_Caster);

                            if (arc != null)
                            {
                                if (arc.EtherealKenetics())
                                    animate = false;
                            }
                        }

                        if( count != 0 && animate )
                        {
                            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();

                    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;
        }
Exemple #26
0
 private void AnimStopButton_Click(object sender, EventArgs e)
 {
     AnimTimer.Stop();
     AnimTimer.Enabled = false;
 }
Exemple #27
0
        public bool Cast()
        {
            m_StartCastTime = DateTime.Now;
            Spellbook book = Caster.FindItemOnLayer(Layer.OneHanded) as Spellbook;

            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.");
            }
            else if (BlockedByHorrificBeast && TransformationSpell.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)))
            {
                m_Caster.SendAsciiMessage("You cannot cast that spell in this form.");
            }
            else if (!(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen))
            {
                m_Caster.SendAsciiMessage("You can not cast a spell while frozen.");
            }
            else if (CheckNextSpellTime && DateTime.Now < m_Caster.NextSpellTime)
            {
                m_Caster.SendAsciiMessage("You must wait for that spell to have an effect.");
            }
            else if (m_Caster.Mana >= ScaleMana(GetMana()))
            {
                if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                {
                    if (Caster.Player == true && book != null && CheckSpellbook == true || Caster.Player == false || CheckSpellbook == false || (m_Scroll is BaseWand) || (m_Scroll is Items.IceStaff) || (m_Scroll is Runebook))
                    {
                        m_State        = SpellState.Casting;
                        m_Caster.Spell = this;

                        if (RevealOnCast)
                        {
                            m_Caster.RevealingAction();
                        }

                        SayMantra();

                        TimeSpan castDelay = this.GetCastDelay();

                        if (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 if (Caster.Player == true)
                    {
                        Container backpack = Caster.Backpack;

                        Spellbook spbook = (Spellbook)backpack.FindItemByType(typeof(Spellbook));
                        if (spbook != null)
                        {
                            m_Caster.ClearHands();
                            Caster.EquipItem(spbook);
                            Cast();
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                   // Insufficient mana
            }

            return(false);
        }
Exemple #28
0
		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 && TransformationSpell.UnderTransformation( m_Caster, typeof( HorrificBeastSpell ) ) )
			//{
			//	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 )
			else if ( DateTime.Now < m_Caster.NextSpellTime )
			{
				m_Caster.SendLocalizedMessage( 502644 ); // You must wait for that spell to have an effect.
			}
			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();

// ---- Individual spell timing alterations ----

// For FC ----
					if ( m_Info.Name == "Mind Blast" )
						castDelay = this.GetCastDelay() + TimeSpan.FromSeconds( 0.45 );
					else if ( m_Info.Name == "Cure" )
						castDelay = this.GetCastDelay() + TimeSpan.FromSeconds( 0.02 );

// For FCR ----
					if ( m_Info.Name == "Heal" )
						NextSpellDelay = TimeSpan.FromSeconds( 0.95 );
					else
						NextSpellDelay = TimeSpan.FromSeconds( 0.80 );
// ----

					if ( 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();

					// If the caster is a staffmember, log the spellcasting.
					if ( m_Caster.AccessLevel > AccessLevel.Player )
						Server.Scripts.Commands.CommandLogging.LogCastSpell( m_Caster, this.Name );

					return true;
				}
				else
				{
					return false;
				}
			}
			else
			{
				m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana
			}

			return false;
		}
Exemple #29
0
        }                                                                     //return !(m_Scroll is BaseWand); } }

        public bool Cast()
        {
            m_StartCastTime = DateTime.Now;

            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 (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 must wait for that spell to have an effect.
            }
            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 (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 = 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 && TransformationSpell.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)))
            {
                m_Caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
            }
            else if (!(this is Shadowjump || this is MirrorImage || this is AnimalForm) && AnimalForm.UnderEffect(m_Caster))
            {
                // TODO: Revealing action and mantra should be before this ( at least for palading spell)
                if (this is PaladinSpell)
                {
                    m_Caster.SendLocalizedMessage(1063218);                       // You cannot use that ability in this form.
                }
                else if (this is SamuraiSpell)
                {
                    if (this is MomentumStrike || this is LightningStrike || this is HonorableExecution)
                    {
                        m_Caster.SendLocalizedMessage(1063024);                           // You cannot perform this special move right now.
                    }
                    else
                    {
                        m_Caster.SendLocalizedMessage(1063218);                           // You cannot use that ability in this form.
                    }
                }
                else if (this is NinjaSpell)
                {
                    m_Caster.SendLocalizedMessage(1063024);                       // You cannot perform this special move right now.
                }
                else
                {
                    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 must wait for that spell to have an effect.
            }
            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 (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);
        }
Exemple #31
0
        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 (!(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();
                    }

                    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);
        }
Exemple #32
0
		public bool Cast()
		{
			m_StartCastTime = DateTime.UtcNow;

			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 (!(m_Scroll is BaseWand || m_Scroll is GnarledStaff) && (m_Caster.Paralyzed || m_Caster.Frozen))
			{
				m_Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen.
			}
			else if (CheckNextSpellTime && DateTime.UtcNow < m_Caster.NextSpellTime)
			{
				m_Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell.
			}
			else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow)
			{
				m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
			}
				#region Dueling
			else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null &&
					 !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast(m_Caster, this))
			{ }
				#endregion

			else if (m_Caster.Mana >= ScaleMana(GetMana()))
			{
				if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast())
				{
					if (XmlScript.HasTrigger(m_Caster, TriggerName.onBeginCast) &&
						UberScriptTriggers.Trigger(m_Caster, m_Caster, TriggerName.onBeginCast, null, null, this))
					{
						return false;
					}
					else if (m_Caster.Region.OnBeginSpellCast(m_Caster, this))
					{
						m_State = SpellState.Casting;
						m_Caster.Spell = this;

						if (!(m_Scroll is BaseWand || m_Scroll is GnarledStaff) && RevealOnCast)
						{
							m_Caster.RevealingAction();
						}

						SayMantra();

						TimeSpan castDelay = GetCastDelay();
						var count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);
						if (ShowHandMovement && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster)))
						{
							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);
							}
						}
							//BaseCreature Animations For Casting
						else if (m_Caster is BaseCreature)
						{
							if (count != 0 && Utility.Random(3) == 0 || (!m_Caster.Deleted && m_Caster.NetState != null))
								// 1 in 3 chance that they do the animation
							{
								m_AnimTimer = new AnimTimer(this, count);
								m_AnimTimer.Start();
							}
						}

						if (ClearHandsOnCast)
						{
							m_Caster.ClearHands();
						}

						if (m_Caster.EraML)
						{
							WeaponAbility.ClearCurrentAbility(m_Caster);
						}

						m_CastTimer = new CastTimer(this, castDelay);
						m_CastTimer.Start();

						OnBeginCast();

						return true;
					}
				}
				return false;
			}
			else
			{
				m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana
			}

			return false;
		}
Exemple #33
0
        public bool SphereCast(Mobile from, object obj)
        {
            m_StartCastTime = DateTime.Now;

            if (m_PlayerCaster.Paralyzed && !m_PlayerCaster.HasFreeHand())
            {
                m_Caster.SendAsciiMessage(33, "You must have your hands free to cast while paralyzed!");
                return false;
            }

            if (IsCastPossible())
            {
                m_SphereSpellTarget = obj;

                if (m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                {
                    if (m_Caster is PlayerMobile && ClearHandsOnCast) //Mobiles don't need to disarm
                        m_Caster.ClearHands();

                    m_State = SpellState.Casting;

                    m_Caster.Spell = this;

                    m_PlayerCaster.WeaponTimerCheck();
                    m_PlayerCaster.BandageCheck();

                    m_PlayerCaster.AbortCurrentPlayerAction();

                    //Maka
                    if (RevealOnCast && !m_PlayerCaster.HiddenWithSpell)
                        m_Caster.RevealingAction();

                    SayMantra();

                    var castDelay = GetCastDelay();

                    var count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);

                    if (count != 0)
                    {
                        m_AnimTimer = new AnimTimer(this, 1);
                        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 (Core.ML)
                        WeaponAbility.ClearCurrentAbility(m_Caster);

                    m_CastTimer = new CastTimer(this, castDelay);
                    m_CastTimer.Start();

                    OnBeginCast();
                    return true;
                }
                return false;
            }
            return false;
        }
Exemple #34
0
        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 (m_Caster.Sleep)
            {
                m_Caster.SendLocalizedMessage(1080138);                   // You cannot cast a spell while sleeping.
            }
            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()))
            {
                #region SA
                if (m_Caster.Race == Race.Gargoyle && m_Caster.Flying)
                {
                    StaticTile[] 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.AccessLevel == AccessLevel.Player)
                        {
                            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 (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);
        }
Exemple #35
0
        public bool Cast()
        {
            bool GoblinHarm   = false;
            bool TalathasHarm = false;

            if (m_Caster.Player)
            {
                TeiravonMobile m_Person = (TeiravonMobile)m_Caster;

                if (this is HarmSpell && m_Person.Faith == TeiravonMobile.Deity.Jareth)
                {
                    GoblinHarm = true;
                }

                if (this is HarmSpell && m_Person.Faith == TeiravonMobile.Deity.Talathas)
                {
                    TalathasHarm = true;
                }
                //m_Person.SendMessage( "Type: {0}", this /*, m_Caster.Spell.GetType() */ );

                if (!m_Person.Magicable && !(m_Scroll is BaseWand) && !m_Person.HasFeat(TeiravonMobile.Feats.UseMagicDevice))
                {
                    m_Caster.SendMessage("You cannot cast spells.");
                    return(false);
                }
//				else if ( (this is NecromancerSpell) && !m_Person.IsNecromancer() )
//				{
//					m_Caster.SendMessage( "Only necromancers can cast that." );
//					return false;
//				}
                else if ((this is PaladinSpell) && m_Person.Skills.Chivalry.Base < 25.0)
                {
                    m_Caster.SendMessage("Only a true paladin can cast that.");
                    return(false);
                }
                else if ((this is NecromancerSpell) && !m_Person.HasFeat(TeiravonMobile.Feats.NecroSpellbook))
                {
                    m_Caster.SendMessage("You have not learned advanced necromancy.");
                    return(false);
                }
                else if (!(this is NecromancerSpell) && !(this is PaladinSpell) && !m_Person.CanCast(m_Info.Name) && !m_Person.HasFeat(TeiravonMobile.Feats.UseMagicDevice))
                {
                    m_Caster.SendMessage("You cannot cast this spell!");
                    return(false);
                }

                if (m_Person.Mounted)
                {
                    int fallchance = 0;

                    if (m_Person.RidingSkill == 0)
                    {
                        fallchance = 20;
                    }
                    else if (m_Person.RidingSkill == 1)
                    {
                        fallchance = 10;
                    }
                    else if (m_Person.RidingSkill == 2)
                    {
                        fallchance = 5;
                    }

                    if (fallchance > Utility.RandomMinMax(1, 100))
                    {
                        m_Person.OnDoubleClick(m_Person);
                        m_Person.Damage(Utility.RandomMinMax(1, 10), m_Person);
                        m_Person.SendMessage("You fall off your mount while casting");
                    }
                }
            }

            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 (XmlAttach.FindAttachmentOnMobile(m_Caster, typeof(XmlData), "silenced") != null)
            {
                m_Caster.SendMessage("You cannot cast spells right now.");
                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 (!(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 must wait for that spell to have an effect.
            }
            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 (GoblinHarm)
                    {
                        castDelay = TimeSpan.FromSeconds(.25);
                    }

                    if (TalathasHarm)
                    {
                        castDelay = TimeSpan.FromSeconds(.5);
                    }

                    if (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);
        }
Exemple #36
0
 private void AnimStartButton_Click(object sender, EventArgs e)
 {
     AnimTimer.Start();
     AnimTimer.Enabled = true;
 }
Exemple #37
0
		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;
		}
Exemple #38
0
    public UIButton(int commandId)
    {
        this.m_state                  = 0;
        this.m_pointerNum             = -1;
        this.m_posX                   = 0;
        this.m_posY                   = 0;
        this.m_radius                 = 35;
        this.m_animTimer              = new AnimTimer();
        this.m_commandId              = commandId;
        this.m_flags                  = 0;
        this.m_animBackground         = -1;
        this.m_animForeground         = -1;
        this.m_animForegroundDisabled = -1;
        this.m_foregroundScaleX       = 1f;
        this.m_foregroundScaleY       = 1f;
        this.m_animHighlight          = -1;
        this.m_highlightScale         = 1f;
        this.m_highlightAlpha         = 0.5f;
        this.m_highlightOffsetX       = 0.0f;
        this.m_highlightOffsetY       = 0.0f;
        this.m_soundId                = -1;
        switch (commandId)
        {
        case 1:
            this.m_animForeground         = 381;
            this.m_animForegroundDisabled = 381;
            this.m_soundId = 18;
            break;

        case 2:
            this.m_animBackground         = 119;
            this.m_animForeground         = 123;
            this.m_animForegroundDisabled = 123;
            this.m_soundId = 20;
            break;

        case 4:
        case 524288:
            this.m_animBackground         = 119;
            this.m_animForeground         = 122;
            this.m_animForegroundDisabled = 122;
            this.m_soundId = 20;
            break;

        case 8:
        case 32:
            this.m_animBackground         = 118;
            this.m_animForeground         = 125;
            this.m_animForegroundDisabled = 125;
            this.m_soundId = 21;
            break;

        case 16:
            this.m_animBackground = 119;
            this.m_animForeground = 122;
            this.m_soundId        = 20;
            break;

        case 64:
            this.m_animBackground         = 121;
            this.m_animForeground         = 124;
            this.m_animForegroundDisabled = 124;
            this.m_soundId = 20;
            break;

        case 128:
            this.m_soundId = 20;
            break;

        case 256:
            this.m_animForeground         = 196;
            this.m_animForegroundDisabled = 197;
            this.m_soundId = 21;
            break;

        case 512:
            this.m_animForeground         = 193;
            this.m_animForegroundDisabled = 195;
            this.m_soundId = 21;
            break;

        case 1024:
            this.m_animForeground         = 192;
            this.m_animForegroundDisabled = 194;
            this.m_soundId = 21;
            break;

        case 2048:
            this.m_animForeground         = 162;
            this.m_animForegroundDisabled = 162;
            this.m_soundId = 21;
            break;

        case 4096:
            this.m_animBackground         = 121;
            this.m_animForeground         = 122;
            this.m_animForegroundDisabled = 122;
            this.m_soundId = 20;
            break;

        case 8192:
            this.m_animBackground         = 118;
            this.m_animForeground         = 125;
            this.m_animForegroundDisabled = 125;
            this.m_soundId = 21;
            break;

        case 16384:
            this.m_animForeground = 198;
            this.m_soundId        = 21;
            break;

        case 32768:
            this.m_highlightScale = 1.35f;
            this.m_animForeground = 441;
            this.m_soundId        = 21;
            break;

        case 65536:
            this.m_highlightScale = 1.35f;
            this.m_animForeground = 317;
            this.m_soundId        = 21;
            break;

        case 131072:
            this.m_highlightScale = 1.35f;
            this.m_animForeground = 318;
            this.m_soundId        = 21;
            break;

        case 262144:
            this.m_highlightScale = 1.35f;
            this.m_animForeground = 319;
            this.m_soundId        = 21;
            break;

        case 1048576:
            this.m_animForeground = 178;
            this.m_soundId        = 18;
            break;

        case 2097152:
            this.m_animForeground         = 163;
            this.m_animForegroundDisabled = 163;
            this.m_soundId          = 21;
            this.m_highlightScale   = 1.35f;
            this.m_highlightOffsetX = -2f;
            this.m_highlightOffsetY = -3f;
            this.m_radius           = 50;
            break;

        case 4194304:
            this.m_flags                 |= 1;
            this.m_animForeground         = 247;
            this.m_animForegroundDisabled = 247;
            this.m_animHighlight          = 248;
            this.m_highlightAlpha         = 1f;
            this.m_soundId                = 21;
            this.m_radius                 = 50;
            break;

        case 8388608:
            this.m_animForeground = 246;
            this.m_soundId        = 21;
            break;

        case 16777216:
            this.m_animForeground = 25;
            this.m_animBackground = 27;
            this.m_soundId        = 21;
            break;

        case 33554432:
            this.m_animForeground = 26;
            this.m_animBackground = 27;
            this.m_soundId        = 21;
            break;

        case 67108864:
            this.m_animBackground   = 118;
            this.m_animForeground   = 123;
            this.m_foregroundScaleX = -1f;
            this.m_soundId          = 21;
            break;

        case 134217728:
            this.m_animBackground = 119;
            this.m_animForeground = 123;
            this.m_soundId        = 21;
            break;

        case 268435456:
            this.m_animForeground = 245;
            this.m_soundId        = 21;
            break;
        }
    }
Exemple #39
0
        public bool Cast()
        {
            m_StartCastTime = DateTime.UtcNow;

            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 (!(m_Scroll is BaseWand || m_Scroll is GnarledStaff) && (m_Caster.Paralyzed || m_Caster.Frozen))
            {
                m_Caster.SendLocalizedMessage(502643);                 // You can not cast a spell while frozen.
            }
            else if (CheckNextSpellTime && DateTime.UtcNow < m_Caster.NextSpellTime)
            {
                m_Caster.SendLocalizedMessage(502644);                 // You have not yet recovered from casting a spell.
            }
            else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow)
            {
                m_Caster.SendLocalizedMessage(1072060);                 // You cannot cast a spell while calmed.
            }
            #region Dueling
            else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null &&
                     !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast(m_Caster, this))
            {
            }
            #endregion

            else if (m_Caster.Mana >= ScaleMana(GetMana()))
            {
                if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast())
                {
                    if (XmlScript.HasTrigger(m_Caster, TriggerName.onBeginCast) &&
                        UberScriptTriggers.Trigger(m_Caster, m_Caster, TriggerName.onBeginCast, null, null, this))
                    {
                        return(false);
                    }
                    else if (m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                    {
                        m_State        = SpellState.Casting;
                        m_Caster.Spell = this;

                        if (!(m_Scroll is BaseWand || m_Scroll is GnarledStaff) && RevealOnCast)
                        {
                            m_Caster.RevealingAction();
                        }

                        SayMantra();

                        TimeSpan castDelay = GetCastDelay();
                        var      count     = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);
                        if (ShowHandMovement && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster)))
                        {
                            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);
                            }
                        }
                        //BaseCreature Animations For Casting
                        else if (m_Caster is BaseCreature)
                        {
                            if (count != 0 && Utility.Random(3) == 0 || (!m_Caster.Deleted && m_Caster.NetState != null))
                            // 1 in 3 chance that they do the animation
                            {
                                m_AnimTimer = new AnimTimer(this, count);
                                m_AnimTimer.Start();
                            }
                        }

                        if (ClearHandsOnCast)
                        {
                            m_Caster.ClearHands();
                        }

                        if (m_Caster.EraML)
                        {
                            WeaponAbility.ClearCurrentAbility(m_Caster);
                        }

                        m_CastTimer = new CastTimer(this, castDelay);
                        m_CastTimer.Start();

                        OnBeginCast();

                        return(true);
                    }
                }
                return(false);
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                 // Insufficient mana
            }

            return(false);
        }
Exemple #40
0
        public bool SphereCast(Mobile from, object obj)
        {
            m_StartCastTime = DateTime.UtcNow;

            if (m_PlayerCaster.Paralyzed && !m_PlayerCaster.HasFreeHand())
            {
                m_Caster.SendAsciiMessage(33, "You must have your hands free to cast while paralyzed!");
                return(false);
            }

            if (IsCastPossible())
            {
                m_SphereSpellTarget = obj;

                if (m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                {
                    if (m_Caster is PlayerMobile && ClearHandsOnCast) //Mobiles don't need to disarm
                    {
                        m_Caster.ClearHands();
                    }

                    m_State = SpellState.Casting;

                    m_Caster.Spell = this;

                    //m_PlayerCaster.WeaponTimerCheck();
                    //m_PlayerCaster.BandageCheck();

                    //m_PlayerCaster.AbortCurrentPlayerAction();

                    //Maka
                    //if (RevealOnCast && !m_PlayerCaster.HiddenWithSpell)
                    //     m_Caster.RevealingAction();

                    SayMantra();

                    var castDelay = GetCastDelay();

                    var count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);

                    if (count != 0)
                    {
                        m_AnimTimer = new AnimTimer(this, 1);
                        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 (Core.ML)
                    {
                        WeaponAbility.ClearCurrentAbility(m_Caster);
                    }

                    m_CastTimer = new CastTimer(this, castDelay);
                    m_CastTimer.Start();

                    OnBeginCast();
                    return(true);
                }
                return(false);
            }
            return(false);
        }
Exemple #41
0
        public virtual 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 (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 (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow)
            {
                m_Caster.SendLocalizedMessage(1072060);                 // You cannot cast a spell while calmed.
            }
            else if (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();
                    }

                    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);
        }
Exemple #42
0
        public bool Cast()
        {
            if (Caster.Spell is Spell && ((Spell)Caster.Spell).State == SpellState.Sequencing)
            {
                ((Spell)Caster.Spell).Disturb(DisturbType.NewCast);
            }

            if (!Caster.CheckAlive())
            {
                return(false);
            }
            else if (Caster.Spell != null && Caster.Spell.IsCasting)
            {
                Caster.SendLocalizedMessage(502642);                   // You are already casting a spell.
            }
            else if (BlockedByHorrificBeast && TransformationSpell.UnderTransformation(Caster, typeof(HorrificBeastSpell)))
            {
                Caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
            }
            else if (BlockedByAnimalForm && AnimalForm.UnderTransformation(Caster))
            {
                Caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
            }
            else if (!(Scroll is BaseWand) && (Caster.Paralyzed || Caster.Frozen))
            {
                Caster.SendLocalizedMessage(502643);                   // You can not cast a spell while frozen.
            }
            else if (CheckNextSpellTime && DateTime.UtcNow < Caster.NextSpellTime)
            {
                Caster.SendLocalizedMessage(502644);                   // You have not yet recovered from casting a spell.
            }
            else if (BaseBardCreature.IsCalmed(Caster))
            {
                Caster.SendLocalizedMessage(1072060);                   // You cannot cast a spell while calmed.
            }
            else if (Caster.Mana >= ScaleMana(GetMana()))
            {
                if (Caster.Spell == null && Caster.CheckSpellCast(this) && CheckCast() && Caster.Region.OnBeginSpellCast(Caster, this))
                {
                    State        = SpellState.Casting;
                    Caster.Spell = this;

                    if (RevealOnCast)
                    {
                        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 && Caster.Body.IsHuman && !(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 (Info.LeftHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, Info.LeftHandEffect, EffectLayer.LeftHand);
                        }

                        if (Info.RightHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, Info.RightHandEffect, EffectLayer.RightHand);
                        }
                    }

                    if (ClearHandsOnCast)
                    {
                        Caster.ClearHands();
                    }

                    m_CastTimer = new CastTimer(this, castDelay);
                    m_CastTimer.Start();

                    SpecialMove.ClearCurrentMove(Caster);
                    WeaponAbility.ClearCurrentAbility(Caster);

                    OnBeginCast();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                   // Insufficient mana
            }

            return(false);
        }