View Full Version: Monstre sorcier

RunUO.FR Support > comment on fait ... > Monstre sorcier


Title: Monstre sorcier


Kaervek - September 19, 2004 02:55 PM (GMT)
Quelqu'un pourrait-il expliquer clairement la programmation d'un monstre sorcier? Comment définir quels spells il lance?

Dihel - September 20, 2004 07:55 AM (GMT)
il ne faut pas voir du coter des "AI" ?

slade15 - September 20, 2004 04:29 PM (GMT)
oui je pense bien mais sans plus car j'ai jamais fait

Kaervek - September 20, 2004 05:01 PM (GMT)
Dans les IA on a IA_MAge qui fait lancer des sorts (de base de UO sans vraiment les sélectionner, ou alors je ne l'ai pas remarqué lol :P)


Moi je veux désigner TEL ou TEL sort UNIQUEMENT ^^ ;)

Dihel - September 20, 2004 09:12 PM (GMT)
ca serai pas de ce coté la ?
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 );
  }
 }
ou encore
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;
 }




Hosted for free by InvisionFree