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


C# Entities.Unit类代码示例

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


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

示例1: CheckInitialize

		protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
		{
			if (target.MaxPower == 0 || target.PowerType != (PowerType)m_spellEffect.MiscValue)
			{
				failReason = SpellFailedReason.BadTargets;
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:7,代码来源:PeriodicManaLeech.cs

示例2: CheckInitialize

        protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterRef, Unit target, ref SpellFailedReason failReason)
        {
            if (!(target is NPC))
            {
                failReason = SpellFailedReason.BadTargets;
            }

            if (casterRef != null && casterRef.Object is Unit)
            {
                var caster = (Unit)casterRef.Object;
                //if (target.Target == caster)
                //{
                //    failReason = SpellFailedReason.NoValidTargets;
                //}
                //else
                {
                    var spell = m_aura.Spell;
                    var hasSingleFriendTarget = spell.HasBeneficialEffects && !spell.IsAreaSpell && spell.HasTargets;
                    if (hasSingleFriendTarget && caster.Target != null && caster.IsFriendlyWith(caster.Target))
                    {
                        // taunting a friend, means we want to taunt his attackers
                        // needed for Righteous defense, amongst others
                        if (target.Target != caster.Target)
                        {
                            failReason = SpellFailedReason.NoValidTargets;
                        }
                    }
                }
            }
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:30,代码来源:ModTaunt.cs

示例3: CalculateManaRegen

		/// <summary>
		/// Calculates the amount of power regeneration for the class at a specific level, Intellect and Spirit.
		/// Changed in 3.1, overrides for casters are redundant.
		/// </summary>
		public static int CalculateManaRegen(Unit unit)
		{
			// default mana generation
			// see: http://www.wowwiki.com/Mana_regeneration
			var regen = (int)((0.001f + unit.Spirit * (float)Math.Sqrt(unit.Intellect) * GameTables.GetBaseRegenForLevel(unit.Level)) * 0.6f + 0.9f);  // rounded up
			return regen * RegenRateFactor;
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:11,代码来源:RegenerationFormulas.cs

示例4: Init

		/// <summary>
		/// Method is called before the Unit is actually in the World
		/// to initialize the set of Actions.
		/// </summary>
		/// <param name="owner"></param>
		public override void Init(Unit owner)
		{
			base.Init(owner);

			this[BrainState.Idle] = new AIIdleAction(owner);
			this[BrainState.Dead] = this[BrainState.Idle];

			this[BrainState.Evade] = new AIEvadeAction(owner);
			this[BrainState.Roam] = new AIRoamAction(owner)
			{
				Strategy = new AIWaypointMoveAction(owner, AIMovementType.ForwardThenBack, owner.Waypoints)
			};

			this[BrainState.Follow] = new AIFollowMasterAction(owner);
			this[BrainState.Guard] = new AIGuardMasterAction(owner);

			if (owner is NPC)
			{
				this[BrainState.Combat] = new AICombatAction((NPC)owner)
				{
					Strategy = new AIAttackAction((NPC)owner)
				};

				this[BrainState.FormationMove] = new AIFormationMoveAction((NPC)owner);
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:31,代码来源:DefaultAIActionCollection.cs

示例5: CheckInitialize

		protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
		{
			Caster = casterReference.Object as Unit;
			if (Caster == null || Caster is Vehicle)
			{
				log.Warn("Invalid SpellCaster \"{0}\" for Spell: {1}", Caster, SpellEffect.Spell);
				failReason = SpellFailedReason.Error;
				return;
			}

			Vehicle = target as Vehicle;
			if (Vehicle == null)
			{
				failReason = SpellFailedReason.BadTargets;
			}
			else
			{
				Seat = Vehicle.GetSeatFor(Caster);
				if (Seat == null)
				{
					// must never happen since Vehicle is unclickable when full
					failReason = SpellFailedReason.BadTargets;
				}
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:25,代码来源:VehicleAuraHandler.cs

示例6: CheckInitialize

 protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
 {
     if (!(target is Character))
     {
         failReason = SpellFailedReason.TargetNotPlayer;
     }
 }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:7,代码来源:TrackCreatures.cs

示例7: OnProc

		public override void OnProc(Unit triggerer, IUnitAction action)
		{
			if (action is IDamageAction)
			{
				var owner = Owner;
				var dmgAction = ((IDamageAction)action);

				var healSelfAmount = ((dmgAction.Damage * EffectValue) + 50) / 100;	// don't forget rounding
				var healPartyAmount = (healSelfAmount + 3) / 5; // don't forget rounding

				owner.Heal(healSelfAmount, owner, SpellEffect);
				if (owner is Character)
				{
					var chr = (Character)owner;
					var group = chr.Group;
					if (group != null)
					{
						// heal all group members in same context (ie same Map in current implementation)
						group.CallOnAllInSameContext(chr.ContextHandler, (member) =>
						{
							member.Heal(healPartyAmount, owner, SpellEffect);
						});
					}
				}
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:26,代码来源:PriestShadowFixes.cs

示例8: SpellCollection

		protected SpellCollection(Unit owner, bool initDictionary)
		{
			if (initDictionary)
				m_byId = new Dictionary<uint, Spell>(60);

			Owner = owner;
		}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:SpellCollection.cs

示例9: CheckInitialize

 protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterRef, Unit target, ref SpellFailedReason failReason)
 {
     var caster = creatingCast.CasterReference.Object as Unit;
     if (caster == null)
     {
         failReason = SpellFailedReason.BadTargets;
     }
     else
     {
         if (caster.Charm != null)
         {
             failReason = SpellFailedReason.AlreadyHaveCharm;
         }
         else if (target.HasMaster)
         {
             failReason = SpellFailedReason.CantDoThatRightNow;
         }
         else if (caster.HasMaster)
         {
             failReason = SpellFailedReason.Possessed;
         }
         else if (caster is Character)
         {
             if (((Character)caster).ActivePet != null)
             {
                 failReason = SpellFailedReason.AlreadyHaveSummon;
             }
         }
     }
 }
开发者ID:KroneckerX,项目名称:WCell,代码行数:30,代码来源:ModPossessAuraHandler.cs

示例10: AuraCollection

		public AuraCollection(Unit owner)
		{
			m_auras = new Dictionary<AuraIndexId, Aura>();
			m_AuraArray = Aura.EmptyArray;

			m_owner = owner;
		}
开发者ID:WCellFR,项目名称:WCellFR,代码行数:7,代码来源:AuraCollection.cs

示例11: CheckInitialize

		protected internal override void CheckInitialize(CasterInfo casterInfo, Unit target, ref SpellFailedReason failReason)
		{
			if (!(target is Character))
			{
				failReason = SpellFailedReason.TargetNotPlayer;
			}
		}
开发者ID:ray2006,项目名称:WCell,代码行数:7,代码来源:TrackResources.cs

示例12: SendAllAuras

		public static void SendAllAuras(IPacketReceiver rcv, Unit owner)
		{
			using (var packet = CreateAllAuraPacket(owner))
			{
				rcv.Send(packet);
			}
		}
开发者ID:Skizot,项目名称:WCell,代码行数:7,代码来源:AuraHandler.cs

示例13: CheckInitialize

		protected internal override void CheckInitialize(CasterInfo casterInfo, Unit target, ref SpellFailedReason failReason)
		{
			if (target.MaxPower == 0 || target.PowerType != (PowerType)m_spellEffect.MiscValue)
			{
				failReason = SpellFailedReason.BadTargets;
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:PeriodicManaLeech.cs

示例14: AIWaypointMoveAction

		public AIWaypointMoveAction(Unit owner, AIMovementType waypointSequence)
			: base(owner)
		{
			m_waypoints = new LinkedList<WaypointEntry>();

			_waypointSequence = waypointSequence;
		}
开发者ID:origins,项目名称:WCell,代码行数:7,代码来源:AIWaypointMoveAction.cs

示例15: AIWaypointMoveAction

		public AIWaypointMoveAction(Unit owner, AIMovementType wpMovementType)
			: base(owner)
		{
			m_waypoints = new LinkedList<WaypointEntry>();

			m_WPmovementType = wpMovementType;
		}
开发者ID:primax,项目名称:WCell,代码行数:7,代码来源:AIWaypointMoveAction.cs


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