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


C# Skill.Train方法代码示例

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


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

示例1: Prepare

		/// <summary>
		/// Prepares the skill, called after entering the MML,
		/// goes straight to Use.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public bool Prepare(Creature creature, Skill skill, Packet packet)
		{
			var scrollId = packet.GetLong();
			var title = packet.GetString();
			var author = packet.GetString();
			var mml = packet.GetString();
			var song = packet.GetString(); // [180300, NA166 (18.09.2013)] Singing
			var hidden = packet.GetByte(); // bool, but the meta data is a byte

			// Get item
			var item = creature.Inventory.GetItem(scrollId);
			if (item == null) goto L_Fail;

			// Get all parts of the MML (Melody, Haromony 1+2)
			var mmlParts = mml.Split(',');

			// Check lengths
			if (mml.Length > MmlMaxLength || song.Length > MmlMaxLength) goto L_Fail; // Total
			if (mmlParts.Length > 0 && mmlParts[0].Length > skill.RankData.Var1) goto L_Fail; // Melody
			if (mmlParts.Length > 1 && mmlParts[1].Length > skill.RankData.Var2) goto L_Fail; // Harmony 1
			if (mmlParts.Length > 2 && mmlParts[2].Length > skill.RankData.Var3) goto L_Fail; // Harmony 2

			// Score level = Musical Knowledge rank
			var level = SkillRank.Novice;
			var knowledge = creature.Skills.Get(SkillId.MusicalKnowledge);
			if (knowledge != null) level = knowledge.Info.Rank;

			// Update item and send skill complete from Complete
			creature.Skills.Callback(SkillId.Composing, () =>
			{
				// Skill training
				if (skill.Info.Rank == SkillRank.Novice)
					skill.Train(1); // Try the skill.

				// Scroll information
				item.MetaData1.SetString("TITLE", title);
				item.MetaData1.SetString("AUTHOR", author);
				item.MetaData1.SetString("SCORE", MabiZip.Compress(mml));
				item.MetaData1.SetString("SCSING", MabiZip.Compress(song)); // [180300, NA166 (18.09.2013)] Singing
				item.MetaData1.SetByte("HIDDEN", hidden);
				item.MetaData1.SetShort("LEVEL", (short)level);

				// Update
				Send.ItemUpdate(creature, item);
				Send.SkillCompleteEntity(creature, skill.Info.Id, item.EntityId);
			});

			// Finish
			Send.SkillUseEntity(creature, skill.Info.Id, scrollId);
			skill.State = SkillState.Used;
			return true;

		L_Fail:
			return false;
		}
开发者ID:aura-project,项目名称:aura,代码行数:62,代码来源:Composing.cs

示例2: AfterPlay

        /// <summary>
        /// Called when completing (training).
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="skill"></param>
        /// <param name="quality"></param>
        protected override void AfterPlay(Creature creature, Skill skill, PlayingQuality quality)
        {
            // All ranks above F have the same 3 first conditions.
            if (skill.Info.Rank >= SkillRank.RF && skill.Info.Rank <= SkillRank.R1)
            {
                if (quality >= PlayingQuality.Bad)
                    skill.Train(1); // Use the skill successfully.

                if (quality == PlayingQuality.Good)
                    skill.Train(2); // Give an excellent vocal performance.

                if (quality == PlayingQuality.VeryGood)
                    skill.Train(3); // Give a heavenly performance.

                // Very bad training possible till E.
                if (skill.Info.Rank <= SkillRank.RE && quality == PlayingQuality.VeryBad)
                    skill.Train(4); // Fail at using the skill.
            }

            // TODO: "Use the skill to grow crops faster."
            // TODO: "Grant a buff to a party member."
        }
开发者ID:Kuukrow,项目名称:aura,代码行数:28,代码来源:SongSkillHandler.cs

