Ejemplo n.º 1
0
        public override void OnTarget(Object o)
        {
            Mobile target = o as Mobile;

            if (target == null)
            {
                return;
            }
            else if (CheckHSequence(target))
            {
                Map map = Caster.Map;

                if (map != null)
                {
                    List <Mobile> targets = new List <Mobile>();

                    IPooledEnumerable eable = target.GetMobilesInRange(3);
                    foreach (Mobile m in eable)
                    {
                        if (Caster != m && target.InLOS(m) && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && !SleepSpell.IsUnderSleepEffects(m) && !m.Paralyzed)
                        {
                            targets.Add(m);
                        }
                    }
                    eable.Free();

                    for (int i = 0; i < targets.Count; ++i)
                    {
                        Mobile m = targets[i];

                        double duration = ((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 20) + 3;
                        duration -= target.Skills[SkillName.MagicResist].Value / 10;

                        if (duration > 0)
                        {
                            Caster.DoHarmful(m);

                            SleepSpell.DoSleep(Caster, m, TimeSpan.FromSeconds(duration));
                        }
                    }
                }
            }

            FinishSequence();
        }
Ejemplo n.º 2
0
        public Spell GetMysticSpell()
        {
            Spell spell = null;

            switch( Utility.Random(8) )
            {
                case 0:
                case 1:
                    {
                        if (m_Mobile.Combatant is Mobile && this.CheckForSleep((Mobile)this.m_Mobile.Combatant))
                        {
                            this.m_Mobile.DebugSay("Casting Sleep");
                            spell = new SleepSpell(this.m_Mobile, null);
                            break;
                        }
                        else
                            goto case 7;
                    }
                case 2:
                    {
                        if (this.m_Mobile.Followers < 2)
                        {
                            int whichone = Utility.Random(3);

                            if (this.m_Mobile.Skills[SkillName.Mysticism].Value > 80.0 && whichone > 0)
                            {
                                this.m_Mobile.DebugSay("Casting Rising Colossus");
                                spell = new RisingColossusSpell(this.m_Mobile, null);
                            }
                            else if (this.m_Mobile.Skills[SkillName.Mysticism].Value > 30.0)
                            {
                                this.m_Mobile.DebugSay("Casting Animated Weapon");
                                spell = new AnimatedWeaponSpell(this.m_Mobile, null);
                            }
                        }

                        if (spell != null)
                            break;
                        else
                            goto case 7;
                    }
                case 3:
                    {
                        if (this.m_CanShapeShift && this.m_Mobile.Skills[SkillName.Mysticism].Value > 30.0)
                        {
                            this.m_Mobile.DebugSay("Casting Stone Form");
                            spell = new StoneFormSpell(this.m_Mobile, null);
                            break;
                        }
                        else
                            goto case 7;
                    }
                case 4:
                case 5:
                    {
                        if (m_Mobile.Combatant is Mobile && !SpellPlagueSpell.HasSpellPlague((Mobile)m_Mobile.Combatant) && this.m_Mobile.Skills[SkillName.Mysticism].Value > 70.0)
                        {
                            this.m_Mobile.DebugSay("Casting Spell Plague");
                            spell = new SpellPlagueSpell(this.m_Mobile, null);
                            break;
                        }
                        else
                            goto case 7;
                    }
                case 6:
                case 7:
                    {
                        switch( Utility.Random((int)(this.m_Mobile.Skills[SkillName.Mysticism].Value / 20)) )
                        {
                            default:
                                spell = new NetherBoltSpell(this.m_Mobile, null);
                                break;
                            case 1:
                                spell = new EagleStrikeSpell(this.m_Mobile, null);
                                break;
                            case 2:
                                spell = new BombardSpell(this.m_Mobile, null);
                                break;
                            case 3:
                                spell = new HailStormSpell(this.m_Mobile, null);
                                break;
                            case 4:
                                spell = new NetherCycloneSpell(this.m_Mobile, null);
                                break;
                        }

                        break;
                    }
            }

            return spell;
        }
Ejemplo n.º 3
0
        public override void OnTarget(Object o)
        {
            IPoint3D p = o as IPoint3D;

            if (p == null)
            {
                return;
            }

            if (CheckSequence())
            {
                List <Mobile> targets = new List <Mobile>();
                Party         party   = Party.Get(Caster);
                StatMod       mod;

                double prim = Caster.Skills[CastSkill].Value;
                double sec  = Caster.Skills[DamageSkill].Value;

                IPooledEnumerable eable = Caster.Map.GetMobilesInRange(new Point3D(p), 3);
                foreach (Mobile mob in eable)
                {
                    if (mob == null)
                    {
                        continue;
                    }

                    if (mob == Caster)
                    {
                        targets.Add(mob);
                    }

                    if (Caster.CanBeBeneficial(mob, false) && party != null && party.Contains(mob))
                    {
                        targets.Add(mob);
                    }
                }
                eable.Free();

                Mobile m;
                int    toheal = (int)(((prim + sec) / 2) * 0.3) - 6;
                Caster.PlaySound(0x64C);

                for (int i = 0; i < targets.Count; i++)
                {
                    m = targets[i];
                    int toHealMod = toheal;

                    if (!m.Alive)
                    {
                        continue;
                    }

                    if (m.Poisoned)
                    {
                        int chanceToCure = (10000 + (int)(((prim + sec) / 2) * 75) - ((m.Poison.RealLevel + 1) * 1750)) / 100;

                        if (chanceToCure > Utility.Random(100) && m.CurePoison(Caster))
                        {
                            toHealMod /= 3;
                        }
                        else
                        {
                            toHealMod = 0;
                        }
                    }

                    if (MortalStrike.IsWounded(m))
                    {
                        MortalStrike.EndWound(m);
                        toHealMod = 0;
                    }

                    if (toHealMod > 0)
                    {
                        m.Heal(toHealMod + Utility.RandomMinMax(1, 6));
                    }

                    m.RemoveStatMod("[Magic] Str Curse");
                    m.RemoveStatMod("[Magic] Dex Curse");
                    m.RemoveStatMod("[Magic] Int Curse");

                    SleepSpell.EndSleep(m);
                    EvilOmenSpell.TryEndEffect(m);
                    StrangleSpell.RemoveCurse(m);
                    CorpseSkinSpell.RemoveCurse(m);
                    CurseSpell.RemoveEffect(m);
                    BloodOathSpell.RemoveCurse(m);
                    MindRotSpell.ClearMindRotScalar(m);

                    BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
                    BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
                    BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
                    BuffInfo.RemoveBuff(m, BuffIcon.Curse);
                    BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
                    BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);
                    BuffInfo.RemoveBuff(m, BuffIcon.Mindrot);
                    BuffInfo.RemoveBuff(m, BuffIcon.CorpseSkin);
                    BuffInfo.RemoveBuff(m, BuffIcon.Strangle);
                    BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);

                    //TODO: Message/Effects???
                }
            }

            FinishSequence();
        }