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 (!SmartAI) { spell = CheckCastHealingSpell(); if (spell != null) { return(spell); } if (spell == null && m_Mobile.RawInt >= 80) { spell = CheckCastDispelField(); } switch (Utility.Random(15)) { case 0: case 1: // Poison them { if (c.Poisoned || !CheckCast(3)) { goto default; } m_Mobile.DebugSay("Attempting to poison"); spell = new PoisonSpell(m_Mobile, null); break; } case 2: // Bless ourselves { if (BlessSpell.IsBlessed(m_Mobile) || !CheckCast(3)) { goto default; } m_Mobile.DebugSay("Blessing myself"); spell = GetRandomBuffSpell(); //new BlessSpell(m_Mobile, null); break; } case 3: case 4: // Curse them { m_Mobile.DebugSay("Attempting to curse"); spell = GetRandomCurseSpell(); if (spell == null) { goto default; } break; } case 5: // Paralyze them { m_Mobile.DebugSay("Attempting to paralyze"); if (CheckCast(5)) { spell = new ParalyzeSpell(m_Mobile, null); } else { spell = GetRandomCurseSpell(); } if (spell == null) { goto default; } break; } case 6: // Drain mana { m_Mobile.DebugSay("Attempting to drain mana"); spell = GetRandomManaDrainSpell(); if (spell == null) { goto default; } break; } default: // Damage them { m_Mobile.DebugSay("Just doing damage"); spell = 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(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); }
public BuffType GetRandomBuff(Mobile target) { List <BuffType> buffs = new List <BuffType>(); if (MagicReflectSpell.HasReflect(target)) { buffs.Add(BuffType.MagicReflect); } if (ReactiveArmorSpell.HasArmor(target)) { buffs.Add(BuffType.ReactiveArmor); } if (ProtectionSpell.HasProtection(target)) { buffs.Add(BuffType.Protection); } TransformContext context = TransformationSpellHelper.GetContext(target); if (context != null && context.Type != typeof(AnimalForm)) { buffs.Add(BuffType.Transformation); } if (BlessSpell.IsBlessed(target)) { buffs.Add(BuffType.Bless); } else { StatMod mod = target.GetStatMod("[Magic] Str Buff"); if (mod != null) { buffs.Add(BuffType.StrBonus); } mod = target.GetStatMod("[Magic] Dex Buff"); if (mod != null) { buffs.Add(BuffType.DexBonus); } mod = target.GetStatMod("[Magic] Int Buff"); if (mod != null) { buffs.Add(BuffType.IntBonus); } } if (EodonianPotion.IsUnderEffects(target, PotionEffect.Barrab)) { buffs.Add(BuffType.BarrabHemolymph); } if (EodonianPotion.IsUnderEffects(target, PotionEffect.Urali)) { buffs.Add(BuffType.UraliTrance); } if (buffs.Count == 0) { return(BuffType.None); } BuffType type = buffs[Utility.Random(buffs.Count)]; buffs.Clear(); return(type); }