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


C# GameSpellEffect.Cancel方法代码示例

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


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

示例1: OnEffectExpires

        /// Effect expiring (duration spells only).		
        /// <returns>Immunity duration in milliseconds.</returns>
        public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
        {
            GamePlayer player = effect.Owner as GamePlayer;

            if (player != null)
            {
                effect.Cancel(false);
                player.Model = player.CreationModel;

                GameEventMgr.RemoveHandler((GamePlayer)effect.Owner, GamePlayerEvent.RegionChanged, new DOLEventHandler(OnZone));
            }
            return 0;
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:15,代码来源:CostumeSpellHandler.cs

示例2: OnEffectPulse

 public override void OnEffectPulse(GameSpellEffect effect)
 {
     if (!m_caster.IsAlive || !effect.Owner.IsAlive || m_caster.Mana < Spell.PulsePower || !m_caster.IsWithinRadius(effect.Owner, (int)(Spell.Range * m_caster.GetModified(eProperty.SpellRange) * 0.01)) || m_caster.IsMezzed || m_caster.IsStunned || (m_caster.TargetObject is GameLiving ? effect.Owner != m_caster.TargetObject as GameLiving : true))
     {
         effect.Cancel(false);
         return;
     }
     base.OnEffectPulse(effect);
     SendEffectAnimation(effect.Owner, 0, false, 1);
     // An acidic cloud surrounds you!
     MessageToLiving(effect.Owner, Spell.Message1, eChatType.CT_Spell);
     // {0} is surrounded by an acidic cloud!
     Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), eChatType.CT_YouHit, effect.Owner);
     OnDirectEffect(effect.Owner, effect.Effectiveness);
 }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:15,代码来源:HereticDoTSpellHandler.cs

