示例#1
0
 public void MakeProc(AuraEffectHandlerCreator creator, params SpellLineId[] exclusiveTriggers)
 {
     IsProc = true;
     ClearAffectMask();
     AddAffectingSpells(exclusiveTriggers);
     AuraEffectHandlerCreator = creator;
 }
示例#2
0
        /// <summary>
        /// Uses the AffectMask, rather than exclusive trigger spells. This is important if also spells
        /// that are triggerd by the triggered spells are allowed to trigger this proc.
        /// </summary>
        public void MakeProcWithMask(AuraEffectHandlerCreator creator, params SpellLineId[] exclusiveTriggers)
        {
            //Spell.ProcTriggerFlags = ProcTriggerFlags.SpellCast;

            IsProc = true;
            SetAffectMask(exclusiveTriggers);
            AuraEffectHandlerCreator = creator;
        }
示例#3
0
文件: Spell.cs 项目: WCellFR/WCellFR
		/// <summary>
		/// Adds a SpellEffect that will be applied to an Aura to be casted on the given type of target
		/// </summary>
		public SpellEffect AddAuraEffect(AuraEffectHandlerCreator creator, ImplicitTargetType targetType)
		{
			var effect = AddEffect(SpellEffectType.ApplyAura);
			effect.AuraType = AuraType.Dummy;
			effect.AuraEffectHandlerCreator = creator;
			effect.ImplicitTargetA = targetType;
			return effect;
		}
示例#4
0
文件: Spell.cs 项目: WCellFR/WCellFR
		/// <summary>
		/// Adds a SpellEffect that will be applied to an Aura to be casted on the given type of target
		/// </summary>
		public SpellEffect AddAuraEffect(AuraEffectHandlerCreator creator)
		{
			return AddAuraEffect(creator, ImplicitTargetType.Self);
		}
示例#5
0
		/// <summary>
		/// Uses the AffectMask, rather than exclusive trigger spells. This is important if also spells
		/// that are triggerd by the triggered spells are allowed to trigger this proc.
		/// </summary>
		public void MakeProcWithMask(AuraEffectHandlerCreator creator, params SpellLineId[] exclusiveTriggers)
		{
			//Spell.ProcTriggerFlags = ProcTriggerFlags.SpellCast; 

			IsProc = true;
			SetAffectMask(exclusiveTriggers);
			AuraEffectHandlerCreator = creator;
		}
示例#6
0
		public void MakeProc(AuraEffectHandlerCreator creator, params SpellLineId[] exclusiveTriggers)
		{
			//Spell.ProcTriggerFlags = ProcTriggerFlags.SpellCast;

			IsProc = true;
			ClearAffectMask();
			AddAffectingSpells(exclusiveTriggers);
			AuraEffectHandlerCreator = creator;
		}
