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


C# TargetAction类代码示例

本文整理汇总了C#中TargetAction的典型用法代码示例。如果您正苦于以下问题:C# TargetAction类的具体用法?C# TargetAction怎么用?C# TargetAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Handle

		/// <summary>
		/// Checks if target's Mana Shield is active, calculates mana
		/// damage, and sets target action's Mana Damage property if applicable.
		/// </summary>
		/// <param name="target"></param>
		/// <param name="damage"></param>
		/// <param name="tAction"></param>
		public static void Handle(Creature target, ref float damage, TargetAction tAction)
		{
			// Mana Shield active?
			if (!target.Conditions.Has(ConditionsA.ManaShield))
				return;

			// Get Mana Shield skill to get the rank's vars
			var manaShield = target.Skills.Get(SkillId.ManaShield);
			if (manaShield == null) // Checks for things that should never ever happen, yay.
				return;

			// Var 1 = Efficiency
			var manaDamage = damage / manaShield.RankData.Var1;
			if (target.Mana >= manaDamage)
			{
				// Damage is 0 if target's mana is enough to cover it
				damage = 0;
			}
			else
			{
				// Set mana damage to target's mana and reduce the remaining
				// damage from life if the mana is not enough.
				damage -= (manaDamage - target.Mana) * manaShield.RankData.Var1;
				manaDamage = target.Mana;
			}

			// Reduce mana
			target.Mana -= manaDamage;

			if (target.Mana <= 0)
				ChannelServer.Instance.SkillManager.GetHandler<StartStopSkillHandler>(SkillId.ManaShield).Stop(target, manaShield);

			tAction.ManaDamage = manaDamage;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:41,代码来源:ManaShield.cs

示例2: 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, skill.Info.Id, mainTarget.EntityId);
			aAction.Set(AttackerOptions.Result);

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

			var targets = new List<Creature>();
			targets.Add(mainTarget);
			targets.AddRange(mainTarget.Region.GetCreaturesInRange(mainTarget.GetPosition(), SplashRange).Where(a => a != mainTarget && attacker.CanTarget(a) && attacker.CanAttack(a)));

			// 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;

				// Reduce damage
				var maxDamage = damage; //Damage without Defense and Protection
				// Reduce damage
				Defense.Handle(aAction, tAction);
				SkillHelper.HandleMagicDefenseProtection(target, ref targetDamage);
				ManaShield.Handle(target, ref targetDamage, tAction, maxDamage, true);

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

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

				// Death/Knockback
				this.HandleKnockBack(attacker, target, tAction);

				cap.Add(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();
		}
开发者ID:xKamuna,项目名称:aura,代码行数:66,代码来源:Lightningbolt.cs

示例3: selectTargetAction

 public TargetAction selectTargetAction()
 {
     TargetAction targetAction = new TargetAction();
     targetAction.target = selectTarget();
     targetAction.action = selectAction();
     return targetAction;
 }
开发者ID:sjai013,项目名称:RPG,代码行数:7,代码来源:SkeletonAI.cs

示例4: AutoTargetSession

 public AutoTargetSession(object entity, TargetAction action)
 {
     this.m_Entity = entity;
     this.m_Action = action;
     this.m_Timer = new Timer(new OnTick(Engine.AutoTarget_Expire), 0x9c4, 1);
     this.m_Timer.SetTag("Session", this);
     this.m_Timer.Start(false);
 }
开发者ID:Skinny1001,项目名称:PlayUO,代码行数:8,代码来源:AutoTargetSession.cs

示例5: HandleKnockBack

		/// <summary>
		/// Handles knock back/stun/death.
		/// </summary>
		protected override void HandleKnockBack(Creature attacker, Creature target, TargetAction tAction, bool overcharge)
		{
			attacker.Shove(target, KnockbackDistance);
			if (target.IsDead)
				tAction.Set(TargetOptions.FinishingKnockDown);
			else
				tAction.Set(TargetOptions.KnockDown);
		}
开发者ID:Vinna,项目名称:aura,代码行数:11,代码来源:Firebolt.cs