示例3: Start

        public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict)
        {
            creature.StopMove();

            var chairItemEntityId = dict.GetLong("ITEMID");

            if (chairItemEntityId != 0)
                this.SetUpChair(creature, chairItemEntityId);

            creature.Activate(CreatureStates.SitDown);
            Send.SitDown(creature);

            creature.Regens.Add("Rest", Stat.Life, (0.12f * ((skill.RankData.Var1 - 100) / 100)), creature.LifeMax);
            creature.Regens.Add("Rest", Stat.Stamina, (0.4f * ((skill.RankData.Var2 - 100) / 100)), creature.StaminaMax);
            creature.Regens.Add("Rest", Stat.LifeInjured, skill.RankData.Var3, creature.LifeMax);

            if (skill.Info.Rank == SkillRank.Novice) skill.Train(1); // Use Rest.

            return StartStopResult.Okay;
        }
开发者ID:pie3467,项目名称:aura,代码行数:20,代码来源:RestSkillHandler.cs

示例4: Ready

		/// <summary>
		/// Handles redying the skill, called when finishing casting it.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public override bool Ready(Creature creature, Skill skill, Packet packet)
		{
			Send.SkillReady(creature, skill.Info.Id);

			// Default lock is Run, lock Walk if no combat weapon is equipped.
			if (AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
			{
				if (creature.RightHand == null || !creature.RightHand.HasTag("/weapontype_combat/"))
					creature.Lock(Locks.Walk);
			}
			// Tell client to lock any movement if renovation isn't enabled.
			else
				creature.Lock(Locks.Move, true);

			// Training
			if (skill.Info.Rank == SkillRank.RF)
				skill.Train(1); // Use Counterattack.

			return true;
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:26,代码来源:Counterattack.cs

示例5: Start

		/// <summary>
		/// Starts rest skill.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="dict"></param>
		/// <returns></returns>
		public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict)
		{
			creature.StopMove();

			creature.IsInBattleStance = false;
			creature.AttemptingAttack = false;

			var chairItemEntityId = dict.GetLong("ITEMID");

			if (chairItemEntityId != 0)
				this.SetUpChair(creature, chairItemEntityId);

			creature.Activate(CreatureStates.SitDown);
			if (skill.Info.Rank >= SkillRank.R9)
				creature.Activate(CreatureStatesEx.RestR9);

			Send.SitDown(creature);

			// Get bonuses if meditation isn't active.
			if (!creature.Conditions.Has(ConditionsE.Meditation))
			{
				ApplyRestBonus(creature, skill, chairItemEntityId);
			}
			else
			{
				RestCampfireBonus(creature, skill, chairItemEntityId);
			}

			// Add bonus from campfire
			// TODO: Check for disappearing of campfire? (OnDisappears+Recheck)
			var campfires = creature.Region.GetProps(a => a.Info.Id == 203 && a.GetPosition().InRange(creature.GetPosition(), 500));
			if (campfires.Count > 0)
			{
				Send.Notice(creature, Localization.Get("The fire feels very warm."));
			}

			if (skill.Info.Rank == SkillRank.Novice) skill.Train(1); // Use Rest.

			return StartStopResult.Okay;
		}
开发者ID:xKamuna,项目名称:aura,代码行数:47,代码来源:Rest.cs

示例6: Use


//.........这里部分代码省略.........
				if (attacker.Temp.FireArrow)
					damage *= FireBonus;

				// Critical Hit
				var critChance = attacker.GetRightCritChance(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);

				// Natural Shield
				var delayReduction = NaturalShield.Handle(attacker, target, ref damage, tAction);

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

				// Aggro
				target.Aggro(attacker);

				// Knock down on deadly
				if (target.Conditions.Has(ConditionsA.Deadly))
					tAction.Set(TargetOptions.KnockDown);

				// Death/Knockback
				if (target.IsDead)
				{
					tAction.Set(TargetOptions.FinishingKnockDown);
				}
				else
				{
					// Insta-recover in knock down
					if (target.IsKnockedDown)
					{
						tAction.Stun = 0;
					}
					// Knock down if hit repeatedly
					else if (target.Stability < 30)
					{
						tAction.Set(TargetOptions.KnockDown);
					}
					// Normal stability reduction
					else
					{
						var stabilityReduction = StabilityReduction;

						// Reduce reduction, based on ping
						// According to the Wiki, "the Knockdown Gauge
						// [does not] build up", but it's still possible
						// to knock back with repeated hits. The stability
						// reduction is probably reduced, just like stun.
						if (delayReduction > 0)
							stabilityReduction = (short)Math.Max(0, stabilityReduction - (stabilityReduction / 100 * delayReduction));

						target.Stability -= stabilityReduction;
						if (target.IsUnstable)
						{
							tAction.Set(TargetOptions.KnockBack);
						}
					}
				}

				// Knock Back
				if (tAction.IsKnockBack)
					attacker.Shove(target, KnockBackDistance);

				// Reduce stun, based on ping
				if (delayReduction > 0)
					tAction.Stun = (short)Math.Max(0, tAction.Stun - (tAction.Stun / 100 * delayReduction));
			}

			// Skill training
			if (skill.Info.Rank == SkillRank.RF)
				skill.Train(1); // Try attacking with Arrow Revolver.

			// Reduce arrows
			if (attacker.Magazine != null && !ChannelServer.Instance.Conf.World.InfiniteArrows && !attacker.Magazine.HasTag("/unlimited_arrow/"))
				attacker.Inventory.Decrement(attacker.Magazine);

			// Reduce stack
			skill.Stacks--;

			// Handle
			cap.Handle();

			// Disable fire arrow effect
			if (attacker.Temp.FireArrow)
				Send.Effect(attacker, Effect.FireArrow, false);

			return CombatSkillResult.Okay;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:101,代码来源:ArrowRevolver.cs

