| CODE |
| public virtual Spell GetRandomDamageSpell() { int maxCircle = (int)((m_Mobile.Skills[SkillName.Magery].Value + 20.0) / (100.0 / 7.0)); if ( maxCircle < 1 ) maxCircle = 1; switch ( Utility.Random( maxCircle*2 ) ) { case 0: case 1: return new MagicArrowSpell( m_Mobile, null ); case 2: case 3: return new HarmSpell( m_Mobile, null ); case 4: case 5: return new FireballSpell( m_Mobile, null ); case 6: case 7: return new LightningSpell( m_Mobile, null ); case 8: case 9: return new MindBlastSpell( m_Mobile, null ); case 10: return new EnergyBoltSpell( m_Mobile, null ); case 11: return new ExplosionSpell( m_Mobile, null ); default: return new FlameStrikeSpell( m_Mobile, null ); } } |
| CODE |
| 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; } |