当前位置: 首页>>代码示例>>C#>>正文


C# DamageAction.OnFinished方法代码示例

本文整理汇总了C#中WCell.RealmServer.Misc.DamageAction.OnFinished方法的典型用法代码示例。如果您正苦于以下问题:C# DamageAction.OnFinished方法的具体用法?C# DamageAction.OnFinished怎么用?C# DamageAction.OnFinished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WCell.RealmServer.Misc.DamageAction的用法示例。


在下文中一共展示了DamageAction.OnFinished方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Strike


//.........这里部分代码省略.........

			if (weapon == null)
			{
				log.Error("Trying to strike without weapon: " + this);
				return;
			}

			//if (IsMovementConrolled)
			//{
			//    // stop running when landing a hit
			//    m_Movement.Stop();
			//}

			target.IsInCombat = true;

			action.Victim = target;
			action.Attacker = this;
			action.Weapon = weapon;

			if (m_pendingCombatAbility != null && m_pendingCombatAbility.IsCasting)
			{
				// Pending combat ability
				var ability = m_pendingCombatAbility;

				// send pending animation
				if (ability.IsInstant)
				{
					m_pendingCombatAbility.SendCastStart();
				}

				if (!ability.Spell.IsRangedAbility)
				{
					m_pendingCombatAbility.CheckHitAndSendSpellGo(true);
				}

				// prevent the ability from cancelling itself
				m_pendingCombatAbility = null;

				action.Schools = ability.Spell.SchoolMask;
				action.SpellEffect = ability.Spell.Effects[0];

				if (ability.Targets.Count > 0)
				{
					action.IsDot = false;

					// AoE spell
					foreach (var targ in ability.Targets)
					{
						var dmg = GetWeaponDamage(weapon, ability);
						action.Reset(this, (Unit)targ, weapon, dmg);
						action.DoAttack();
						if (ability.Spell.IsDualWieldAbility)
						{
							action.Reset(this, (Unit)targ, weapon, Utility.Random((int)MinOffHandDamage, (int)MaxOffHandDamage + 1));
							action.DoAttack();
						}
					}
				}
				else
				{
					// single target

					// calc damage
					action.Damage = GetWeaponDamage(weapon, m_pendingCombatAbility);
					if (!action.DoAttack() &&
						ability.Spell.AttributesExC.HasFlag(SpellAttributesExC.RequiresTwoWeapons))
					{
						// missed and is not attacking with both weapons -> don't trigger spell
						CancelPendingAbility();
						return;
					}
				}

				// Impact and trigger remaining effects (if not cancelled)
				if (!ability.Spell.IsRangedAbility)
				{
					ability.Impact(ability.Spell.IsOnNextStrike);
				}
			}
			else
			{
				// no combat ability
				m_extraAttacks += 1;
				do
				{
					// calc damage
					action.Damage = GetWeaponDamage(weapon, m_pendingCombatAbility);

					action.Schools = weapon.Damages.AllSchools();
					if (action.Schools == DamageSchoolMask.None)
					{
						action.Schools = DamageSchoolMask.Physical;
					}

					// normal attack
					action.DoAttack();
				} while (--m_extraAttacks > 0);
			}
			action.OnFinished();
		}
开发者ID:ray2006,项目名称:WCell,代码行数:101,代码来源:Unit.Combat.cs

