/// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn);

            if (template == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString());
                }
                MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System);
                return;
            }

            GameSpellEffect effect = CreateSpellEffect(target, effectiveness);

            IControlledBrain brain = GetPetBrain(Caster);

            m_pet = GetGamePet(template);
            //brain.WalkState = eWalkState.Stay;
            m_pet.SetOwnBrain(brain as AI.ABrain);

            int    x, y, z;
            ushort heading;
            Region region;

            GetPetLocation(out x, out y, out z, out heading, out region);

            m_pet.X             = x;
            m_pet.Y             = y;
            m_pet.Z             = z;
            m_pet.Heading       = heading;
            m_pet.CurrentRegion = region;

            m_pet.CurrentSpeed = 0;
            m_pet.Realm        = Caster.Realm;
            m_pet.Level        = GetPetLevel();

            if (m_isSilent)
            {
                m_pet.IsSilent = true;
            }

            m_pet.AddToWorld();

            //Check for buffs
            if (brain is ControlledNpcBrain)
            {
                (brain as ControlledNpcBrain).CheckSpells(StandardMobBrain.eCheckSpellType.Defensive);
            }

            AddHandlers();

            SetBrainToOwner(brain);

            effect.Start(m_pet);

            Caster.OnPetSummoned(m_pet);
        }
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn);
            if (template == null)
            {
                if (log.IsWarnEnabled)
                    log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString());
                MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System);
                return;
            }

            GameSpellEffect effect = CreateSpellEffect(target, effectiveness);

            IControlledBrain brain = GetPetBrain(Caster);
            m_pet = GetGamePet(template);
            //brain.WalkState = eWalkState.Stay;
            m_pet.SetOwnBrain(brain as AI.ABrain);

            int x, y, z;
            ushort heading;
            Region region;

            GetPetLocation(out x, out y, out z, out heading, out region);

            m_pet.X = x;
            m_pet.Y = y;
            m_pet.Z = z;
            m_pet.Heading = heading;
            m_pet.CurrentRegion = region;

            m_pet.CurrentSpeed = 0;
            m_pet.Realm = Caster.Realm;
            m_pet.Level = GetPetLevel();

            if (m_isSilent)
                m_pet.IsSilent = true;

            m_pet.AddToWorld();

            //Check for buffs
            if (brain is ControlledNpcBrain)
                (brain as ControlledNpcBrain).CheckSpells(StandardMobBrain.eCheckSpellType.Defensive);

            AddHandlers();

            SetBrainToOwner(brain);

            effect.Start(m_pet);

            Caster.OnPetSummoned(m_pet);
        }
Beispiel #3
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn);

            if (template == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString());
                }
                MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System);
                return;
            }

            GameSpellEffect effect = CreateSpellEffect(target, effectiveness);

            IControlledBrain brain = null;

            if (template.ClassType != null && template.ClassType.Length > 0)
            {
                Assembly asm = Assembly.GetExecutingAssembly();
                brain = (IControlledBrain)asm.CreateInstance(template.ClassType, true);

                if (brain == null && log.IsWarnEnabled)
                {
                    log.Warn($"ApplyEffectOnTarget(): ClassType {template.ClassType} on NPCTemplateID {template.TemplateId} not found, using default ControlledBrain");
                }
            }
            if (brain == null)
            {
                brain = GetPetBrain(Caster);
            }

            m_pet = GetGamePet(template);
            //brain.WalkState = eWalkState.Stay;
            m_pet.SetOwnBrain(brain as AI.ABrain);

            m_pet.SummonSpellDamage = Spell.Damage;
            m_pet.SummonSpellValue  = Spell.Value;

            int    x, y, z;
            ushort heading;
            Region region;

            GetPetLocation(out x, out y, out z, out heading, out region);

            m_pet.X             = x;
            m_pet.Y             = y;
            m_pet.Z             = z;
            m_pet.Heading       = heading;
            m_pet.CurrentRegion = region;

            m_pet.CurrentSpeed = 0;
            m_pet.Realm        = Caster.Realm;

            if (m_isSilent)
            {
                m_pet.IsSilent = true;
            }

            m_pet.AddToWorld();

            //Check for buffs
            if (brain is ControlledNpcBrain)
            {
                (brain as ControlledNpcBrain).CheckSpells(StandardMobBrain.eCheckSpellType.Defensive);
            }

            AddHandlers();

            SetBrainToOwner(brain);

            m_pet.SetPetLevel();
            m_pet.Health = m_pet.MaxHealth;

            if (DOL.GS.ServerProperties.Properties.PET_SCALE_SPELL_MAX_LEVEL > 0)
            {
                m_pet.Spells = template.Spells;                 // Have to scale spells again now that the pet level has been assigned
            }
            effect.Start(m_pet);

            Caster.OnPetSummoned(m_pet);
        }