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


C# GameLiving.IsWithinRadius方法代码示例

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


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

示例1: Execute

        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED )) return;

            bool deactivate = false;

            GamePlayer player = living as GamePlayer;
            if (player != null)
            {
                if (player.Group != null)
                {
                    SendCasterSpellEffectAndCastMessage(living, 7066, true);
                    foreach (GamePlayer member in player.Group.GetPlayersInTheGroup())
                    {
                        if (!CheckPreconditions(member, DEAD) && living.IsWithinRadius(member, 2000))
                        {
                            if (restoreMana(member, player))
                                deactivate = true;
                        }
                    }
                }
                else
                {
                    if (!CheckPreconditions(player, DEAD))
                    {
                        if (restoreMana(player, player))
                            deactivate = true;
                    }
                }

                if (deactivate)
                    DisableSkill(living);
            }
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:38,代码来源:EpiphanyAbility.cs

示例2: Execute

        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

            if (living.TargetObject == null)
                return;

            GameLiving target = (GameLiving)living.TargetObject;

            if (target == null) return;

            if (!GameServer.ServerRules.IsAllowedToAttack(living, target, false))
                return;

            if (!living.IsWithinRadius(target, 1000))
                return;

            if (living.ActiveWeaponSlot != GameLiving.eActiveWeaponSlot.Distance)
                return;

            SendCasterSpellEffectAndCastMessage(living, 7061, true);
            new DesperateBowmanDisarmEffect().Start(living);
            new DesperateBowmanStunEffect().Start(target);
            DamageTarget(target, living);
            DisableSkill(living);
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:30,代码来源:DesperateBowmanAbility.cs

