本文整理汇总了C#中Aura.World.World.MabiCreature.TakeDamage方法的典型用法代码示例。如果您正苦于以下问题:C# MabiCreature.TakeDamage方法的具体用法?C# MabiCreature.TakeDamage怎么用?C# MabiCreature.TakeDamage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.World.World.MabiCreature
的用法示例。
在下文中一共展示了MabiCreature.TakeDamage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Explode
protected void Explode(MabiCreature attacker, MabiCreature target, MabiSkill skill, MabiProp casterProp, float dmgModifier = 1f)
{
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, target.Id).PutInt(Effect.IcespearFreeze).PutByte(1).PutInt(0), SendTargets.Range, target); // Cancel freeze
var tPos = target.GetPosition();
var bombProp = new MabiProp(280, target.Region, tPos.X, tPos.Y, 0); //4
WorldManager.Instance.AddProp(bombProp);
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, bombProp.Id).PutInts(Effect.IcespearBoom, target.Region, tPos.X, tPos.Y), SendTargets.Range, bombProp);
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, target.Id).PutInt(Effect.Thunderbolt).PutByte(0), SendTargets.Range, target);
var sAction = new AttackerAction(CombatActionType.SpecialHit, attacker, skill.Id, SkillHelper.GetAreaTargetID(target.Region, tPos.X, tPos.Y));
sAction.PropId = casterProp.Id;
sAction.Options = AttackerOptions.KnockBackHit1 | AttackerOptions.UseEffect;
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Id);
tAction.Options = TargetOptions.Result;
tAction.StunTime = target.Stun = 2000;
var rnd = RandomProvider.Get();
var damage = attacker.GetMagicDamage(attacker.RightHand, rnd.Next((int)skill.RankInfo.Var1, (int)skill.RankInfo.Var2 + 1)) * dmgModifier;
if (CombatHelper.TryAddCritical(target, ref damage, attacker.CriticalChanceAgainst(target)))
tAction.Options |= TargetOptions.Critical;
target.TakeDamage(tAction.Damage = damage);
// Knock down if dead
tAction.OldPosition = CombatHelper.KnockBack(target, bombProp);
if (target.IsDead)
{
tAction.Options |= TargetOptions.FinishingKnockDown;
}
else
{
tAction.Options |= TargetOptions.KnockDown;
CombatHelper.SetAggro(attacker, target);
}
var cap = new CombatActionPack(attacker, skill.Id);
cap.Add(sAction, tAction);
WorldManager.Instance.HandleCombatActionPack(cap);
sAction = new AttackerAction(CombatActionType.SpecialHit, attacker, skill.Id, SkillHelper.GetAreaTargetID(target.Region, tPos.X, tPos.Y));
sAction.PropId = bombProp.Id;
sAction.Options = AttackerOptions.UseEffect;
cap = new CombatActionPack(attacker, skill.Id);
cap.Add(sAction);
WorldManager.Instance.HandleCombatActionPack(cap);
WorldManager.Instance.RemoveProp(bombProp);
}