本文整理匯總了C#中wServer.realm.entities.Player.Damage方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.Damage方法的具體用法?C# Player.Damage怎麽用?C# Player.Damage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wServer.realm.entities.Player
的用法示例。
在下文中一共展示了Player.Damage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PoisonPlayer
private void PoisonPlayer(Player enemy, ActivateEffect eff)
{
var remainingDmg =
(int) StatsManager.GetDefenseDamage(enemy, Math.Max(1, eff.TotalDamage/5), enemy.ObjectDesc.Defense);
int perDmg = remainingDmg*1000/eff.DurationMS;
WorldTimer tmr = null;
int x = 0;
tmr = new WorldTimer(100, (w, t) =>
{
if (enemy.Owner == null) return;
w.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Dead,
TargetId = enemy.Id,
Color = new ARGB(0xffddff00)
}, null);
if (x%10 == 0)
{
int thisDmg;
if (remainingDmg < perDmg) thisDmg = remainingDmg;
else thisDmg = perDmg;
enemy.Damage(thisDmg, enemy, false, true);
remainingDmg -= thisDmg;
if (remainingDmg <= 0) return;
}
x++;
tmr.Reset();
Manager.Logic.AddPendingAction(_ => w.Timers.Add(tmr), PendingPriority.Creation);
});
Owner.Timers.Add(tmr);
}