示例3: OnLivingAttacked

        /// <summary>
        /// Come to this living's aid.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="attacker"></param>
        protected override void OnLivingAttacked(GameLiving target, GameLiving attacker)
        {
            base.OnLivingAttacked(target, attacker);

            if (target.IsWithinRadius(Body, AggressionRange))
                EngageOn(attacker);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:12,代码来源:SocialBrain.cs

示例4: Execute

        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
            InventoryItem shield = living.Inventory.GetItem(eInventorySlot.LeftHandWeapon);
            if (shield == null)
                return;
            if (shield.Object_Type != (int)eObjectType.Shield)
                return;
            if (living.TargetObject == null)
                return;
            if (living.ActiveWeaponSlot == GameLiving.eActiveWeaponSlot.Distance)
                return;
            if (living.AttackWeapon == null)
                return;
            if (living.AttackWeapon.Hand == 1)
                return;
            GameLiving target = (GameLiving)living.TargetObject;
            if (target == null) return;
            if (!GameServer.ServerRules.IsAllowedToAttack(living, target, false))
                return;
            if (!living.IsWithinRadius( target, 1000 ))
                return;
            new ShieldTripRootEffect().Start(target);

            GamePlayer player = living as GamePlayer;
            if (player != null)
            {
                SendCasterSpellEffectAndCastMessage(player, 7046, true);
                ShieldTripDisarmEffect effect = new ShieldTripDisarmEffect();
                effect.Start(player);
            }
            DisableSkill(living);
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:37,代码来源:ShieldTripAbility.cs

示例5: Execute

		/// <summary>
		/// Action
		/// </summary>
		/// <param name="living"></param>
		public override void Execute(GameLiving living)
		{
			if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

			ushort Icon = 7026;
			effectiveness = 0;
			owner = living;

			if(ServerProperties.Properties.USE_NEW_ACTIVES_RAS_SCALING)
			{
				switch (Level)
				{
					case 1: effectiveness = 300; break;
					case 2: effectiveness = 450; break;
					case 3: effectiveness = 600; break;
					case 4: effectiveness = 750; break;
					case 5: effectiveness = 900; break;
				}
			}
			else
			{
				switch (Level)
				{
					case 1: effectiveness = 300; break;
					case 2: effectiveness = 600; break;
					case 3: effectiveness = 900; break;
				}
			}

			if (living.GroundTarget == null)
				return;
			if (!living.IsWithinRadius( living.GroundTarget, 1500 ))
				return;
			GamePlayer player = living as GamePlayer;
			if (player == null)
				return;

			if (player.RealmAbilityCastTimer != null)
			{
				player.RealmAbilityCastTimer.Stop();
				player.RealmAbilityCastTimer = null;
				player.Out.SendMessage("You cancel your Spell!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
			}

			foreach (GamePlayer p in living.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				p.Out.SendSpellCastAnimation(living, Icon, 20);

			player.RealmAbilityCastTimer = new RegionTimer(player);
			player.RealmAbilityCastTimer.Callback = new RegionTimerCallback(startSpell);
			player.RealmAbilityCastTimer.Start(2000);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:55,代码来源:DecimationTrap.cs

示例6: Execute

        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

            bool deactivate = false;
            AbstractServerRules rules = GameServer.ServerRules as AbstractServerRules;
            GamePlayer player = living as GamePlayer;
            GamePlayer target = living.TargetObject as GamePlayer;
            if (player.TargetObject == null || target == null)
            {
                player.Out.SendMessage("You must target a player to launch this spell!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                return;
            }
            if (!GameServer.ServerRules.IsAllowedToAttack(living, target, true))
            {
                player.Out.SendMessage("You must select an enemy target!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                return;
            }

            if (!living.IsWithinRadius(target, (int)(1500 * living.GetModified(eProperty.SpellRange) * 0.01)))
            {
                Message.ChatToOthers(living, "You are too far away from your target to use this ability!", eChatType.CT_SpellResisted);
                return;
            }
            SendCasterSpellEffectAndCastMessage(living, 3505, true);
            DamageTarget(target, living, 0);
            deactivate = true;
            GamePlayer m_oldtarget = target;
            GamePlayer m_newtarget = null;
            for (int x = 1; x < 5; x++)
            {
                if (m_newtarget != null)
                    m_oldtarget = m_newtarget;
                foreach (GamePlayer p in m_oldtarget.GetPlayersInRadius(500))
                {
                    if (p != m_oldtarget && p != living && GameServer.ServerRules.IsAllowedToAttack(living, p, true))
                    {
                        DamageTarget(p, living, x);
                        p.StartInterruptTimer(3000, AttackData.eAttackType.Spell, living);
                        m_newtarget = p;
                        break;
                    }
                }
            }
            if (deactivate)
                DisableSkill(living);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:51,代码来源:ChainLightningAbilityHandler.cs

示例7: Execute

        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

            bool deactivate = false;

            GamePlayer player = living as GamePlayer;
            if (player != null)
            {
                if (player.Group != null)
                {
                    SendCasterSpellEffectAndCastMessage(living, 7071, true);
                    foreach (GamePlayer member in player.Group.GetPlayersInTheGroup())
                    {
                        RestorativeMindEffect aog = member.EffectList.GetOfType<RestorativeMindEffect>();
                        if (!CheckPreconditions(member, DEAD) && aog == null
                            && living.IsWithinRadius( member, 2000 ))
                        {
                            RestorativeMindEffect effect = new RestorativeMindEffect();
                            effect.Start(member);
                            deactivate = true;
                        }
                    }
                }
                else
                {
                    RestorativeMindEffect aog = player.EffectList.GetOfType<RestorativeMindEffect>();
                    if (!CheckPreconditions(player, DEAD) && aog == null)
                    {
                        RestorativeMindEffect effect = new RestorativeMindEffect();
                        effect.Start(player);
                        deactivate = true;
                    }
                }
            }
            if (deactivate)
                DisableSkill(living);
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:42,代码来源:RestorativeMindAbility.cs

示例8: Execute

        public override void Execute(GameLiving living)
        {
            GamePlayer player = living as GamePlayer;
            #region preCheck
            if (living == null)
            {
                log.Warn("Could not retrieve player in JuggernautAbilityHandler.");
                return;
            }

            if (!(living.IsAlive))
            {
                if(player != null)
                    player.Out.SendMessage("You cannot use this ability while dead!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            if (living.IsMezzed)
            {
                if(player != null)
                    player.Out.SendMessage("You cannot use this ability while mesmerized!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            if (living.IsStunned)
            {
                if(player != null)
                    player.Out.SendMessage("You cannot use this ability while stunned!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            if (living.IsSitting)
            {
                if(player != null)
                    player.Out.SendMessage("You cannot use this ability while sitting!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            if (living.ControlledBrain == null)
            {
                if(player != null)
                    player.Out.SendMessage("You must have a pet controlled to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            if (!living.IsWithinRadius( player.ControlledBrain.Body, m_range ))
            {
                if(player != null)
                    player.Out.SendMessage("Your pet is too far away!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            GameSpellEffect ml9=SpellHandler.FindEffectOnTarget(living.ControlledBrain.Body,"SummonMastery");
            if (ml9 != null)
            {
                if(player != null)
                    player.Out.SendMessage("Your Pet already has an ability of this type active", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                return;
            }

            #endregion

            if(ServerProperties.Properties.USE_NEW_ACTIVES_RAS_SCALING)
            {
                switch (this.Level)
                {
                    case 1:
                        m_value = 10;
                        break;
                    case 2:
                        m_value = 15;
                        break;
                    case 3:
                        m_value = 20;
                        break;
                    case 4:
                        m_value = 25;
                        break;
                    case 5:
                        m_value = 30;
                        break;
                    default:
                        return;
                }
            }
            else
            {
                switch (this.Level)
                {
                    case 1:
                        m_value = 10;
                        break;
                    case 2:
                        m_value = 20;
                        break;
                    case 3:
                        m_value = 30;
                        break;
                    default:
                        return;
                }
            }

            new JuggernautEffect().Start(living, m_duration, m_value);

            DisableSkill(living);
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:JuggernautAbility.cs

示例9: AddToAggroList

		public virtual void AddToAggroList(GameLiving living, int aggroamount, bool NaturalAggro)
		{
			if (m_body.IsConfused) return;

			// tolakram - duration spell effects will attempt to add to aggro after npc is dead
			if (!m_body.IsAlive) return;

			if (living == null) return;

			//Handle trigger to say sentance on first aggro.
			if (m_aggroTable.Count < 1)
				Body.FireAmbientSentence(GameNPC.eAmbientTrigger.aggroing, living);
			
			// Check LOS (walls, pits, etc...) before  attacking, player + pet
			// Be sure the aggrocheck is triggered by the brain on Think() method
			if (DOL.GS.ServerProperties.Properties.ALWAYS_CHECK_LOS && NaturalAggro)
			{
				GamePlayer thisLiving = null;
				if (living is GamePlayer)
					thisLiving = (GamePlayer)living;
				
				if (living is GamePet)
				{
					IControlledBrain brain = ((GamePet)living).Brain as IControlledBrain;
					thisLiving = brain.GetPlayerOwner();
				}
				
				if (thisLiving != null)
				{
					thisLiving.Out.SendCheckLOS (Body, living, new CheckLOSResponse(CheckAggroLOS));
					if (!AggroLOS) return;
				}
			}
			
			// only protect if gameplayer and aggroamout > 0
			if (living is GamePlayer && aggroamount > 0)
			{
				GamePlayer player = (GamePlayer)living;
				
				if (player.Group != null)
				{ // player is in group, add whole group to aggro list
					lock ((m_aggroTable as ICollection).SyncRoot)
					{
						foreach (GamePlayer p in player.Group.GetPlayersInTheGroup())
						{
							if (!m_aggroTable.ContainsKey(p))
							{
								m_aggroTable[p] = 1L;	// add the missing group member on aggro table
							}
						}
					}
				}

				//ProtectEffect protect = (ProtectEffect) player.EffectList.GetOfType(typeof(ProtectEffect));
				foreach (ProtectEffect protect in player.EffectList.GetAllOfType<ProtectEffect>())
				{
					// if no aggro left => break
					if (aggroamount <= 0) break;

					//if (protect==null) continue;
					if (protect.ProtectTarget != living) continue;
					if (protect.ProtectSource.IsStunned) continue;
					if (protect.ProtectSource.IsMezzed) continue;
					if (protect.ProtectSource.IsSitting) continue;
					if (protect.ProtectSource.ObjectState != GameObject.eObjectState.Active) continue;
					if (!protect.ProtectSource.IsAlive) continue;
					if (!protect.ProtectSource.InCombat) continue;

					if (!living.IsWithinRadius(protect.ProtectSource, ProtectAbilityHandler.PROTECT_DISTANCE))
						continue;
					// P I: prevents 10% of aggro amount
					// P II: prevents 20% of aggro amount
					// P III: prevents 30% of aggro amount
					// guessed percentages, should never be higher than or equal to 50%
					int abilityLevel = protect.ProtectSource.GetAbilityLevel(Abilities.Protect);
					int protectAmount = (int)((abilityLevel * 0.10) * aggroamount);

					if (protectAmount > 0)
					{
						aggroamount -= protectAmount;
						protect.ProtectSource.Out.SendMessage(LanguageMgr.GetTranslation(protect.ProtectSource.Client.Account.Language, "AI.Brain.StandardMobBrain.YouProtDist", player.GetName(0, false),
						                                                                 Body.GetName(0, false, protect.ProtectSource.Client.Account.Language, Body)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
						//player.Out.SendMessage("You are protected by " + protect.ProtectSource.GetName(0, false) + " from " + Body.GetName(0, false) + ".", eChatType.CT_System, eChatLoc.CL_SystemWindow);

						lock ((m_aggroTable as ICollection).SyncRoot)
						{
							if (m_aggroTable.ContainsKey(protect.ProtectSource))
								m_aggroTable[protect.ProtectSource] += protectAmount;
							else
								m_aggroTable[protect.ProtectSource] = protectAmount;
						}
					}
				}
			}

			lock ((m_aggroTable as ICollection).SyncRoot)
			{
				if (m_aggroTable.ContainsKey(living))
				{
					long amount = m_aggroTable[living];
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:StandardMobBrain.cs

示例10: HealTarget

        /// <summary>
        /// Heals targets group
        /// </summary>
        /// <param name="target"></param>
        /// <param name="amount">amount of hit points to heal</param>
        /// <returns>true if heal was done</returns>
        public override bool HealTarget(GameLiving target, int amount)
        {
            Hashtable injuredTargets = new Hashtable();
            GameLiving mostInjuredLiving = target;
            double mostInjuredPercent = mostInjuredLiving.Health / (float)mostInjuredLiving.MaxHealth;

            int minHealVariance;
            int maxHealVariance;
            int targetHealCap;

            CalculateHealVariance(out minHealVariance, out maxHealVariance);

            if (minHealVariance >= maxHealVariance)
            {
                targetHealCap = maxHealVariance;
            }
            else
            {
                targetHealCap = Util.Random(minHealVariance, maxHealVariance);
            }

            int groupHealCap = targetHealCap;

            Group group = target.Group;
            if (group != null)
            {
                groupHealCap *= group.MemberCount;
                targetHealCap *= 2;

                foreach (GameLiving living in group.GetMembersInTheGroup())
                {
                    if (!living.IsAlive) continue;
                    //heal only if target is in range
                    if (target.IsWithinRadius(living, m_spell.Range))
                    {
                        double livingHealthPercent = living.Health / (double)living.MaxHealth;
                        if (livingHealthPercent < 1)
                        {
                            injuredTargets.Add(living, livingHealthPercent);
                            if (livingHealthPercent < mostInjuredPercent)
                            {
                                mostInjuredLiving = living;
                                mostInjuredPercent = livingHealthPercent;
                            }
                        }
                    }
                }
            }
            else
            {
                // heal caster
                if (mostInjuredPercent < 1)
                    injuredTargets.Add(target, mostInjuredPercent);
            }

            if (mostInjuredPercent >= 1)
            {
                //all are healed, 1/2 power
                SendEffectAnimation(target, 0, false, 0);
                MessageToCaster("Your group is already fully healed!", eChatType.CT_SpellResisted);
                return false;
            }

            double bestHealPercent = targetHealCap / (double)mostInjuredLiving.MaxHealth;
            double totalHealed = 0;
            Hashtable healAmount = new Hashtable();

            IDictionaryEnumerator iter = injuredTargets.GetEnumerator();
            //calculate heal for all targets
            while (iter.MoveNext())
            {
                GameLiving healTarget = iter.Key as GameLiving;
                double targetHealthPercent = (double) iter.Value;
                //targets hp percent after heal is same as mostInjuredLiving
                double targetHealPercent = bestHealPercent + mostInjuredPercent - targetHealthPercent;
                int targetHeal = (int) (healTarget.MaxHealth * targetHealPercent);

                if (targetHeal > 0)
                {
                    totalHealed += targetHeal;
                    healAmount.Add(healTarget, targetHeal);
                }
            }

            iter = healAmount.GetEnumerator();
            //reduce healed hp according to targetHealCap and heal targets
            while (iter.MoveNext())
            {
                GameLiving healTarget = iter.Key as GameLiving;
                double uncappedHeal = (int) iter.Value;
                int reducedHeal = (int) Math.Min(targetHealCap, uncappedHeal * (groupHealCap / totalHealed));

                //heal target
                base.HealTarget(healTarget, reducedHeal);
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:SpreadhealSpellHandler.cs

示例11: SendCastMessage

		/// <summary>
		/// Sends cast message to environment
		/// </summary>
		protected virtual void SendCastMessage(GameLiving caster)
		{
			foreach (GamePlayer player in caster.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
			{
				if ( caster.IsWithinRadius( player, WorldMgr.INFO_DISTANCE ) )
				{
					if (player == caster)
					{
						player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "RealmAbility.SendCastMessage.YouCast", m_name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
					}
					else
					{
						player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "RealmAbility.SendCastMessage.PlayerCasts", player.Name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
					}
				}
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:20,代码来源:RealmAbility.cs

示例12: SendCasterSpellEffectAndCastMessage

		/// <summary>
		/// Send spell effect animation on caster and send messages
		/// </summary>
		/// <param name="caster"></param>
		/// <param name="spellEffect"></param>
		/// <param name="success"></param>
		public virtual void SendCasterSpellEffectAndCastMessage(GameLiving caster, ushort spellEffect, bool success)
		{
			foreach (GamePlayer player in caster.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
			{
				player.Out.SendSpellEffectAnimation(caster, caster, spellEffect, 0, false, success ? (byte)1 : (byte)0);

				if ( caster.IsWithinRadius( player, WorldMgr.INFO_DISTANCE ) )
				{
					if (player == caster)
					{
						player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "RealmAbility.SendCasterSpellEffectAndCastMessage.You", m_name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
					}
					else
					{
						player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "RealmAbility.SendCasterSpellEffectAndCastMessage.Caster", caster.Name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
					}
				}
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:25,代码来源:RealmAbility.cs

示例13: Start

        /// <summary>
        /// Start the guarding on player
        /// </summary>
        /// <param name="guardSource">The guarder</param>
        /// <param name="guardTarget">The player guarded by guarder</param>
        public void Start(GameLiving guardSource, GameLiving guardTarget)
        {
            if (guardSource == null || guardTarget == null)
                return;

            if (guardSource is GamePlayer && guardTarget is GamePlayer)
            {
                m_playerGroup = ((GamePlayer)guardSource).Group;
                if (m_playerGroup == null) return;
                if (m_playerGroup != guardTarget.Group) return;
                GameEventMgr.AddHandler(m_playerGroup, GroupEvent.MemberDisbanded, new DOLEventHandler(GroupDisbandCallback));
            }

            m_guardSource = guardSource;
            m_guardTarget = guardTarget;
            m_owner = m_guardSource;

            if (!guardSource.IsWithinRadius(guardTarget, GuardAbilityHandler.GUARD_DISTANCE))
            {
                if (guardSource is GamePlayer)
                    ((GamePlayer)guardSource).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)guardSource).Client, "Effects.GuardEffect.YouAreNowGuardingYBut", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                if (guardSource is GamePlayer && guardTarget is GamePlayer)
                    ((GamePlayer)guardTarget).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)guardTarget).Client, "Effects.GuardEffect.XIsNowGuardingYouBut", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
            else
            {
                if (guardSource is GamePlayer)
                    ((GamePlayer)guardSource).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)guardSource).Client, "Effects.GuardEffect.YouAreNowGuardingY", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                if (guardSource is GamePlayer && guardTarget is GamePlayer)
                    ((GamePlayer)guardTarget).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)guardTarget).Client, "Effects.GuardEffect.XIsNowGuardingYou", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }

            m_guardSource.EffectList.Add(this);
            m_guardTarget.EffectList.Add(this);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:40,代码来源:GuardEffect.cs

示例14: Start

        /// <summary>
        /// Start the intercepting on player
        /// </summary>
        /// <param name="interceptor">The interceptor</param>
        /// <param name="intercepted">The intercepted</param>
        public void Start(GameLiving interceptor, GameLiving intercepted)
        {
            if (interceptor is GamePlayer && intercepted is GamePlayer)
            {
                m_group = ((GamePlayer)interceptor).Group;
                if (m_group == null) return;
                GameEventMgr.AddHandler(m_group, GroupEvent.MemberDisbanded, new DOLEventHandler(GroupDisbandCallback));
            }
            m_interceptSource = interceptor;
            m_owner = m_interceptSource;
            m_interceptTarget = intercepted;

            if (!interceptor.IsWithinRadius(intercepted, InterceptAbilityHandler.INTERCEPT_DISTANCE))
            {
                if (interceptor is GamePlayer)
                    ((GamePlayer)interceptor).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)interceptor).Client, "Effects.InterceptEffect.YouAttemtInterceptYBut", intercepted.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                if (intercepted is GamePlayer && interceptor is GamePlayer)
                    ((GamePlayer)intercepted).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)intercepted).Client, "Effects.InterceptEffect.XAttemtInterceptYouBut", interceptor.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
            else
            {
                if (interceptor is GamePlayer)
                    ((GamePlayer)interceptor).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)interceptor).Client, "Effects.InterceptEffect.YouAttemtInterceptY", intercepted.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                if (intercepted is GamePlayer && interceptor is GamePlayer)
                    ((GamePlayer)intercepted).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)intercepted).Client, "Effects.InterceptEffect.XAttemptInterceptYou", interceptor.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
            interceptor.EffectList.Add(this);
            intercepted.EffectList.Add(this);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:34,代码来源:InterceptEffect.cs


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