示例6: GetFlags

        public static ServerTargetFlags GetFlags(TargetAction action)
        {
            if (action < TargetAction.DetectHidden)
            {
                if (action >= TargetAction.Bola)
                {
                    return ServerTargetFlags.Harmful;
                }
                if (action >= TargetAction.Bandage)
                {
                    return ServerTargetFlags.Beneficial;
                }
                switch (action)
                {
                    case TargetAction.Clumsy:
                    case TargetAction.Feeblemind:
                    case TargetAction.MagicArrow:
                    case TargetAction.Weaken:
                    case TargetAction.Harm:
                    case TargetAction.Fireball:
                    case TargetAction.Poison:
                    case TargetAction.Curse:
                    case TargetAction.Lightning:
                    case TargetAction.ManaDrain:
                    case TargetAction.MindBlast:
                    case TargetAction.Paralyze:
                    case TargetAction.Dispel:
                    case TargetAction.EnergyBolt:
                    case TargetAction.Explosion:
                    case TargetAction.FlameStrike:
                    case TargetAction.ManaVampire:
                        return ServerTargetFlags.Harmful;

                    case TargetAction.Heal:
                    case TargetAction.Agility:
                    case TargetAction.Cunning:
                    case TargetAction.Cure:
                    case TargetAction.Strength:
                    case TargetAction.Bless:
                    case TargetAction.GreaterHeal:
                    case TargetAction.Invisibility:
                    case TargetAction.Resurrection:
                        return ServerTargetFlags.Beneficial;

                    case TargetAction.ArchCure:
                    case TargetAction.ArchProtection:
                    case TargetAction.FireField:
                    case TargetAction.PoisonField:
                    case TargetAction.ParalyzeField:
                    case TargetAction.Reveal:
                    case TargetAction.ChainLightning:
                    case TargetAction.EnergyField:
                    case TargetAction.MeteorSwarm:
                        return ServerTargetFlags.None;
                }
            }
            return ServerTargetFlags.None;
        }
开发者ID:Skinny1001,项目名称:PlayUO,代码行数:58,代码来源:TargetActions.cs

示例7: 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();
		}
开发者ID:tkiapril,项目名称:aura,代码行数:61,代码来源:Firebolt.cs

