• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Misc.DamageAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: OnDefend

		public override void OnDefend(DamageAction action)
		{
			var defender = Owner;	// same as action.Victim
			var power = defender.Power;
			var damage = action.Damage;

			var drainAmount = Math.Min(damage, (int)(power * factorInverse));	// figure out how much to drain
			if (remaining < drainAmount)
			{
				// shield is used up
				drainAmount = remaining;
				remaining = 0;
				m_aura.Remove(false);
			}
			else
			{
				remaining -= drainAmount;
			}

			drainAmount = (int)(drainAmount * factor);

			var caster = Aura.CasterUnit;
			if (caster != null)
			{
				// see MageArcaneArcaneShielding
				drainAmount = caster.Auras.GetModifiedInt(SpellModifierType.HealingOrPowerGain, m_spellEffect.Spell, drainAmount);
			}
			defender.Power = power - drainAmount;					// drain power
			damage -= drainAmount;									// reduce damage

			action.Damage = damage;
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:32,代码来源:ManaShield.cs


示例2: OnDefend

 public override void OnDefend(DamageAction action)
 {
     if (m_spellEffect.Spell.SchoolMask.HasAnyFlag(action.UsedSchool))
     {
         action.ModDamagePercent(EffectValue);
     }
 }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:7,代码来源:DamagePctAmplifierHandler.cs


示例3: GenerateDefaultAttackerRage

        /// <summary>
        /// Rage for the attacker of an AttackAction
        /// </summary>
        public static void GenerateDefaultAttackerRage(DamageAction action)
        {
            var attacker = action.Attacker;

            // only generate Rage for white damage
            if (action.IsWeaponAttack)
            {
                double hitFactor;
                if (action.Weapon == attacker.OffHandWeapon)
                {
                    hitFactor = 1.75;
                }
                else
                {
                    hitFactor = 3.5;
                }
                if (action.IsCritical)
                {
                    hitFactor *= 2;
                }

                hitFactor *= action.Weapon.AttackTime;

                var lvl = attacker.Level;
                var c = 0.0092f * lvl * lvl + 3.23f * lvl + 4.27f;
                var rageRight = ((15 * action.ActualDamage / (4f * c)) + (hitFactor / 2000));
                var rageLeft = 15 * action.ActualDamage / c;

                var rage = rageRight;
                if (rageRight <= rageLeft)
                    rage = rageLeft;
                // Multiplied by 2 to match an approximate value, check the formula instead.
                attacker.Power += (int)(rage) * 10;
            }
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:38,代码来源:RageGenerator.cs


示例4: GenerateDefaultVictimRage

        /// <summary>
        /// Rage for the victim of an AttackAction
        /// </summary>
        public static void GenerateDefaultVictimRage(DamageAction action)
        {
            var victim = action.Victim;

            var lvl = victim.Level;
            var c = (int)(0.0092 * lvl * lvl + 3.23f * lvl + 4.27f);			// polynomial rage co-efficient
            victim.Power += (5 / 2 * action.ActualDamage / c) * 10;
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:11,代码来源:RageGenerator.cs


示例5: OnAttack

		public override void OnAttack(DamageAction action)
		{
			//if (!action.IsDot)
			{
				var amount = action.GetDamagePercent(EffectValue);
				Owner.Heal(amount, m_aura.CasterUnit, m_spellEffect);
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:8,代码来源:LifeLeechPercentAuraHandler.cs


示例6: OnDefend

		public override void OnDefend(DamageAction action)
		{
			RemainingValue = action.Absorb(RemainingValue, (DamageSchoolMask)m_spellEffect.MiscValue);
			if (RemainingValue <= 0)
			{
				Owner.AddMessage(m_aura.Cancel);
			}
		}
开发者ID:NVN,项目名称:WCell,代码行数:8,代码来源:SchoolAbsorb.cs


示例7: OnAttack

 public override void OnAttack(DamageAction action)
 {
     if (action.Victim is NPC && ((NPC)action.Victim).CheckCreatureType(Mask))
     {
         // crit this guy
         action.IsCritical = true;
         action.SetCriticalDamage();
     }
 }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:9,代码来源:CritCreatureMaskHandler.cs


示例8: OnDefend

 public override void OnDefend(DamageAction action)
 {
     // if damage was blocked and we are lucky, we double the block amount
     if (action.Blocked > 0 && EffectValue > Utility.Random(1, 101))
     {
         // crit block
         action.Blocked *= 2;
     }
 }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:9,代码来源:CriticalBlockPctHandler.cs


示例9: OnDefend

		public override void OnDefend(DamageAction action)
		{
			action.Victim.AddMessage(() =>
			{
				if (action.Victim.MayAttack(action.Attacker))
				{
					action.Attacker.DealSpellDamage(action.Victim, SpellEffect, EffectValue);
				}
			});
		}
开发者ID:remixod,项目名称:netServer,代码行数:10,代码来源:DamageShieldEffectHandler.cs


示例10: OnDefend

		public override void OnDefend(DamageAction action)
		{
			// strike back
			var victim = action.Victim;
			var atk = action.Attacker;
			if (!atk.IsBehind(victim))
			{
				victim.AddMessage(() =>
				{
					if (atk.IsInWorld && victim.MayAttack(atk))
					{
						victim.Strike(atk);
					}
				});
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:16,代码来源:WarriorFixes.cs


示例11: OnAttack

			/// <summary>
			/// Register with OnAttack, since it's executed right after OnDefend, which is where
			/// Absorption handlers are handled.
			/// "When your Mana Shield, Frost Ward, Fire Ward, or Ice Barrier absorbs damage
			///  your spell damage is increased by $s1% of the amount absorbed for $44413d."
			/// </summary>
			public override void OnAttack(DamageAction action)
			{
				if (action.Absorbed > 0)
				{
					// apply aura
					Owner.SpellCast.TriggerSelf(SpellId.EffectClassSkillIncantersAbsorption);

					// retreive aura & handler
					var aura = Owner.Auras[SpellId.EffectClassSkillIncantersAbsorption];
					if (aura != null)
					{
						var handler = aura.GetHandler(AuraType.ModDamageDone) as ModDamageDoneHandler;
						if (handler != null)
						{
							// override effect value
							handler.BaseEffectValue = EffectValue;
						}
					}
				}
			}
开发者ID:remixod,项目名称:netServer,代码行数:26,代码来源:MageArcaneFixes.cs


示例12: OnDefend

		public override void OnDefend(DamageAction action)
		{
			var defender = Owner;	// same as action.Victim
			var power = defender.Power;
			var damage = action.Damage;

			var amount = Math.Min(damage, (int)(power / factor));	// figure out how much to drain
			if (remaining < amount)
			{
				// shield is used up
				amount = remaining;
				remaining = 0;
				m_aura.Remove(false);
			}
			else
			{
				remaining -= amount;
			}
			defender.Power = power - (int)(amount * factor);	// drain power
			damage -= amount;									// reduce damage

			action.Damage = damage;
		}
开发者ID:NVN,项目名称:WCell,代码行数:23,代码来源:ManaShield.cs


示例13: OnAttack

			public override void OnAttack(DamageAction action)
			{
				if (action.IsMagic && TriggerSpells.Contains(action.Spell.Line.LineId))
				{
					if (!action.IsCritical)
					{
						critCount = 0;				// reset critCount
					}
					else
					{
						critCount++;
						if (critCount == 2)
						{
							// 2 crits in a row
							critCount = 0;			// reset critCount
							if (Utility.Random(0, 101) < EffectValue)
							{
								// we have a Hot Streak
								Owner.SpellCast.TriggerSelf(SpellId.HotStreak);
							}
						}
					}
				}
			}
开发者ID:remixod,项目名称:netServer,代码行数:24,代码来源:MageFireFixes.cs


示例14: OnAttack

			public override void OnAttack(DamageAction action)
			{
				// "Your spells and abilities deal 4% more damage to targets infected with Blood Plague."
				if (action.SpellEffect != null && action.Victim.Auras.Contains(SpellId.EffectBloodPlague))
				{
					action.ModDamagePercent(EffectValue);
				}
			}
开发者ID:remixod,项目名称:netServer,代码行数:8,代码来源:DeathKnightUnholyFixes.cs


示例15: OnDefend

			public override void OnDefend(DamageAction action)
			{
				// absorb EffectValue % from the damage
				var absorbed = Math.Min(action.GetDamagePercent(EffectValue), RemainingValue);

				// RemainingValue corresponds to AMZ's health, when it reaches 0, AMZ will be destroyed
				RemainingValue = action.Absorb(absorbed, (DamageSchoolMask)m_spellEffect.MiscValue);
			}
开发者ID:remixod,项目名称:netServer,代码行数:8,代码来源:DeathKnightUnholyFixes.cs


示例16: Strike

		/// <summary>
		/// Do a single attack on the target using given weapon, ability and action.
		/// </summary>
		public ProcHitFlags Strike(IWeapon weapon, DamageAction action, Unit target, SpellCast ability)
		{
			ProcHitFlags procHitFlags = ProcHitFlags.None;

			EnsureContext();
			if (!IsAlive)
			{
				return procHitFlags;
			}

			if (!target.IsInContext || !target.IsAlive)
			{
				return procHitFlags;
			}

			if (weapon == null)
			{
				log.Error("Trying to strike without weapon: " + this);
				return procHitFlags;
			}

			//if (IsMovementControlled)
			//{
			//    // stop running when landing a hit
			//    m_Movement.Stop();
			//}

			target.IsInCombat = true;

			action.Victim = target;
			action.Attacker = this;
			action.Weapon = weapon;

			if (ability != null)
			{
				action.Schools = ability.Spell.SchoolMask;
				action.SpellEffect = ability.Spell.Effects[0];

				// calc damage
				GetWeaponDamage(action, weapon, ability);
				procHitFlags = action.DoAttack();
				if (ability.Spell.AttributesExC.HasFlag(SpellAttributesExC.RequiresTwoWeapons) && m_offhandWeapon != null)
				{
					// also strike with offhand
					action.Reset(this, target, m_offhandWeapon);
					GetWeaponDamage(action, m_offhandWeapon, ability);
					procHitFlags |= action.DoAttack();
					m_lastOffhandStrike = Environment.TickCount;
				}
			}
			else
			{
				// no combat ability
				m_extraAttacks += 1;
				do
				{
					// calc damage
					GetWeaponDamage(action, weapon, null);

					action.Schools = weapon.Damages.AllSchools();
					if (action.Schools == DamageSchoolMask.None)
					{
						action.Schools = DamageSchoolMask.Physical;
					}

					// normal attack
					action.DoAttack();
				} while (--m_extraAttacks > 0);
			}
			action.OnFinished();
			return procHitFlags;
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:75,代码来源:Unit.Combat.cs


示例17: OnAttack

			public override void OnAttack(DamageAction action)
			{
				// do nothing
			}
开发者ID:remixod,项目名称:netServer,代码行数:4,代码来源:WarriorProtectionFixes.cs


示例18: OnDefend

 public override void OnDefend(DamageAction action)
 {
 }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:3,代码来源:CritCreatureMaskHandler.cs


示例19: AddDamageMods

		/// <summary>
		/// Adds all damage boni and mali
		/// </summary>
		public override void AddDamageMods(DamageAction action)
		{
			base.AddDamageMods(action);
			var dmg = UnitUpdates.GetMultiMod(GetInt32(PlayerFields.MOD_DAMAGE_DONE_PCT + (int)action.UsedSchool) / 100f, action.Damage);
			if (action.Spell != null)
			{
				dmg = PlayerSpells.GetModifiedInt(SpellModifierType.SpellPower, action.Spell, dmg);
			}

			dmg += GetDamageDoneMod(action.UsedSchool);
			action.Damage = dmg;
		}
开发者ID:Skizot,项目名称:WCell,代码行数:15,代码来源:Character.cs


示例20: OnDefend

		/// <summary>
		/// Adds damage mods to the given AttackAction
		/// </summary>
		public virtual void OnDefend(DamageAction action)
		{
			for (var i = AttackEventHandlers.Count - 1; i >= 0; i--)
			{
				var mod = AttackEventHandlers[i];
				mod.OnDefend(action);
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:11,代码来源:Unit.Combat.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NPCs.NPCEntry类代码示例发布时间:2022-05-26
下一篇:
C# Items.ItemTemplate类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap