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


C# Spells.SpellEffect类代码示例

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


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

示例1: Trigger

		//internal static readonly ObjectPool<List<AuraApplicationInfo>> AuraAppListPool = ObjectPoolMgr.CreatePool(() => new List<AuraApplicationInfo>());

		public static void Trigger(WorldObject caster, SpellEffect triggerEffect, Spell spell)
		{
			var cast = SpellCastPool.Obtain();
			cast.Caster = caster;
			cast.m_triggerEffect = triggerEffect;

			caster.ExecuteInContext(() =>
			{
				cast.Start(spell, true);
				cast.Dispose();
			});
		}
开发者ID:pallmall,项目名称:WCell,代码行数:14,代码来源:SpellCast.cs

示例2: CreateHandler

        private void CreateHandler(SpellEffect effect, int h, SpellEffectHandler[] handlers, ref SpellTargetCollection targets, ref SpellFailedReason failReason)
        {
            var handler = effect.SpellEffectHandlerCreator(this, effect);
            handlers[h] = handler;

            // make sure, we have the right Caster-Type
            handler.CheckCasterType(ref failReason);
            if (failReason != SpellFailedReason.Ok)
            {
                return;
            }

            // find targets and amount SpellTargetCollection if effects have same ImplicitTargetTypes
            if (InitialTargets != null)
            {
                // do we have given targets?
                if (targets == null)
                {
                    targets = CreateSpellTargetCollection();
                }
            }
            else if (handler.HasOwnTargets)
            {
                // see if targets are shared between effects
                targets = null;

                for (var j = 0; j < h; j++)
                {
                    var handler2 = handlers[j];
                    if (handler.Effect.SharesTargetsWith(handler2.Effect, IsAICast))
                    {
                        // same targets -> share target collection
                        targets = handler2.m_targets;
                        break;
                    }
                }

                if (targets == null)
                {
                    targets = CreateSpellTargetCollection();
                }
            }

            if (targets != null)
            {
                handler.m_targets = targets;
                targets.m_handlers.Add(handler);
            }
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:49,代码来源:SpellCast.Perform.cs

示例3: LeechPower

		/// <summary>
		/// Leeches the given amount of power from this Unit and adds it to the receiver (if receiver != null and is Unit).
		/// </summary>
		public void LeechPower(Unit receiver, int amount, float factor, SpellEffect effect)
		{
			var currentPower = Power;

			// Resilience reduces mana drain by 2.2%, amount is rounded.
			amount -= (amount * GetResiliencePct() * 2.2f).RoundInt();
			if (amount > currentPower)
			{
				amount = currentPower;
			}
			Power = currentPower - amount;
			if (receiver != null)
			{
				receiver.Energize(this, amount, effect);
			}
		}
开发者ID:ray2006,项目名称:WCell,代码行数:19,代码来源:Unit.cs

示例4: LeechHealth

		/// <summary>
		/// Leeches the given amount of health from this Unit and adds it to the receiver (if receiver != null and is Unit).
		/// </summary>
		/// <param name="factor">The factor applied to the amount that was leeched before adding it to the receiver</param>
		public void LeechHealth(Unit receiver, int amount, float factor, SpellEffect effect)
		{
			var initialHealth = Health;

			DoSpellDamage(receiver != null ? receiver.Master : this, effect, amount);

			// only apply as much as was leeched
			amount = initialHealth - Health;

			if (factor > 0)
			{
				amount = (int)(amount * factor);
			}

			if (receiver != null)
			{
				receiver.Heal(this, amount, effect);
			}
		}
开发者ID:ray2006,项目名称:WCell,代码行数:23,代码来源:Unit.cs

示例5: Heal

		/// <summary>
		/// Heals this unit and sends the corresponding animation (healer might be null)
		/// </summary>
		/// <param name="effect">The effect of the spell that triggered the healing (or null)</param>
		/// <param name="healer">The object that heals this Unit (or null)</param>
		/// <param name="value">The amount to be healed</param>
		public void Heal(Unit healer, int value, SpellEffect effect)
		{
			var critChance = 0f;
			var crit = false;
			int overheal = 0;

			if (effect != null)
			{
				var oldVal = value;
				
				if (healer != null)
				{
					if (effect.IsPeriodic)
					{
						// add periodic boni
						if (healer is Character)
						{
							value = ((Character)healer).PlayerSpells.GetModifiedInt(SpellModifierType.PeriodicEffectValue, effect.Spell, value);
						}
					}
					else
					{
						// add healing mods (spell power for healing)
						value = healer.AddHealingModsToAction(value, effect, effect.Spell.Schools[0]);
					}
				}

				if (this is Character)
				{
					value += (int) ((oldVal*((Character) this).HealingTakenModPct)/100);
				}

				critChance = GetSpellCritChance((DamageSchool) effect.Spell.SchoolMask)*100;

				// do a critcheck
				if (!effect.Spell.AttributesExB.HasFlag(SpellAttributesExB.CannotCrit) && critChance != 0)
				{
					var roll = Utility.Random(1f, 10001);

					if (roll <= critChance)
					{
						value = (int) (value*(SpellHandler.SpellCritBaseFactor + GetIntMod(StatModifierInt.CriticalHealValuePct)));
						crit = true;
					}
				}
			}

			if (value > 0)
			{
				value = (int)(value * Utility.Random(0.95f, 1.05f));
				if (Health + value > MaxHealth)
				{
					overheal = (Health + value) - MaxHealth;
					value = (MaxHealth - Health);
				}
				Health += value;
				value += overheal;
				CombatLogHandler.SendHealLog(healer, this, effect != null ? effect.Spell.Id : 0, value, crit, overheal);
			}

			if (healer != null)
			{
				var action = new HealAction
				{
					Attacker = (Unit)healer,
					Victim = this,
					Spell = effect != null ? effect.Spell : null,
					IsCritical = crit,
					Value = value
				};
				healer.Proc(ProcTriggerFlags.HealOther, this, action, true);
				Proc(ProcTriggerFlags.Heal, healer, action, false);

				OnHeal(healer, effect, value);
			}
		}
开发者ID:ray2006,项目名称:WCell,代码行数:82,代码来源:Unit.cs

示例6: ClearEffects

		public void ClearEffects()
		{
			Effects = new SpellEffect[0];
		}
开发者ID:WCellFR,项目名称:WCellFR,代码行数:4,代码来源:Spell.cs

示例7: ReplaceEffect

		/// <summary>
		/// Removes the first Effect of the given Type and replace it with a new one which will be returned.
		/// Appends a new one if none of the given type was found.
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		public SpellEffect ReplaceEffect(SpellEffectType type)
		{
			for (var i = 0; i < Effects.Length; i++)
			{
				var effect = Effects[i];
				if (effect.EffectType == type)
				{
					return Effects[i] = new SpellEffect();
				}
			}
			return AddEffect(SpellEffectType.None);
		}
开发者ID:WCellFR,项目名称:WCellFR,代码行数:18,代码来源:Spell.cs

示例8: Initialize

		/// <summary>
		/// Sets all default variables
		/// </summary>
		internal void Initialize()
		{
			var learnSpellEffect = GetEffect(SpellEffectType.LearnSpell);
			if (learnSpellEffect == null)
			{
				learnSpellEffect = GetEffect(SpellEffectType.LearnPetSpell);
			}
			if (learnSpellEffect != null && learnSpellEffect.TriggerSpellId != 0)
			{
				IsTeachSpell = true;
			}

			// figure out Trigger spells
			for (var i = 0; i < Effects.Length; i++)
			{
				var effect = Effects[i];
				if (effect.TriggerSpellId != SpellId.None || effect.AuraType == AuraType.PeriodicTriggerSpell)
				{
					var triggeredSpell = SpellHandler.Get((uint)effect.TriggerSpellId);
					if (triggeredSpell != null)
					{
						if (!IsTeachSpell)
						{
							triggeredSpell.IsTriggeredSpell = true;
						}
						else
						{
							LearnSpell = triggeredSpell;
						}
						effect.TriggerSpell = triggeredSpell;
					}
					else
					{
						if (IsTeachSpell)
						{
							IsTeachSpell = GetEffect(SpellEffectType.LearnSpell) != null;
						}
						Effects[i].IsInvalid = true;
					}
				}
			}

			foreach (var effect in Effects)
			{
				if (effect.EffectType == SpellEffectType.PersistantAreaAura || effect.HasTarget(ImplicitTargetType.DynamicObject))
				{
					DOEffect = effect;
					break;
				}
			}

			//foreach (var effect in Effects)
			//{
			//    effect.Initialize();
			//}
		}
开发者ID:WCellFR,项目名称:WCellFR,代码行数:59,代码来源:Spell.cs

示例9: CorpseExplosionHandler

			public CorpseExplosionHandler(SpellCast cast, SpellEffect effect)
				: base(cast, effect)
			{
			}
开发者ID:remixod,项目名称:netServer,代码行数:4,代码来源:DeathKnightUnholyFixes.cs

示例10: DeathStrikeHealHandler

			public DeathStrikeHealHandler(SpellCast cast, SpellEffect effect)
				: base(cast, effect)
			{
			}
开发者ID:remixod,项目名称:netServer,代码行数:4,代码来源:DeathKnightUnholyFixes.cs

示例11: DeathCoilHandler

			public DeathCoilHandler(SpellCast cast, SpellEffect effect)
				: base(cast, effect)
			{
			}
开发者ID:remixod,项目名称:netServer,代码行数:4,代码来源:DeathKnightUnholyFixes.cs

示例12: AddBleedWeaponDamageHandler

		public AddBleedWeaponDamageHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
开发者ID:primax,项目名称:WCell,代码行数:4,代码来源:DruidFeralCombatFixes.cs

示例13: FerociousBiteHandler

		public FerociousBiteHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
开发者ID:primax,项目名称:WCell,代码行数:4,代码来源:DruidFeralCombatFixes.cs

示例14: IncDmgImmunityCount

		/// <summary>
		/// Adds immunity against given damage-schools
		/// </summary>
		public void IncDmgImmunityCount(SpellEffect effect)
		{
			if (m_dmgImmunities == null)
			{
				m_dmgImmunities = CreateDamageSchoolArr();
			}

			foreach (var school in effect.MiscBitSet)
			{
				m_dmgImmunities[(int)school]++;
			}

			Auras.RemoveWhere(aura =>
				aura.Spell.AuraUID != effect.Spell.AuraUID &&
				aura.Spell.SchoolMask.HasAnyFlag(effect.Spell.SchoolMask) &&
				!aura.Spell.Attributes.HasFlag(SpellAttributes.UnaffectedByInvulnerability));
		}
开发者ID:enjoii,项目名称:WCell,代码行数:20,代码来源:Unit.Mechanics.cs

示例15: GetGeneratedThreat

		/// <summary>
		/// Threat mod in percent
		/// </summary>
		public virtual int GetGeneratedThreat(int dmg, DamageSchool school, SpellEffect effect)
		{
			if (m_threatMods == null)
			{
				return dmg;
			}
			return dmg + ((dmg * m_threatMods[(int)school]) / 100);
		}
开发者ID:enjoii,项目名称:WCell,代码行数:11,代码来源:Unit.Mechanics.cs


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