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


C# Creature.GetTargetableCreaturesAround方法代码示例

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


在下文中一共展示了Creature.GetTargetableCreaturesAround方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 mainTarget)
		{
			// Create actions
			var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, mainTarget.EntityId);
			aAction.Set(AttackerOptions.Result);

			var cap = new CombatActionPack(attacker, skill.Info.Id, aAction);

			// Get targets
			// Add the main target as first target, so it gets the first hit,
			// and the full damage.
			var targets = new List<Creature>();
			targets.Add(mainTarget);

			var inSplashRange = attacker.GetTargetableCreaturesAround(mainTarget.GetPosition(), SplashRange);
			targets.AddRange(inSplashRange.Where(a => a != mainTarget));

			// Damage
			var damage = this.GetDamage(attacker, skill);

			var max = Math.Min(targets.Count, skill.Stacks);
			for (int i = 0; i < max; ++i)
			{
				var target = targets[i];
				var targetDamage = damage;

				target.StopMove();

				var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
				tAction.Set(TargetOptions.Result);
				tAction.Stun = TargetStun;

				// Full damage for the first target, -10% for every subsequent one.
				targetDamage -= (targetDamage * 0.1f) * i;

				// Critical Hit
				var critChance = attacker.GetTotalCritChance(target.Protection, true);
				CriticalHit.Handle(attacker, critChance, ref damage, tAction);

				// Reduce damage
				Defense.Handle(aAction, tAction, ref targetDamage);
				SkillHelper.HandleMagicDefenseProtection(target, ref targetDamage);
				SkillHelper.HandleConditions(attacker, target, ref damage);
				ManaShield.Handle(target, ref targetDamage, tAction);

				// Mana Deflector
				var mdResult = ManaDeflector.Handle(attacker, target, ref targetDamage, tAction);
				var delayReduction = mdResult.DelayReduction;
				var pinged = mdResult.Pinged;

				// Deal damage
				if (targetDamage > 0)
					target.TakeDamage(tAction.Damage = targetDamage, attacker);

				if (target == mainTarget)
					target.Aggro(attacker);

				// Reduce stun, based on ping
				if (pinged && 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
					{
						// If number of stacks is greater than the number of
						// targets hit, the targets are knocked back, which is
						// done by reducing the stability to min here.
						// Targets with high enough Mana Deflector might
						// negate this knock back, by reducing the stability
						// reduction to 0.
						var stabilityReduction = (skill.Stacks > targets.Count ? OverchargeStabilityReduction : 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)
//.........这里部分代码省略.........
开发者ID:aura-project,项目名称:aura,代码行数:101,代码来源:Lightningbolt.cs


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