示例#7
0
		internal void Init2()
		{
			// see http://www.wowhead.com/spell=25269 for comparison
			ValueMin = BasePoints + 1;
			ValueMax = BasePoints + DiceSides; // TODO: check this!

			IsTargetAreaEffect = TargetAreaEffects.Contains(ImplicitTargetA) || TargetAreaEffects.Contains(ImplicitTargetB);

			// prevent aoe and non-aoe effects from mixing together
			if (AreaEffects.Contains(ImplicitTargetA))
			{
				IsAreaEffect = true;
				if (ImplicitTargetB != ImplicitTargetType.None && AreaEffects.Contains(ImplicitTargetB))
				{
					ImplicitTargetB = ImplicitTargetType.None;
				}
			}
			else if (ImplicitTargetB != ImplicitTargetType.None && AreaEffects.Contains(ImplicitTargetB))
			{
				IsAreaEffect = true;
				ImplicitTargetA = ImplicitTargetType.None;
			}

			if (IsPeriodic = Amplitude > 0)
			{
				_IsPeriodicAura = (AuraType == AuraType.PeriodicDamage ||
								  AuraType == AuraType.PeriodicDamagePercent ||
								  AuraType == AuraType.PeriodicEnergize ||
								  AuraType == AuraType.PeriodicHeal ||
								  AuraType == AuraType.PeriodicHealthFunnel ||
								  AuraType == AuraType.PeriodicLeech ||
								  AuraType == AuraType.PeriodicManaLeech ||
								  AuraType == AuraType.PeriodicTriggerSpell);
			}

			if (Spell.IsPassive)
			{
				// proc effect etc
				HarmType = HarmType.Beneficial;
			}
			else if ((HasTarget(ImplicitTargetType.AllEnemiesAroundCaster,
				ImplicitTargetType.AllEnemiesInArea,
				ImplicitTargetType.AllEnemiesInAreaChanneled,
				ImplicitTargetType.AllEnemiesInAreaInstant,
				ImplicitTargetType.CurrentSelection) ||

				HasTarget(ImplicitTargetType.InFrontOfCaster,
						ImplicitTargetType.InvisibleOrHiddenEnemiesAtLocationRadius,
						ImplicitTargetType.LocationInFrontCaster,
						ImplicitTargetType.NetherDrakeSummonLocation,
						ImplicitTargetType.SelectedEnemyChanneled,
						ImplicitTargetType.SelectedEnemyDeadlyPoison,
						ImplicitTargetType.SingleEnemy,
						ImplicitTargetType.SpreadableDesease,
						ImplicitTargetType.TargetAtOrientationOfCaster)) &&

				(!HasTarget(
				ImplicitTargetType.Self,
				ImplicitTargetType.AllFriendlyInAura,
				ImplicitTargetType.AllParty,
				ImplicitTargetType.AllPartyAroundCaster,
				ImplicitTargetType.AllPartyInArea,
				ImplicitTargetType.PartyAroundCaster,
				ImplicitTargetType.AllPartyInAreaChanneled) ||

				Spell.Mechanic.IsNegative()))
			{
				HarmType = HarmType.Harmful;
			}
			else if (!HasTarget(ImplicitTargetType.Duel) && 
				(ImplicitTargetA != ImplicitTargetType.None || ImplicitTargetB != ImplicitTargetType.None))
			{
				HarmType = HarmType.Beneficial;
			}

			if (Spell.IsPassive)
			{
				// do some correction for ModManaRegen
				if (AuraType == AuraType.ModManaRegen && Amplitude == 0)
				{
					// 5000 ms if not specified otherwise
					Amplitude = ModManaRegenHandler.DefaultAmplitude;
				}
			}

			HasTargets = !NoTargetTypes.Contains(ImplicitTargetA) || !NoTargetTypes.Contains(ImplicitTargetB);

			HasSingleTarget = HasTargets && !IsAreaEffect;

			IsAreaAuraEffect = (EffectType == SpellEffectType.PersistantAreaAura ||
					EffectType == SpellEffectType.ApplyAreaAura ||
					EffectType == SpellEffectType.ApplyGroupAura);

			if (EffectType == SpellEffectType.ApplyGroupAura)
			{
				if (Radius > 0)
				{
					ImplicitTargetA = ImplicitTargetType.AllPartyInArea;
				}
				else
				{
					ImplicitTargetA = ImplicitTargetType.AllParty;
				}
			}

			IsAuraEffect = IsAreaAuraEffect ||
						   EffectType == SpellEffectType.ApplyAura ||
						   EffectType == SpellEffectType.ApplyAuraToMaster ||
						   EffectType == SpellEffectType.ApplyPetAura ||
						   EffectType == SpellEffectType.ApplyStatAura ||
						   EffectType == SpellEffectType.ApplyStatAuraPercent;

			IsEnhancer = IsAuraEffect && (AuraType == AuraType.AddModifierFlat || AuraType == AuraType.AddModifierPercent);

			MiscBitSet = MiscValue > 0 ? Utility.GetSetIndices((uint)MiscValue) : new uint[0];

            MinValue = BasePoints;// + DiceCount; TODO: check this!

			IsStrikeEffectFlat = EffectType == SpellEffectType.WeaponDamage ||
								 EffectType == SpellEffectType.WeaponDamageNoSchool ||
								 EffectType == SpellEffectType.NormalizedWeaponDamagePlus;

			IsStrikeEffectPct = EffectType == SpellEffectType.WeaponPercentDamage;

			IsTotem = HasTarget(ImplicitTargetType.TotemAir) ||
				HasTarget(ImplicitTargetType.TotemEarth) ||
				HasTarget(ImplicitTargetType.TotemFire) ||
				HasTarget(ImplicitTargetType.TotemWater);

			IsProc = IsProc || (AuraType == AuraType.ProcTriggerSpell && TriggerSpell != null) || AuraType == AuraType.ProcTriggerDamage;

			IsHealEffect = EffectType == SpellEffectType.Heal ||
				EffectType == SpellEffectType.HealMaxHealth ||
				AuraType == AuraType.PeriodicHeal ||
				(TriggerSpell != null && TriggerSpell.IsHealSpell);

			IsModifierEffect = AuraType == AuraType.AddModifierFlat || AuraType == AuraType.AddModifierPercent;

			foreach (var mask in AffectMask)
			{
				if (mask != 0)
				{
					HasAffectMask = true;
					break;
				}
			}

			if (HasAffectMask)
			{
				AffectMaskBitSet = Utility.GetSetIndices(AffectMask);
			}

			if (SpellEffectHandlerCreator == null && !IsUsed)
			{
				SpellEffectHandlerCreator = SpellHandler.SpellEffectCreators[(int)EffectType];
			}
			if (IsAuraEffect && AuraEffectHandlerCreator == null)
			{
				AuraEffectHandlerCreator = AuraHandler.EffectHandlers[(int)AuraType];
				if (AuraEffectHandlerCreator == null)
				{
					AuraEffectHandlerCreator = AuraHandler.EffectHandlers[0];
				}
			}

			RepairBrokenTargetPairs();
		}
