Server.Mobiles.MageAI.ChooseSpell C# (CSharp) Метод

ChooseSpell() публичный Метод

public ChooseSpell ( Mobile c ) : Spell
c Mobile
Результат Server.Spells.Spell
		public virtual Spell ChooseSpell( Mobile c )
		{
			Spell spell = null;

			if( !SmartAI )
			{
				spell = CheckCastHealingSpell();

				if( spell != null )
					return spell;

				switch (Utility.Random(16))
				{
					case 0:
					case 1:	// Poison them
						{
							if (c.Poisoned)
								goto default;

							m_Mobile.DebugSay( "Attempting to poison" );

							spell = new PoisonSpell(m_Mobile, null);
							break;
						}
					case 2:	// Bless ourselves
						{
							m_Mobile.DebugSay( "Blessing myself" );

							spell = new BlessSpell(m_Mobile, null);
							break;
						}
					case 3:
					case 4: // Curse them
						{
							m_Mobile.DebugSay( "Attempting to curse" );

							spell = GetRandomCurseSpell();
							break;
						}
					case 5:	// Paralyze them
						{
							if (c.Paralyzed || m_Mobile.Skills[ SkillName.Magery ].Value <= 50.0)
								goto default;

							m_Mobile.DebugSay( "Attempting to paralyze" );

							spell = new ParalyzeSpell(m_Mobile, null);
							break;
						}
					case 6: // Drain mana
						{
							m_Mobile.DebugSay( "Attempting to drain mana" );

							spell = GetRandomManaDrainSpell();
							break;
						}
					case 7: // Invis ourselves
						{
							if (Utility.RandomBool())
								goto default;

							m_Mobile.DebugSay( "Attempting to invis myself" );

							spell = new InvisibilitySpell(m_Mobile, null);
							break;
						}
					default: // Damage them
						{
							m_Mobile.DebugSay( "Just doing damage" );

							spell = GetRandomDamageSpell();
							break;
						}
				}

				return spell;
			}

			spell = CheckCastHealingSpell();

			if( spell != null )
				return spell;

			switch( Utility.Random( 3 ) )
			{
				case 0: // Poison them
					{
						if( c.Poisoned )
							goto case 1;

						spell = new PoisonSpell( m_Mobile, null );
						break;
					}
				case 1: // Deal some damage
					{
						spell = GetRandomDamageSpell();

						break;
					}
				default: // Set up a combo
					{
						if( m_Mobile.Mana > 15 && m_Mobile.Mana < 40 )
						{
							if( c.Paralyzed && !c.Poisoned && !m_Mobile.Meditating )
							{
								m_Mobile.DebugSay( "I am going to meditate" );

								m_Mobile.UseSkill( SkillName.Meditation );
							}
							else if( !c.Poisoned )
							{
								spell = new ParalyzeSpell( m_Mobile, null );
							}
						}
						else if( m_Mobile.Mana > 60 )
						{
							if( Utility.RandomBool() && !c.Paralyzed && !c.Frozen && !c.Poisoned )
							{
								m_Combo = 0;
								spell = new ParalyzeSpell( m_Mobile, null );
							}
							else
							{
								m_Combo = 1;
								spell = new ExplosionSpell( m_Mobile, null );
							}
						}

						break;
					}
			}

			return spell;
		}