Inheritance: MagerySpell
Ejemplo n.º 1
0
        public bool TryToHeal()
        {
            if (this.m_Mobile.Summoned)
                return false;
            else if (DateTime.UtcNow < this.m_NextHealTime)
                return false;

            int diff = this.m_Mobile.HitsMax - this.m_Mobile.Hits;
            diff = ((this.m_Mobile.HitsMax * (100 - diff)) / 100);
            diff = 100 - diff;

            if ((int)(Utility.RandomDouble() * 100.0) > diff)
                return false;

            Spell spell = null;
            this.m_NextHealTime = DateTime.UtcNow + TimeSpan.FromSeconds(20);

            if (this.m_CanUseMagery)
            {
                if (this.m_Mobile.Poisoned)
                    spell = new CureSpell(this.m_Mobile, null);

                spell = new GreaterHealSpell(this.m_Mobile, null);

                if (spell == null)
                    spell = new HealSpell(this.m_Mobile, null);
            }
            else if (this.m_CanUseNecromancy)
            {
                this.m_Mobile.UseSkill(SkillName.SpiritSpeak);
                this.m_NextHealTime = DateTime.UtcNow + TimeSpan.FromSeconds(10);
            }
            else if (this.m_CanUseChivalry)
            {
                if (this.m_Mobile.Poisoned)
                    spell = new CleanseByFireSpell(this.m_Mobile, null);
                else
                    spell = new CloseWoundsSpell(this.m_Mobile, null);
            }
            else if (this.m_CanUseMystic)
            {
                spell = new CleansingWindsSpell(this.m_Mobile, null);
            }
            else if (this.m_Mobile.Skills[SkillName.Healing].Value > 10.0)
            {
                int delay = (int)(5.0 + (0.5 * ((120 - this.m_Mobile.Dex) / 10)));
                new BandageContext(this.m_Mobile, this.m_Mobile, TimeSpan.FromSeconds(delay), false);
                this.m_NextHealTime = DateTime.UtcNow + TimeSpan.FromSeconds(delay + 1);
                return true;
            }

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

            return true;
        }
Ejemplo n.º 2
0
        protected Spell CheckCastHealingSpell()
        {
            // If I'm poisoned, always attempt to cure.
            if (this.m_Mobile.Poisoned)
                return new CureSpell(this.m_Mobile, null);

            // Summoned creatures never heal themselves.
            if (this.m_Mobile.Summoned)
                return null;

            if (this.m_Mobile.Controlled)
            {
                if (DateTime.UtcNow < this.m_NextHealTime)
                    return null;
            }

            if (!this.SmartAI)
            {
                if (ScaleByMagery(HealChance) < Utility.RandomDouble())
                    return null;
            }
            else
            {
                if (Utility.Random(0, 4 + (this.m_Mobile.Hits == 0 ? this.m_Mobile.HitsMax : (this.m_Mobile.HitsMax / this.m_Mobile.Hits))) < 3)
                    return null;
            }

            Spell spell = null;

            if (this.m_Mobile.Hits < (this.m_Mobile.HitsMax - 50))
            {
                spell = new GreaterHealSpell(this.m_Mobile, null);

                if (spell == null)
                    spell = new HealSpell(this.m_Mobile, null);
            }
            else if (this.m_Mobile.Hits < (this.m_Mobile.HitsMax - 10))
            {
                spell = new HealSpell(this.m_Mobile, null);
            }

            double delay;

            if (this.m_Mobile.Int >= 500)
                delay = Utility.RandomMinMax(7, 10);
            else
                delay = Math.Sqrt(600 - this.m_Mobile.Int);

            this.m_NextHealTime = DateTime.UtcNow + TimeSpan.FromSeconds(delay);

            return spell;
        }
Ejemplo n.º 3
0
 public InternalTarget(HealSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.Beneficial)
 {
     this.m_Owner = owner;
 }
Ejemplo n.º 4
0
 public InternalTarget(HealSpell owner)
     : base(owner.Caster.EraML ? 10 : 12, false, TargetFlags.Beneficial)
 {
     m_Owner = owner;
 }
Ejemplo n.º 5
0
 public InternalSphereTarget(HealSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.Beneficial)
 {
     m_Owner = owner;
     m_Owner.Caster.SendAsciiMessage("Select target...");
 }