示例#8
0
        internal void Init2()
        {
            ValueMin           = BasePoints + 1;
            ValueMax           = BasePoints + DiceSides;
            IsTargetAreaEffect = TargetAreaEffects.Contains(ImplicitTargetA) ||
                                 TargetAreaEffects.Contains(ImplicitTargetB);
            if (AreaEffects.Contains(ImplicitTargetA))
            {
                IsAreaEffect = true;
                if (ImplicitTargetB != ImplicitSpellTargetType.None &&
                    AreaEffects.Contains(ImplicitTargetB))
                {
                    ImplicitTargetB = ImplicitSpellTargetType.None;
                }
            }
            else if (ImplicitTargetB != ImplicitSpellTargetType.None &&
                     AreaEffects.Contains(ImplicitTargetB))
            {
                IsAreaEffect    = true;
                ImplicitTargetA = ImplicitSpellTargetType.None;
            }

            if (IsPeriodic = Amplitude > 0)
            {
                _IsPeriodicAura = AuraType == AuraType.PeriodicDamage ||
                                  AuraType == AuraType.PeriodicDamagePercent ||
                                  (AuraType == AuraType.PeriodicEnergize ||
                                   AuraType == AuraType.PeriodicHeal) ||
                                  (AuraType == AuraType.PeriodicHealthFunnel ||
                                   AuraType == AuraType.PeriodicLeech ||
                                   AuraType == AuraType.PeriodicManaLeech) ||
                                  AuraType == AuraType.PeriodicTriggerSpell;
            }
            if (Spell.IsPassive)
            {
                HarmType = HarmType.Beneficial;
            }
            else
            {
                if (!HasTarget(ImplicitSpellTargetType.AllEnemiesAroundCaster,
                               ImplicitSpellTargetType.AllEnemiesInArea, ImplicitSpellTargetType.AllEnemiesInAreaChanneled,
                               ImplicitSpellTargetType.AllEnemiesInAreaInstant, ImplicitSpellTargetType.CurrentSelection))
                {
                    if (!HasTarget(ImplicitSpellTargetType.InFrontOfCaster,
                                   ImplicitSpellTargetType.InvisibleOrHiddenEnemiesAtLocationRadius,
                                   ImplicitSpellTargetType.LocationInFrontCaster,
                                   ImplicitSpellTargetType.NetherDrakeSummonLocation,
                                   ImplicitSpellTargetType.SelectedEnemyChanneled,
                                   ImplicitSpellTargetType.SelectedEnemyDeadlyPoison, ImplicitSpellTargetType.SingleEnemy,
                                   ImplicitSpellTargetType.SpreadableDesease, ImplicitSpellTargetType.TargetAtOrientationOfCaster))
                    {
                        goto label_13;
                    }
                }

                if (!HasTarget(ImplicitSpellTargetType.Self, ImplicitSpellTargetType.AllFriendlyInAura,
                               ImplicitSpellTargetType.AllParty, ImplicitSpellTargetType.AllPartyAroundCaster,
                               ImplicitSpellTargetType.AllPartyInArea, ImplicitSpellTargetType.PartyAroundCaster,
                               ImplicitSpellTargetType.AllPartyInAreaChanneled) || Spell.Mechanic.IsNegative())
                {
                    HarmType = HarmType.Harmful;
                    goto label_15;
                }

label_13:
                if (!HasTarget(ImplicitSpellTargetType.Duel) &&
                    (ImplicitTargetA != ImplicitSpellTargetType.None ||
                     ImplicitTargetB != ImplicitSpellTargetType.None))
                {
                    HarmType = HarmType.Beneficial;
                }
            }

label_15:
            if (AuraType == AuraType.ModManaRegen && Amplitude == 0)
            {
                Amplitude = ModManaRegenHandler.DefaultAmplitude;
            }
            if (HasTarget(ImplicitSpellTargetType.AllFriendlyInAura))
            {
                ImplicitTargetA = ImplicitSpellTargetType.AllFriendlyInAura;
                ImplicitTargetB = ImplicitSpellTargetType.None;
            }

            HasTargets =
                !NoTargetTypes.Contains(
                    ImplicitTargetA) ||
                !NoTargetTypes.Contains(
                    ImplicitTargetB);
            HasSingleTarget  = HasTargets && !IsAreaEffect;
            IsAreaAuraEffect = EffectType == SpellEffectType.PersistantAreaAura ||
                               EffectType == SpellEffectType.ApplyAreaAura ||
                               EffectType == SpellEffectType.ApplyRaidAura;
            if (EffectType == SpellEffectType.ApplyRaidAura)
            {
                ImplicitTargetA = (double)Radius <= 0.0
          ? ImplicitSpellTargetType.AllParty
          : ImplicitSpellTargetType.AllPartyInArea;
            }
            IsAuraEffect = IsAreaAuraEffect || EffectType == SpellEffectType.ApplyAura ||
                           (EffectType == SpellEffectType.ApplyAuraToMaster ||
                            EffectType == SpellEffectType.ApplyPetAura) ||
                           EffectType == SpellEffectType.ApplyStatAura ||
                           EffectType == SpellEffectType.ApplyStatAuraPercent;
            IsEnhancer = IsAuraEffect &&
                         (AuraType == AuraType.AddModifierFlat ||
                          AuraType == AuraType.AddModifierPercent);
            if (MiscValueType == typeof(DamageSchoolMask))
            {
                MiscValue &= sbyte.MaxValue;
            }
            MiscBitSet         = MiscValue > 0 ? Utility.GetSetIndices((uint)MiscValue) : new uint[0];
            MinValue           = BasePoints;
            IsStrikeEffectFlat = EffectType == SpellEffectType.WeaponDamage ||
                                 EffectType == SpellEffectType.WeaponDamageNoSchool ||
                                 EffectType == SpellEffectType.NormalizedWeaponDamagePlus;
            IsStrikeEffectPct = EffectType == SpellEffectType.WeaponPercentDamage;
            IsTotem           = HasTarget(ImplicitSpellTargetType.TotemAir) ||
                                HasTarget(ImplicitSpellTargetType.TotemEarth) ||
                                HasTarget(ImplicitSpellTargetType.TotemFire) ||
                                HasTarget(ImplicitSpellTargetType.TotemWater);
            IsProc = IsProc || ProcAuraTypes.Contains(AuraType);
            OverrideEffectValue =
                OverrideEffectValue || AuraType == AuraType.ProcTriggerSpellWithOverride;
            IsHealEffect = EffectType == SpellEffectType.Heal ||
                           EffectType == SpellEffectType.HealMaxHealth ||
                           AuraType == AuraType.PeriodicHeal ||
                           TriggerSpell != null && TriggerSpell.IsHealSpell;
            IsDamageEffect   = EffectType == SpellEffectType.SchoolDamage || IsStrikeEffect;
            IsModifierEffect =
                AuraType == AuraType.AddModifierFlat || AuraType == AuraType.AddModifierPercent;
            HasAffectMask =
                AffectMask.Any(mask => mask != 0U);
            if (HasAffectMask)
            {
                AffectMaskBitSet = Utility.GetSetIndices(AffectMask);
            }
            if (SpellEffectHandlerCreator == null)
            {
                SpellEffectHandlerCreator = SpellHandler.SpellEffectCreators[(int)EffectType];
            }
            if (IsAuraEffect && AuraEffectHandlerCreator == null)
            {
                AuraEffectHandlerCreator = AuraHandler.EffectHandlers[(int)AuraType];
                if (AuraEffectHandlerCreator == null)
                {
                    AuraEffectHandlerCreator = AuraHandler.EffectHandlers[0];
                }
            }

            RepairBrokenTargetPairs();
            IsEnchantmentEffect = EffectType == SpellEffectType.EnchantHeldItem ||
                                  EffectType == SpellEffectType.EnchantItem ||
                                  EffectType == SpellEffectType.EnchantItemTemporary;
            AISpellUtil.DecideDefaultTargetHandlerDefintion(this);
        }