Inheritance: MagerySpell
Exemple #1
0
        public virtual Spell DoCombo(Mobile c)
        {
            Spell spell = null;

            if (m_Combo == 0)
            {
                spell = new ExplosionSpell(m_Mobile, null);
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 1)
            {
                spell = new WeakenSpell(m_Mobile, null);
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 2)
            {
                if (!c.Poisoned)
                    spell = new PoisonSpell(m_Mobile, null);
                else if (IsNecromancer)
                    spell = new StrangleSpell(m_Mobile, null);

                ++m_Combo; // Move to next spell
            }

            if (m_Combo == 3 && spell == null)
            {
                switch (Utility.Random(IsNecromancer ? 4 : 3))
                {
                    case 0:
                        {
                            if (c.Int < c.Dex)
                                spell = new FeeblemindSpell(m_Mobile, null);
                            else
                                spell = new ClumsySpell(m_Mobile, null);

                            ++m_Combo; // Move to next spell

                            break;
                        }
                    case 1:
                        {
                            spell = new EnergyBoltSpell(m_Mobile, null);
                            m_Combo = -1; // Reset combo state
                            break;
                        }
                    case 2:
                        {
                            spell = new FlameStrikeSpell(m_Mobile, null);
                            m_Combo = -1; // Reset combo state
                            break;
                        }
                    default:
                        {
                            spell = new PainSpikeSpell(m_Mobile, null);
                            m_Combo = -1; // Reset combo state
                            break;
                        }
                }
            }
            else if (m_Combo == 4 && spell == null)
            {
                spell = new MindBlastSpell(m_Mobile, null);
                m_Combo = -1;
            }

            return spell;
        }
		public virtual Spell ChooseSpell( Mobile c )
		{
			if ( !SmartAI )
			{
				if ( !m_Mobile.Summoned && ScaleByHealing( HealChance ) > Utility.RandomDouble() )
				{
					switch( Utility.Random( 2 ) )
					{
						case 0:
							if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
							{
								m_Mobile.UseSkill( SkillName.SpiritSpeak );
							}
							else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
							{
								m_Mobile.UseSkill( SkillName.SpiritSpeak );
							}
						break;
						case 1:
							if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
							{
								return new GreaterHealSpell( m_Mobile, null );
							}
							else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
							{
								return new HealSpell( m_Mobile, null );
							}
						break;
					}
				}

				return GetRandomDamageSpell();
			}

			Spell spell = null;

			int healChance = (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits));

			if ( m_Mobile.Summoned )
				healChance = 0;

			switch ( Utility.Random( 6 + healChance ) )
			{
				default:
				case 0: // Heal ourself
				{
					if ( !m_Mobile.Summoned )
					{
						switch( Utility.Random( 2 ) )
						{
							case 0:
								if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
								{
									m_Mobile.UseSkill( SkillName.SpiritSpeak );
								}
								else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
								{
									m_Mobile.UseSkill( SkillName.SpiritSpeak );
								}
							break;
							case 1:
								if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
								{
									return new GreaterHealSpell( m_Mobile, null );
								}
								else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
								{
									return new HealSpell( m_Mobile, null );
								}
							break;
						}
					}

					break;
				}
				case 1: // Poison them
				{
					if ( !c.Poisoned )
						spell = new PoisonSpell( m_Mobile, null );

					break;
				}
				case 2: // PoisonStrike them
				{
					if ( !c.Poisoned )
						spell = new PoisonStrikeSpell( m_Mobile, null );

					break;
				}
				case 3: // Deal some damage
				{
					spell = GetRandomDamageSpell();

					break;
				}
				case 4: // Set up a combo
				{
					if ( m_Mobile.Mana < 40 && m_Mobile.Mana > 15 )
					{
						if ( c.Paralyzed && !c.Poisoned )
						{
							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.Random( 4 ) == 0 && !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;
				}
				case 5: //Combo to soften our enemies with a powerful attack while we have max mana amounts
				{
					if ( m_Mobile.Mana > 80 )
					{
						if ( Utility.Random( 2 ) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned ) 
						{
							m_Combo = 0;
							spell = new VengefulSpiritSpell ( m_Mobile, null );
						}
						else
						{
							m_Combo = 0;
							spell = new ParalyzeSpell( m_Mobile, null );
						}
					}
				    break;
				}
			}

			return spell;
		}
Exemple #3
0
        public override Spell ChooseSpell( Mobile c )
        {
            Spell spell = null;

            spell = GetRandomBlessSpell();

            if ( spell != null )
                return spell;

            spell = CheckCastHealingSpell();

            if ( spell != null )
                return spell;

            switch ( Utility.Random( 12 ) )
            {
                default:
                case 0:
                case 1: // Curse them.
                    {
                        spell = GetRandomCurseSpell( c );

                        break;
                    }
                case 2: // Poison them
                    {
                        if ( !c.Poisoned )
                            spell = new PoisonSpell( m_Mobile, null );

                        break;
                    }
                case 3: // Drain some mana
                    {
                        spell = GetRandomManaDrainSpell( c );

                        break;
                    }
                case 4: // Animate dead
                    {
                        spell = new AnimateDeadSpell( m_Mobile, null );

                        break;
                    }
                case 5: // Vengeful spirit
                    {
                        spell = new VengefulSpiritSpell( m_Mobile, null );

                        break;
                    }
                case 6:
                case 7:
                case 8: // Deal some damage
                    {
                        spell = GetRandomDamageSpell( c );

                        break;
                    }
                case 9:
                case 10:
                case 11: // Set up a combo
                    {
                        if ( m_Mobile.Mana < 40 && m_Mobile.Mana > 15 )
                        {
                            if ( c.Paralyzed && !c.Poisoned )
                            {
                                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.Random( 2 ) == 0 && !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;
        }
Exemple #4
0
        public virtual Spell ChooseSpell(IDamageable d)
        {
            if (!(d is Mobile))
            {
                m_Mobile.DebugSay("Just doing damage");
                return GetRandomDamageSpell();
            }

            Mobile c = d as Mobile;
            Spell spell = null;

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

                if (spell == null && m_Mobile.RawInt >= 80)
                    spell = CheckCastDispelField();

                if (spell != null)
                    return spell;

                int maxCircle = GetMaxCircle();

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

                            this.m_Mobile.DebugSay("Attempting to poison");

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

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

                            spell = this.GetRandomCurseSpell();
                            break;
                        }
                    case 5:	// Paralyze them
                        {
                            this.m_Mobile.DebugSay("Attempting to paralyze");

                            if (maxCircle >= 5)
                                spell = new ParalyzeSpell(m_Mobile, null);
                            else
                                spell = GetRandomCurseSpell();
                            break;
                        }
                    case 6: // Drain mana
                        {
                            this.m_Mobile.DebugSay("Attempting to drain mana");

                            spell = this.GetRandomManaDrainSpell();
                            break;
                        }
                    default: // Damage them
                        {
                            this.m_Mobile.DebugSay("Just doing damage");

                            spell = this.GetRandomDamageSpell();
                            break;
                        }
                }

                return spell;
            }

            if (m_Mobile.Hidden)
                return null;

            spell = CheckCastDispelField();

            if (spell == null)
                spell = CheckCastHealingSpell();

            if (spell == null && 0.05 >= Utility.RandomDouble())
                spell = GetRandomBuffSpell();

            else if (spell == null && m_Mobile.Followers + 1 < m_Mobile.FollowersMax && 0.05 >= Utility.RandomDouble())
                spell = GetRandomSummonSpell();

            else if (spell == null && 0.05 >= Utility.RandomDouble())
                spell = GetRandomFieldSpell();

            else if (spell == null && 0.05 >= Utility.RandomDouble())
                spell = GetRandomManaDrainSpell();

            if (spell != null)
                return spell;

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

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

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

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

                        break;
                    }
            }

            return spell;
        }
