コード例 #1
0
ファイル: OmniAI Shared.cs プロジェクト: Crome696/ServUO
        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;
        }
コード例 #2
0
 public InternalTarget(CloseWoundsSpell owner) : base(12, false, TargetFlags.Beneficial)
 {
     m_Owner = owner;
 }
コード例 #3
0
			public InternalTarget( CloseWoundsSpell owner ) : base( 12, false, TargetFlags.Beneficial )
			{
				m_Owner = owner;
			}
コード例 #4
0
ファイル: PaladinAI.cs プロジェクト: Crome696/ServUO
		public virtual Spell CheckCastHealingSpell()
		{
			// Summoned creatures never heal themselves.
			if ( m_Mobile.Summoned )
				return null;
				
			if ( m_Mobile.Controlled )
			{
				if ( DateTime.Now < m_NextHealTime )
					return null;
			}
			
			if ( m_Mobile.Skills[ SkillName.Chivalry ].Value * 0.0005 < Utility.RandomDouble() )
				return null;
			
			Spell spell = null;

			if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
				spell = new CloseWoundsSpell( 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;
		}