Exemple #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 != 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)
            {
                // proc effect etc
                HarmType = HarmType.Beneficial;
            }
            else if ((HasTarget(ImplicitSpellTargetType.AllEnemiesAroundCaster,
                                ImplicitSpellTargetType.AllEnemiesInArea,
                                ImplicitSpellTargetType.AllEnemiesInAreaChanneled,
                                ImplicitSpellTargetType.AllEnemiesInAreaInstant,
                                ImplicitSpellTargetType.CurrentSelection) ||
                      HasTarget(ImplicitSpellTargetType.InFrontOfCaster,
                                ImplicitSpellTargetType.InvisibleOrHiddenEnemiesAtLocationRadius,
                                ImplicitSpellTargetType.LocationInFrontCaster,
                                ImplicitSpellTargetType.NetherDrakeSummonLocation,
                                ImplicitSpellTargetType.SelectedEnemyChanneled,
                                ImplicitSpellTargetType.SelectedEnemyDeadlyPoison,
                                ImplicitSpellTargetType.SingleEnemy,
                                ImplicitSpellTargetType.SpreadableDesease,
                                ImplicitSpellTargetType.TargetAtOrientationOfCaster)) &&
                     (!HasTarget(
                          ImplicitSpellTargetType.Self,
                          ImplicitSpellTargetType.AllFriendlyInAura,
                          ImplicitSpellTargetType.AllParty,
                          ImplicitSpellTargetType.AllPartyAroundCaster,
                          ImplicitSpellTargetType.AllPartyInArea,
                          ImplicitSpellTargetType.PartyAroundCaster,
                          ImplicitSpellTargetType.AllPartyInAreaChanneled) ||
                      Spell.Mechanic.IsNegative()))
            {
                HarmType = HarmType.Harmful;
            }
            else if (!HasTarget(ImplicitSpellTargetType.Duel) &&
                     (ImplicitTargetA != ImplicitSpellTargetType.None || ImplicitTargetB != ImplicitSpellTargetType.None))
            {
                HarmType = HarmType.Beneficial;
            }

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

            if (HasTarget(ImplicitSpellTargetType.AllFriendlyInAura))
            {
                // whenever it's used, its used together with AllEnemiesAroundCaster in a beneficial spell)
                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)
            {
                if (Radius > 0)
                {
                    ImplicitTargetA = ImplicitSpellTargetType.AllPartyInArea;
                }
                else
                {
                    ImplicitTargetA = ImplicitSpellTargetType.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);

            if (MiscValueType == typeof(DamageSchoolMask))
            {
                // make sure that only valid schools are used
                MiscValue = MiscValue & (int)DamageSchoolMask.AllSchools;
            }

            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(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 != 0);

            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);
        }
Exemple #2
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);
        }