public void Target(Mobile m)
        {
            bool CanAffect = true;

            if (m is BaseCreature)
            {
                SlayerEntry undead = SlayerGroup.GetEntryByName(SlayerName.Silver);
                SlayerEntry elly   = SlayerGroup.GetEntryByName(SlayerName.ElementalBan);
                SlayerEntry golem  = SlayerGroup.GetEntryByName(SlayerName.GolemDestruction);
                if (undead.Slays(m) || elly.Slays(m) || golem.Slays(m))
                {
                    CanAffect = false;
                }
            }

            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (!(m is BaseCreature))
            {
                Caster.SendMessage("This spell cannot affect those type of creatures.");
            }
            else if (!CanAffect)
            {
                Caster.SendMessage("You cannot charm supernatural creatures, golems, constructs, or elementals.");
            }
            else if (m is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)m;

                int pFame = (int)(DamagingSkill(Caster)) * 60;
                int mFame = m.Fame;

                if (bc.ControlMaster != null)
                {
                    Caster.SendMessage("That is already controlled by another.");
                }
                else if (bc.FightMode != FightMode.Closest && bc.FightMode != FightMode.Aggressor)
                {
                    Caster.SendMessage("These charms will not work very well on that.");
                }
                else if (mFame > pFame)
                {
                    Caster.SendMessage("That creature is too powerful for you to charm.");
                }
                else if (CheckHSequence(m))
                {
                    SpellHelper.Turn(Caster, m);

                    SpellHelper.CheckReflect(CirclePower, Caster, ref m);

                    TimeSpan duration = TimeSpan.FromSeconds((DamagingSkill(Caster) / 4));

                    if (bc.FightMode == FightMode.Closest)
                    {
                        bc.FightMode = FightMode.CharmMonster;
                    }
                    else if (bc.FightMode == FightMode.Aggressor)
                    {
                        bc.FightMode = FightMode.CharmAnimal;
                    }

                    m.PlaySound(0x20B);

                    m.FixedParticles(0x3039, 9, 32, 5008, 0x48F, 0, EffectLayer.Waist);

                    new CharmTimer(m, duration).Start();
                    Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, false);

                    HarmfulSpell(m);
                }

                FinishSequence();
            }
        }
示例#2
0
        public virtual double GetSlayerDamageScalar(Mobile defender)
        {
            Spellbook atkBook = Spellbook.FindEquippedSpellbook(m_Caster);

            double scalar = 1.0;

            if (atkBook != null)
            {
                SlayerEntry atkSlayer  = SlayerGroup.GetEntryByName(atkBook.Slayer);
                SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName(atkBook.Slayer2);

                if (atkSlayer == null && atkSlayer2 == null)
                {
                    atkSlayer = SlayerGroup.GetEntryByName(SlayerSocket.GetSlayer(atkBook));
                }

                if (atkSlayer != null && atkSlayer.Slays(defender) || atkSlayer2 != null && atkSlayer2.Slays(defender))
                {
                    defender.FixedEffect(0x37B9, 10, 5);

                    bool isSuper = false;

                    if (atkSlayer != null && atkSlayer == atkSlayer.Group.Super)
                    {
                        isSuper = true;
                    }
                    else if (atkSlayer2 != null && atkSlayer2 == atkSlayer2.Group.Super)
                    {
                        isSuper = true;
                    }

                    scalar = isSuper ? 2.0 : 3.0;
                }


                TransformContext context = TransformationSpellHelper.GetContext(defender);

                if ((atkBook.Slayer == SlayerName.Silver || atkBook.Slayer2 == SlayerName.Silver) && context != null && context.Type != typeof(HorrificBeastSpell))
                {
                    scalar += .25; // Every necromancer transformation other than horrific beast take an additional 25% damage
                }
                if (scalar != 1.0)
                {
                    return(scalar);
                }
            }

            ISlayer defISlayer = Spellbook.FindEquippedSpellbook(defender);

            if (defISlayer == null)
            {
                defISlayer = defender.Weapon as ISlayer;
            }

            if (defISlayer != null)
            {
                SlayerEntry defSlayer  = SlayerGroup.GetEntryByName(defISlayer.Slayer);
                SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName(defISlayer.Slayer2);

                if (defSlayer != null && defSlayer.Group.OppositionSuperSlays(m_Caster) ||
                    defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays(m_Caster))
                {
                    scalar = 2.0;
                }
            }

            return(scalar);
        }