protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
if ( targeted is BaseCreature )
{
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 ( m_Creature.Unprovokable )
{
from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
}
else if ( creature.Unprovokable )
{
from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
}
else if ( m_Creature.Map != creature.Map || !m_Creature.InRange( creature, BaseInstrument.GetBardRange( from, SkillName.Provocation ) ) )
{
from.SendLocalizedMessage( 1049450 ); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
}
else if ( m_Creature != creature )
{
from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
double diff = ((m_Instrument.GetDifficultyFor( m_Creature ) + m_Instrument.GetDifficultyFor( creature )) * 0.5) - 5.0;
double music = from.Skills[SkillName.Musicianship].Value;
if ( music > 100.0 )
diff -= (music - 100.0) * 0.5;
if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( creature, true ) )
{
if ( !BaseInstrument.CheckMusicianship( from ) )
{
from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
m_Instrument.PlayInstrumentBadly( from );
m_Instrument.ConsumeUse( from );
}
else
{
//from.DoHarmful( m_Creature );
//from.DoHarmful( creature );
if ( !from.CheckTargetSkill( SkillName.Provocation, creature, diff-25.0, diff+25.0 ) )
{
from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
from.SendLocalizedMessage( 501599 ); // Your music fails to incite enough anger.
m_Instrument.PlayInstrumentBadly( from );
m_Instrument.ConsumeUse( from );
}
else
{
from.SendLocalizedMessage( 501602 ); // Your music succeeds, as you start a fight.
m_Instrument.PlayInstrumentWell( from );
m_Instrument.ConsumeUse( from );
m_Creature.Provoke( from, creature, true );
}
}
}
}
else
{
from.SendLocalizedMessage( 501593 ); // You can't tell someone to attack themselves!
}
}
else
{
from.SendLocalizedMessage( 501589 ); // You can't incite that!
}
}
}