當前位置: 首頁>>代碼示例>>C#>>正文


C# Misc.DamageAction類代碼示例

本文整理匯總了C#中WCell.RealmServer.Misc.DamageAction的典型用法代碼示例。如果您正苦於以下問題:C# DamageAction類的具體用法?C# DamageAction怎麽用?C# DamageAction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DamageAction類屬於WCell.RealmServer.Misc命名空間,在下文中一共展示了DamageAction類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的WCell.RealmServer.Misc.DamageAction類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。