示例7: Ready

		/// <summary>
		/// Readies the skill, called when casting is done.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public override bool Ready(Creature creature, Skill skill, Packet packet)
		{
			Send.SkillReady(creature, skill.Info.Id);

			// No default locks, set them depending on whether a shield is
			// equipped or not.
			if (AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
			{
				if (creature.LeftHand == null || !creature.LeftHand.IsShield)
					creature.Lock(Locks.Run);
			}
			// Send lock to client if renovation isn't enabled,
			// so it doesn't let the creature run, no matter what.
			else
			{
				creature.Lock(Locks.Run, true);
			}

			// Training
			if (skill.Info.Rank == SkillRank.RF)
				skill.Train(1); // Use the Defense skill.

			return true;
		}
开发者ID:aura-project,项目名称:aura,代码行数:30,代码来源:Defense.cs

示例8: Training

		/// <summary>
		/// Handles skill training.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="success"></param>
		/// <param name="item"></param>
		/// <exception cref="ArgumentException"></exception>
		public void Training(Creature creature, Skill skill, bool success, Item item)
		{
			if (success && item == null)
				throw new ArgumentException("Item shouldn't be null if fishing was successful.");

			if (skill.Info.Rank == SkillRank.Novice)
			{
				skill.Train(2); // Attempt to fish.

				if (success && item.HasTag("/fish/"))
					skill.Train(1); // Catch a fish.

				if (!success)
					skill.Train(3); // Fail at fishing.

				return;
			}

			if (skill.Info.Rank >= SkillRank.RF && skill.Info.Rank <= SkillRank.R1)
			{
				if (success)
				{
					if (item.HasTag("/fish/"))
						skill.Train(1); // Catch a fish.
					else if (item.QuestId != 0)
						skill.Train(2); // Catch a quest scroll.
					else
						skill.Train(3); // Catch an item.
				}

				if (skill.Info.Rank <= SkillRank.RA)
					skill.Train(4); // Attempt to fish.

				return;
			}
		}
开发者ID:aura-project,项目名称:aura,代码行数:44,代码来源:Fishing.cs

示例9: 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

示例10: Use


//.........这里部分代码省略.........
			var lProp = new Prop(280, attacker.RegionId, poe.X, poe.Y, MabiMath.ByteToRadian(attacker.Direction), 1f, 0f, "single");
			attacker.Region.AddProp(lProp);

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

			var targetAreaId = new Location(attacker.RegionId, poe).ToLocationId();

			var aAction = new AttackerAction(CombatActionType.SpecialHit, attacker, targetAreaId);
			aAction.Set(AttackerOptions.KnockBackHit1 | AttackerOptions.UseEffect);
			aAction.PropId = lProp.EntityId;
			cap.Add(aAction);

			// Get targets in Polygon - includes collission check
			var targets = attacker.Region.GetCreaturesInPolygon(p1, p2, p3, p4).Where(x => attacker.CanTarget(x) && !attacker.Region.Collisions.Any(attacker.GetPosition(), x.GetPosition())).ToList();

			var rnd = RandomProvider.Get();

			// Check crit
			var crit = false;
			var critSkill = attacker.Skills.Get(SkillId.CriticalHit);
			if (critSkill != null && critSkill.Info.Rank > SkillRank.Novice)
			{
				var critChance = Math2.Clamp(0, 30, attacker.GetTotalCritChance(0));
				if (rnd.NextDouble() * 100 < critChance)
					crit = true;
			}

			foreach (var target in targets)
			{
				var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, SkillId.CombatMastery);
				tAction.Set(TargetOptions.None);
				tAction.AttackerSkillId = skill.Info.Id;
				cap.Add(tAction);

				var damage = attacker.GetRndMagicDamage(skill, skill.RankData.Var1, skill.RankData.Var2);

				// Add damage if the skill is fully charged
				var dmgMultiplier = skill.RankData.Var4 / 100f;
				if (attacker.Temp.LightningRodFullCharge)
				{
					damage += (damage * dmgMultiplier);
				}

				// Critical Hit
				if (crit)
				{
					var bonus = critSkill.RankData.Var1 / 100f;
					damage = damage + (damage * bonus);

					tAction.Set(TargetOptions.Critical);
				}

				// MDef and MProt
				SkillHelper.HandleMagicDefenseProtection(target, ref damage);

				// Conditions
				SkillHelper.HandleConditions(attacker, target, ref damage);

				// Mana Deflector
				var delayReduction = ManaDeflector.Handle(attacker, target, ref damage, tAction);

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

				// Apply Damage
				target.TakeDamage(tAction.Damage = damage, attacker);

				// Stun Time
				tAction.Stun = TargetStun;

				// Death or Knockback
				if (target.IsDead)
				{
					tAction.Set(TargetOptions.FinishingKnockDown);
					attacker.Shove(target, KnockbackDistance);
				}
				else
				{
					// Always knock down
					if (target.Is(RaceStands.KnockDownable))
					{
						tAction.Set(TargetOptions.KnockDown);
						attacker.Shove(target, KnockbackDistance);
					}
				}
			}

			// Update current weapon
			SkillHelper.UpdateWeapon(attacker, targets.FirstOrDefault(), ProficiencyGainType.Melee, attacker.RightHand);

			cap.Handle();

			Send.Effect(attacker, Effect.LightningRod, (int)LightningRodEffect.Attack, poe.X, poe.Y);

			Send.SkillUse(attacker, skill.Info.Id, targetAreaId, 0, 1);
			skill.Train(1); // Use the Skill

			attacker.Region.RemoveProp(lProp);
		}
开发者ID:aura-project,项目名称:aura,代码行数:101,代码来源:LightningRod.cs

示例11: OnPlay

		/// <summary>
		/// Called when starting playing (training).
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="quality"></param>
		protected virtual void OnPlay(Creature creature, Skill skill, int quality)
		{
			if (skill.Info.Rank == SkillRank.Novice)
				skill.Train(1); // Try the skill.
		}
开发者ID:aura-project,项目名称:aura,代码行数:11,代码来源:PlayingInstrument.cs

示例12: SkillTraining

		protected override void SkillTraining(Creature creature, Skill skill, ProductionData data, bool success)
		{
			if (skill.Info.Rank == SkillRank.Novice)
			{
				skill.Train(1); // Use the skill.
				if (success)
					skill.Train(2); // Use the skill successfully.
				return;
			}

			if (skill.Info.Rank >= SkillRank.RF && skill.Info.Rank <= SkillRank.RD)
			{
				if (data.ItemData.HasTag("/ironingot/"))
				{
					if (success)
						skill.Train(1); // Successfully refine Iron Ore.
					else
						skill.Train(2); // Fail to refine Iron Ore.
				}
				return;
			}

			if (skill.Info.Rank == SkillRank.RB)
			{
				if (data.ItemData.HasTag("/copperingot/"))
				{
					if (success)
						skill.Train(1); // Successfully refine Copper Ore.
					else
						skill.Train(2); // Fail to refine Copper Ore.
				}
				else if (data.ItemData.HasTag("/ironingot/"))
				{
					if (success)
						skill.Train(3); // Successfully refine Iron Ore.
					else
						skill.Train(4); // Fail to refine Iron Ore.
				}
				return;
			}

			if (skill.Info.Rank >= SkillRank.RA && skill.Info.Rank <= SkillRank.R9)
			{
				if (data.ItemData.HasTag("/silveringot/"))
				{
					if (success)
						skill.Train(1); // Successfully refine Silver Ore.
					else
						skill.Train(2); // Fail to refine Silver Ore.
				}
				else if (data.ItemData.HasTag("/copperingot/"))
				{
					if (success)
						skill.Train(3); // Successfully refine Copper Ore.
					else
						skill.Train(4); // Fail to refine Copper Ore.
				}
				else if (data.ItemData.HasTag("/ironingot/"))
				{
					if (success)
						skill.Train(5); // Successfully refine Iron Ore.
					else
						skill.Train(6); // Fail to refine Iron Ore.
				}
				return;
			}

			if (skill.Info.Rank >= SkillRank.R8 && skill.Info.Rank <= SkillRank.R7)
			{
				if (data.ItemData.HasTag("/goldingot/"))
				{
					if (success)
						skill.Train(1); // Successfully refine Gold Ore.
					else
						skill.Train(2); // Fail to refine Gold Ore.
				}
				else if (data.ItemData.HasTag("/silveringot/"))
				{
					if (success)
						skill.Train(3); // Successfully refine Silver Ore.
					else
						skill.Train(4); // Fail to refine Silver Ore.
				}
				else if (data.ItemData.HasTag("/copperingot/"))
				{
					if (success)
						skill.Train(5); // Successfully refine Copper Ore.
					else
						skill.Train(6); // Fail to refine Copper Ore.
				}
				else if (data.ItemData.HasTag("/ironingot/"))
				{
					if (success)
						skill.Train(7); // Successfully refine Iron Ore.
					else
						skill.Train(8); // Fail to refine Iron Ore.
				}
				return;
			}

//.........这里部分代码省略.........
开发者ID:Vinna,项目名称:aura,代码行数:101,代码来源:Refining.cs

示例13: Complete

		/// <summary>
		/// Completes skill, healing the target.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var entityId = packet.GetLong();
			var unkInt1 = packet.GetInt();
			var unkInt2 = packet.GetInt();

			// Get target
			var target = ChannelServer.Instance.World.GetCreature(entityId);
			if (target == null)
			{
				Send.Notice(creature, Localization.Get("Invalid target."));
				goto L_End;
			}

			// Check range
			if (!creature.GetPosition().InRange(target.GetPosition(), Range))
			{
				Send.Notice(creature, Localization.Get("Out of range."));
				goto L_End;
			}

			// Remove bandage
			// TODO: Remove actual bandage
			if (!creature.Inventory.Remove(BandageItemId, 1))
			{
				Send.Notice(creature, Localization.Get("Invalid bandage."));
				goto L_End;
			}

			// Fails if target is moving.
			if (target.IsMoving)
			{
				// Unofficial
				Send.Notice(creature, Localization.Get("Failed because target was moving."));
				// Fail motion?
				goto L_End;
			}

			// Heal injuries
			var rnd = RandomProvider.Get();
			var heal = rnd.Next((int)skill.RankData.Var1, (int)skill.RankData.Var2 + 1);

			// 50% efficiency if target isn't resting
			if (!target.Has(CreatureStates.SitDown))
				heal /= 2;

			target.Injuries -= heal;
			Send.StatUpdateDefault(creature);

			// Skill training
			if (skill.Info.Rank == SkillRank.Novice)
				skill.Train(1); // Use First Aid.

			// First Aid animation
			Send.Effect(creature, Effect.UseMagic, "healing_firstaid", entityId);

		L_End:
			Send.SkillComplete(creature, skill.Info.Id, entityId, unkInt1, unkInt2);
		}