Ejemplo n.º 6
0
 public InternalTarget(HealSpell owner) : base(12, false, TargetFlags.Beneficial)
 {
     m_Owner = owner;
 }
Ejemplo n.º 7
0
 public InternalTarget( HealSpell owner )
     : base(12, false, TargetFlags.Beneficial)
 {
     m_Owner = owner;
 }
Ejemplo n.º 8
0
		public override bool DoActionCombat()
		{
			m_Mobile.DebugSay("doing Base HumanMageAI combataction");
			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 (c is PlayerMobile && SmartAI && (c.Spell is MagicTrapSpell || c.Spell is MagicArrowSpell))
			{
				m_EnemyCountersPara = true;
			}

			if (c.Paralyzed || c.Frozen)
			{
				if (m_Mobile.InRange(c, 1))
					RunFrom(c);
			}

			if (m_Mobile.Paralyzed)
			{
				UseTrapPouch(m_Mobile);

			}
			TrapPouch(m_Mobile);

			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.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);

				//try an cure with a pot first if the poison is serious or where in the middle of dumping
				if (UsesPotions && (m_Mobile.Poisoned && m_Mobile.Poison.Level >= 3) || m_Mobile.Poisoned && Combo != -1)
				{
					DrinkCure(m_Mobile);
				}

				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);
					}
				}

				//were hurt they have atleast half life and were to low on mana to finish them start healing
				else if (m_Mobile.Hits < 70 && c.Hits > 50 && m_Mobile.Mana < 30)
					spell = new HealSpell(m_Mobile, null);

				else if (toDispel != null) // Something dispellable is attacking us
				{
					spell = DoDispel(toDispel);
				}
				//take down reflect on are enemy if its up
				else if (c.MagicDamageAbsorb > 5)
				{
					m_Mobile.DebugSay("Takeing Down Reflect");
					spell = new FireballSpell(m_Mobile, null);
				}
				else if (Combo != -1) // We are doing a spell combo
				{
					spell = DoCombo(c);
				}
				else
				{
					spell = ChooseSpell(c);
				}

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

				if (spell != null && spell.Cast())
				{
					TimeSpan delay;
					//spell cast time is equal to the delay for the spells.
					delay = spell.GetCastDelay() + spell.GetCastRecovery();

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

			return true;
		}
Ejemplo n.º 9
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();
			}

			if (c.Int > 70 && m_Mobile.CanBeginAction(typeof(DefensiveSpell)))
				return new MagicReflectSpell(m_Mobile, null);

			if (c.Dex > 60 && m_Mobile.CanBeginAction(typeof(DefensiveSpell)))
				return new ReactiveArmorSpell(m_Mobile, null);


			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(1 + 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 1: // Set up a combo
					{
						if (m_Mobile.Mana < 50 && m_Mobile.Mana > 15)
						{
							if (c.Paralyzed && !c.Poisoned)
							{
								if (c.Hits < 45)
									spell = new ExplosionSpell(m_Mobile, null);

								if (c.Hits < 30)
									spell = new EnergyBoltSpell(m_Mobile, null);

								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 > 80)
						{

							m_Combo = 1;
							spell = new ExplosionSpell(m_Mobile, null);

						}

						break;
					}
			}

			return spell;
		}
Ejemplo n.º 10
0
		public virtual Spell ChooseSpell(Mobile c)
		{

			// tamable solution ---------------
			Mobile com = m_Mobile.Combatant;
			Spell spell = null;

			if (com != null && com is BaseCreature && DateTime.Now >= m_NextCouncilSpell)
			{
				if (CastRevelationWave())
				{
					m_Mobile.DebugSay("I'm gunna cast Revelation Wave!");
					m_NextCouncilSpell = DateTime.Now + TimeBetweenCouncilSpell;
					return new RevelationWaveSpell(m_Mobile, null);
				}

				if (CastPoisonWave())
				{
					m_Mobile.DebugSay("I'm gunna cast Poison Wave!");
					m_NextCouncilSpell = DateTime.Now + TimeBetweenCouncilSpell;
					return new PoisonWaveSpell(m_Mobile, null);
				}
			}
			// end tamable solution ---------------		

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

			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;
		}