示例3: OnEffectStart

        public override void OnEffectStart(GameSpellEffect effect)
        {
            base.OnEffectStart(effect);

            double playerAF = 0;
            double bonusAF = 0;
            double bonusHP = 0;

            if (effect == null || effect.Owner == null)
            {
                effect.Cancel(false);
                return;
            }

            foreach (InventoryItem item in effect.Owner.Inventory.EquippedItems)
            {
                if (item.Object_Type >= (int)eObjectType._FirstArmor && item.Object_Type <= (int)eObjectType._LastArmor)
                {
                    playerAF += item.DPS_AF;
                }
            }

            playerAF += effect.Owner.GetModifiedFromItems(eProperty.ArmorFactor);

            if (m_spell.Value < 0)
            {
                bonusAF = ((m_spell.Value * -1) * playerAF) / 100;
                bonusHP = ((m_spell.Value * -1) * effect.Owner.MaxHealth) / 100;
            }
            else
            {
                bonusAF = m_spell.Value;
                bonusHP = m_spell.Value;
            }

            GameLiving living = effect.Owner as GameLiving;
            living.TempProperties.setProperty("BONUS_HP", bonusHP);
            living.TempProperties.setProperty("BONUS_AF", bonusAF);
            living.AbilityBonus[(int)eProperty.MaxHealth] += (int)bonusHP;
            living.ItemBonus[(int)eProperty.ArmorFactor] += (int)bonusAF;

            SendUpdates(effect.Owner);
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:43,代码来源:AfHitsBuff.cs

示例4: OnEffectPulse

        public override void OnEffectPulse(GameSpellEffect effect)
        {
            if (storm == null || storm.ObjectState == GameObject.eObjectState.Deleted)
            {
                effect.Cancel(false);
                return;
            }
            if (tempest == null || s == null)
            {
                return;
            }
            int ranged = storm.GetDistanceTo(new Point3D((int)effect.Owner.X, (int)effect.Owner.Y, (int)effect.Owner.Z));
            if (ranged > 3000) return;

            if (s.Name == "Dazzling Array")
            {
                foreach (GamePlayer player in storm.GetPlayersInRadius(sRadius))
                {
                    tempest = ScriptMgr.CreateSpellHandler(m_caster, s, sl);
                    if ((player.IsAlive) && (GameServer.ServerRules.IsSameRealm(storm, player, true))) tempest.StartSpell((GameLiving)player);
                }
            }
            else
            {
                foreach (GamePlayer player in storm.GetPlayersInRadius(sRadius))
                {
                    tempest = ScriptMgr.CreateSpellHandler(m_caster, s, sl);
                    if ((player.IsAlive) && (GameServer.ServerRules.IsAllowedToAttack(storm, player, true))) tempest.StartSpell((GameLiving)player);
                }
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:31,代码来源:MasterLevelBase.cs

示例5: OnEffectStart

		public override void OnEffectStart(GameSpellEffect effect)
		{
			base.OnEffectStart(effect);
			m_effect = effect;
			if (effect.Owner == null || !effect.Owner.IsAlive)
				return;

			if ((effect.Owner is GamePlayer))
			{
				GamePlayer casterPlayer = effect.Owner as GamePlayer;
				if (casterPlayer.GroundTarget != null && casterPlayer.GroundTargetInView)
				{
					GameEventMgr.AddHandler(casterPlayer, GamePlayerEvent.Moving, new DOLEventHandler(PlayerMoves));
					GameEventMgr.AddHandler(warder, GameLivingEvent.Dying, new DOLEventHandler(BattleWarderDie));
					GameEventMgr.AddHandler(casterPlayer, GamePlayerEvent.CastStarting, new DOLEventHandler(PlayerMoves));
					GameEventMgr.AddHandler(casterPlayer, GamePlayerEvent.AttackFinished, new DOLEventHandler(PlayerMoves));
					warder.X = casterPlayer.GroundTarget.X;
					warder.Y = casterPlayer.GroundTarget.Y;
					warder.Z = casterPlayer.GroundTarget.Z;
					warder.AddBrain(new MLBrain());
					warder.AddToWorld();
				}
				else
				{
					MessageToCaster("Your area target is out of range.  Set a closer ground position.", eChatType.CT_SpellResisted);
					effect.Cancel(false);
				}
			}
		}
开发者ID:andyhebear,项目名称:DOLSharp,代码行数:29,代码来源:Convoker.cs

示例6: OnEffectPulse

 /// <summary>
 /// When an applied effect pulses
 /// duration spells only
 /// </summary>
 /// <param name="effect"></param>
 public virtual void OnEffectPulse(GameSpellEffect effect)
 {
     if (effect.Owner.IsAlive == false)
     {
         effect.Cancel(false);
     }
 }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:12,代码来源:SpellHandler.cs

示例7: OnEffectPulse

        public override void OnEffectPulse(GameSpellEffect effect)
        {
            if (mine == null || mine.ObjectState == GameObject.eObjectState.Deleted)
            {
                effect.Cancel(false);
                return;
            }

            if (trap == null) return;
            bool wasstealthed = ((GamePlayer)Caster).IsStealthed;
            foreach (GameNPC npc in mine.GetNPCsInRadius((ushort)s.Range))
            {
                if (npc is GameSiegeWeapon && npc.IsAlive && GameServer.ServerRules.IsAllowedToAttack(Caster, npc, true))
                {
                    trap.StartSpell((GameLiving)npc);
                    if (!Unstealth) ((GamePlayer)Caster).Stealth(wasstealthed);
                    return;
                }
            }
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:20,代码来源:Spymaster.cs

示例8: OnEffectStart

        public override void OnEffectStart(GameSpellEffect effect)
        {
            if (effect.Owner == null) return;
            if (!effect.Owner.IsAlive || effect.Owner.ObjectState != GameLiving.eObjectState.Active) return;

            //SendEffectAnimation(effect.Owner, 0, false, 1); //send the effect

            if (effect.Owner is GamePlayer)
            {
                /*
                 *Q: What does the confusion spell do against players?
                 *A: According to the magic man, “Confusion against a player interrupts their current action, whether it's a bow shot or spellcast.
                 */
                if (Spell.Value < 0 || Util.Chance(Convert.ToInt32(Math.Abs(Spell.Value))))
                {
                    //Spell value below 0 means it's 100% chance to confuse.
                    GamePlayer player = effect.Owner as GamePlayer;

                    player.StartInterruptTimer(player.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                }

                effect.Cancel(false);
            }
            else if (effect.Owner is GameNPC)
            {
                //check if we should do anything at all.

                bool doConfuse = (Spell.Value < 0 || Util.Chance(Convert.ToInt32(Spell.Value)));

                if (!doConfuse)
                    return;

                bool doAttackFriend = Spell.Value < 0 && Util.Chance(Convert.ToInt32(Math.Abs(Spell.Value)));

                GameNPC npc = effect.Owner as GameNPC;

                npc.IsConfused = true;

                if (log.IsDebugEnabled)
                    log.Debug("CONFUSION: " + npc.Name + " was confused(true," + doAttackFriend.ToString() + ")");

                if (npc is GamePet && npc.Brain != null && (npc.Brain as IControlledBrain) != null)
                {
                    //it's a pet.
                    GamePlayer playerowner = (npc.Brain as IControlledBrain).GetPlayerOwner();
                    if (playerowner != null && playerowner.CharacterClass.ID == (int)eCharacterClass.Theurgist)
                    {
                        //Theurgist pets die.
                        npc.Die(Caster);
                        effect.Cancel(false);
                        return;
                    }
                }

                targetList.Clear();
                foreach (GamePlayer target in npc.GetPlayersInRadius(1000))
                {
                    if (doAttackFriend)
                        targetList.Add(target);
                    else
                    {
                        //this should prevent mobs from attacking friends.
                        if (GameServer.ServerRules.IsAllowedToAttack(npc, target, true))
                            targetList.Add(target);
                    }
                }

                foreach (GameNPC target in npc.GetNPCsInRadius(1000))
                {
                    //don't agro yourself.
                    if (target == npc)
                        continue;

                    if (doAttackFriend)
                        targetList.Add(target);
                    else
                    {
                        //this should prevent mobs from attacking friends.
                        if (GameServer.ServerRules.IsAllowedToAttack(npc, target, true) && !GameServer.ServerRules.IsSameRealm(npc, target, true))
                            targetList.Add(target);
                    }
                }

                //targetlist should be full, start effect pulse.
                if (targetList.Count > 0)
                {
                    npc.StopAttack();
                    npc.StopCurrentSpellcast();

                    GameLiving target = targetList[Util.Random(targetList.Count - 1)] as GameLiving;
                    npc.StartAttack(target);
                }
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:94,代码来源:ConfusionSpellHandler.cs

示例9: OnEffectPulse

        /// <summary>
        /// When an applied effect pulses
        /// duration spells only
        /// </summary>
        /// <param name="effect"></param>
        public override void OnEffectPulse(GameSpellEffect effect)
        {
            base.OnEffectPulse(effect);

            MessageToLiving(effect.Owner, Spell.Message1, eChatType.CT_YouWereHit);
            Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), eChatType.CT_YouHit, effect.Owner);

            int bleedValue = effect.Owner.TempProperties.getProperty<int>(BLEED_VALUE_PROPERTY);

            AttackData ad = CalculateDamageToTarget( effect.Owner, 1.0 );

            SendDamageMessages(ad);

            // attacker must be null, attack result is 0x0A
            foreach(GamePlayer player in ad.Target.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendCombatAnimation(null, ad.Target, 0, 0, 0, 0, 0x0A, ad.Target.HealthPercent);
            }
            // send animation before dealing damage else dead livings show no animation
            ad.Target.OnAttackedByEnemy(ad);
            ad.Attacker.DealDamage(ad);

            if (--bleedValue <= 0 || !effect.Owner.IsAlive)
                effect.Cancel(false);
            else effect.Owner.TempProperties.setProperty(BLEED_VALUE_PROPERTY, bleedValue);
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:31,代码来源:StyleBleeding.cs

示例10: OnEffectStart

        /// Effect starting.		
        /// <param name="effect"></param>
        public override void OnEffectStart(GameSpellEffect effect)
        {
            GamePlayer player = effect.Owner as GamePlayer;

            if (player != null)
            {
                if (CheckBeginCast(player, true) == false)
                {
                    if (effect != null)
                        effect.Cancel(true);
                    player.Model = player.CreationModel;
                    return;
                }
                else
                {
                    player.Model = (ushort)effect.Spell.Value;
                }
                GameEventMgr.AddHandler(effect.Owner, GamePlayerEvent.RegionChanged, new DOLEventHandler(OnZone));
            }
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:22,代码来源:CostumeSpellHandler.cs

示例11: OnEffectPulse

 public override void OnEffectPulse(GameSpellEffect effect)
 {
     if (storm == null || storm.ObjectState == GameObject.eObjectState.Deleted)
     {
         effect.Cancel(false);
         return;
     }
     if (tempest == null || s == null)
     {
         return;
     }
     foreach (GamePlayer player in storm.GetPlayersInRadius(sRadius))
     {
         if (player.IsAlive) tempest.StartSpell(player);
     }
 }
开发者ID:boscorillium,项目名称:dol,代码行数:16,代码来源:MasterLevelBase.cs


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