Exemple #1
0
        public void Target(BaseCreature bc)
        {
            if (!Caster.CanSee(bc))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            if (!Caster.InRange(bc, 6))
            {
                Caster.SendLocalizedMessage(500643);                   // Target is too far away.
            }
            else if (!Caster.CanBeHarmful(bc) || !bc.CanBeDamaged())
            {
                Caster.SendLocalizedMessage(1074379);                   // You cannot charm that!
            }
            else if (bc.Controlled || bc.Name == null)
            {
                Caster.SendLocalizedMessage(1074379);                   // You cannot charm that!
            }
            else if (bc is BaseChampion || bc.IsParagon || bc is Medusa || bc is Lurg || !SlayerGroup.GetEntryByName(SlayerName.Repond).Slays(bc))
            {
                Caster.SendLocalizedMessage(1074379);                   // You cannot charm that!
            }
            else if (CheckSequence())
            {
                double chance = Caster.Skills[SkillName.Spellweaving].Fixed / 1000;

                chance += (SpellweavingSpell.GetFocusLevel(Caster) * 2) / 100;

                if (chance > Utility.RandomDouble())
                {
                    SpellHelper.Turn(Caster, bc);

                    bc.ControlSlots = 3;

                    bc.ActiveSpeed  = 2;
                    bc.PassiveSpeed = 2;

                    bc.Owners.Add(Caster);

                    bc.SetControlMaster(Caster);

                    bc.IsBonded = false;

                    Caster.SendLocalizedMessage(1072527);                       // You allure the humanoid to follow and protect you.

                    Caster.PlaySound(0x5C4);
                }
                else
                {
                    bc.Combatant = Caster;

                    Caster.SendLocalizedMessage(1072528);                       // The humanoid becomes enraged by your charming attempt and attacks you.

                    Caster.PlaySound(0x5C5);
                }
            }

            FinishSequence();
        }