Exemple #5
0
        public override bool DoActionCombat()
        {
            IDamageable c = this.m_Mobile.Combatant;
            m_Mobile.Warmode = true;

            if (m_Mobile.Target != null)
                ProcessTarget();

            if (c == null || c.Deleted || !c.Alive || (c is Mobile && ((Mobile)c).IsDeadBondedPet) || !this.m_Mobile.CanSee(c) || !this.m_Mobile.CanBeHarmful(c, false) || c.Map != this.m_Mobile.Map)
            {
                // Our combatant is deleted, dead, hidden, or we cannot hurt them
                // Try to find another combatant
                if (this.AcquireFocusMob(this.m_Mobile.RangePerception, this.m_Mobile.FightMode, false, false, true))
                {
                    this.m_Mobile.DebugSay("Something happened to my combatant, so I am going to fight {0}", this.m_Mobile.FocusMob.Name);

                    this.m_Mobile.Combatant = c = this.m_Mobile.FocusMob;
                    this.m_Mobile.FocusMob = null;
                }
                else
                {
                    this.m_Mobile.DebugSay("Something happened to my combatant, and nothing is around. I am on guard.");
                    this.Action = ActionType.Guard;
                    return true;
                }
            }

            if (!this.m_Mobile.InLOS(c))
            {
                this.m_Mobile.DebugSay("I can't see my target");

                if (this.AcquireFocusMob(this.m_Mobile.RangePerception, this.m_Mobile.FightMode, false, false, true))
                {
                    this.m_Mobile.DebugSay("I will switch to {0}", this.m_Mobile.FocusMob.Name);
                    this.m_Mobile.Combatant = c = this.m_Mobile.FocusMob;
                    this.m_Mobile.FocusMob = null;
                }
            }

            if (!Core.AOS && this.SmartAI && !this.m_Mobile.StunReady && this.m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && this.m_Mobile.Skills[SkillName.Anatomy].Value >= 80.0)
                EventSink.InvokeStunRequest(new StunRequestEventArgs(this.m_Mobile));

            if (!this.m_Mobile.InRange(c, this.m_Mobile.RangePerception))
            {
                // They are somewhat far away, can we find something else?
                if (this.AcquireFocusMob(this.m_Mobile.RangePerception, this.m_Mobile.FightMode, false, false, true))
                {
                    this.m_Mobile.Combatant = this.m_Mobile.FocusMob;
                    this.m_Mobile.FocusMob = null;
                }
                else if (!this.m_Mobile.InRange(c, this.m_Mobile.RangePerception * 3))
                {
                    this.m_Mobile.Combatant = null;
                }

                c = this.m_Mobile.Combatant as Mobile;

                if (c == null)
                {
                    this.m_Mobile.DebugSay("My combatant has fled, so I am on guard");
                    this.Action = ActionType.Guard;

                    return true;
                }
            }

            if (!this.m_Mobile.Controlled && !this.m_Mobile.Summoned && this.m_Mobile.CanFlee)
            {
                if (this.m_Mobile.Hits < this.m_Mobile.HitsMax * 20 / 100)
                {
                    // We are low on health, should we flee?
                    bool flee = false;

                    if (this.m_Mobile.Hits < c.Hits)
                    {
                        // We are more hurt than them
                        int diff = c.Hits - this.m_Mobile.Hits;

                        flee = (Utility.Random(0, 100) > (10 + diff)); // (10 + diff)% chance to flee
                    }
                    else
                    {
                        flee = Utility.Random(0, 100) > 10; // 10% chance to flee
                    }

                    if (flee)
                    {
                        this.m_Mobile.DebugSay("I am going to flee from {0}", c.Name);

                        this.Action = ActionType.Flee;
                        return true;
                    }
                }
            }

            if (this.m_Mobile.Spell == null && DateTime.UtcNow > this.m_NextCastTime && this.m_Mobile.InRange(c, Core.ML ? 10 : 12))
            {
                // We are ready to cast a spell
                Spell spell = null;
                Mobile toDispel = this.FindDispelTarget(true);

                if (this.m_Mobile.Poisoned) // Top cast priority is cure
                {
                    this.m_Mobile.DebugSay("I am going to cure myself");

                    spell = new CureSpell(this.m_Mobile, null);
                }
                else if (toDispel != null) // Something dispellable is attacking us
                {
                    this.m_Mobile.DebugSay("I am going to dispel {0}", toDispel);

                    spell = this.DoDispel(toDispel);
                }
                else if (c is Mobile && this.SmartAI && this.m_Combo != -1) // We are doing a spell combo
                {
                    spell = this.DoCombo((Mobile)c);
                }
                else if (c is Mobile && this.SmartAI && (((Mobile)c).Spell is HealSpell || ((Mobile)c).Spell is GreaterHealSpell) && !((Mobile)c).Poisoned) // They have a heal spell out
                {
                    spell = new PoisonSpell(this.m_Mobile, null);
                }
                else
                {
                    spell = this.ChooseSpell(c);
                }

                // Now we have a spell picked
                // Move first before casting

                TimeSpan ts = !SmartAI && !(spell is DispelSpell) ? TimeSpan.FromSeconds(1.5) : m_Combo > -1 ? TimeSpan.FromSeconds(.5) : TimeSpan.FromSeconds(1.5);
                TimeSpan delay = spell == null ? TimeSpan.FromSeconds(m_Mobile.ActiveSpeed) : spell.GetCastDelay() + spell.GetCastRecovery() + ts;

                RunTo(c);

                if (spell != null)
                    spell.Cast();

                this.m_NextCastTime = DateTime.UtcNow + delay;
            }
            else/* if (this.m_Mobile.Spell == null || !this.m_Mobile.Spell.IsCasting)*/
            {
                this.RunTo(c);
            }

            this.m_LastTarget = c as Mobile;
            this.m_LastTargetLoc = c.Location;

            return true;
        }
		public virtual Spell DoCombo( Mobile c )
		{
			Spell spell = null;

			if ( m_Combo == 0 )
			{
				spell = new FlameStrikeSpell( m_Mobile, null );
				++m_Combo; // Move to next spell
			}
			else if ( m_Combo == 1 )
			{
				spell = new WitherSpell( m_Mobile, null );
				++m_Combo; // Move to next spell
			}
			else if ( m_Combo == 2 )
			{
				if ( !c.Poisoned )
					spell = new PoisonSpell( m_Mobile, null );

				++m_Combo; // Move to next spell
			}

			if ( m_Combo == 3 && spell == null )
			{
				switch ( Utility.Random( 3 ) )
				{
					default:
					case 0:
					{
						if ( c.Int < c.Dex )
							spell = new MindRotSpell( m_Mobile, null );
						else
							spell = new WitherSpell( m_Mobile, null );

						++m_Combo; // Move to next spell

						break;
					}
					case 1:
					{
						spell = new StrangleSpell( m_Mobile, null );
						m_Combo = -1; // Reset combo state
						break;
					}
					case 2:
					{
						spell = new WitherSpell( m_Mobile, null );
						m_Combo = -1; // Reset combo state
						break;
					}
				}
			}
			else if ( m_Combo == 4 && spell == null )
			{
				spell = new VengefulSpiritSpell( m_Mobile, null );
				m_Combo = -1;
			}

			return spell;
		}
