示例#1
0
        public override void Apply()
        {
            NPC          activePet = this.Cast.CasterChar.ActivePet;
            ItemTemplate template  = this.Cast.TargetItem.Template;

            if (activePet == null || template == null)
            {
                return;
            }
            this.Cast.Trigger(this.Effect.TriggerSpell, new WorldObject[1]
            {
                (WorldObject)activePet
            });
            Aura aura = activePet.Auras[this.Effect.TriggerSpellId];

            if (aura == null)
            {
                return;
            }
            AuraEffectHandler handler = aura.GetHandler(AuraType.PeriodicEnergize);

            if (handler == null)
            {
                return;
            }
            handler.BaseEffectValue = activePet.GetHappinessGain(template);
        }
示例#2
0
        internal AuraEffectHandler CreateAuraEffectHandler(ObjectReference caster, Unit target,
                                                           ref SpellFailedReason failedReason, SpellCast triggeringCast)
        {
            AuraEffectHandler auraEffectHandler = AuraEffectHandlerCreator();

            if (triggeringCast != null && triggeringCast.TriggerEffect != null &&
                triggeringCast.TriggerEffect.OverrideEffectValue)
            {
                if (Spell.Effects.Length > 1)
                {
                    log.Warn(
                        "Spell {0} had overriding SpellEffect although the spell that was triggered had {2} (> 1) effects",
                        Spell, Spell.Effects.Length);
                }
                auraEffectHandler.m_spellEffect = triggeringCast.TriggerEffect;
            }
            else
            {
                auraEffectHandler.m_spellEffect = this;
            }

            auraEffectHandler.BaseEffectValue = CalcEffectValue(caster);
            auraEffectHandler.CheckInitialize(triggeringCast, caster, target, ref failedReason);
            return(auraEffectHandler);
        }
示例#3
0
 public AuraApplicationInfo(Unit target, AuraEffectHandler firstHandler)
 {
     this.Target   = target;
     this.Handlers = new List <AuraEffectHandler>(3)
     {
         firstHandler
     };
 }
        public override SpellFailedReason InitializeTarget(WorldObject target)
        {
            SpellFailedReason failedReason      = SpellFailedReason.Ok;
            AuraEffectHandler auraEffectHandler = this.Effect.CreateAuraEffectHandler(this.m_cast.CasterReference,
                                                                                      (Unit)target, ref failedReason, this.m_cast);

            if (failedReason == SpellFailedReason.Ok)
            {
                this.m_auraEffectHandlers.Add(new SingleAuraApplicationInfo((Unit)target, auraEffectHandler));
            }
            return(failedReason);
        }
示例#5
0
 public SingleAuraApplicationInfo(Unit target, AuraEffectHandler handler)
 {
     Target  = target;
     Handler = handler;
 }