示例8: Start

        public override SkillResults Start(MabiCreature creature, MabiSkill skill)
        {
            creature.Activate(CreatureConditionB.Demigod);

            creature.StopMove();

            // Spawn eruption
            {
                var pos = creature.GetPosition();
                var targets = WorldManager.Instance.GetAttackableCreaturesInRange(creature, EruptionRadius);

                var cap = new CombatActionPack(creature, skill.Id);
                var aAction = new AttackerAction(CombatActionType.SpecialHit, creature, skill.Id, SkillHelper.GetAreaTargetID(creature.Region, pos.X, pos.Y));
                aAction.Options |= AttackerOptions.KnockBackHit1 | AttackerOptions.UseEffect;

                cap.Add(aAction);

                foreach (var target in targets)
                {
                    target.StopMove();

                    // Officials use CM skill id.
                    var tAction = new TargetAction(CombatActionType.TakeHit, target, creature, skill.Id);
                    tAction.StunTime = EruptionStun;
                    tAction.Delay = 1000;

                    // Supposedly it's magic damage
                    tAction.Damage = creature.GetMagicDamage(null, EruptionDamage);

                    target.TakeDamage(tAction.Damage);
                    tAction.OldPosition = CombatHelper.KnockBack(target, creature, EruptionKnockBack);
                    if (target.IsDead)
                        tAction.Options |= TargetOptions.FinishingKnockDown;

                    cap.Add(tAction);
                }

                WorldManager.Instance.HandleCombatActionPack(cap);
            }

            Send.EffectDelayed(Effect.AwakeningOfLight1, 800, creature);
            Send.EffectDelayed(Effect.AwakeningOfLight2, 800, creature);
            Send.UseMotion(creature, 67, 3, false, false);

            creature.StatRegens.Add(creature.Temp.DemiHpRegen = new MabiStatRegen(Stat.Life, skill.RankInfo.Var3, creature.LifeMax));
            creature.StatRegens.Add(creature.Temp.DemiMpRegen = new MabiStatRegen(Stat.Mana, skill.RankInfo.Var4, creature.ManaMax));
            creature.StatRegens.Add(creature.Temp.DemiStmRegen = new MabiStatRegen(Stat.Stamina, skill.RankInfo.Var5, creature.StaminaMax));
            WorldManager.Instance.CreatureStatsUpdate(creature);

            return SkillResults.Okay;
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:51,代码来源:AwakeningOfLight.cs

示例9: Handle

		/// <summary>
		/// Checks if target's Mana Shield is active, calculates mana
		/// damage, and sets target action's Mana Damage property if applicable.
		/// </summary>
		/// <param name="target"></param>
		/// <param name="damage"></param>
		/// <param name="tAction"></param>
		public static void Handle(Creature target, ref float damage, TargetAction tAction, float maxDamage, bool magic = false, bool killWhileDeadly = true)
		{
			// Mana Shield active?
			if (!target.Conditions.Has(ConditionsA.ManaShield))
				return;

			// Get Mana Shield skill to get the rank's vars
			var manaShield = target.Skills.Get(SkillId.ManaShield);
			if (manaShield == null) // Checks for things that should never ever happen, yay.
				return;

			// Var 1 = Efficiency
			var manaDamage = 0f;
			if (magic)
			{
				manaDamage = maxDamage / manaShield.RankData.Var1;
				SkillHelper.HandleMagicDefenseProtection(target, ref manaDamage, false, true);
			}
			else
			{
				manaDamage = (maxDamage - (target.LeftHand != null ? target.LeftHand.Data.DefenseBonusMeleePassive : 0)) / manaShield.RankData.Var1;
			}
			if (target.Mana >= manaDamage)
			{
				// Damage is 0 if target's mana is enough to cover it
				damage = 0;
			}
			else
			{
				// Set mana damage to target's mana and reduce the remaining
				// damage from life if the mana is not enough.
				manaDamage = target.Mana;
				damage = Math.Max(1f, damage - manaDamage);
			}
			if (damage <= 0 && target.Life <= 0 && killWhileDeadly)
			{
				damage = 1;
			}

			// Reduce mana
			target.Mana -= manaDamage;

			if (target.Mana <= 0)
				ChannelServer.Instance.SkillManager.GetHandler<StartStopSkillHandler>(SkillId.ManaShield).Stop(target, manaShield);

			tAction.ManaDamage = manaDamage;
		}
开发者ID:xKamuna,项目名称:aura,代码行数:54,代码来源:ManaShield.cs

示例10: Handle

		/// <summary>
		/// Checks if attacker has Critical Hit and applies crit bonus
		/// by chance. Also sets the target action's critical option if a
		/// crit happens.
		/// </summary>
		/// <param name="attacker"></param>
		/// <param name="critChance"></param>
		/// <param name="damage"></param>
		/// <param name="tAction"></param>
		public static void Handle(Creature attacker, float critChance, ref float damage, TargetAction tAction, bool bypassNoviceCheck = false)
		{
			// Check if attacker actually has critical hit
			var critSkill = attacker.Skills.Get(SkillId.CriticalHit);
			if (critSkill == null || (critSkill.Info.Rank == SkillRank.Novice && !bypassNoviceCheck))
				return;

			// Cancel if crit doesn't happen
			if (RandomProvider.Get().Next(100) >= critChance)
				return;

			// Add crit bonus
			var bonus = critSkill.RankData.Var1 / 100f;
			damage = damage + (damage * bonus);

			// Set target option
			tAction.Set(TargetOptions.Critical);
		}
开发者ID:aura-project,项目名称:aura,代码行数:27,代码来源:CriticalHit.cs

示例11: OnCreatureAttack

		/// <summary>
		/// Handles training based on what happened in the combat action.
		/// </summary>
		/// <param name="tAction"></param>
		private void OnCreatureAttack(TargetAction tAction)
		{
			if (!tAction.Has(TargetOptions.Critical))
				return;

			var attackerSkill = tAction.Attacker.Skills.Get(SkillId.CriticalHit);
			var targetSkill = tAction.Creature.Skills.Get(SkillId.CriticalHit);

			if (attackerSkill.Info.Rank == SkillRank.Novice)
			{
				if (tAction.Is(CombatActionType.CounteredHit2))
					attackerSkill.Train(1); // Novice -> RF
			}
			else
			{
				attackerSkill.Train(1); // Land a critical hit.

				if (tAction.Creature.IsDead)
					attackerSkill.Train(3); // Finish off with critical hit.
			}

			if (targetSkill != null && targetSkill.Info.Rank >= SkillRank.RF)
				attackerSkill.Train(2); // Learn from enemy's critical hit.
		}
开发者ID:tkiapril,项目名称:aura,代码行数:28,代码来源:CriticalHit.cs

示例12: Use

		/// <summary>
		/// Handles skill usage.
		/// </summary>
		/// <param name="attacker"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Use(Creature attacker, Skill skill, Packet packet)
		{
			var targetAreaEntityId = packet.GetLong();

			Send.Effect(attacker, 5, (byte)1, targetAreaEntityId);

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

			var aAction = new AttackerAction(CombatActionType.Attacker, attacker, skill.Info.Id, targetAreaEntityId);
			aAction.Options |= AttackerOptions.Result;
			aAction.Stun = UseStun;
			cap.Add(aAction);

			var attackerPosition = attacker.GetPosition();

			// Calculate rectangular target area
			var targetAreaPos = new Position(targetAreaEntityId);
			var poe = targetAreaPos.GetRelative(attackerPosition, -800);
			var r = (Math.PI / 2) + Math.Atan2(attackerPosition.Y - targetAreaPos.Y, attackerPosition.X - targetAreaPos.X);
			var pivot = new Point(poe.X, poe.Y);
			var p1 = new Point(pivot.X - LaserRectWidth / 2, pivot.Y - LaserRectHeight / 2);
			var p2 = new Point(pivot.X - LaserRectWidth / 2, pivot.Y + LaserRectHeight / 2);
			var p3 = new Point(pivot.X + LaserRectWidth / 2, pivot.Y + LaserRectHeight / 2);
			var p4 = new Point(pivot.X + LaserRectWidth / 2, pivot.Y - LaserRectHeight / 2);
			p1 = this.RotatePoint(p1, pivot, r);
			p2 = this.RotatePoint(p2, pivot, r);
			p3 = this.RotatePoint(p3, pivot, r);
			p4 = this.RotatePoint(p4, pivot, r);

			// Attack targets
			var targets = attacker.Region.GetCreaturesInPolygon(p1, p2, p3, p4);
			foreach (var target in targets.Where(cr => !cr.IsDead && !cr.Has(CreatureStates.NamedNpc)))
			{
				var targetPosition = target.GetPosition();

				var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
				tAction.Options = TargetOptions.Result | TargetOptions.KnockDown;
				tAction.Stun = TargetStun;
				tAction.Delay = 1200;
				cap.Add(tAction);

				// Var2: 300/1000, based on rank. Could be damage?
				var damage = skill.RankData.Var2;

				// Increase damage
				CriticalHit.Handle(attacker, attacker.GetTotalCritChance(target.Protection), ref damage, tAction);

				// Reduce damage
				SkillHelper.HandleDefenseProtection(target, ref damage);
				ManaShield.Handle(target, ref damage, tAction);

				// Apply damage
				target.TakeDamage(tAction.Damage = 300, attacker);
				target.Stability = Creature.MinStability;

				// Aggro
				target.Aggro(attacker);

				// Check death
				if (target.IsDead)
					tAction.Options |= TargetOptions.FinishingKnockDown;

				// Knock back
				attacker.Shove(target, KnockbackDistance);
			}

			cap.Handle();

			Send.SkillUse(attacker, skill.Info.Id, 0);
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:76,代码来源:GlasGhaibhleannSkill.cs

示例13: OnCreatureAttacks

		/// <summary>
		/// Handles the majority of the skill training.
		/// </summary>
		/// <param name="obj"></param>
		private void OnCreatureAttacks(TargetAction tAction)
		{
			if (tAction.SkillId != SkillId.RangedAttack)
				return;

			var attackerSkill = tAction.Attacker.Skills.Get(SkillId.RangedAttack);
			var targetSkill = tAction.Creature.Skills.Get(SkillId.RangedAttack);
			var targetPowerRating = tAction.Attacker.GetPowerRating(tAction.Creature);
			var attackerPowerRating = tAction.Creature.GetPowerRating(tAction.Attacker);

			if (attackerSkill != null)
			{
				if (attackerSkill.Info.Rank == SkillRank.RF)
				{
					attackerSkill.Train(2); // Attack an enemy.

					if (tAction.Has(TargetOptions.KnockDown))
						attackerSkill.Train(3); // Down the enemy with continuous hit.

					if (tAction.Creature.IsDead)
						attackerSkill.Train(4); // Kill an enemy.
				}
				else if (attackerSkill.Info.Rank == SkillRank.RE)
				{
					if (targetPowerRating == PowerRating.Normal)
						attackerSkill.Train(3); // Attack a same level enemy.

					if (tAction.Has(TargetOptions.KnockDown))
					{
						attackerSkill.Train(1); // Down the enemy with continuous hit.

						if (targetPowerRating == PowerRating.Normal)
							attackerSkill.Train(4); // Down a same level enemy. 

						if (targetPowerRating == PowerRating.Strong)
							attackerSkill.Train(6); // Down a strong enemy.
					}

					if (tAction.Creature.IsDead)
					{
						attackerSkill.Train(2); // Kill an enemy.

						if (targetPowerRating == PowerRating.Normal)
							attackerSkill.Train(5); // Kill a same level enemy. 

						if (targetPowerRating == PowerRating.Strong)
							attackerSkill.Train(7); // Kill a strong enemy.
					}
				}
				else if (attackerSkill.Info.Rank == SkillRank.RD)
				{
					attackerSkill.Train(1); // Attack any enemy. 

					if (targetPowerRating == PowerRating.Normal)
						attackerSkill.Train(4); // Attack a same level enemy.

					if (tAction.Has(TargetOptions.KnockDown))
					{
						attackerSkill.Train(2); // Down the enemy with continuous hit.

						if (targetPowerRating == PowerRating.Normal)
							attackerSkill.Train(5); // Down a same level enemy. 

						if (targetPowerRating == PowerRating.Strong)
							attackerSkill.Train(7); // Down a strong enemy.
					}

					if (tAction.Creature.IsDead)
					{
						attackerSkill.Train(3); // Kill an enemy.

						if (targetPowerRating == PowerRating.Normal)
							attackerSkill.Train(6); // Kill a same level enemy. 

						if (targetPowerRating == PowerRating.Strong)
							attackerSkill.Train(8); // Kill a strong enemy.
					}
				}
				else if (attackerSkill.Info.Rank >= SkillRank.RC && attackerSkill.Info.Rank <= SkillRank.RB)
				{
					if (targetPowerRating == PowerRating.Normal)
						attackerSkill.Train(1); // Attack a same level enemy.

					if (tAction.Has(TargetOptions.KnockDown))
					{
						if (targetPowerRating == PowerRating.Normal)
							attackerSkill.Train(2); // Down a same level enemy. 

						if (targetPowerRating == PowerRating.Strong)
							attackerSkill.Train(4); // Down a strong enemy.

						if (targetPowerRating == PowerRating.Awful)
							attackerSkill.Train(6); // Down an awful enemy.
					}

					if (tAction.Creature.IsDead)
//.........这里部分代码省略.........
开发者ID:xKamuna,项目名称:aura,代码行数:101,代码来源:RangedAttack.cs

示例14: Use

		/// <summary>
		/// Uses the skill.
		/// </summary>
		/// <param name="attacker"></param>
		/// <param name="skill"></param>
		/// <param name="targetEntityId"></param>
		/// <returns></returns>
		public CombatSkillResult Use(Creature attacker, Skill skill, long targetEntityId)
		{
			// Get target
			var target = attacker.Region.GetCreature(targetEntityId);
			if (target == null)
				return CombatSkillResult.InvalidTarget;

			if (target.IsNotReadyToBeHit)
				return CombatSkillResult.Okay;

			var targetPos = target.GetPosition();
			var attackerPos = attacker.GetPosition();

			// Check range
			//if (!attackerPos.InRange(targetPos, attacker.RightHand.OptionInfo.EffectiveRange + 100))
			//	return CombatSkillResult.OutOfRange;

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

			var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, skill.Info.Id, targetEntityId);
			aAction.Set(AttackerOptions.Result);
			aAction.Stun = AttackerStun;
			cap.Add(aAction);

			// Hit by chance
			var chance = attacker.AimMeter.GetAimChance(target);
			var rnd = RandomProvider.Get();
			if (rnd.NextDouble() * 100 < chance)
			{
				var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
				tAction.Set(TargetOptions.Result);
				tAction.Stun = TargetStun;
				cap.Add(tAction);

				// Damage
				var damage = attacker.GetRndRangedDamage();

				// More damage with fire arrow
				if (attacker.Temp.FireArrow)
					damage *= FireBonus;

				// Critical Hit
				var critShieldReduction = (target.LeftHand != null ? target.LeftHand.Data.DefenseBonusCrit : 0);
				var critChance = attacker.GetRightCritChance(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
				Defense.Handle(aAction, tAction, ref damage, true);

				// Mana Shield
				ManaShield.Handle(target, ref damage, tAction, maxDamage);

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

				// Aggro
				target.Aggro(attacker);

				// Death/Knockback
				if (target.IsDead)
				{
					tAction.Set(TargetOptions.FinishingKnockDown);
					attacker.Shove(target, KnockBackDistance);
				}
				else
				{
					// Insta-recover in knock down
					// TODO: Tied to stability?
					if (target.IsKnockedDown)
					{
						tAction.Stun = 0;
					}
					// Knock down if hit repeatedly
					else if (target.Stability < 30)
					{
						tAction.Set(TargetOptions.KnockDown);
					}
					// Normal stability reduction
					else
					{
						target.Stability -= StabilityReduction;
						if (target.IsUnstable)
						{
							tAction.Set(TargetOptions.KnockBack);
							attacker.Shove(target, KnockBackDistance);
						}
					}
//.........这里部分代码省略.........
开发者ID:xKamuna,项目名称:aura,代码行数:101,代码来源:RangedAttack.cs

示例15: Train

		/// <summary>
		/// Trains skill based on target action.
		/// </summary>
		/// <param name="tAction"></param>
		/// <param name="attackerSkill"></param>
		protected virtual void Train(TargetAction tAction, Skill attackerSkill)
		{
			var rating = tAction.Attacker.GetPowerRating(tAction.Creature);

			if (attackerSkill.Info.Rank == SkillRank.RF)
			{
				attackerSkill.Train(1); // Attack anything.
				attackerSkill.Train(2); // Attack an enemy.

				if (tAction.Has(TargetOptions.KnockDown))
					attackerSkill.Train(3); // Knock down an enemy using combo attack.

				if (tAction.Creature.IsDead)
					attackerSkill.Train(4); // Defeat an enemy.

				return;
			}

			if (attackerSkill.Info.Rank == SkillRank.RE)
			{
				if (tAction.Has(TargetOptions.KnockDown))
					attackerSkill.Train(1); // Knock down an enemy using combo attack.

				if (tAction.Creature.IsDead)
					attackerSkill.Train(2); // Defeat an enemy.

				if (rating == PowerRating.Normal)
				{
					attackerSkill.Train(3); // Attack a similar-ranked enemy.

					if (tAction.Has(TargetOptions.KnockDown))
						attackerSkill.Train(4); // Knock down a similar-ranked enemy.

					if (tAction.Creature.IsDead)
						attackerSkill.Train(5); // Defeat a similar-ranked enemy.
				}
				else if (rating == PowerRating.Strong)
				{
					if (tAction.Has(TargetOptions.KnockDown))
						attackerSkill.Train(6); // Knock down a powerful enemy.

					if (tAction.Creature.IsDead)
						attackerSkill.Train(7); // Defeat a powerful enemy.
				}

				return;
			}

			if (attackerSkill.Info.Rank == SkillRank.RD)
			{
				attackerSkill.Train(1); // Defeat an enemy (They probably mean attack?)

				if (tAction.Has(TargetOptions.KnockDown))
					attackerSkill.Train(2); // Knock down an enemy using combo attack.

				if (tAction.Creature.IsDead)
					attackerSkill.Train(3); // Defeat an enemy.

				if (rating == PowerRating.Normal)
				{
					attackerSkill.Train(4); // Attack a similar-ranked enemy.

					if (tAction.Has(TargetOptions.KnockDown))
						attackerSkill.Train(5); // Knock down a similar-ranked enemy.

					if (tAction.Creature.IsDead)
						attackerSkill.Train(6); // Defeat a similar-ranked enemy.
				}
				else if (rating == PowerRating.Strong)
				{
					if (tAction.Has(TargetOptions.KnockDown))
						attackerSkill.Train(7); // Knock down a powerful enemy.

					if (tAction.Creature.IsDead)
						attackerSkill.Train(8); // Defeat a powerful enemy.
				}

				return;
			}

			if (attackerSkill.Info.Rank >= SkillRank.RC && attackerSkill.Info.Rank <= SkillRank.RB)
			{
				if (rating == PowerRating.Normal)
				{
					attackerSkill.Train(1); // Attack a similar-ranked enemy.

					if (tAction.Has(TargetOptions.KnockDown))
						attackerSkill.Train(2); // Knock down a similar-ranked enemy.

					if (tAction.Creature.IsDead)
						attackerSkill.Train(3); // Defeat a similar-ranked enemy.
				}
				else if (rating == PowerRating.Strong)
				{
					if (tAction.Has(TargetOptions.KnockDown))
//.........这里部分代码省略.........
开发者ID:ripxfrostbite,项目名称:aura,代码行数:101,代码来源:MagicBolt.cs


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