Ejemplo n.º 11
0
		public override Spell ChooseSpell(Mobile c)
		{

			if (c is PlayerMobile && SmartAI && (c.Spell is MagicTrapSpell || c.Spell is MagicArrowSpell))
			{
				m_EnemyCountersPara = true;
			}

			if (c.Int > 70 && m_Mobile.MagicDamageAbsorb <= 0 && m_Mobile.Mana > 20 && m_Mobile.Hits > 60 && m_Mobile.CanBeginAction(typeof(DefensiveSpell)))
			{
				Spell temp = c.Spell as Spell;

				if (temp == null || (temp != null && temp.IsCasting && (int)temp.Circle <= (int)SpellCircle.Fourth))
					return new MagicReflectSpell(m_Mobile, null);
			}

			if (c.Dex > 60 && m_Mobile.MeleeDamageAbsorb <= 0 && m_Mobile.Mana > 20 && m_Mobile.Hits > 30 && m_Mobile.CanBeginAction(typeof(DefensiveSpell)))
				return new ReactiveArmorSpell(m_Mobile, null);


			Spell spell = null;

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

			switch (Utility.Random(1 + healChance))
			{
				default:
				case 0: // Heal ourself
					{
						if (HealPotCount >= 1 && m_Mobile.Hits < (m_Mobile.HitsMax - 30))
							DrinkHeal(m_Mobile);
						else if (m_Mobile.Hits < (m_Mobile.HitsMax - 35) && m_Mobile.Hits >= 45)
							spell = new GreaterHealSpell(m_Mobile, null);
						else if (m_Mobile.Hits < (m_Mobile.HitsMax - 10))
							spell = new HealSpell(m_Mobile, null);
						break;
					}

				case 1: // Set up a combo
					{
						//para them and med up until we have mana for a dump
						if (m_Mobile.Mana < 85 && m_Mobile.Mana > 2)
						{
							m_RegainingMana = true;
							//if there low on life and we have the mana try an finish them		
							if (m_Mobile.Mana > 20 && c.Hits < 28)
								spell = new EnergyBoltSpell(m_Mobile, null);

							if (m_Mobile.Mana > 12 && c.Hits < 15)
								spell = new LightningSpell(m_Mobile, null);

							if (c.Paralyzed && !c.Poisoned)
							{
								if (c.Hits < 45 && m_Mobile.Mana > 40)
									spell = new ExplosionSpell(m_Mobile, null);

								if (c.Hits < 30)
									spell = new EnergyBoltSpell(m_Mobile, null);

								m_Mobile.DebugSay("I am going to meditate");

								m_Mobile.UseSkill(SkillName.Meditation);
							}
							else if (!c.Poisoned && m_EnemyCountersPara == false && m_Mobile.Mana > 40)
							{
								spell = new ParalyzeSpell(m_Mobile, null);
							}
							else
							{
								if (m_Mobile.InRange(c, 4))
									RunFrom(c);
								if (!m_Mobile.InRange(c, 6))
									RunTo(c, CanRun);

								//m_Mobile.UseSkill( SkillName.Meditation );

							}
						}

						if (m_Mobile.Mana > 85)
						{
							m_RegainingMana = false;
							Combo = 0;

						}

						break;
					}
			}

			return spell;
		}
