本文整理汇总了C#中Enemy.ApplyConditionEffect方法的典型用法代码示例。如果您正苦于以下问题:C# Enemy.ApplyConditionEffect方法的具体用法?C# Enemy.ApplyConditionEffect怎么用?C# Enemy.ApplyConditionEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy.ApplyConditionEffect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PoisonEnemy
private void PoisonEnemy(Enemy enemy, ActivateEffect eff)
{
try
{
if (eff.ConditionEffect != null)
enemy.ApplyConditionEffect(new[]
{
new ConditionEffect
{
Effect = (ConditionEffectIndex) eff.ConditionEffect,
DurationMS = (int) eff.EffectDuration
}
});
var remainingDmg = (int)StatsManager.GetDefenseDamage(enemy, eff.TotalDamage, enemy.ObjectDesc.Defense);
var perDmg = remainingDmg * 1000 / eff.DurationMS;
WorldTimer tmr = null;
var 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(this, t, thisDmg, true);
remainingDmg -= thisDmg;
if (remainingDmg <= 0) return;
}
x++;
tmr.Reset();
RealmManager.Logic.AddPendingAction(_ => w.Timers.Add(tmr), PendingPriority.Creation);
});
Owner.Timers.Add(tmr);
}
catch
{
Console.ForegroundColor = ConsoleColor.DarkBlue;
Console.Out.WriteLine("Crash halted - Poisons!");
Console.ForegroundColor = ConsoleColor.White;
}
}
示例2: PoisonEnemy
private void PoisonEnemy(Enemy enemy, ActivateEffect eff)
{
try
{
if (eff.ConditionEffect != null)
enemy.ApplyConditionEffect(new[]
{
new ConditionEffect
{
Effect = (ConditionEffectIndex) eff.ConditionEffect,
DurationMS = (int) eff.EffectDuration
}
});
int remainingDmg = (int)StatsManager.GetDefenseDamage(enemy, eff.TotalDamage, 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(this, t, thisDmg, true);
remainingDmg -= thisDmg;
if (remainingDmg <= 0) return;
}
x++;
tmr.Reset();
Manager.Logic.AddPendingAction(_ => w.Timers.Add(tmr), PendingPriority.Creation);
});
Owner.Timers.Add(tmr);
}
catch (Exception ex)
{
Entity.logger.Error(ex);
}
}