开发者ID:xKamuna,项目名称:aura,代码行数:65,代码来源:FirstAid.cs

示例14: SkillTraining

		protected override void SkillTraining(Creature creature, Skill skill, ProductionData data, bool success)
		{
			if (skill.Info.Rank == SkillRank.Novice)
			{
				if (data.ItemData.HasTag("/potion/hp/"))
				{
					skill.Train(1); // Attempt to concoct a HP Potion.
					if (success)
						skill.Train(2); // Successful in concocting a HP Potion.
				}

				return;
			}

			if (!success)
				return;

			if (skill.Info.Rank >= SkillRank.RF && skill.Info.Rank <= SkillRank.RE)
			{
				if (data.ItemData.HasTag("/potion/hp/"))
					skill.Train(2); // Successful in concocting a HP Potion.
				else if (data.ItemData.HasTag("/potion/mana/"))
					skill.Train(4); // Successful in concocting an MP Potion.
				else if (data.ItemData.HasTag("/potion/stamina/"))
					skill.Train(6); // Successful in concocting a Stamina Potion.

				return;
			}

			if (skill.Info.Rank >= SkillRank.RD && skill.Info.Rank <= SkillRank.RA)
			{
				if (data.Materials.Any(a => a.Tag == "*/bloodyherb/*"))
					skill.Train(1); // Successful in concocting a potion using a Bloody Herb.

				if (data.Materials.Any(a => a.Tag == "*/sunlightherb/*"))
					skill.Train(2); // Successful in concocting a potion using a Sunlight Herb.

				if (data.Materials.Any(a => a.Tag == "*/manaherb/*"))
					skill.Train(3); // Successful in concocting a potion using a Mana Herb.

				if (data.ItemData.HasTag("/potion/mana/hp/"))
					skill.Train(4); // Successful in concocting a HP & MP Potion.

				if (data.Materials.Any(a => a.Tag == "*/goldenherb/*"))
					skill.Train(5); // Successful in concocting a potion using a Golden Herb.

				if (skill.Info.Rank == SkillRank.RA)
				{
					if (data.Materials.Any(a => a.Tag == "*/whiteherb/*"))
						skill.Train(6); // Successful in concocting a potion using a White Herb.
				}

				return;
			}

			if (skill.Info.Rank == SkillRank.R9)
			{
				if (data.Materials.Any(a => a.Tag == "*/sunlightherb/*"))
					skill.Train(1); // Successful in concocting a potion using a Sunlight Herb.

				if (data.Materials.Any(a => a.Tag == "*/manaherb/*"))
					skill.Train(2); // Successful in concocting a potion using a Mana Herb.

				if (data.ItemData.HasTag("/potion/mana/hp/"))
					skill.Train(3); // Successful in concocting a HP & MP Potion.

				if (data.Materials.Any(a => a.Tag == "*/goldenherb/*"))
					skill.Train(4); // Successful in concocting a potion using a Golden Herb.

				if (data.Materials.Any(a => a.Tag == "*/whiteherb/*"))
					skill.Train(5); // Successful in concocting a potion using a White Herb.

				if (data.Materials.Any(a => a.Tag == "*/mandrake/*"))
					skill.Train(6); // Successful in concocting a potion using a Mandrake.

				return;
			}

			if (skill.Info.Rank == SkillRank.R8)
			{
				if (data.Materials.Any(a => a.Tag == "*/sunlightherb/*"))
					skill.Train(1); // Successful in concocting a potion using a Sunlight Herb.

				if (data.Materials.Any(a => a.Tag == "*/manaherb/*"))
					skill.Train(2); // Successful in concocting a potion using a Mana Herb.

				if (data.Materials.Any(a => a.Tag == "*/goldenherb/*"))
					skill.Train(3); // Successful in concocting a potion using a Golden Herb.

				if (data.ItemData.HasTag("/potion/wound/"))
					skill.Train(4); // Successful in concocting a Wound Remedy Potion.

				if (data.Materials.Any(a => a.Tag == "*/whiteherb/*"))
					skill.Train(5); // Successful in concocting a potion using a White Herb.

				if (data.Materials.Any(a => a.Tag == "*/mandrake/*"))
					skill.Train(6); // Successful in concocting a potion using a Mandrake.

				return;
			}
//.........这里部分代码省略.........
开发者ID:Vinna,项目名称:aura,代码行数:101,代码来源:PotionMaking.cs

示例15: Use


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

					// Critical Hit
					var critChance = attacker.GetRightCritChance(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);

					// Natural Shield
					var delayReduction = NaturalShield.Handle(attacker, target, ref damage, tAction);

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

					// Knock down on deadly
					if (target.Conditions.Has(ConditionsA.Deadly))
					{
						tAction.Set(TargetOptions.KnockDown);
						tAction.Stun = (short)(actionType == CombatActionPackType.ChainRangeAttack ? TargetStunElf : TargetStun);
					}

					// Aggro
					target.Aggro(attacker);

					// Death/Knockback
					if (target.IsDead)
					{
						tAction.Set(TargetOptions.FinishingKnockDown);
						maxHits = 1;
					}
					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
						{
							var stabilityReduction = (actionType == CombatActionPackType.ChainRangeAttack ? StabilityReductionElf : StabilityReduction);

							// Reduce reduction, based on ping
							// According to the Wiki, "the Knockdown Gauge
							// [does not] build up", but it's still possible
							// to knock back with repeated hits. The stability
							// reduction is probably reduced, just like stun.
							if (delayReduction > 0)
								stabilityReduction = (short)Math.Max(0, stabilityReduction - (stabilityReduction / 100 * delayReduction));

							target.Stability -= stabilityReduction;
							if (target.IsUnstable)
							{
								tAction.Set(TargetOptions.KnockBack);
							}
						}
					}

					// Knock Back
					if (tAction.IsKnockBack)
						attacker.Shove(target, KnockBackDistance);

					// Reduce stun, based on ping
					if (delayReduction > 0)
						tAction.Stun = (short)Math.Max(0, tAction.Stun - (tAction.Stun / 100 * delayReduction));
				}

				// Skill training
				if (skill.Info.Rank == SkillRank.Novice || skill.Info.Rank == SkillRank.RF)
					skill.Train(1); // Try ranged attack.

				// Reduce arrows
				if (attacker.Magazine != null && !ChannelServer.Instance.Conf.World.InfiniteArrows && !attacker.Magazine.HasTag("/unlimited_arrow/"))
					attacker.Inventory.Decrement(attacker.Magazine);

				cap.Handle();
			}

			// Disable fire arrow effect
			if (attacker.Temp.FireArrow)
				Send.Effect(attacker, Effect.FireArrow, false);

			return CombatSkillResult.Okay;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:101,代码来源:RangedAttack.cs


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