예제 #1
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();
		}
예제 #2
0
파일: Spell.cs 프로젝트: ebakkedahl/WCell
        ///// <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, SpellEffectType newType, ImplicitTargetType target)
        //{
        //    for (var i = 0; i < Effects.Length; i++)
        //    {
        //        var effect = Effects[i];
        //        if (effect.EffectType == type)
        //        {
        //            return Effects[i] = new SpellEffect();
        //        }
        //    }
        //    return AddEffect(type, target);
        //}

        /// <summary>
        /// Adds a new Effect to this Spell
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public SpellEffect AddEffect(SpellEffectHandlerCreator creator, ImplicitSpellTargetType target)
        {
            var effect = AddEffect(SpellEffectType.Dummy, target);
            effect.SpellEffectHandlerCreator = creator;
            return effect;
        }
예제 #3
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);
        }