public static int GetLuckChance( Mobile killer, Mobile victim )
{
if ( !Core.AOS )
return 0;
int luck = killer.Luck;
PlayerMobile pmKiller = killer as PlayerMobile;
if( pmKiller != null && pmKiller.SentHonorContext != null && pmKiller.SentHonorContext.Target == victim )
luck += pmKiller.SentHonorContext.PerfectionLuckBonus;
if ( luck < 0 )
return 0;
if ( !Core.SE && luck > 1200 )
luck = 1200;
return (int)(Math.Pow( luck, 1 / 1.8 ) * 100);
}
public void OnTargetHit( Mobile from )
{
if ( from != m_Source || m_Perfection == 100 )
return;
int bushido = (int) from.Skills.Bushido.Value;
if ( bushido < 50 )
return;
m_Perfection += bushido / 10;
if ( m_Perfection >= 100 )
{
m_Perfection = 100;
m_Source.SendLocalizedMessage( 1063254 ); // You have Achieved Perfection in inflicting damage to this opponent!
}
else
{
m_Source.SendLocalizedMessage( 1063255 ); // You gain in Perfection as you precisely strike your opponent.
}
}
public int PerfectionLuckBonus
{
get{ return (m_Perfection * m_Perfection) / 10; }
}