本文整理汇总了C#中Aura.Channel.World.Entities.Creature.TakeDamage方法的典型用法代码示例。如果您正苦于以下问题:C# Creature.TakeDamage方法的具体用法?C# Creature.TakeDamage怎么用?C# Creature.TakeDamage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.Channel.World.Entities.Creature
的用法示例。
在下文中一共展示了Creature.TakeDamage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UseSkillOnTarget
/// <summary>
/// Bolt specific use code.
/// </summary>
/// <param name="attacker"></param>
/// <param name="skill"></param>
/// <param name="target"></param>
protected override void UseSkillOnTarget(Creature attacker, Skill skill, Creature target)
{
attacker.StopMove();
target.StopMove();
// Create actions
var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, target.EntityId);
aAction.Set(AttackerOptions.Result);
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
tAction.Set(TargetOptions.Result);
tAction.Stun = TargetStun;
var cap = new CombatActionPack(attacker, skill.Info.Id, aAction, tAction);
// Damage
var damage = this.GetDamage(attacker, skill);
// Elements
damage *= this.GetElementalDamageMultiplier(attacker, target);
// Reduce damage
SkillHelper.HandleMagicDefenseProtection(target, ref damage);
ManaShield.Handle(target, ref damage, tAction);
ManaDeflector.Handle(attacker, target, ref damage, tAction);
// Deal damage
if (damage > 0)
target.TakeDamage(tAction.Damage = damage, attacker);
target.Aggro(attacker);
// Knock down on deadly
if (target.Conditions.Has(ConditionsA.Deadly))
{
tAction.Set(TargetOptions.KnockDown);
tAction.Stun = TargetStun;
}
// Death/Knockback
attacker.Shove(target, KnockbackDistance);
if (target.IsDead)
tAction.Set(TargetOptions.FinishingKnockDown);
else
tAction.Set(TargetOptions.KnockDown);
// Override stun set by defense
aAction.Stun = AttackerStun;
Send.Effect(attacker, Effect.UseMagic, EffectSkillName);
Send.SkillUseStun(attacker, skill.Info.Id, aAction.Stun, 1);
skill.Stacks = 0;
cap.Handle();
}
示例2: UseSkillOnTarget
/// <summary>
/// Bolt specific use code.
/// </summary>
/// <param name="attacker"></param>
/// <param name="skill"></param>
/// <param name="target"></param>
protected virtual void UseSkillOnTarget(Creature attacker, Skill skill, Creature target)
{
target.StopMove();
// Create actions
var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, skill.Info.Id, target.EntityId);
aAction.Set(AttackerOptions.Result);
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
tAction.Set(TargetOptions.Result);
tAction.Stun = TargetStun;
var cap = new CombatActionPack(attacker, skill.Info.Id, aAction, tAction);
// Damage
var damage = this.GetDamage(attacker, skill);
// Reduce damage
if (this.Defendable)
Defense.Handle(aAction, tAction, ref damage);
SkillHelper.HandleMagicDefenseProtection(target, ref damage);
ManaShield.Handle(target, ref damage, tAction);
// Deal damage
if (damage > 0)
target.TakeDamage(tAction.Damage = damage, attacker);
target.Aggro(attacker);
// Death/Knockback
this.HandleKnockBack(attacker, target, tAction);
// Override stun set by defense
aAction.Stun = AttackerStun;
Send.Effect(attacker, Effect.UseMagic, EffectSkillName);
Send.SkillUseStun(attacker, skill.Info.Id, aAction.Stun, 1);
this.BeforeHandlingPack(attacker, skill);
cap.Handle();
}
示例3: Use
/// <summary>
/// Handles usage of the skill.
/// </summary>
/// <param name="attacker"></param>
/// <param name="target"></param>
public void Use(Creature attacker, Creature target)
{
// Updating unlock because of the updating lock for pre-renovation
// Has to be done here because we can't have an updating unlock
// after the combat action, it resets the stun.
if (!AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
attacker.Unlock(Locks.Move, true);
var skill = attacker.Skills.Get(SkillId.Counterattack);
var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, SkillId.Counterattack, target.EntityId);
aAction.Options |= AttackerOptions.Result | AttackerOptions.KnockBackHit2;
var tAction = new TargetAction(CombatActionType.CounteredHit2, target, attacker, target.Skills.IsReady(SkillId.Smash) ? SkillId.Smash : SkillId.CombatMastery);
tAction.Options |= TargetOptions.Result | TargetOptions.Smash;
var cap = new CombatActionPack(attacker, skill.Info.Id);
cap.Add(aAction, tAction);
var damage =
(attacker.GetRndTotalDamage() * (skill.RankData.Var2 / 100f)) +
(target.GetRndTotalDamage() * (skill.RankData.Var1 / 100f));
var critChance = attacker.GetTotalCritChance(target.Protection) + skill.RankData.Var3;
CriticalHit.Handle(attacker, critChance, ref damage, tAction, true);
SkillHelper.HandleDefenseProtection(target, ref damage, true, true);
target.TakeDamage(tAction.Damage = damage, attacker);
target.Aggro(attacker);
if (target.IsDead)
tAction.Options |= TargetOptions.FinishingKnockDown;
aAction.Stun = StunTime;
tAction.Stun = StunTime;
target.Stability = Creature.MinStability;
attacker.Shove(target, KnockbackDistance);
// Update both weapons
SkillHelper.UpdateWeapon(attacker, target, attacker.RightHand, attacker.LeftHand);
Send.SkillUseStun(attacker, skill.Info.Id, StunTime, 1);
this.Training(aAction, tAction);
cap.Handle();
}
示例4: UseSkillOnTarget
/// <summary>
/// Bolt specific use code.
/// </summary>
/// <param name="attacker"></param>
/// <param name="skill"></param>
/// <param name="target"></param>
protected override void UseSkillOnTarget(Creature attacker, Skill skill, Creature target)
{
attacker.StopMove();
target.StopMove();
// Create actions
var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, target.EntityId);
aAction.Set(AttackerOptions.Result);
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
tAction.Set(TargetOptions.Result);
tAction.Stun = TargetStun;
var cap = new CombatActionPack(attacker, skill.Info.Id, aAction, tAction);
// Damage
var damage = this.GetDamage(attacker, skill);
// Elements
damage *= this.GetElementalDamageMultiplier(attacker, target);
// Critical Hit
var critChance = attacker.GetTotalCritChance(target.Protection, true);
CriticalHit.Handle(attacker, critChance, ref damage, tAction);
// Reduce damage
Defense.Handle(aAction, tAction, ref damage);
SkillHelper.HandleMagicDefenseProtection(target, ref damage);
ManaShield.Handle(target, ref damage, tAction);
// Mana Deflector
var delayReduction = ManaDeflector.Handle(attacker, target, ref damage, tAction);
// Deal damage
if (damage > 0)
target.TakeDamage(tAction.Damage = damage, attacker);
target.Aggro(attacker);
// Knock down on deadly
if (target.Conditions.Has(ConditionsA.Deadly))
{
tAction.Set(TargetOptions.KnockDown);
tAction.Stun = TargetStun;
}
// Reduce stun, based on ping
if (delayReduction > 0)
tAction.Stun = (short)Math.Max(0, tAction.Stun - (tAction.Stun / 100 * delayReduction));
// Death/Knockback
if (target.IsDead)
{
tAction.Set(TargetOptions.FinishingKnockDown);
}
else
{
// If knocked down, instant recovery,
// if repeat hit, knock down,
// otherwise potential knock back.
if (target.IsKnockedDown)
{
tAction.Stun = 0;
}
else if (target.Stability < MinStability)
{
tAction.Set(TargetOptions.KnockDown);
}
else
{
var stabilityReduction = StabilityReduction;
// Reduce reduction, based on ping
// While the Wiki says that "the Knockdown Gauge [does not]
// build up", tests show that it does. However, it's
// reduced, assumedly based on the MD rank.
if (delayReduction > 0)
stabilityReduction = (short)Math.Max(0, stabilityReduction - (stabilityReduction / 100 * delayReduction));
target.Stability -= stabilityReduction;
if (target.IsUnstable)
{
tAction.Set(TargetOptions.KnockBack);
}
}
}
if (tAction.IsKnockBack)
attacker.Shove(target, KnockbackDistance);
// Override stun set by defense
aAction.Stun = AttackerStun;
Send.Effect(attacker, Effect.UseMagic, EffectSkillName);
//.........这里部分代码省略.........
示例5: Use
/// <summary>
/// Handles usage of the skill.
/// </summary>
/// <param name="attacker"></param>
/// <param name="target"></param>
public void Use(Creature attacker, Creature target)
{
// Updating unlock because of the updating lock for pre-renovation
// Has to be done here because we can't have an updating unlock
// after the combat action, it resets the stun.
if (!AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
{
attacker.Unlock(Locks.Run, true);
attacker.Unlock(Locks.Move, true);
}
var skill = attacker.Skills.Get(SkillId.Counterattack);
var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, SkillId.Counterattack, target.EntityId);
aAction.Options |= AttackerOptions.Result | AttackerOptions.KnockBackHit2;
var tAction = new TargetAction(CombatActionType.CounteredHit2, target, attacker, target.Skills.IsReady(SkillId.Smash) ? SkillId.Smash : SkillId.CombatMastery);
tAction.Options |= TargetOptions.Result | TargetOptions.Smash;
var cap = new CombatActionPack(attacker, skill.Info.Id);
cap.Add(aAction, tAction);
float damage;
if (attacker.RightHand != null && attacker.RightHand.Data.HasTag("/weapon/gun/")) //TODO: Only do this when out of ammo.
{
damage = (attacker.GetRndBareHandDamage() * (skill.RankData.Var2 / 100f)) +
(target.GetRndTotalDamage() * (skill.RankData.Var1 / 100f));
}
else
{
damage = (attacker.GetRndTotalDamage() * (skill.RankData.Var2 / 100f)) +
(target.GetRndTotalDamage() * (skill.RankData.Var1 / 100f));
}
var critShieldReduction = (target.LeftHand != null ? target.LeftHand.Data.DefenseBonusCrit : 0);
var critChance = attacker.GetTotalCritChance(target.Protection + critShieldReduction) + skill.RankData.Var3;
CriticalHit.Handle(attacker, critChance, ref damage, tAction, true);
var maxDamage = damage; //Damage without Defense and Protection
SkillHelper.HandleDefenseProtection(target, ref damage, true, true);
ManaShield.Handle(target, ref damage, tAction, maxDamage);
target.TakeDamage(tAction.Damage = damage, attacker);
target.Aggro(attacker);
if (target.IsDead)
tAction.Options |= TargetOptions.FinishingKnockDown;
if (attacker.IsCharacter && AuraData.FeaturesDb.IsEnabled("CombatSystemRenewal"))
{
aAction.Stun = 2000;
}
else
{
aAction.Stun = AttackStunTime;
}
tAction.Stun = StunTime;
target.Stability = Creature.MinStability;
attacker.Shove(target, KnockbackDistance);
// Update both weapons
SkillHelper.UpdateWeapon(attacker, target, attacker.RightHand, attacker.LeftHand);
Send.SkillUseStun(attacker, skill.Info.Id, aAction.Stun, 1);
this.Training(aAction, tAction);
cap.Handle();
}