示例2: Strike

		/// <summary>
		/// Do a single attack on the target using given weapon, ability and action.
		/// </summary>
		public ProcHitFlags Strike(IWeapon weapon, DamageAction action, Unit target, SpellCast ability)
		{
			ProcHitFlags procHitFlags = ProcHitFlags.None;

			EnsureContext();
			if (!IsAlive)
			{
				return procHitFlags;
			}

			if (!target.IsInContext || !target.IsAlive)
			{
				return procHitFlags;
			}

			if (weapon == null)
			{
				log.Error("Trying to strike without weapon: " + this);
				return procHitFlags;
			}

			//if (IsMovementControlled)
			//{
			//    // stop running when landing a hit
			//    m_Movement.Stop();
			//}

			target.IsInCombat = true;

			action.Victim = target;
			action.Attacker = this;
			action.Weapon = weapon;

			if (ability != null)
			{
				action.Schools = ability.Spell.SchoolMask;
				action.SpellEffect = ability.Spell.Effects[0];

				// calc damage
				GetWeaponDamage(action, weapon, ability);
				procHitFlags = action.DoAttack();
				if (ability.Spell.AttributesExC.HasFlag(SpellAttributesExC.RequiresTwoWeapons) && m_offhandWeapon != null)
				{
					// also strike with offhand
					action.Reset(this, target, m_offhandWeapon);
					GetWeaponDamage(action, m_offhandWeapon, ability);
					procHitFlags |= action.DoAttack();
					m_lastOffhandStrike = Environment.TickCount;
				}
			}
			else
			{
				// no combat ability
				m_extraAttacks += 1;
				do
				{
					// calc damage
					GetWeaponDamage(action, weapon, null);

					action.Schools = weapon.Damages.AllSchools();
					if (action.Schools == DamageSchoolMask.None)
					{
						action.Schools = DamageSchoolMask.Physical;
					}

					// normal attack
					action.DoAttack();
				} while (--m_extraAttacks > 0);
			}
			action.OnFinished();
			return procHitFlags;
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:75,代码来源:Unit.Combat.cs

示例3: Strike


//.........这里部分代码省略.........

			action.Victim = target;
			action.Attacker = this;
			action.Weapon = weapon;

			if (m_pendingCombatAbility != null && m_pendingCombatAbility.IsCasting)
			{
				// Pending combat ability
				var ability = m_pendingCombatAbility;
				// get boni, damage and let the Spell impact
				var multiplier = 100;
				SpellEffect effect = null;
				foreach (var effectHandler in ability.Handlers)
				{
					if (effectHandler.Effect.IsStrikeEffectFlat)
					{
						action.Damage += effectHandler.CalcEffectValue();
					}
					else if (effectHandler.Effect.IsStrikeEffectPct)
					{
						multiplier += effectHandler.CalcEffectValue();
					}

					if (effect == null)
					{
						// use the first effect
						effect = effectHandler.Effect;
					}
				}
				action.Damage = (action.Damage * multiplier) / 100;

				// send pending animation
				if (ability.IsInstant)
				{
					m_pendingCombatAbility.SendCastStart();
				}

				if (!ability.Spell.IsRangedAbility)
				{
					m_pendingCombatAbility.CheckHitAndSendSpellGo(true);
				}

				// prevent the ability from cancelling itself
				m_pendingCombatAbility = null;

				action.Schools = ability.Spell.SchoolMask;
				action.SpellEffect = effect;

				if (ability.Spell.IsAreaSpell)
				{
					var totalDmg = action.Damage;
					action.IsDot = false;

					// AoE spell
					foreach (var targ in ability.Targets)
					{
						action.Reset(this, (Unit)targ, weapon, totalDmg);
						action.DoAttack();
						if (ability.Spell.IsDualWieldAbility)
						{
							action.Reset(this, (Unit)targ, weapon, Utility.Random((int)MinOffHandDamage, (int)MaxOffHandDamage + 1));
							action.DoAttack();
						}
					}
				}
				else
				{
					// single target
					if (!action.DoAttack() &&
						ability.Spell.AttributesExC.HasFlag(SpellAttributesExC.RequiresTwoWeapons))
					{
						// missed and is not attacking with both weapons -> don't trigger spell
						CancelPendingAbility();
						return;
					}
				}

				// Impact and trigger remaining effects (if not cancelled)
				if (!ability.Spell.IsRangedAbility)
				{
					ability.Impact(ability.Spell.IsOnNextStrike);
				}
			}
			else
			{
				m_extraAttacks += 1;
				do
				{
					action.Schools = weapon.Damages.AllSchools();
					if (action.Schools == DamageSchoolMask.None)
					{
						action.Schools = DamageSchoolMask.Physical;
					}

					// normal attack
					action.DoAttack();
				} while (--m_extraAttacks > 0);
			}
			action.OnFinished();
		}
开发者ID:WCellFR,项目名称:WCellFR,代码行数:101,代码来源:Unit.Combat.cs


注:本文中的WCell.RealmServer.Misc.DamageAction.OnFinished方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。