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


C# GameLiving.OnAttackedByEnemy方法代码示例

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


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

示例1: DamageTarget

        private void DamageTarget(GameLiving target, GameLiving caster)
        {
            double modifier = 0.5 + (caster.GetModifiedSpecLevel("Soulrending") * 0.01);
            int basedamage = (int)(250 * modifier);
            int resist = basedamage * target.GetResist(eDamageType.Spirit) / -100;
            int damage = basedamage + resist;
            int heal = (int)(damage * 0.75);
            int modheal = caster.MaxHealth - caster.Health;
            if (modheal > heal)
                modheal = heal;
            caster.Health += modheal;

            GamePlayer player = caster as GamePlayer;
            if (player != null)
                player.Out.SendMessage("You hit " + target.Name + " for " + damage + "(" + resist + ") points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
            if (caster is GamePlayer && modheal > 0)
                ((GamePlayer)caster).Out.SendMessage("Your Soul Quench returns " + modheal + " lifepoints to you", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);

            GamePlayer targetPlayer = target as GamePlayer;
            if (targetPlayer != null)
            {
                if (targetPlayer.IsStealthed)
                    targetPlayer.Stealth(false);
            }

            foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE))
            {
                p.Out.SendSpellEffectAnimation(caster, target, 1145, 0, false, 1);
                p.Out.SendCombatAnimation(caster, target, 0, 0, 0, 0, 0x14, target.HealthPercent);
            }

            //target.TakeDamage(caster, eDamageType.Spirit, damage, 0);
            AttackData ad = new AttackData();
            ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
            ad.Attacker = caster;
            ad.Target = target;
            ad.DamageType = eDamageType.Spirit;
            ad.Damage = damage;
            target.OnAttackedByEnemy(ad);
            caster.DealDamage(ad);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:41,代码来源:SoulQuenchAbility.cs

