本文整理汇总了C#中Aura.Channel.World.Entities.Creature.GetLeftCritChance方法的典型用法代码示例。如果您正苦于以下问题:C# Creature.GetLeftCritChance方法的具体用法?C# Creature.GetLeftCritChance怎么用?C# Creature.GetLeftCritChance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.Channel.World.Entities.Creature
的用法示例。
在下文中一共展示了Creature.GetLeftCritChance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
/// <summary>
/// Handles attack.
/// </summary>
/// <param name="attacker">The creature attacking.</param>
/// <param name="skill">The skill being used.</param>
/// <param name="targetEntityId">The entity id of the target.</param>
/// <returns></returns>
public CombatSkillResult Use(Creature attacker, Skill skill, long targetEntityId)
{
if (attacker.IsStunned)
return CombatSkillResult.Okay;
var target = attacker.Region.GetCreature(targetEntityId);
if (target == null)
return CombatSkillResult.Okay;
if (!attacker.GetPosition().InRange(target.GetPosition(), attacker.AttackRangeFor(target)))
return CombatSkillResult.OutOfRange;
attacker.StopMove();
var targetPosition = target.StopMove();
// Counter
if (Counterattack.Handle(target, attacker))
return CombatSkillResult.Okay;
var rightWeapon = attacker.Inventory.RightHand;
var leftWeapon = attacker.Inventory.LeftHand;
var magazine = attacker.Inventory.Magazine;
var dualWield = (rightWeapon != null && leftWeapon != null && leftWeapon.Data.WeaponType != 0);
var maxHits = (byte)(dualWield ? 2 : 1);
int prevId = 0;
for (byte i = 1; i <= maxHits; ++i)
{
var weapon = (i == 1 ? rightWeapon : leftWeapon);
var weaponIsKnuckle = (weapon != null && weapon.Data.HasTag("/knuckle/"));
var aAction = new AttackerAction(CombatActionType.Attacker, attacker, skill.Info.Id, targetEntityId);
aAction.Set(AttackerOptions.Result);
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
tAction.Set(TargetOptions.Result);
var cap = new CombatActionPack(attacker, skill.Info.Id, aAction, tAction);
cap.Hit = i;
cap.Type = (dualWield ? CombatActionPackType.TwinSwordAttack : CombatActionPackType.NormalAttack);
cap.PrevId = prevId;
prevId = cap.Id;
// Default attacker options
aAction.Set(AttackerOptions.Result);
if (dualWield)
{
aAction.Set(AttackerOptions.DualWield);
aAction.WeaponParameterType = (byte)(i == 1 ? 2 : 1);
}
// Base damage
var damage = (i == 1 ? attacker.GetRndRightHandDamage() : attacker.GetRndLeftHandDamage());
// Critical Hit
var critChance = (i == 1 ? attacker.GetRightCritChance(target.Protection) : attacker.GetLeftCritChance(target.Protection));
CriticalHit.Handle(attacker, critChance, ref damage, tAction);
// Subtract target def/prot
SkillHelper.HandleDefenseProtection(target, ref damage);
// Defense
Defense.Handle(aAction, tAction, ref damage);
// Mana Shield
ManaShield.Handle(target, ref damage, tAction);
// Deal with it!
if (damage > 0)
target.TakeDamage(tAction.Damage = damage, attacker);
// Aggro
target.Aggro(attacker);
// Evaluate caused damage
if (!target.IsDead)
{
if (tAction.SkillId != SkillId.Defense)
{
target.Stability -= this.GetStabilityReduction(attacker, weapon) / maxHits;
// React normal for CombatMastery, knock down if
// FH and not dual wield, don't knock at all if dual.
if (skill.Info.Id != SkillId.FinalHit)
{
// Originally we thought you knock enemies back, unless it's a critical
// hit, but apparently you knock *down* under normal circumstances.
// More research to be done.
if (target.IsUnstable && target.Is(RaceStands.KnockBackable))
//tAction.Set(tAction.Has(TargetOptions.Critical) ? TargetOptions.KnockDown : TargetOptions.KnockBack);
tAction.Set(TargetOptions.KnockDown);
}
else if (!dualWield && !weaponIsKnuckle)
//.........这里部分代码省略.........
示例2: Use
/// <summary>
/// Handles attack.
/// </summary>
/// <param name="attacker">The creature attacking.</param>
/// <param name="skill">The skill being used.</param>
/// <param name="targetEntityId">The entity id of the target.</param>
/// <returns></returns>
public CombatSkillResult Use(Creature attacker, Skill skill, long targetEntityId)
{
if (attacker.IsStunned)
return CombatSkillResult.Okay;
var mainTarget = attacker.Region.GetCreature(targetEntityId);
if (mainTarget == null)
return CombatSkillResult.Okay;
if (!attacker.GetPosition().InRange(mainTarget.GetPosition(), attacker.AttackRangeFor(mainTarget)))
return CombatSkillResult.OutOfRange;
attacker.StopMove();
// Get targets, incl. splash.
var targets = new HashSet<Creature>() { mainTarget };
targets.UnionWith(attacker.GetTargetableCreaturesInCone(mainTarget.GetPosition(), attacker.GetTotalSplashRadius(), attacker.GetTotalSplashAngle()));
// Counter
if (Counterattack.Handle(targets, attacker))
return CombatSkillResult.Okay;
var rightWeapon = attacker.Inventory.RightHand;
var leftWeapon = attacker.Inventory.LeftHand;
var magazine = attacker.Inventory.Magazine;
var maxHits = (byte)(attacker.IsDualWielding ? 2 : 1);
int prevId = 0;
for (byte i = 1; i <= maxHits; ++i)
{
var weapon = (i == 1 ? rightWeapon : leftWeapon);
var weaponIsKnuckle = (weapon != null && weapon.Data.HasTag("/knuckle/"));
var aAction = new AttackerAction(CombatActionType.Attacker, attacker, targetEntityId);
aAction.Set(AttackerOptions.Result);
if (attacker.IsDualWielding)
{
aAction.Set(AttackerOptions.DualWield);
aAction.WeaponParameterType = (byte)(i == 1 ? 2 : 1);
}
var cap = new CombatActionPack(attacker, skill.Info.Id, aAction);
cap.Hit = i;
cap.Type = (attacker.IsDualWielding ? CombatActionPackType.TwinSwordAttack : CombatActionPackType.NormalAttack);
cap.PrevId = prevId;
prevId = cap.Id;
var mainDamage = (i == 1 ? attacker.GetRndRightHandDamage() : attacker.GetRndLeftHandDamage());
foreach (var target in targets)
{
if (target.IsDead)
continue;
target.StopMove();
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
tAction.Set(TargetOptions.Result);
cap.Add(tAction);
// Base damage
var damage = mainDamage;
// Elementals
damage *= attacker.CalculateElementalDamageMultiplier(target);
// Splash modifier
if (target != mainTarget)
damage *= attacker.GetSplashDamage(weapon);
// Critical Hit
var critChance = (i == 1 ? attacker.GetRightCritChance(target.Protection) : attacker.GetLeftCritChance(target.Protection));
CriticalHit.Handle(attacker, critChance, ref damage, tAction);
// Subtract target def/prot
SkillHelper.HandleDefenseProtection(target, ref damage);
// Defense
Defense.Handle(aAction, tAction, ref damage);
// Mana Shield
ManaShield.Handle(target, ref damage, tAction);
// Heavy Stander
// Can only happen on the first hit
var pinged = (cap.Hit == 1 && HeavyStander.Handle(attacker, target, ref damage, tAction));
// Deal with it!
if (damage > 0)
{
target.TakeDamage(tAction.Damage = damage, attacker);
SkillHelper.HandleInjury(attacker, target, damage);
//.........这里部分代码省略.........
示例3: Use
//.........这里部分代码省略.........
tAction.Options |= TargetOptions.Result;
}
else
{
aAction = new AttackerAction(CombatActionType.Hit, attacker, skill.Info.Id, targetEntityId);
tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, target.Skills.IsReady(SkillId.FinalHit) ? SkillId.FinalHit : SkillId.CombatMastery);
aAction.Options |= AttackerOptions.Result;
tAction.Options |= TargetOptions.Result;
}
attacker.InterceptingSkillId = SkillId.None;
var cap = new CombatActionPack(attacker, skill.Info.Id, tAction, aAction);
cap.Hit = i;
cap.MaxHits = maxHits;
cap.PrevId = prevId;
prevId = cap.Id;
// Default attacker options
aAction.Set(AttackerOptions.Result);
if (dualWield)
aAction.Set(AttackerOptions.DualWield);
// Base damage
var damage = (i == 1 ? attacker.GetRndRightHandDamage() : attacker.GetRndLeftHandDamage());
if (lowStamina)
{
damage = attacker.GetRndBareHandDamage();
}
// Critical Hit
var critShieldReduction = (target.LeftHand != null ? target.LeftHand.Data.DefenseBonusCrit : 0);
var critChance = (i == 1 ? attacker.GetRightCritChance(target.Protection + critShieldReduction) : attacker.GetLeftCritChance(target.Protection + critShieldReduction));
CriticalHit.Handle(attacker, critChance, ref damage, tAction);
var maxDamage = damage; //Damage without Defense and Protection
// Subtract target def/prot
SkillHelper.HandleDefenseProtection(target, ref damage);
// Defense
var tActionOldType = tAction.Type;
Defense.Handle(aAction, tAction, ref damage);
if (i == 1 && tAction.Type == CombatActionType.Defended)
{
defenseStun = tAction.Stun;
}
// Mana Shield
ManaShield.Handle(target, ref damage, tAction, maxDamage);
// Deal with it!
if (damage > 0)
target.TakeDamage(tAction.Damage = damage, attacker);
if (tAction.Type == CombatActionType.Defended && target.Life <= 0)
{
tAction.Type = tActionOldType;
}
// Aggro
target.Aggro(attacker);
// Evaluate caused damage
if (!target.IsDead)