本文整理汇总了C#中Server.Mobiles.PlayerMobile.CanBeHarmful方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerMobile.CanBeHarmful方法的具体用法?C# PlayerMobile.CanBeHarmful怎么用?C# PlayerMobile.CanBeHarmful使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Mobiles.PlayerMobile
的用法示例。
在下文中一共展示了PlayerMobile.CanBeHarmful方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Shoot
private static void Shoot(PlayerMobile from, Mobile target, INinjaWeapon weapon)
{
if (from != target && CanUseWeapon(from, weapon) && from.CanBeHarmful(target))
{
if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
{
from.NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo(target);
from.RevealingAction();
weapon.AttackAnimation(from, target);
ConsumeUse(weapon);
if (CombatCheck(from, target))
{
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback<object[]>(OnHit), new object[] { from, target, weapon });
}
Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerStateCallback<PlayerMobile>(ResetUsing), from);
}
else
{
from.SendLocalizedMessage(1063303); // Your target is too close!
}
}
}
示例2: Honor
private static void Honor( PlayerMobile source, Mobile target )
{
IHonorTarget honorTarget = target as IHonorTarget;
if ( honorTarget == null || !source.CanBeHarmful( target, true ) )
return;
if ( honorTarget.ReceivedHonorContext != null )
{
if ( honorTarget.ReceivedHonorContext.Source == source )
return;
if ( honorTarget.ReceivedHonorContext.CheckDistance() )
{
source.SendLocalizedMessage( 1063233 ); // Somebody else is honoring this opponent
return;
}
}
if ( target.Hits < target.HitsMax )
{
source.SendLocalizedMessage( 1063166 ); // You cannot honor this monster because it is too damaged.
return;
}
if ( source.SentHonorContext != null )
source.SentHonorContext.Cancel();
new HonorContext( source, target );
source.Direction = source.GetDirectionTo( target );
if ( !source.Mounted )
source.Animate( 32, 5, 1, true, true, 0 );
// OSI apparently removed this message... it's nice though
source.Say( 1063231 ); // I honor you
}