Exemple #7
0
        public virtual Spell ChooseSpell(Mobile c)
        {
            Spell spell = this.CheckCastHealingSpell();

            if (spell != null)
                return spell;
				
            double damage = ((this.m_Mobile.Skills[SkillName.SpiritSpeak].Value - c.Skills[SkillName.MagicResist].Value) / 10) + (c.Player ? 18 : 30);
			
            if (damage > c.Hits)
                return new PainSpikeSpell(this.m_Mobile, null);

            switch ( Utility.Random(25) )
            {
                case 0:
                case 1:
                case 2:	// Poison them
                    {
                        this.m_Mobile.DebugSay("Attempting to poison");

                        if (!c.Poisoned)
                            spell = new PoisonSpell(this.m_Mobile, null);

                        break;
                    }
                case 3:	// Bless ourselves.
                    {
                        this.m_Mobile.DebugSay("Blessing myself");

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

                        spell = this.GetRandomCurseSpell();
                        break;
                    }
                case 7:	// Paralyze them.
                    {
                        this.m_Mobile.DebugSay("Attempting to paralyze");

                        if (this.m_Mobile.Skills[SkillName.Magery].Value > 50.0)
                            spell = new ParalyzeSpell(this.m_Mobile, null);

                        break;
                    }
                case 8: // Drain mana
                    {
                        this.m_Mobile.DebugSay("Attempting to drain mana");

                        spell = this.GetRandomManaDrainSpell();
                        break;
                    }
                case 9:
                case 10: // Blood oath them
                    {
                        this.m_Mobile.DebugSay("Attempting to blood oath");
										
                        if (this.m_Mobile.Skills[SkillName.Necromancy].Value > 30 && BloodOathSpell.GetBloodOath(c) != this.m_Mobile)
                            spell = new BloodOathSpell(this.m_Mobile, null);
						
                        break;
                    }
                case 11:
                case 12: // Animate dead
                    {
                        this.m_Mobile.DebugSay("Attempting to animate dead");

                        if ((this.m_Animated == null || !this.m_Animated.Alive) && this.m_Mobile.Skills[SkillName.Necromancy].Value > 40)
                            spell = new AnimateDeadSpell(this.m_Mobile, null);

                        break;
                    }
                case 13:
                case 14:
                    {
                        this.m_Mobile.DebugSay("Attempting to cast vengeful spirit");

                        if (this.m_Mobile.Skills[SkillName.Necromancy].Value > 80 && (this.m_Mobile.Followers + 3) < this.m_Mobile.FollowersMax)
                            spell = new VengefulSpiritSpell(this.m_Mobile, null);

                        break;
                    }
                default: // Damage them.
                    {
                        this.m_Mobile.DebugSay("Just doing damage");

                        spell = this.GetRandomDamageSpell();
                        break;
                    }
            }

            return spell;
        }
		public virtual Spell DoCombo( Mobile c )
		{
			Spell spell = null;

			if ( m_Combo == 0 )
			{
				spell = new ExplosionSpell( m_Mobile, null );
				++m_Combo; // Move to next spell
			}
			else if ( m_Combo == 1 )
			{
				spell = new WeakenSpell( m_Mobile, null );
				++m_Combo; // Move to next spell
			}
			else if ( m_Combo == 2 )
			{
				if ( !( ( m_Mobile is IEvoCreature || m_Mobile is EvolutionDragon ) && c is PlayerMobile ) && !c.Poisoned )
					spell = new PoisonSpell( m_Mobile, null );

				++m_Combo; // Move to next spell
			}

			if ( m_Combo == 3 && spell == null )
			{
				switch ( Utility.Random( 3 ) )
				{
					default:
					case 0:
					{
						if ( c.Int < c.Dex )
							spell = new FeeblemindSpell( m_Mobile, null );
						else
							spell = new ClumsySpell( m_Mobile, null );

						++m_Combo; // Move to next spell

						break;
					}
					case 1:
					{
						spell = new EnergyBoltSpell( m_Mobile, null );
						m_Combo = -1; // Reset combo state
						break;
					}
					case 2:
					{
						spell = new FlameStrikeSpell( m_Mobile, null );
						m_Combo = -1; // Reset combo state
						break;
					}
				}
			}
			else if ( m_Combo == 4 && spell == null )
			{
				spell = new MindBlastSpell( m_Mobile, null );
				m_Combo = -1;
			}

			return spell;
		}
        public virtual Spell DoCombo(Mobile c)
        {
            Spell spell = null;

            if ( m_Mobile.HitsMax > 0 && (m_Mobile.Hits / m_Mobile.HitsMax) < 0.1 && m_Mobile.Hits < 300 )
            {
                spell = CheckCastHealingSpell();
                m_Combo = -1;
                return spell;
            }
            if (m_Combo == 0)
            {
                spell = new ExplosionSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Explosion" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 1)
            {
                spell = new CorpseSkinSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Corpse skin" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 2)
            {
                if ( !c.Poisoned )
                {
                    spell = new PoisonSpell(m_Mobile, null);
                    m_Mobile.DebugSay( "Poison" );
                }
                else
                {
                    spell = new CurseSpell(m_Mobile, null);
                    m_Mobile.DebugSay( "Curse" );
                }

                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 3)
            {
                spell = new StrangleSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Strangle" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 4)
            {
                spell = new PainSpikeSpell(m_Mobile, null);
                m_Mobile.DebugSay( "pain spike" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 7)
            {
                spell = new ExplosionSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Explosion" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 8)
            {
                if ( !c.Poisoned )
                {
                    spell = new PoisonSpell(m_Mobile, null);
                    m_Mobile.DebugSay( "Poison" );
                }
                else
                {
                    spell = new CurseSpell(m_Mobile, null);
                    m_Mobile.DebugSay( "Curse" );
                }

                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 9)
            {
                spell = new FlameStrikeSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Flamestrike" );
                m_Combo = -1;
            }
            else if (m_Combo == 10)
            {
                spell = new StrangleSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Strangle" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 11)
            {
                spell = new CorpseSkinSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Corpse skin" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 12)
            {
                spell = new ExplosionSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Explosion" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 13)
            {
                spell = new PoisonStrikeSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Poison strike" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 14)
            {
                spell = new PoisonStrikeSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Poison strike" );
                ++m_Combo; // Move to next spell
            }
            else if (m_Combo == 15)
            {
                spell = new PainSpikeSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Pain spike" );
                m_Combo = -1;
            }
            if (m_Combo == 5 && spell == null)
            {
                switch (Utility.Random(3))
                {
                    default:
                    case 0:
                        {
                            spell = new ExplosionSpell(m_Mobile, null);
                            m_Mobile.DebugSay( "Explosion" );
                            break;
                        }
                    case 1:
                        {
                            spell = new PoisonStrikeSpell(m_Mobile, null);
                            m_Mobile.DebugSay( "Poison strike" );
                            break;
                        }
                    case 2:
                        {
                            spell = new FlameStrikeSpell(m_Mobile, null);
                            m_Mobile.DebugSay( "Flamestrike" );
                            ++m_Combo; // Move to next spell
                            break;
                        }
                }
            }
            else if (m_Combo == 6 && spell == null)
            {
                spell = new VengefulSpiritSpell(m_Mobile, null);
                m_Mobile.DebugSay( "Revenant" );
                m_Combo = -1;
            }

            return spell;
        }
Exemple #10
0
        public override bool DoActionCombat()
        {
            Mobile c = m_Mobile.Combatant;
            m_Mobile.Warmode = true;

            if ( m_Mobile.ChangeCombatantChance > Utility.RandomDouble() )
            {
                if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
                {
                    if ( m_Mobile.Debug )
                        m_Mobile.DebugSay( "Changing my combatant, now I am going to fight {0}", m_Mobile.FocusMob.Name );

                    m_Mobile.Combatant = c = m_Mobile.FocusMob;
                    m_Mobile.FocusMob = null;
                }
            }

            if ( c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee( c ) || !m_Mobile.CanBeHarmful( c, false ) || c.Map != m_Mobile.Map )
            {
                // Our combatant is deleted, dead, hidden, or we cannot hurt them
                // Try to find another combatant

                if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
                {
                    if ( m_Mobile.Debug )
                        m_Mobile.DebugSay( "Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name );

                    m_Mobile.Combatant = c = m_Mobile.FocusMob;
                    m_Mobile.FocusMob = null;
                }
                else
                {
                    m_Mobile.DebugSay( "Something happened to my combatant, and nothing is around. I am on guard." );
                    Action = ActionType.Guard;
                    return true;
                }
            }

            if ( !m_Mobile.InLOS( c ) )
            {
                m_Mobile.DebugSay( "I can't see my target" );

                if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
                {
                    m_Mobile.DebugSay( "Nobody else is around" );
                    m_Mobile.Combatant = c = m_Mobile.FocusMob;
                    m_Mobile.FocusMob = null;
                }
            }

            if ( !m_Mobile.InRange( c, m_Mobile.RangePerception ) )
            {
                // They are somewhat far away, can we find something else?

                if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
                {
                    m_Mobile.Combatant = m_Mobile.FocusMob;
                    m_Mobile.FocusMob = null;
                }
                else if ( !m_Mobile.InRange( c, m_Mobile.RangePerception * 3 ) )
                {
                    m_Mobile.Combatant = null;
                }

                c = m_Mobile.Combatant;

                if ( c == null )
                {
                    m_Mobile.DebugSay( "My combatant has fled, so I am on guard" );
                    Action = ActionType.Guard;

                    return true;
                }
            }

            if ( !m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee )
            {
                if ( m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100 )
                {
                    // We are low on health, should we flee?

                    bool flee = false;

                    if ( m_Mobile.Hits < c.Hits )
                    {
                        // We are more hurt than them

                        int diff = c.Hits - m_Mobile.Hits;

                        flee = ( Utility.Random( 0, 100 ) > ( 10 + diff ) ); // (10 + diff)% chance to flee
                    }
                    else
                    {
                        flee = Utility.Random( 0, 100 ) > 10; // 10% chance to flee
                    }

                    if ( flee )
                    {
                        if ( m_Mobile.Debug )
                            m_Mobile.DebugSay( "I am going to flee from {0}", c.Name );

                        Action = ActionType.Flee;
                        return true;
                    }
                }
            }

            if ( m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange( c, 12 ) )
            {
                // We are ready to cast a spell

                Spell spell = null;
                Mobile toDispel = FindDispelTarget( true );

                if ( m_Mobile.Poisoned ) // Top cast priority is cure
                {
                    m_Mobile.DebugSay( "I am going to cure myself" );

                    spell = new CureSpell( m_Mobile, null );
                }
                else if ( toDispel != null ) // Something dispellable is attacking us
                {
                    m_Mobile.DebugSay( "I am going to dispel {0}", toDispel );

                    spell = DoDispel( toDispel );
                }
                else if ( m_Combo != -1 ) // We are doing a spell combo
                {
                    spell = DoCombo( c );
                }
                else if ( ( c.Spell is HealSpell || c.Spell is GreaterHealSpell ) && !c.Poisoned ) // They have a heal spell out
                {
                    spell = new PoisonSpell( m_Mobile, null );
                }
                else
                {
                    spell = ChooseSpell( c );
                }

                // Now we have a spell picked
                // Move first before casting

                RunTo( c );

                TimeSpan delay = TimeSpan.FromSeconds( m_Mobile.ActiveSpeed );

                if ( spell != null )
                {
                    spell.Cast();
                    delay += spell.GetCastRecovery();
                }

                if ( m_Mobile.Mana < 20 )
                    m_NextCastTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); // Let mana raise...
                else
                    m_NextCastTime = DateTime.Now + delay;
            }
            else if ( m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting )
            {
                RunTo( c );
            }

            return true;
        }
Exemple #11
0
        public override Spell ChooseSpell( Mobile c )
        {
            Spell spell = CheckCastHealingSpell();

            if ( spell != null )
                return spell;

            switch ( Utility.Random( 16 ) )
            {
                case 0:
                case 1:
                case 2:	// Poison them
                    {
                        m_Mobile.DebugSay( "Attempting to poison" );

                        if ( !c.Poisoned )
                            spell = new PoisonSpell( m_Mobile, null );

                        break;
                    }
                case 3:	// Bless ourselves.
                    {
                        m_Mobile.DebugSay( "Blessing myself" );

                        if ( Utility.RandomBool() && !ArcaneEmpowermentSpell.IsBuffed( m_Mobile ) )
                            spell = new ArcaneEmpowermentSpell( m_Mobile, null );
                        else
                            spell = new BlessSpell( m_Mobile, null );

                        break;
                    }
                case 4: // Wildfire
                    {
                        m_Mobile.DebugSay( "Incendio!" );

                        spell = new WildfireSpell( m_Mobile, null );

                        break;
                    }
                case 5: // Reduce their cast speed
                    {
                        if ( c.InRange( m_Mobile.Location, 6 ) )
                        {
                            if ( m_Mobile.Skills[SkillName.Spellweaving].Value >= 90.0 )
                                spell = new EssenceOfWindSpell( m_Mobile, null );
                            else if ( c.InRange( m_Mobile.Location, 2 ) )
                                spell = new ThunderstormSpell( m_Mobile, null );
                        }

                        m_Mobile.DebugSay( "Attempting to reduce their cast speed" );

                        break;
                    }
                case 6: // Curse them.
                    {
                        m_Mobile.DebugSay( "Attempting to curse" );

                        spell = GetRandomCurseSpell( c );
                        break;
                    }
                case 7:	// Paralyze them.
                    {
                        m_Mobile.DebugSay( "Attempting to paralyze" );

                        if ( m_Mobile.Skills[SkillName.Magery].Value > 50.0 )
                            spell = new ParalyzeSpell( m_Mobile, null );

                        break;
                    }
                case 8: // Drain mana
                    {
                        m_Mobile.DebugSay( "Attempting to drain mana" );

                        spell = GetRandomManaDrainSpell( c );
                        break;
                    }

                default: // Damage them.
                    {
                        m_Mobile.DebugSay( "Just doing damage" );

                        spell = GetRandomDamageSpell( c );
                        break;
                    }
            }

            return spell;
        }
Exemple #12
0
		public override bool DoActionCombat()
		{
			Mobile c = m_Mobile.Combatant;
			m_Mobile.Warmode = true;

			if (c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee(c) || !m_Mobile.CanBeHarmful(c, false) || c.Map != m_Mobile.Map)
			{
				// Our combatant is deleted, dead, hidden, or we cannot hurt them
				// Try to find another combatant

				if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
				{
					if (m_Mobile.Debug)
						m_Mobile.DebugSay("Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name);

					m_Mobile.Combatant = c = m_Mobile.FocusMob;
					m_Mobile.FocusMob = null;
				}
				else
				{
					m_Mobile.DebugSay("Something happened to my combatant, and nothing is around. I am on guard.");
					Action = ActionType.Guard;
					return true;
				}
			}

			if (!m_Mobile.InLOS(c))
			{
				if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
				{
					m_Mobile.Combatant = c = m_Mobile.FocusMob;
					m_Mobile.FocusMob = null;
				}
			}

			if (SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.Anatomy].Value >= 80.0)
				EventSink.InvokeStunRequest(new StunRequestEventArgs(m_Mobile));

			if (!m_Mobile.InRange(c, m_Mobile.RangePerception))
			{
				// They are somewhat far away, can we find something else?

				if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
				{
					m_Mobile.Combatant = m_Mobile.FocusMob;
					m_Mobile.FocusMob = null;
				}
				else if (!m_Mobile.InRange(c, m_Mobile.RangePerception * 3))
				{
					m_Mobile.Combatant = null;
				}

				c = m_Mobile.Combatant;

				if (c == null)
				{
					m_Mobile.DebugSay("My combatant has fled, so I am on guard");
					Action = ActionType.Guard;

					return true;
				}
			}

			if (!m_Mobile.Controlled && !m_Mobile.Summoned)
			{
				if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100)
				{
					// We are low on health, should we flee?

					bool flee = false;

					if (m_Mobile.Hits < c.Hits)
					{
						// We are more hurt than them

						int diff = c.Hits - m_Mobile.Hits;

						flee = (Utility.Random(0, 100) > (10 + diff)); // (10 + diff)% chance to flee
					}
					else
					{
						flee = Utility.Random(0, 100) > 10; // 10% chance to flee
					}

					if (flee)
					{
						if (m_Mobile.Debug)
							m_Mobile.DebugSay("I am going to flee from {0}", c.Name);

						Action = ActionType.Flee;
						return true;
					}
				}
			}

			if (m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange(c, 12))
			{
				// We are ready to cast a spell

				Spell spell = null;
				Mobile toDispel = FindDispelTarget(true);

				if (m_Mobile.Poisoned) // Top cast priority is cure
				{
					spell = new CureSpell(m_Mobile, null);
					try
					{
						if ((((m_Mobile.Skills[SkillName.Magery].Value / (m_Mobile.Poison.Level + 1)) - 20) * 7.5) > 50)
						{
							spell = new CureSpell(m_Mobile, null);
						}
						else
						{
							spell = new ArchCureSpell(m_Mobile, null);
						}
					}
					catch
					{
						spell = new CureSpell(m_Mobile, null);
					}
				}
				else if (toDispel != null) // Something dispellable is attacking us
				{
					spell = DoDispel(toDispel);
				}
				else if (m_Combo != -1) // We are doing a spell combo
				{
					spell = DoCombo(c);
				}
				else if ((c.Spell is HealSpell || c.Spell is GreaterHealSpell) && !c.Poisoned) // They have a heal spell out
				{
					spell = new PoisonSpell(m_Mobile, null);
				}
				else
				{
					spell = ChooseSpell(c);
				}

				// Now we have a spell picked
				// Move first before casting

				if (SmartAI && toDispel != null)
				{
					if (m_Mobile.InRange(toDispel, 10))
						RunFrom(toDispel);
					else if (!m_Mobile.InRange(toDispel, 12))
						RunTo(toDispel);
				}
				else
				{
					RunTo(c);
				}

				if (spell != null && spell.Cast())
				{
					TimeSpan delay;

					if (SmartAI || (spell is DispelSpell))
					{
						delay = TimeSpan.FromSeconds(m_Mobile.ActiveSpeed);
					}
					if (spell is HarmSpell)
					{
						delay = TimeSpan.FromSeconds(m_Mobile.ActiveSpeed);
					}

					else
					{
						double del = ScaleByMagery(4.3);
						double min = 6.0 - (del * 0.75);
						double max = 6.0 - (del * 1.25);

						delay = TimeSpan.FromSeconds(min + ((max - min) * Utility.RandomDouble()));
					}

					m_NextCastTime = DateTime.Now + delay;
				}
			}
			else if (m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting)
			{
				RunTo(c);
			}

			return true;
		}
Exemple #13
0
		public virtual Spell DoCombo(Mobile c)
		{
			Spell spell = null;

			if (m_Combo == 0)
			{
				//m_Mobile.Say( "combo phase 0" );
				spell = new ExplosionSpell(m_Mobile, null);
				++m_Combo; // Move to next spell
			}
			else if (m_Combo == 1)
			{
				//m_Mobile.Say( "combo phase 1" );
				spell = new ExplosionSpell(m_Mobile, null);
				++m_Combo; // Move to next spell
			}
			else if (m_Combo == 2)
			{
				//m_Mobile.Say( "combo phase 2" );
				if (!c.Poisoned)
					spell = new PoisonSpell(m_Mobile, null);

				++m_Combo; // Move to next spell
			}

			else if (m_Combo == 3)
			{

				//m_Mobile.Say( "combo phase 3" );
				if (c.Poisoned)
					spell = new WeakenSpell(m_Mobile, null);

				if (!c.Poisoned)
					spell = new PoisonSpell(m_Mobile, null);

				++m_Combo; // Move to next spell
			}

			else if (m_Combo == 4)
			{
				//	m_Mobile.Say( "combo phase 4 ebolt" );
				spell = new EnergyBoltSpell(m_Mobile, null);

				++m_Combo; // Move to next spell
			}

			else if (m_Combo == 5)
			{
				//m_Mobile.Say( "combo phase 5" );
				if (c.Poisoned && c.Alive)
				{
					spell = new HarmSpell(m_Mobile, null);

					m_Combo = 5; // Move to next spell
				}

				if (!c.Poisoned)
				{
					if (m_Mobile.Mana > 20)
						spell = new EnergyBoltSpell(m_Mobile, null);

					if (m_Mobile.Mana < 19)
						spell = new LightningSpell(m_Mobile, null);
					m_Combo = -1; // Reset combo state
				}

			}

			return spell;
		}
Exemple #14
0
        public virtual Spell ChooseSpell( Mobile c )
        {
            Spell spell = null;

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

                if( spell != null )
                    return spell;

                switch( Utility.Random(16) )
                {
                    case 0:
                        {
                            spell = new FireballSpell(m_Mobile, null);
                            break;
                        }
                    case 1:
                        {
                            m_Mobile.DebugSay("Protecting myself");

                            spell = new ProtectionSpell(m_Mobile, null);
                            break;
                        }
                    case 2:	// Poison them
                        {
                            m_Mobile.DebugSay("Attempting to poison");

                            if( !c.Poisoned )
                                spell = new PoisonSpell(m_Mobile, null);

                            break;
                        }
                    case 3:	// Bless ourselves.
                        {
                            m_Mobile.DebugSay("Blessing myself");

                            spell = new BlessSpell(m_Mobile, null);
                            break;
                        }
                    case 4:
                        {
                            m_Mobile.DebugSay("Summoning FIRE FIELD!!!");

                            spell = new FireFieldSpell(m_Mobile, null);
                            break;
                        }
                    case 5:
                    case 6: // Curse them.
                        {
                            m_Mobile.DebugSay("Attempting to curse");

                            spell = GetRandomCurseSpell();
                            break;
                        }
                    case 7:	// Paralyze them.
                        {
                            m_Mobile.DebugSay("Attempting to paralyze");

                            if( m_Mobile.Skills[SkillName.Magery].Value > 50.0 )
                                spell = new ParalyzeSpell(m_Mobile, null);

                            break;
                        }
                    case 8: // Drain mana
                        {
                            m_Mobile.DebugSay("Attempting to drain mana");

                            spell = GetRandomManaDrainSpell();
                            break;
                        }

                    default: // Damage them.
                        {
                            m_Mobile.DebugSay("Just doing damage");

                            spell = GetRandomDamageSpell();
                            break;
                        }
                }

                return spell;
            }

            spell = CheckCastHealingSpell();

            if( spell != null )
                return spell;

            if( !c.Poisoned && c.Spell != null && c.Mana > (c.ManaMax / 2) )
                return GetRandomManaDrainSpell();

            if( m_Mobile.Hits < (m_Mobile.HitsMax / 2) && 0.30 > Utility.RandomDouble() )
            {
                spell = new ProtectionSpell(m_Mobile, null);

                if( spell == null )
                    spell = new BlessSpell(m_Mobile, null);

                if( spell != null )
                    return spell;
            }

            if( c.Hits < (c.HitsMax * 0.30) ) //They're dying, set up a kill combo
            {
                m_Combo = 0;

                if( !c.Poisoned )
                    spell = new PoisonSpell(m_Mobile, null);
                else
                    spell = new ParalyzeSpell(m_Mobile, null);
            }

            switch( Utility.Random(10) )
            {
                default:
                case 0: // Deal some damage
                    {
                        spell = GetRandomDamageSpell();
                        break;
                    }
                case 1: // Poison them
                    {
                        if( !c.Poisoned )
                            spell = new PoisonSpell(m_Mobile, null);

                        break;
                    }
                case 2: // Set up a combo
                    {
                        if( m_Mobile.Mana < 40 && m_Mobile.Mana > 15 )
                        {
                            if( c.Paralyzed && !c.Poisoned )
                            {
                                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.Random(2) == 0 && !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;
                    }
                case 3:
                    {
                        spell = GetRandomCurseSpell();
                        break;
                    }
            }

            return spell;
        }
		public override bool Think()
		{
			if (m_Mobile.Deleted)
			{
				return false;
			}

			Mobile combatant = m_Guard.Combatant;

			if (combatant == null || combatant.Deleted || !combatant.Alive || combatant.IsDeadBondedPet ||
				!m_Mobile.CanSee(combatant) || !m_Mobile.CanBeHarmful(combatant, false) || combatant.Map != m_Mobile.Map)
			{
				// Our combatant is deleted, dead, hidden, or we cannot hurt them
				// Try to find another combatant
				if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
				{
					m_Mobile.Combatant = combatant = m_Mobile.FocusMob;
					m_Mobile.FocusMob = null;
				}
				else
				{
					m_Mobile.Combatant = combatant = null;
				}
			}

			if (combatant != null && (!m_Mobile.InLOS(combatant) || !m_Mobile.InRange(combatant, 12)))
			{
				if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
				{
					m_Mobile.Combatant = combatant = m_Mobile.FocusMob;
					m_Mobile.FocusMob = null;
				}
				else if (!m_Mobile.InRange(combatant, 36))
				{
					m_Mobile.Combatant = combatant = null;
				}
			}

			Mobile dispelTarget = FindDispelTarget(true);

			if (m_Guard.Target != null && m_ReleaseTarget == DateTime.MinValue)
			{
				m_ReleaseTarget = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
			}

			if (m_Guard.Target != null && DateTime.UtcNow > m_ReleaseTarget)
			{
				Target targ = m_Guard.Target;

				Mobile toHarm = (dispelTarget == null ? combatant : dispelTarget);

				if ((targ.Flags & TargetFlags.Harmful) != 0 && toHarm != null)
				{
					if (m_Guard.Map == toHarm.Map && (targ.Range < 0 || m_Guard.InRange(toHarm, targ.Range)) && m_Guard.CanSee(toHarm) &&
						m_Guard.InLOS(toHarm))
					{
						targ.Invoke(m_Guard, toHarm);
					}
					else if (targ is DispelSpell.InternalTarget)
					{
						targ.Cancel(m_Guard, TargetCancelType.Canceled);
					}
				}
				else if ((targ.Flags & TargetFlags.Beneficial) != 0)
				{
					targ.Invoke(m_Guard, m_Guard);
				}
				else
				{
					targ.Cancel(m_Guard, TargetCancelType.Canceled);
				}

				m_ReleaseTarget = DateTime.MinValue;
			}

			if (dispelTarget != null)
			{
				if (Action != ActionType.Combat)
				{
					Action = ActionType.Combat;
				}

				m_Guard.Warmode = true;

				RunFrom(dispelTarget);
			}
			else if (combatant != null)
			{
				if (Action != ActionType.Combat)
				{
					Action = ActionType.Combat;
				}

				m_Guard.Warmode = true;

				RunTo(combatant);
			}
			else if (m_Guard.Orders.Movement != MovementType.Stand)
			{
				Mobile toFollow = null;

				if (m_Guard.Town != null && m_Guard.Orders.Movement == MovementType.Follow)
				{
					toFollow = m_Guard.Orders.Follow;

					if (toFollow == null)
					{
						toFollow = m_Guard.Town.Sheriff;
					}
				}

				if (toFollow != null && toFollow.Map == m_Guard.Map && toFollow.InRange(m_Guard, m_Guard.RangePerception * 3) &&
					Town.FromRegion(toFollow.Region) == m_Guard.Town)
				{
					if (Action != ActionType.Combat)
					{
						Action = ActionType.Combat;
					}

					if (m_Mobile.CurrentSpeed != m_Mobile.ActiveSpeed)
					{
						m_Mobile.CurrentSpeed = m_Mobile.ActiveSpeed;
					}

					m_Guard.Warmode = true;

					RunTo(toFollow);
				}
				else
				{
					if (Action != ActionType.Wander)
					{
						Action = ActionType.Wander;
					}

					if (m_Mobile.CurrentSpeed != m_Mobile.PassiveSpeed)
					{
						m_Mobile.CurrentSpeed = m_Mobile.PassiveSpeed;
					}

					m_Guard.Warmode = false;

					WalkRandomInHome(2, 2, 1);
				}
			}
			else
			{
				if (Action != ActionType.Wander)
				{
					Action = ActionType.Wander;
				}

				m_Guard.Warmode = false;
			}

			if ((IsDamaged || IsPoisoned) && m_Guard.Skills.Healing.Base > 20.0)
			{
				TimeSpan ts = TimeUntilBandage;

				if (ts == TimeSpan.MaxValue)
				{
					StartBandage();
				}
			}

			if (m_Mobile.Spell == null && Core.TickCount >= m_Mobile.NextSpellTime)
			{
				Spell spell = null;

				DateTime toRelease = DateTime.MinValue;

				if (IsPoisoned)
				{
					Poison p = m_Guard.Poison;

					TimeSpan ts = TimeUntilBandage;

					if (p != Poison.Lesser || ts == TimeSpan.MaxValue || TimeUntilBandage < TimeSpan.FromSeconds(1.5) ||
						(m_Guard.HitsMax - m_Guard.Hits) > Utility.Random(250))
					{
						if (IsAllowed(GuardAI.Bless))
						{
							spell = new CureSpell(m_Guard, null);
						}
						else
						{
							UseItemByType(typeof(BaseCurePotion));
						}
					}
				}
				else if (IsDamaged && (m_Guard.HitsMax - m_Guard.Hits) > Utility.Random(200))
				{
					if (IsAllowed(GuardAI.Magic) && ((m_Guard.Hits * 100) / Math.Max(m_Guard.HitsMax, 1)) < 10 &&
						m_Guard.Home != Point3D.Zero && !Utility.InRange(m_Guard.Location, m_Guard.Home, 15) && m_Guard.Mana >= 11)
					{
						spell = new RecallSpell(m_Guard, null, new RunebookEntry(m_Guard.Home, m_Guard.Map, "Guard's Home", null), null);
					}
					else if (IsAllowed(GuardAI.Bless))
					{
						if (m_Guard.Mana >= 11 && (m_Guard.Hits + 30) < m_Guard.HitsMax)
						{
							spell = new GreaterHealSpell(m_Guard, null);
						}
						else if ((m_Guard.Hits + 10) < m_Guard.HitsMax &&
								 (m_Guard.Mana < 11 || (m_Guard.NextCombatTime - Core.TickCount) > 2000))
						{
							spell = new HealSpell(m_Guard, null);
						}
					}
					else if (m_Guard.CanBeginAction(typeof(BaseHealPotion)))
					{
						UseItemByType(typeof(BaseHealPotion));
					}
				}
				else if (dispelTarget != null && (IsAllowed(GuardAI.Magic) || IsAllowed(GuardAI.Bless) || IsAllowed(GuardAI.Curse)))
				{
					if (!dispelTarget.Paralyzed && m_Guard.Mana > (ManaReserve + 20) && 40 > Utility.Random(100))
					{
						spell = new ParalyzeSpell(m_Guard, null);
					}
					else
					{
						spell = new DispelSpell(m_Guard, null);
					}
				}

				if (combatant != null)
				{
					if (m_Combo != null)
					{
						if (spell == null)
						{
							spell = SpellCombo.Process(m_Guard, combatant, ref m_Combo, ref m_ComboIndex, ref toRelease);
						}
						else
						{
							m_Combo = null;
							m_ComboIndex = -1;
						}
					}
					else if (20 > Utility.Random(100) && IsAllowed(GuardAI.Magic))
					{
						if (80 > Utility.Random(100))
						{
							m_Combo = (IsAllowed(GuardAI.Smart) ? SpellCombo.Simple : SpellCombo.Strong);
							m_ComboIndex = -1;

							if (m_Guard.Mana >= (ManaReserve + m_Combo.Mana))
							{
								spell = SpellCombo.Process(m_Guard, combatant, ref m_Combo, ref m_ComboIndex, ref toRelease);
							}
							else
							{
								m_Combo = null;

								if (m_Guard.Mana >= (ManaReserve + 40))
								{
									spell = RandomOffenseSpell();
								}
							}
						}
						else if (m_Guard.Mana >= (ManaReserve + 40))
						{
							spell = RandomOffenseSpell();
						}
					}

					if (spell == null && 2 > Utility.Random(100) && m_Guard.Mana >= (ManaReserve + 10))
					{
						int strMod = GetStatMod(m_Guard, StatType.Str);
						int dexMod = GetStatMod(m_Guard, StatType.Dex);
						int intMod = GetStatMod(m_Guard, StatType.Int);

						var types = new List<Type>();

						if (strMod <= 0)
						{
							types.Add(typeof(StrengthSpell));
						}

						if (dexMod <= 0 && IsAllowed(GuardAI.Melee))
						{
							types.Add(typeof(AgilitySpell));
						}

						if (intMod <= 0 && IsAllowed(GuardAI.Magic))
						{
							types.Add(typeof(CunningSpell));
						}

						if (IsAllowed(GuardAI.Bless))
						{
							if (types.Count > 1)
							{
								spell = new BlessSpell(m_Guard, null);
							}
							else if (types.Count == 1)
							{
								spell = (Spell)Activator.CreateInstance(types[0], new object[] {m_Guard, null});
							}
						}
						else if (types.Count > 0)
						{
							if (types[0] == typeof(StrengthSpell))
							{
								UseItemByType(typeof(BaseStrengthPotion));
							}
							else if (types[0] == typeof(AgilitySpell))
							{
								UseItemByType(typeof(BaseAgilityPotion));
							}
						}
					}

					if (spell == null && 2 > Utility.Random(100) && m_Guard.Mana >= (ManaReserve + 10) && IsAllowed(GuardAI.Curse))
					{
						if (!combatant.Poisoned && 40 > Utility.Random(100))
						{
							spell = new PoisonSpell(m_Guard, null);
						}
						else
						{
							int strMod = GetStatMod(combatant, StatType.Str);
							int dexMod = GetStatMod(combatant, StatType.Dex);
							int intMod = GetStatMod(combatant, StatType.Int);

							var types = new List<Type>();

							if (strMod >= 0)
							{
								types.Add(typeof(WeakenSpell));
							}

							if (dexMod >= 0 && IsAllowed(GuardAI.Melee))
							{
								types.Add(typeof(ClumsySpell));
							}

							if (intMod >= 0 && IsAllowed(GuardAI.Magic))
							{
								types.Add(typeof(FeeblemindSpell));
							}

							if (types.Count > 1)
							{
								spell = new CurseSpell(m_Guard, null);
							}
							else if (types.Count == 1)
							{
								spell = (Spell)Activator.CreateInstance(types[0], new object[] {m_Guard, null});
							}
						}
					}
				}

				if (spell != null && (m_Guard.HitsMax - m_Guard.Hits + 10) > Utility.Random(100))
				{
					Type type = null;

					if (spell is GreaterHealSpell)
					{
						type = typeof(BaseHealPotion);
					}
					else if (spell is CureSpell)
					{
						type = typeof(BaseCurePotion);
					}
					else if (spell is StrengthSpell)
					{
						type = typeof(BaseStrengthPotion);
					}
					else if (spell is AgilitySpell)
					{
						type = typeof(BaseAgilityPotion);
					}

					if (type == typeof(BaseHealPotion) && !m_Guard.CanBeginAction(type))
					{
						type = null;
					}

					if (type != null && m_Guard.Target == null && UseItemByType(type))
					{
						if (spell is GreaterHealSpell)
						{
							if ((m_Guard.Hits + 30) > m_Guard.HitsMax && (m_Guard.Hits + 10) < m_Guard.HitsMax)
							{
								spell = new HealSpell(m_Guard, null);
							}
						}
						else
						{
							spell = null;
						}
					}
				}
				else if (spell == null && m_Guard.Stam < (m_Guard.StamMax / 3) && IsAllowed(GuardAI.Melee))
				{
					UseItemByType(typeof(BaseRefreshPotion));
				}

				if (spell == null || !spell.Cast())
				{
					EquipWeapon();
				}
			}
			else if (m_Mobile.Spell is Spell && ((Spell)m_Mobile.Spell).State == SpellState.Sequencing)
			{
				EquipWeapon();
			}

			return true;
		}
        public virtual Spell ChooseSpell( Mobile c )
        {
            Spell spell = null;

            spell = CheckCastHealingSpell();

            if ( spell != null )
                return spell;

            switch (Utility.Random(5))
            {
                default:
                case 0: case 1: case 2: // Deal some damage
                    {
                        spell = GetRandomDamageSpell(c);
                        break;
                    }
                case 3: // Curse it
                    {
                        spell = GetRandomCurseSpell();
                        break;
                    }
                case 4: // Set up a combo of attacks
                    {
                        switch ( Utility.Random( 6 ) )
                        {
                            default: case  0:
                            {
                                m_Combo = 0;
                                spell = new PoisonSpell(m_Mobile, null);
                                m_Mobile.DebugSay( "Poison" );
                                break;
                            }
                            case  1:
                            {
                                m_Combo = 0;
                                spell = new EvilOmenSpell(m_Mobile, null);
                                m_Mobile.DebugSay( "Evil Omen" );
                                break;
                            }
                            case  2:
                            {
                                m_Combo = 7;
                                spell = new CorpseSkinSpell(m_Mobile, null);
                                m_Mobile.DebugSay( "Corpse Skin" );
                                break;
                            }
                            case  3:
                            {
                                m_Combo = 7;
                                spell = new CurseSpell(m_Mobile, null);
                                m_Mobile.DebugSay( "Curse" );
                                break;
                            }
                            case  4:
                            {
                                m_Combo = 10;
                                spell = new CurseSpell(m_Mobile, null);
                                m_Mobile.DebugSay( "Curse" );
                                break;
                            }
                            case  5:
                            {
                                m_Combo = 10;
                                spell = new ExplosionSpell(m_Mobile, null);
                                m_Mobile.DebugSay( "Explosion" );
                                break;
                            }
                        }
                        break;
                    }
            }

            return spell;
        }
Exemple #17
0
 public InternalTarget(PoisonSpell owner)
     : base(owner.Caster.EraML ? 10 : 12, false, TargetFlags.Harmful)
 {
     m_Owner = owner;
 }
Exemple #18
0
 public InternalTarget(PoisonSpell owner)
     : base(owner.Caster.EraML ? 10 : 12, false, TargetFlags.Harmful)
 {
     m_Owner = owner;
 }
Exemple #19
0
        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:
                    case 2:	// Poison them
                    {
                        m_Mobile.DebugSay( "Attempting to poison" );

                        if ( !c.Poisoned )
                            spell = new PoisonSpell( m_Mobile, null );

                        break;
                    }
                    case 3:	// Bless ourselves.
                    {
                        m_Mobile.DebugSay( "Blessing myself" );

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

                        spell = GetRandomCurseSpell();
                        break;
                    }
                    case 7:	// Paralyze them.
                    {
                        m_Mobile.DebugSay( "Attempting to paralyze" );

                        if ( m_Mobile.Skills[SkillName.Magery].Value > 50.0 )
                            spell = new ParalyzeSpell( m_Mobile, null );

                        break;
                    }
                    case 8: // Drain mana
                    {
                        m_Mobile.DebugSay( "Attempting to drain mana" );

                        spell = GetRandomManaDrainSpell();
                        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 ) )
            {
                default:
                case 0: // Poison them
                {
                    if ( !c.Poisoned )
                        spell = new PoisonSpell( m_Mobile, null );

                    break;
                }
                case 1: // Deal some damage
                {
                    spell = GetRandomDamageSpell();

                    break;
                }
                case 2: // Set up a combo
                {
                    if ( m_Mobile.Mana < 40 && m_Mobile.Mana > 15 )
                    {
                        if ( c.Paralyzed && !c.Poisoned )
                        {
                            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.Random( 2 ) == 0 && !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;
        }
Exemple #20
0
        public override Spell DoCombo(Mobile c)
        {
            Spell spell = null;

            if (m_NecroComboType == NecroComboType.None)
            {
                m_NecroComboType = (NecroComboType)Utility.RandomMinMax(1, 7);
                m_Combo = 0;
                m_Mobile.DebugSay("Doing {0} Combo", m_NecroComboType);
            }

            if (m_Combo == 0)
            {
                switch (m_NecroComboType)
                {
                    case NecroComboType.Exp_FS_Omen_Poison_PS:
                    case NecroComboType.Exp_MB_Omen_Poison_PS:
                    case NecroComboType.Exp_EB_Omen_Poison_PS:
                    case NecroComboType.Exp_FB_MA_Poison_PS:
                    case NecroComboType.Exp_FB_Poison_PS:
                    case NecroComboType.Exp_FB_MA_PS:
                    case NecroComboType.Exp_Poison_FB_PS: spell = new ExplosionSpell(m_Mobile, null); break;
                }

                ++m_Combo;
            }
            else if (m_Combo == 1)
            {
                switch (m_NecroComboType)
                {
                    case NecroComboType.Exp_FS_Omen_Poison_PS: spell = new FlameStrikeSpell(m_Mobile, null); break;
                    case NecroComboType.Exp_MB_Omen_Poison_PS: spell = new MindBlastSpell(m_Mobile, null); break;
                    case NecroComboType.Exp_EB_Omen_Poison_PS: spell = new EnergyBoltSpell(m_Mobile, null); break;
                    case NecroComboType.Exp_FB_MA_Poison_PS:
                    case NecroComboType.Exp_FB_Poison_PS:
                    case NecroComboType.Exp_FB_MA_PS: spell = new FireballSpell(m_Mobile, null); break;
                    case NecroComboType.Exp_Poison_FB_PS: spell = new PoisonSpell(m_Mobile, null); break;
                }

                ++m_Combo;
            }
            else if (m_Combo == 2)
            {
                switch (m_NecroComboType)
                {
                    case NecroComboType.Exp_FS_Omen_Poison_PS:
                    case NecroComboType.Exp_MB_Omen_Poison_PS:
                    case NecroComboType.Exp_EB_Omen_Poison_PS: spell = new EvilOmenSpell(m_Mobile, null); break;
                    case NecroComboType.Exp_FB_MA_Poison_PS: spell = new MagicArrowSpell(m_Mobile, null); break;
                    case NecroComboType.Exp_FB_Poison_PS: spell = new PoisonSpell(m_Mobile, null); break;
                    case NecroComboType.Exp_FB_MA_PS: spell = new MagicArrowSpell(m_Mobile, null); break;
                    case NecroComboType.Exp_Poison_FB_PS: spell = new FireballSpell(m_Mobile, null); break;
                }

                ++m_Combo;
            }
            else if (m_Combo == 3)
            {
                switch (m_NecroComboType)
                {
                    case NecroComboType.Exp_FS_Omen_Poison_PS:
                    case NecroComboType.Exp_MB_Omen_Poison_PS:
                    case NecroComboType.Exp_EB_Omen_Poison_PS:
                    case NecroComboType.Exp_FB_MA_Poison_PS:
                    case NecroComboType.Exp_FB_Poison_PS: spell = new PoisonSpell(m_Mobile, null); break;
                    case NecroComboType.Exp_FB_MA_PS:
                    case NecroComboType.Exp_Poison_FB_PS:
                        if (Utility.RandomBool())
                            spell = new PoisonStrikeSpell(m_Mobile, null);
                        else
                            spell = new PainSpikeSpell(m_Mobile, null);
                        EndCombo();
                        return spell;
                }

                ++m_Combo;
            }

            else if (m_Combo == 4)
            {
                switch (m_NecroComboType)
                {
                    case NecroComboType.Exp_FS_Omen_Poison_PS:
                    case NecroComboType.Exp_MB_Omen_Poison_PS:
                    case NecroComboType.Exp_EB_Omen_Poison_PS:
                    case NecroComboType.Exp_FB_MA_Poison_PS:
                    case NecroComboType.Exp_FB_Poison_PS:
                    case NecroComboType.Exp_FB_MA_PS:
                    case NecroComboType.Exp_Poison_FB_PS:
                        if (Utility.RandomBool())
                            spell = new PoisonStrikeSpell(m_Mobile, null);
                        else
                            spell = new PainSpikeSpell(m_Mobile, null);
                        EndCombo();
                        return spell;
                }
            }

            return spell;
        }
Exemple #21
0
 public InternalSphereTarget(PoisonSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
 {
     m_Owner = owner;
     m_Owner.Caster.SendAsciiMessage("Select target...");
 }
Exemple #22
0
 public InternalTarget(PoisonSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
 {
     this.m_Owner = owner;
 }
Exemple #23
0
        public virtual Spell DoCombo(Mobile c)
        {
            Spell spell = null;

            if (m_ComboType == ComboType.None)
                m_ComboType = (ComboType)Utility.RandomMinMax(1, 7);

            if (m_Combo == 1)
            {
                switch (m_ComboType)
                {
                    case ComboType.Exp_FS_Poison:
                    case ComboType.Exp_MB_Poison:
                    case ComboType.Exp_EB_Poison:
                    case ComboType.Exp_FB_MA_Poison:
                    case ComboType.Exp_FB_Poison_Light:
                    case ComboType.Exp_FB_MA_Light:
                    case ComboType.Exp_Poison_FB_Light: spell = new ExplosionSpell(m_Mobile, null); break;
                }
            }
            else if (m_Combo == 2)
            {
                switch (m_ComboType)
                {
                    case ComboType.Exp_FS_Poison: spell = new FlameStrikeSpell(m_Mobile, null); break;
                    case ComboType.Exp_MB_Poison: spell = new MindBlastSpell(m_Mobile, null); break;
                    case ComboType.Exp_EB_Poison: spell = new EnergyBoltSpell(m_Mobile, null); break;
                    case ComboType.Exp_FB_MA_Poison: spell = new FireballSpell(m_Mobile, null); break;
                    case ComboType.Exp_FB_Poison_Light: spell = new FireballSpell(m_Mobile, null); break;
                    case ComboType.Exp_FB_MA_Light: spell = new FireballSpell(m_Mobile, null); break;
                    case ComboType.Exp_Poison_FB_Light: spell = new PoisonSpell(m_Mobile, null); break;
                }
            }
            else if (m_Combo == 3)
            {
                switch (m_ComboType)
                {
                    case ComboType.Exp_FS_Poison:
                    case ComboType.Exp_MB_Poison:
                    case ComboType.Exp_EB_Poison:
                        spell = new PoisonSpell(m_Mobile, null);
                        EndCombo();
                        return spell;
                    case ComboType.Exp_FB_MA_Poison: spell = new MagicArrowSpell(m_Mobile, null); break;
                    case ComboType.Exp_FB_Poison_Light: spell = new PoisonSpell(m_Mobile, null); break;
                    case ComboType.Exp_FB_MA_Light: spell = new MagicArrowSpell(m_Mobile, null); break;
                    case ComboType.Exp_Poison_FB_Light: spell = new FireballSpell(m_Mobile, null); break;
                }
            }
            else if (m_Combo == 4)
            {
                switch (m_ComboType)
                {
                    case ComboType.Exp_FS_Poison:
                    case ComboType.Exp_MB_Poison:
                    case ComboType.Exp_EB_Poison:
                        spell = new LightningSpell(m_Mobile, null);
                        EndCombo();
                        return spell;
                    case ComboType.Exp_FB_MA_Poison: spell = new PoisonSpell(m_Mobile, null); break;
                    case ComboType.Exp_FB_Poison_Light:
                    case ComboType.Exp_FB_MA_Light:
                    case ComboType.Exp_Poison_FB_Light: spell = new LightningSpell(m_Mobile, null);
                        EndCombo();
                        return spell;
                }
            }
            else if (m_Combo == 5)
            {
                switch (m_ComboType)
                {
                    case ComboType.Exp_FS_Poison:
                    case ComboType.Exp_MB_Poison:
                    case ComboType.Exp_EB_Poison:
                    case ComboType.Exp_FB_MA_Poison:
                    case ComboType.Exp_FB_Poison_Light:
                    case ComboType.Exp_FB_MA_Light:
                    case ComboType.Exp_Poison_FB_Light:
                        spell = new LightningSpell(m_Mobile, null);
                        EndCombo();
                        return spell;
                }
            }

            m_Combo++; // Move to next spell

            if (spell == null)
                spell = new PoisonSpell(m_Mobile, null);

            return spell;
        }
      public override void OnSpeech( SpeechEventArgs e )
      {
         base.OnSpeech(e);
         Mobile from = e.Mobile;

// if( e.Layer.Helm is NecromaticMask )
	if ( from.FindItemOnLayer( Layer.Helm ) is NecromaticMask )
         {
            if (e.Speech.IndexOf( "nwapslleh" ) >= 0  )

            {
                  m_pss = new PoisonSpell( this, null ); // get your spell
                  if( m_pss.Cast() ) // if it casts the spell
                  {
                     TimeSpan castDelay = m_pss.GetCastDelay();
                     m_CastTimer = new PSCastTimer( m_pss, from, castDelay );
                     m_CastTimer.Start();
                  }
               }
            }
}
		public Spell GetMagerySpell()
		{
			Spell spell = null;

			// always check for bless, per OSI
			spell = CheckBless();

			if ( spell != null )
			{
				if ( m_Mobile.Debug )
					m_Mobile.Say( 1156, "Blessing my self" );

				return spell;
			}

			// always check for curse, per OSI
			spell = CheckCurse();

			if ( spell != null )
			{
				if ( m_Mobile.Debug )
					m_Mobile.Say( 1156, "Cursing my opponent" );

				return spell;
			}

			// 25% chance to cast poison if needed
			if ( m_Mobile.Combatant != null && !m_Mobile.Combatant.Poisoned && Utility.RandomDouble() > 0.75 )
			{
				if ( m_Mobile.Debug )
					m_Mobile.Say( 1156, "Casting Poison" );

				spell = new PoisonSpell( m_Mobile, null );
			}

			// scaling chance to drain mana based on how much of a caster the opponent is
			if ( CheckManaDrain() > 0.75 )
			{
				if ( m_Mobile.Skills[SkillName.Magery].Value > 80.0 )
					spell = new ManaVampireSpell( m_Mobile, null );
				else if ( m_Mobile.Skills[SkillName.Magery].Value > 40.0 )
					spell = new ManaDrainSpell( m_Mobile, null );

				if ( spell != null )
				{
					if ( m_Mobile.Debug )
						m_Mobile.Say( 1156, "Draining mana" );

					return spell;
				}
			}

			// 10% chance to summon help
			if ( m_CanUseMagerySummon && Utility.RandomDouble() > 0.90 )
			{
				spell = CheckMagerySummon();

				if ( spell != null )
				{
					if ( m_Mobile.Debug )
						m_Mobile.Say( 1156, "Summoning help" );
					return spell;
				}
			}

			// Let's just blast the hell out of them.
			return GetRandomMageryDamageSpell();
		}
 public PSCastTimer( PoisonSpell spell, Mobile target, TimeSpan castDelay ) : base( castDelay )
 {
    m_Spell = spell;
    m_Target = target;
    Priority = TimerPriority.OneSecond;
 }
Exemple #27
0
			public InternalTarget( PoisonSpell owner ) : base( 12, false, TargetFlags.Harmful )
			{
				m_Owner = owner;
			}
 public InternalSphereTarget(PoisonSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
 {
     m_Owner = owner;
     m_Owner.Caster.SendAsciiMessage("Selecione o alvo...");
 }
Exemple #29
0
        public virtual Spell ChooseSpell(Mobile c)
        {
            Spell spell = null;

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

                if (spell != null)
                    return spell;

                if (IsNecromancer)
                {
                    double psDamage = ((m_Mobile.Skills[SkillName.SpiritSpeak].Value - c.Skills[SkillName.MagicResist].Value) / 10) + (c.Player ? 18 : 30);

                    if (psDamage > c.Hits)
                        return new PainSpikeSpell(m_Mobile, null);
                }

                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;
        }
Exemple #30
0
 public InternalTarget(PoisonSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
 {
     this.m_Owner = owner;
 }
Exemple #31
0
        public override bool DoActionCombat()
        {
            Mobile c = m_Mobile.Combatant;
            m_Mobile.Warmode = true;

            if (c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee(c) || !m_Mobile.CanBeHarmful(c, false) || c.Map != m_Mobile.Map)
            {
                // Our combatant is deleted, dead, hidden, or we cannot hurt them
                // Try to find another combatant

                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    m_Mobile.DebugSay("Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name);

                    m_Mobile.Combatant = c = m_Mobile.FocusMob;
                    m_Mobile.FocusMob = null;
                }
                else
                {
                    m_Mobile.DebugSay("Something happened to my combatant, and nothing is around. I am on guard.");
                    Action = ActionType.Guard;
                    return true;
                }
            }

            if (!m_Mobile.InLOS(c))
            {
                m_Mobile.DebugSay("I can't see my target");

                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    m_Mobile.DebugSay("I will switch to {0}", m_Mobile.FocusMob.Name);
                    m_Mobile.Combatant = c = m_Mobile.FocusMob;
                    m_Mobile.FocusMob = null;
                }
            }

            if (!Core.AOS && SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.Anatomy].Value >= 80.0)
                EventSink.InvokeStunRequest(new StunRequestEventArgs(m_Mobile));

            if (!m_Mobile.InRange(c, m_Mobile.RangePerception))
            {
                // They are somewhat far away, can we find something else?

                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    m_Mobile.Combatant = m_Mobile.FocusMob;
                    m_Mobile.FocusMob = null;
                }
                else if (!m_Mobile.InRange(c, m_Mobile.RangePerception * 3))
                {
                    m_Mobile.Combatant = null;
                }

                c = m_Mobile.Combatant;

                if (c == null)
                {
                    m_Mobile.DebugSay("My combatant has fled, so I am on guard");
                    Action = ActionType.Guard;

                    return true;
                }
            }

            if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee)
            {
                if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100)
                {
                    // We are low on health, should we flee?

                    bool flee = false;

                    if (m_Mobile.Hits < c.Hits)
                    {
                        // We are more hurt than them

                        int diff = c.Hits - m_Mobile.Hits;

                        flee = (Utility.Random(0, 100) > (10 + diff)); // (10 + diff)% chance to flee
                    }
                    else
                    {
                        flee = Utility.Random(0, 100) > 10; // 10% chance to flee
                    }

                    if (flee)
                    {
                        m_Mobile.DebugSay("I am going to flee from {0}", c.Name);

                        Action = ActionType.Flee;
                        return true;
                    }
                }
            }

            if (m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange(c, Core.ML ? 10 : 12))
            {
                // We are ready to cast a spell

                Spell spell = null;
                Mobile toDispel = FindDispelTarget(true);

                if (m_Mobile.Poisoned) // Top cast priority is cure
                {
                    m_Mobile.DebugSay("I am going to cure myself");

                    spell = new CureSpell(m_Mobile, null);
                }
                else if (toDispel != null) // Something dispellable is attacking us
                {
                    m_Mobile.DebugSay("I am going to dispel {0}", toDispel);

                    spell = DoDispel(toDispel);
                }
                else if (SmartAI && m_Combo != -1) // We are doing a spell combo
                {
                    spell = DoCombo(c);
                }
                else if (SmartAI && (c.Spell is HealSpell || c.Spell is GreaterHealSpell) && !c.Poisoned) // They have a heal spell out
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }
                else
                {
                    spell = ChooseSpell(c);
                }

                // Now we have a spell picked
                // Move first before casting

                if (SmartAI && toDispel != null)
                {
                    if (m_Mobile.InRange(toDispel, 10))
                        RunFrom(toDispel);
                    else if (!m_Mobile.InRange(toDispel, Core.ML ? 10 : 12))
                        RunTo(toDispel);
                }
                else
                {
                    RunTo(c);
                }

                if (spell != null)
                    spell.Cast();

                m_NextCastTime = DateTime.Now + GetDelay(spell);
            }
            else if (m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting)
            {
                RunTo(c);
            }

            m_LastTarget = c;
            m_LastTargetLoc = c.Location;

            return true;
        }
Exemple #32
0
        public virtual Spell ChooseSpell( Mobile c )
        {
            if ( !SmartAI )
            {
                if ( !m_Mobile.Summoned && ScaleByMagery( HealChance ) > Utility.RandomDouble() )
                {
                    if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
                        return new GreaterHealSpell( m_Mobile, null );
                    else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
                        return new HealSpell( m_Mobile, null );
                }

                return GetRandomDamageSpell();
            }

            Spell spell = null;

            int healChance = (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits));

            if ( m_Mobile.Summoned )
                healChance = 0;

            switch ( Utility.Random( 4 + healChance ) )
            {
                default:
                case 0: // Heal ourself
                {
                    if ( !m_Mobile.Summoned )
                    {
                        if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
                            spell = new GreaterHealSpell( m_Mobile, null );
                        else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
                            spell = new HealSpell( m_Mobile, null );
                    }

                    break;
                }
                case 1: // Poison them
                {
                    if ( !c.Poisoned )
                        spell = new PoisonSpell( m_Mobile, null );

                    break;
                }
                case 2: // Deal some damage
                {
                    spell = GetRandomDamageSpell();

                    break;
                }
                case 3: // Set up a combo
                {
                    if ( m_Mobile.Mana < 40 && m_Mobile.Mana > 15 )
                    {
                        if ( c.Paralyzed && !c.Poisoned )
                        {
                            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.Random( 2 ) == 0 && !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;
        }
Exemple #33
0
 public InternalTarget(PoisonSpell owner)
     : base(12, false, TargetFlags.Harmful)
 {
     m_Owner = owner;
 }
Exemple #34
0
		public override Spell DoCombo(Mobile c)
		{
			//m_Mobile.Say("doing human AI combo");
			if (c is PlayerMobile && SmartAI && (c.Spell is MagicTrapSpell || c.Spell is MagicArrowSpell))
			{
				m_EnemyCountersPara = true;
			}

			Spell spell = null;

			if (Combo == 0)
			{
				//m_Mobile.Say( "combo phase 1" );
				spell = new ExplosionSpell(m_Mobile, null);
				++Combo; // Move to next spell

			}

			if (Combo == 1)
			{
				//m_Mobile.Say( "combo phase 1" );
				spell = new ExplosionSpell(m_Mobile, null);
				++Combo; // Move to next spell

			}
			else if (Combo == 2)
			{
				//m_Mobile.Say( "combo phase 2" );
				if (!c.Poisoned && (CheckCanPoison(c)))
					spell = new PoisonSpell(m_Mobile, null);

				++Combo; // Move to next spell

			}

			else if (Combo == 3)
			{

				//m_Mobile.Say( "combo phase 3" );
				if (c.Poisoned || !CheckCanPoison(c))
					spell = new WeakenSpell(m_Mobile, null);

				if (!c.Poisoned && (CheckCanPoison(c)))
					spell = new PoisonSpell(m_Mobile, null);

				++Combo; // Move to next spell

			}

			else if (Combo == 4)
			{
				//	m_Mobile.Say( "combo phase 4 ebolt" );

				if (!c.Poisoned && (CheckCanPoison(c)))
				{
					spell = new PoisonSpell(m_Mobile, null);
					Combo = 4;
				}

				else
					spell = new EnergyBoltSpell(m_Mobile, null);

				++Combo; // Move to next spell

			}
			else if (Combo == 5)
			{
				//m_Mobile.Say( "combo phase 5" );
				if (c.Poisoned)
				{
					if (c.Hits < 20 && m_Mobile.Mana >= 20)
						spell = new EnergyBoltSpell(m_Mobile, null);

					else
						spell = new HarmSpell(m_Mobile, null);

					Combo = 5; // Move to next spell

				}

				if (!c.Poisoned)
				{
					if (m_Mobile.Mana > 20)
						spell = new EnergyBoltSpell(m_Mobile, null);

					if (m_Mobile.Mana < 19)
						spell = new LightningSpell(m_Mobile, null);
					Combo = -1; // Reset combo state

				}

			}

			return spell;
		}