Ejemplo n.º 12
0
		public override bool DoActionCombat()
		{
			m_Mobile.DebugSay("doing DoActionCombat");
			Mobile c = m_Mobile.Combatant;
			m_Mobile.Warmode = true;

			// check to see if our attack priority has changed
			Mobile newTarget = null;
			if (PriorityTarget(c, out newTarget) == true)
			{
				m_Mobile.DebugSay("Higher priority target found switching targets");
				m_Mobile.Combatant = c = newTarget;
				m_Mobile.FocusMob = null;
			}

			if (m_Mobile.CanReveal)
			{
				if (c == null)
				{
					//	If we can Recall() a player via FindHiddenTarget, make them our new Combatant.
					//	Keep in mind, CombatTimer.OnTick() will set the Combatant to null if it sees that the mobile is hidden, 
					//	for this reason, we make this check in DoActionGuard and again in DoActionCombat if the Combatant is null.
					Mobile mx = FindHiddenTarget();
					if (mx != null)
					{
						m_Mobile.DebugSay("C: Ah, I remembered {0}!", mx.Name);
						c = m_Mobile.Combatant = mx;
					}
				}

				// if we can reveal and our target just hid and we Recall them, lets try to reveal
				if (c != null && c.Hidden && (Recall(c) || m_Mobile.ConstantFocus == c) && c.Alive && !c.IsDeadBondedPet && m_Mobile.CanBeHarmful(c, false) && !m_Mobile.Controlled)
				{	// we will keep retrying the reveal
					if (DoProcessReveal(c))
						return 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.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.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 (c != null)
			{
				int strMod = GetStatMod(c, StatType.Str);
				Mobile toDispel = null;

				//dont worry about creatures/pets useing these spells, only players.
				if (c is PlayerMobile && SmartAI && (c.Spell is MagicTrapSpell || c.Spell is MagicArrowSpell))
				{
					EnemyCountersPara = true;
				}

				if (UsesPotions && RefreshPotCount >= 1 && m_Mobile.Stam < 20)
				{
					DrinkRefresh(m_Mobile);
				}

				if (m_Mobile.Paralyzed)
				{
					UseTrapPouch(m_Mobile);

				}

				TrapPouch(m_Mobile);

				if ((c.Paralyzed || c.Frozen) && PreferMagic() == true)
				{
					if (m_Mobile.InRange(c, 3))
						RunAround(c);
				}

				if (PreferMagic() == true)
					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 (UsesBandages && (IsDamaged || IsPoisoned) && m_Mobile.Skills.Healing.Base > 20.0)
				{
					TimeSpan ts = TimeUntilBandage;

					if (ts == TimeSpan.MaxValue)
						StartBandage(m_Mobile, m_Mobile);
				}

				if (IsPoisoned && UsesPotions && CurePotCount >= 1)
					if (m_Mobile.Poison.Level >= 3 || Combo != -1 || m_Mobile.Mana < 30)
						DrinkCure(m_Mobile);

				if (IsDamaged && UsesPotions && HealPotCount >= 1)
					if (Utility.Random(0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits))) >= 3)
						if (m_Mobile.Hits < (m_Mobile.HitsMax * .25) || m_Mobile.Mana < (m_Mobile.ManaMax * .25))
							DrinkHeal(m_Mobile);

				if (m_Mobile.Skills[SkillName.Magery].Value >= 50.0 && m_Mobile.Spell == null && DateTime.Now >= m_Mobile.NextSpellTime)
				{
					m_Mobile.DebugSay("Doing spell selection");
					// We are ready to cast a spell
					Spell spell = null;
					toDispel = FindDispelTarget(true);

					//woot weaken block up to lightening!
					ISpell i = c.Spell;
					if (i != null && i.IsCasting)
					{
						Spell s = (Spell)i;
						if (m_Mobile.Hits <= 40 && (s.MaxDamage >= 12 || (s is PoisonSpell && !IsPoisoned && CurePotCount == 0)))
						{
							m_Mobile.DebugSay("Damage is {0}", s.MaxDamage);
							spell = new WeakenSpell(m_Mobile, null);
						}
					}
					// Top cast priority is cure - may override the previous assignment
					else if (IsPoisoned)
					{
						spell = new CureSpell(m_Mobile, null);
						int level = (m_Mobile.Poison.Level + 1);
						if (level > 0 && (((m_Mobile.Skills[SkillName.Magery].Value / level) - 20) * 7.5) > 50)
						{
							spell = new CureSpell(m_Mobile, null);
						}
						else
						{
							spell = new ArchCureSpell(m_Mobile, null);
						}
					}
					//were hurt they have atleast half life and were to low on mana to finish them start healing
					else if (m_Mobile.Hits < 70 && c.Hits > 50 && m_Mobile.Mana < 30)
					{
						spell = new HealSpell(m_Mobile, null);
					}
					// Something dispellable is attacking us
					else if (toDispel != null)
					{
						if (Utility.Random(0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits))) >= 3)
						{
							if (UsesPotions && HealPotCount >= 1 && m_Mobile.Hits < (m_Mobile.HitsMax - 20))
								DrinkHeal(m_Mobile);
							else if (m_Mobile.Hits < (m_Mobile.HitsMax - 20))
								spell = new HealSpell(m_Mobile, null);
						}

						spell = DoDispel(toDispel);
					}
					// a friend needs healed
					else if (CrossHeals && FindHealTarget(true) != null)
					{
						spell = new GreaterHealSpell(m_Mobile, null);
					}
					//target has reflect up hit is with ManaDrain till down
					else if (c.MagicDamageAbsorb > 5)
					{
						spell = new ManaDrainSpell(m_Mobile, null);
					}
					// We are doing a spell combo
					else if (Combo != -1)
					{
						spell = DoCombo(c);
					}
					//keep them weakened.
					else if (m_Mobile.Mana >= 40 && strMod >= 0 && !c.Paralyzed)
					{
						spell = new WeakenSpell(m_Mobile, null);
					}
					else
					{
						spell = ChooseSpell(c);
					}

					if (spell != null && m_Mobile.InRange(c, 12))
						spell.Cast();
				}


				if (SmartAI && toDispel != null)
				{
					if (m_Mobile.InRange(toDispel, 8) && !toDispel.Paralyzed)
						RunFrom(toDispel);
				}
				else if (HoldingWeapon() == true && PreferMagic() == false)
				{
					m_Mobile.DebugSay("I will prefer my weapon over magic");
					RunTo(c, CanRun);
				}
				else
				{
					if (c is BaseCreature && ((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned && !c.Paralyzed && m_Mobile.InRange(c, 6))
					{
						RunFrom(c);
					}

					if (c is BaseCreature && (((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned) && !m_Mobile.InRange(c, 10))
					{
						RunTo(c, CanRun);
					}

					if (RegainingMana == false)
					{
						if (c is PlayerMobile || (c is BaseCreature && !((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned))
						{
							RunTo(c, CanRun);
						}
					}
					else
					{
						if (c is PlayerMobile || (c is BaseCreature && !((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned))
						{
							if (m_Mobile.InRange(c, 4))
								RunAround(c);

							if (!m_Mobile.InRange(c, 6))
								RunTo(c, CanRun);
						}

						m_Mobile.UseSkill(SkillName.Meditation);
					}
				}

				return true;
			}
			return true;
		}
Ejemplo n.º 13
0
 public InternalSphereTarget(HealSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.Beneficial)
 {
     m_Owner = owner;
     m_Owner.Caster.SendAsciiMessage("Selecione o alvo...");
 }
Ejemplo n.º 14
0
			public InternalTarget(HealSpell owner)
				: base(owner.Caster.EraML ? 10 : 12, false, TargetFlags.Beneficial)
			{
				m_Owner = owner;
			}
Ejemplo n.º 15
0
		public virtual Spell DoDispel( Mobile toDispel )
		{
			if ( !SmartAI )
			{
				if ( ScaleByMagery( DispelChance ) > Utility.RandomDouble() )
					return new DispelSpell( m_Mobile, null );

				return ChooseSpell( toDispel );
			}

			Spell spell = null;

			if ( !m_Mobile.Summoned && Utility.Random( 0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits)) ) >= 3 )
			{
				if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
					spell = new GreaterHealSpell( m_Mobile, null );
				else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 20) )
					spell = new HealSpell( m_Mobile, null );
			}

			if ( spell == null )
			{
				if ( !m_Mobile.DisallowAllMoves && Utility.Random( (int)m_Mobile.GetDistanceToSqrt( toDispel ) ) == 0 )
					spell = new TeleportSpell( m_Mobile, null );
				else if ( Utility.Random( 3 ) == 0 && !m_Mobile.InRange( toDispel, 3 ) && !toDispel.Paralyzed && !toDispel.Frozen )
					spell = new ParalyzeSpell( m_Mobile, null );
				else
					spell = new DispelSpell( m_Mobile, null );
			}

			return spell;
		}
Ejemplo n.º 16
0
        private Spell CheckCastHealingSpell()
        {
            // If I'm poisoned, always attempt to cure.
            if (this.m_Mobile.Poisoned)
                return new CureSpell(this.m_Mobile, null);

            // Summoned creatures never heal themselves.
            if (this.m_Mobile.Summoned)
                return null;

            if (this.m_Mobile.Controlled)
            {
                if (DateTime.Now < this.m_NextHealTime)
                    return null;
            }
			
            if (this.ScaleByMagery(HealChance) < Utility.RandomDouble())
                return null;

            Spell spell = null;

            if (this.m_Mobile.Hits < (this.m_Mobile.HitsMax - 50))
            {
                spell = new GreaterHealSpell(this.m_Mobile, null);

                if (spell == null)
                    spell = new HealSpell(this.m_Mobile, null);
            }
            else if (this.m_Mobile.Hits < (this.m_Mobile.HitsMax - 10))
                spell = new HealSpell(this.m_Mobile, null);

            double delay;

            if (this.m_Mobile.Int >= 500)
                delay = Utility.RandomMinMax(7, 10);
            else
                delay = Math.Sqrt(600 - this.m_Mobile.Int);
				
            this.m_Mobile.UseSkill(SkillName.SpiritSpeak);

            this.m_NextHealTime = DateTime.Now + TimeSpan.FromSeconds(delay);

            return spell;
        }
Ejemplo n.º 17
0
        private Spell CheckCastHealingSpell()
        {
            // If I'm poisoned, always attempt to cure.
            if (m_Mobile.Poisoned)
                return new CureSpell(m_Mobile, null);

            // Summoned creatures never heal themselves.
            if (m_Mobile.Summoned)
                return null;

            if (m_Mobile.Controlled)
            {
                if (DateTime.Now < m_NextHealTime)
                    return null;
            }

            if (!SmartAI)
            {
                if (ScaleBySkill(HealChance, SkillName.Magery) < Utility.RandomDouble())
                    return null;
            }
            else
            {
                if (Utility.Random(0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits))) < 3)
                    return null;
            }

            Spell spell = null;

            if (m_Mobile.Hits < (m_Mobile.HitsMax - 50))
            {
                if (UseNecromancy())
                {
                    m_Mobile.UseSkill(SkillName.SpiritSpeak);
                }
                else
                {
                    spell = new GreaterHealSpell(m_Mobile, null);

                    if (spell == null)
                        spell = new HealSpell(m_Mobile, null);
                }
            }
            else if (m_Mobile.Hits < (m_Mobile.HitsMax - 10))
            {
                spell = new HealSpell(m_Mobile, null);
            }

            double delay;

            if (m_Mobile.Int >= 500)
                delay = Utility.RandomMinMax(7, 10);
            else
                delay = Math.Sqrt(600 - m_Mobile.Int);

            m_NextHealTime = DateTime.Now + TimeSpan.FromSeconds(delay);

            return spell;
        }
