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


C# GamePlayer.StopAttack方法代码示例

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


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

示例1: Execute

		public override void Execute(GameLiving living)
		{
			if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

			GamePlayer player = living as GamePlayer;
			if (player == null)
				return;

			if (player.IsMoving)
			{
				player.Out.SendMessage("You must be standing still to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}

			if (player.GroundTarget == null )
            {
                player.Out.SendMessage( "You must set a ground target to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow );
                return;
            }
            else if(!player.IsWithinRadius( player.GroundTarget, 1500 ))
			{
				player.Out.SendMessage("Your ground target is too far away to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}

			this.player = player;
			if (player.AttackState)
			{
				player.StopAttack();
			}
			player.StopCurrentSpellcast();
			switch (Level)
			{
				case 1: dmgValue = 25; duration = 10; break;
				case 2: dmgValue = 100; duration = 20; break;
				case 3: dmgValue = 250; duration = 30; break;
				default: return;
			}
			foreach (GamePlayer i_player in player.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
			{
				if (i_player == player) i_player.Out.SendMessage("You cast " + this.Name + "!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
				else i_player.Out.SendMessage(player.Name + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);

				i_player.Out.SendSpellCastAnimation(player, 7028, 20);
			}

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

			player.RealmAbilityCastTimer = new RegionTimer(player);
			player.RealmAbilityCastTimer.Callback = new RegionTimerCallback(EndCast);
			player.RealmAbilityCastTimer.Start(2000);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:57,代码来源:ThornweedFieldAbility.cs

示例2: Execute

        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
            GamePlayer player = living as GamePlayer;
            if (player.IsMoving)
            {
                player.Out.SendMessage("You must be standing still to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }

            if (player.GroundTarget == null || !player.IsWithinRadius(player.GroundTarget, 1500))
            {
                player.Out.SendMessage("You groundtarget is too far away to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            if (player.TempProperties.getProperty(IS_CASTING, false))
            {
                player.Out.SendMessage("You are already casting an ability.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            this.player = player;
            if (player.AttackState)
            {
                player.StopAttack();
            }
            player.StopCurrentSpellcast();
            switch (Level)
            {
                case 1: dmgValue = 120; break;
                case 2: dmgValue = 240; break;
                case 3: dmgValue = 360; break;
                default: return;
            }
            duration = 30;
            foreach (GamePlayer i_player in player.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
            {
                if (i_player == player) i_player.Out.SendMessage("You cast " + this.Name + "!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                else i_player.Out.SendMessage(player.Name + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);

                i_player.Out.SendSpellCastAnimation(player, 7027, 20);
            }
            player.TempProperties.setProperty(IS_CASTING, true);
            player.TempProperties.setProperty(NM_CAST_SUCCESS, true);
            GameEventMgr.AddHandler(player, GamePlayerEvent.Moving, new DOLEventHandler(CastInterrupted));
            GameEventMgr.AddHandler(player, GamePlayerEvent.AttackFinished, new DOLEventHandler(CastInterrupted));
            GameEventMgr.AddHandler(player, GamePlayerEvent.Dying, new DOLEventHandler(CastInterrupted));
            if (player != null)
            {
                new RegionTimer(player, new RegionTimerCallback(EndCast), 2000);
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:51,代码来源:NegativeMaelstromAbility.cs


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