背景:
阅读新闻

如何限制特定的怪物不能被挑拨或压制

[日期:2007-09-08] 来源:原创  作者:AD Broken [字体: ]

一种方法是修改挑拨技能的目标对象脚本,加入怪物的ID,以便在玩家对此怪物挑拨时直接出错而是技能失败。此方法的缺点是每种怪物都要在挑拨技能的脚本里进行处理,处理量大的话有可能会影响到游戏速度。同理可以修改压制的设定。

\Scripts\Skills\Provocation.cs

   protected override void OnTarget( Mobile from, object targeted )
   {
    from.RevealingAction();

    if ( targeted is BaseCreature && from.CanBeHarmful( (Mobile)targeted, true ) )
    {
     BaseCreature creature = (BaseCreature)targeted;

     if ( !m_Instrument.IsChildOf( from.Backpack ) )
     {
      from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
     }
     else if ( creature.Controlled )
     {
      from.SendLocalizedMessage( 501590 ); // They are too loyal to their master to be provoked.
     }
     else if ( creature.IsParagon && BaseInstrument.GetBaseDifficulty( creature ) >= 160.0 )
     {
      from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
     }
     else if ( creature is AbysmalHorror || creature is DarknightCreeper || creature is DemonKnight || creature is FleshRenderer || creature is Impaler || creature is ShadowKnight || creature is LadyMelisande || creature is Hydra || creature is Irk || creature is LadySabrix || creature is LadyLissith || creature is Gnaw || creature is Malefic )
     {
      from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
     }
     else
     {
      from.RevealingAction();
      m_Instrument.PlayInstrumentWell( from );
      from.SendLocalizedMessage( 1008085 ); // You play your music and your target becomes angered.  Whom do you wish them to attack?
      from.Target = new InternalSecondTarget( from, m_Instrument, creature );
     }
    }
    else
    {
     from.SendLocalizedMessage( 501589 ); // You can't incite that!
    }
   }
  }

\Scripts\Skills\Discordance.cs

    protected override void OnTarget( Mobile from, object target )
   {
    from.RevealingAction();

    if ( !m_Instrument.IsChildOf( from.Backpack ) )
    {
     from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
    }
    else if ( target is Mobile )
    {
     Mobile targ = (Mobile)target;

     if ( targ == from || (targ is BaseCreature && ( ((BaseCreature)targ).BardImmune || !from.CanBeHarmful( targ, false ) )) )
     {
      from.SendLocalizedMessage( 1049535 ); // A song of discord would have no effect on that.
     }
     else if ( targ is AbysmalHorror || targ is DarknightCreeper || targ is DemonKnight || targ is FleshRenderer || targ is Impaler || targ is ShadowKnight || targ is LadyMelisande || targ is Hydra || targ is Irk || targ is LadySabrix || targ is LadyLissith || targ is Gnaw || targ is Malefic )
     {
      from.SendLocalizedMessage( 1049535 ); // A song of discord would have no effect on that.
     }
     else if ( !targ.Player )
     {
      TimeSpan len = TimeSpan.FromSeconds( from.Skills[SkillName.Discordance].Value * 2 );
      double diff = m_Instrument.GetDifficultyFor( targ ) - 10.0;
      double music = from.Skills[SkillName.Musicianship].Value;

      if ( music > 100.0 )
       diff -= (music - 100.0) * 0.5;

      if ( !BaseInstrument.CheckMusicianship( from ) )
      {
       from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
       m_Instrument.PlayInstrumentBadly( from );
       m_Instrument.ConsumeUse( from );
      }
      else if ( from.CheckTargetSkill( SkillName.Discordance, target, diff-25.0, diff+25.0 ) )
      {
       if ( !m_Table.Contains( targ ) )
       {
        from.SendLocalizedMessage( 1049539 ); // You play the song surpressing your targets strength
        m_Instrument.PlayInstrumentWell( from );
        m_Instrument.ConsumeUse( from );

......

收藏 推荐 打印 | 录入:AD Broken | 阅读:
相关新闻