Ejemplo n.º 18
0
        public virtual Spell GetRandomHealingSpell()
        {
            Spell spell = null;

            if ( m_Mobile.Hits < ( m_Mobile.HitsMax - 50 ) )
            {
                spell = new GreaterHealSpell( m_Mobile, null );

                if ( spell == null )
                    spell = new HealSpell( m_Mobile, null );
            }
            else if ( m_Mobile.Hits < ( m_Mobile.HitsMax - 10 ) )
                spell = new HealSpell( m_Mobile, null );

            return spell;
        }
Ejemplo n.º 19
0
		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;
		}
Ejemplo n.º 20
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;
        }
Ejemplo n.º 21
0
 public InternalTarget(HealSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.Beneficial)
 {
     this.m_Owner = owner;
 }
Ejemplo n.º 22
0
		public override Spell ChooseSpell(Mobile c)
		{

			Mobile com = m_Mobile.Combatant;
			Spell spell = null;

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

			switch (Utility.Random(1 + healChance))
			{
				default:
				case 0: // Heal ourself
					{
						if (!m_Mobile.Summoned)
						{
							m_Mobile.DebugSay("I am going to heal myself");
							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: // Set up a combo
					{
						if (m_Mobile.Mana < 40 && m_Mobile.Mana > 15)
						{
							if (c.Paralyzed)
							{
								m_Mobile.DebugSay("I am going to meditate");

								m_Mobile.UseSkill(SkillName.Meditation);
							}

						}
						else if (m_Mobile.Mana > 60)
						{

							Combo = 0;
							m_Mobile.DebugSay("I am going to combo and paralyze");
							if (!c.Paralyzed)
								spell = new ParalyzeSpell(m_Mobile, null);

						}

						break;
					}
			}

			return spell;
		}