本文整理汇总了C#中GameLiving.GetDistanceTo方法的典型用法代码示例。如果您正苦于以下问题:C# GameLiving.GetDistanceTo方法的具体用法?C# GameLiving.GetDistanceTo怎么用?C# GameLiving.GetDistanceTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameLiving
的用法示例。
在下文中一共展示了GameLiving.GetDistanceTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DamageTarget
private void DamageTarget(GameLiving target)
{
if (!GameServer.ServerRules.IsAllowedToAttack(owner, target, true))
return;
if (!target.IsAlive)
return;
if (ticktimer.IsAlive)
{
ticktimer.Stop();
removeHandlers();
}
int dist = target.GetDistanceTo( new Point3D( traparea.X, traparea.Y, traparea.Z ) );
double mod = 1;
if (dist > 0)
mod = 1 - ((double)dist / 350);
int basedamage = (int)(effectiveness * mod);
int resist = (int)(basedamage * target.GetModified(eProperty.Resist_Energy) * -0.01);
int damage = basedamage + resist;
GamePlayer player = owner as GamePlayer;
if (player != null)
{
player.Out.SendMessage("You hit " + target.Name + " for " + damage + "(" + resist + ") points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
}
GamePlayer targetPlayer = target as GamePlayer;
if (targetPlayer != null)
{
if (targetPlayer.IsStealthed)
targetPlayer.Stealth(false);
}
foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE))
{
p.Out.SendSpellEffectAnimation(owner, target, 7026, 0, false, 1);
p.Out.SendCombatAnimation(owner, target, 0, 0, 0, 0, 0x14, target.HealthPercent);
}
//target.TakeDamage(owner, eDamageType.Energy, damage, 0);
AttackData ad = new AttackData();
ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
ad.Attacker = owner;
ad.Target = target;
ad.DamageType = eDamageType.Energy;
ad.Damage = damage;
target.OnAttackedByEnemy(ad);
owner.DealDamage(ad);
}