示例2: DamageTarget

        private void DamageTarget(GameLiving target, GameLiving caster)
        {
            int resist = 251 * target.GetResist(eDamageType.Crush) / -100;
            int damage = 251 + resist;

            GamePlayer player = caster as GamePlayer;
            if (player != null)
                player.Out.SendMessage("You hit " + target.Name + " for " + damage + "(" + resist + ") points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);

            GamePlayer targetPlayer = target as GamePlayer;
            if (targetPlayer != null)
            {
                if (targetPlayer.IsStealthed)
                    targetPlayer.Stealth(false);
            }

            foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE))
            {
                p.Out.SendSpellEffectAnimation(caster, target, 7043, 0, false, 1);
                p.Out.SendCombatAnimation(caster, target, 0, 0, 0, 0, 0x14, target.HealthPercent);
            }

            //target.TakeDamage(caster, eDamageType.Spirit, damage, 0);
            AttackData ad = new AttackData();
            ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
            ad.Attacker = caster;
            ad.Target = target;
            ad.DamageType = eDamageType.Crush;
            ad.Damage = damage;
            target.OnAttackedByEnemy(ad);
            caster.DealDamage(ad);

            if (target.EffectList.GetOfType<WhirlingStaffEffect>() == null)
            {
                WhirlingStaffEffect effect = new WhirlingStaffEffect();
                effect.Start(target);
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:38,代码来源:WhirlingStaffAbility.cs

示例3: DamageTarget

        private void DamageTarget(GameLiving target, GameLiving caster)
        {
            int damage = 300;

            GamePlayer player = caster as GamePlayer;
            if (player != null)
                player.Out.SendMessage("You hit " + target.Name + " for " + damage + " points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);

            GamePlayer targetPlayer = target as GamePlayer;
            if (targetPlayer != null)
            {
                if (targetPlayer.IsStealthed)
                    targetPlayer.Stealth(false);
            }

            AttackData ad = new AttackData();
            ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
            ad.Attacker = caster;
            ad.Target = target;
            ad.DamageType = eDamageType.Crush;
            ad.Damage = damage;
            target.OnAttackedByEnemy(ad);
            caster.DealDamage(ad);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:24,代码来源:DesperateBowmanAbility.cs

示例4: OnSpellResist

        protected virtual void OnSpellResist(GameLiving target)
        {
            m_lastdamage -= m_lastdamage / 4;
            SendEffectAnimation(target, 0, false, 0);
            if (target is GameNPC)
            {
                IControlledBrain brain = ((GameNPC)target).Brain as IControlledBrain;
                if (brain != null)
                {
                    GamePlayer owner = brain.GetPlayerOwner();
                    //Worthless checks
                    if (owner != null/* && owner.ControlledNpc != null && target == owner.ControlledNpc.Body*/)
                    {
                        MessageToLiving(owner, "Your " + target.Name + " resists the effect!", eChatType.CT_SpellResisted);
                    }
                }
            }
            else
            {
                MessageToLiving(target, "You resist the effect!", eChatType.CT_SpellResisted);
            }
            MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);

            if (Spell.Damage != 0)
            {
                // notify target about missed attack for spells with damage
                AttackData ad = new AttackData();
                ad.Attacker = Caster;
                ad.Target = target;
                ad.AttackType = AttackData.eAttackType.Spell;
                ad.AttackResult = GameLiving.eAttackResult.Missed;
                ad.SpellHandler = this;
                target.OnAttackedByEnemy(ad);
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
            }
            else if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }

            if (target is GameNPC)
            {
                IOldAggressiveBrain aggroBrain = ((GameNPC)target).Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                    aggroBrain.AddToAggroList(Caster, 1);
            }
            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP = Caster.CurrentRegion.Time;
            }
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:57,代码来源:HereticDamageLostOnPulse.cs

示例5: SendSpellResistNotification

 /// <summary>
 /// Send Spell Attack Data Notification to Target when Spell is Resisted
 /// </summary>
 /// <param name="target"></param>
 public virtual void SendSpellResistNotification(GameLiving target)
 {
     // Report resisted spell attack data to any type of living object, no need
     // to decide here what to do. For example, NPCs will use their brain.
     // "Just the facts, ma'am, just the facts."
     AttackData ad = new AttackData();
     ad.Attacker = Caster;
     ad.Target = target;
     ad.AttackType = AttackData.eAttackType.Spell;
     ad.SpellHandler = this;
     ad.AttackResult = GameLiving.eAttackResult.Missed;
     ad.IsSpellResisted = true;
     target.OnAttackedByEnemy(ad);
 }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:18,代码来源:SpellHandler.cs

示例6: DamageTarget

        private void DamageTarget(GameLiving target, GameLiving caster, double counter)
        {
            int level = caster.GetModifiedSpecLevel("Stormcalling");
            if (level > 50)
                level = 50;
            modifier = 0.5 + (level * 0.01) * Math.Pow(0.75, counter);
            basedamage = (int)(450 * modifier);
            resist = basedamage * target.GetResist(eDamageType.Energy) / -100;
            damage = basedamage + resist;

            GamePlayer player = caster as GamePlayer;
            if (player != null)
                player.Out.SendMessage("You hit " + target.Name + " for " + damage + "(" + resist + ") points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);

            GamePlayer targetPlayer = target as GamePlayer;
            if (targetPlayer != null)
            {
                if (targetPlayer.IsStealthed)
                    targetPlayer.Stealth(false);
            }

            foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE))
            {
                p.Out.SendSpellEffectAnimation(caster, target, 3505, 0, false, 1);
                p.Out.SendCombatAnimation(caster, target, 0, 0, 0, 0, 0x14, target.HealthPercent);
            }

            //target.TakeDamage(caster, eDamageType.Spirit, damage, 0);
            AttackData ad = new AttackData();
            ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
            ad.Attacker = caster;
            ad.Target = target;
            ad.DamageType = eDamageType.Energy;
            ad.Damage = damage;
            target.OnAttackedByEnemy(ad);
            caster.DealDamage(ad);
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:37,代码来源:ChainLightningAbilityHandler.cs

示例7: OnSpellResisted

		/// <summary>
		/// When spell was resisted
		/// </summary>
		/// <param name="target">the target that resisted the spell</param>
		protected virtual void OnSpellResisted(GameLiving target)
		{
			SendEffectAnimation(target, 0, false, 0);

			// Deliver message to the target, if the target is a pet, to its
			// owner instead.

			if (target is GameNPC)
			{
				IControlledBrain brain = ((GameNPC)target).Brain as IControlledBrain;
				if (brain != null)
				{
					GamePlayer owner = brain.GetPlayerOwner();
					if (owner != null)
					{
						MessageToLiving(owner, "Your " + target.Name + " resists the effect!", eChatType.CT_SpellResisted);
					}
				}
			}
			else
			{
				MessageToLiving(target, "You resist the effect!", eChatType.CT_SpellResisted);
			}

			// Deliver message to the caster as well.

			MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);

			// Report resisted spell attack data to any type of living object, no need
			// to decide here what to do. For example, NPCs will use their brain.
			// "Just the facts, ma'am, just the facts."

			AttackData ad = new AttackData();
			ad.Attacker = Caster;
			ad.Target = target;
			ad.AttackType = AttackData.eAttackType.Spell;
			ad.SpellHandler = this;
			ad.AttackResult = GameLiving.eAttackResult.Missed;
			ad.IsSpellResisted = true;
			target.OnAttackedByEnemy(ad);

			// Spells that would have caused damage or are not instant will still
			// interrupt a casting player.

			/*if (target is GamePlayer)
{
if (target.IsCasting && (Spell.Damage > 0 || Spell.CastTime > 0))
target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
}*/
			if(!(Spell.SpellType.ToLower().IndexOf("debuff")>=0 && Spell.CastTime==0))
				target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);


			if (target.Realm == 0 || Caster.Realm == 0)
			{
				target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
				Caster.LastAttackTickPvE = Caster.CurrentRegion.Time;
			}
			else
			{
				target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
				Caster.LastAttackTickPvP = Caster.CurrentRegion.Time;
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:68,代码来源:SpellHandler.cs

示例8: DamageTarget

		private void DamageTarget(GameLiving target)
		{
			if (!GameServer.ServerRules.IsAllowedToAttack(owner, target, true))
				return;
			if (!target.IsAlive)
				return;
			if (ticktimer.IsAlive)
			{
				ticktimer.Stop();
				removeHandlers();
			}
			int dist = target.GetDistanceTo( new Point3D( traparea.X, traparea.Y, traparea.Z ) );
			double mod = 1;
			if (dist > 0)
				mod = 1 - ((double)dist / 350);

			int basedamage = (int)(effectiveness * mod);
			int resist = (int)(basedamage * target.GetModified(eProperty.Resist_Energy) * -0.01);
			int damage = basedamage + resist;


			GamePlayer player = owner as GamePlayer;
			if (player != null)
			{
				player.Out.SendMessage("You hit " + target.Name + " for " + damage + "(" + resist + ") points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
			}

			GamePlayer targetPlayer = target as GamePlayer;
			if (targetPlayer != null)
			{
				if (targetPlayer.IsStealthed)
					targetPlayer.Stealth(false);
			}

			foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE))
			{
				p.Out.SendSpellEffectAnimation(owner, target, 7026, 0, false, 1);
				p.Out.SendCombatAnimation(owner, target, 0, 0, 0, 0, 0x14, target.HealthPercent);
			}

			//target.TakeDamage(owner, eDamageType.Energy, damage, 0);
			AttackData ad = new AttackData();
			ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
			ad.Attacker = owner;
			ad.Target = target;
			ad.DamageType = eDamageType.Energy;
			ad.Damage = damage;
			target.OnAttackedByEnemy(ad);
			owner.DealDamage(ad);
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:50,代码来源:DecimationTrap.cs


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