public override bool DoActionCombat() { bool ret = base.DoActionCombat(); if (m_Mobile.Spell == null && DateTime.UtcNow > m_NextCastTime) { Spell spell = null; if (m_Mobile.Poisoned) // Top cast priority is cure { m_Mobile.DebugSay("I am going to cure myself"); spell = new CleanseByFireSpell(m_Mobile, null); } else if (FindDispelTarget(true) != null) { m_Mobile.DebugSay("I am going to area dispel"); spell = new DispelEvilSpell(m_Mobile, null); } else if (m_Mobile.Combatant != null) { spell = ChooseSpell(); } if (spell != null) { spell.Cast(); } TimeSpan delay; if (spell is DispelEvilSpell) { delay = TimeSpan.FromSeconds(m_Mobile.ActiveSpeed); } else { delay = GetDelay(); } m_NextCastTime = DateTime.UtcNow + delay; } return(ret); }
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); }