Exemple #1
0
        public virtual Spell DoDispel(Mobile toDispel)
        {
            if (!SmartAI)
            {
                if (ScaleBySkill(DispelChance, SkillName.Magery) > Utility.RandomDouble())
                {
                    return(new DispelSpell(m_Mobile, null));
                }

                return(ChooseSpell(toDispel));
            }

            Spell spell = CheckCastHealingSpell();

            if (spell == null)
            {
                if (!m_Mobile.DisallowAllMoves && Utility.Random((int)m_Mobile.GetDistanceToSqrt(toDispel)) == 0)
                {
                    spell = new TeleportSpell(m_Mobile, null);
                }
                else if (Utility.Random(3) == 0 && !m_Mobile.InRange(toDispel, 3) && !toDispel.Paralyzed && !toDispel.Frozen)
                {
                    spell = new ParalyzeSpell(m_Mobile, null);
                }
                else
                {
                    spell = new DispelSpell(m_Mobile, null);
                }
            }

            return(spell);
        }
Exemple #2
0
        public virtual Spell DoDispel(Mobile toDispel)
        {
            Spell spell = null;

            if (!m_Mobile.Summoned && Utility.Random(0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits))) >= 3)
            {
                if (m_Mobile.Hits < (m_Mobile.HitsMax - 50))
                {
                    spell = new GreaterHealSpell(m_Mobile, null);
                }
                else if (m_Mobile.Hits < (m_Mobile.HitsMax - 20))
                {
                    spell = new HealSpell(m_Mobile, null);
                }
            }

            if (spell == null)
            {
                if (!m_Mobile.DisallowAllMoves && Utility.Random((int)m_Mobile.GetDistanceToSqrt(toDispel)) == 0)
                {
                    spell = new TeleportSpell(m_Mobile, null);
                }
                else if (Utility.Random(3) == 0 && !m_Mobile.InRange(toDispel, 3) && !toDispel.Paralyzed && !toDispel.Frozen)
                {
                    spell = new ParalyzeSpell(m_Mobile, null);
                }
                else
                {
                    spell = new DispelSpell(m_Mobile, null);
                }
            }

            return(spell);
        }
Exemple #3
0
        public override Spell DoDispel(Mobile toDispel)
        {
            Spell spell = null;

            if (spell == null)
            {
                if (!m_Mobile.DisallowAllMoves && m_Mobile.InRange(toDispel, 4) && !toDispel.Paralyzed)
                {
                    spell = new TeleportSpell(m_Mobile, null);
                }
                else if (Utility.Random(1) == 0 && !m_Mobile.InRange(toDispel, 3) && !toDispel.Paralyzed && !toDispel.Frozen)
                {
                    spell = new ParalyzeSpell(m_Mobile, null);
                }
                else
                {
                    if (toDispel is Daemon)
                    {
                        return(new MassDispelSpell(m_Mobile, null));
                    }
                    else
                    {
                        return(new DispelSpell(m_Mobile, null));
                    }
                }
            }

            return(spell);
        }
Exemple #4
0
        public virtual Spell DoDispel(Mobile toDispel)
        {
            if (!SmartAI)
            {
                if (ScaleByMagery(DispelChance) > Utility.RandomDouble())
                {
                    if (toDispel is Daemon)
                    {
                        return(new MassDispelSpell(m_Mobile, null));
                    }
                    else
                    {
                        return(new DispelSpell(m_Mobile, null));
                    }
                }

                return(ChooseSpell(toDispel));
            }

            Spell spell = null;

            if (!m_Mobile.Summoned && Utility.Random(0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits))) >= 3)
            {
                if (m_Mobile.Hits < (m_Mobile.HitsMax - 50))
                {
                    spell = new GreaterHealSpell(m_Mobile, null);
                }
                else if (m_Mobile.Hits < (m_Mobile.HitsMax - 20))
                {
                    spell = new HealSpell(m_Mobile, null);
                }
            }

            if (spell == null)
            {
                if (!m_Mobile.DisallowAllMoves && Utility.Random((int)m_Mobile.GetDistanceToSqrt(toDispel)) == 0)
                {
                    spell = new TeleportSpell(m_Mobile, null);
                }
                else if (Utility.Random(3) == 0 && !m_Mobile.InRange(toDispel, 3) && !toDispel.Paralyzed && !toDispel.Frozen)
                {
                    spell = new ParalyzeSpell(m_Mobile, null);
                }
                else
                {
                    if (toDispel is Daemon)
                    {
                        return(new MassDispelSpell(m_Mobile, null));
                    }
                    else
                    {
                        return(new DispelSpell(m_Mobile, null));
                    }
                }
            }

            return(spell);
        }
Exemple #5
0
        public virtual ISpell CreateSpell(LivingEntity caller)
        {
            ISpell spell = null;

            switch (this.Kind)
            {
            case SpellKind.FireBall:
                spell = new FireBallSpell(caller);
                break;

            case SpellKind.PoisonBall:
                spell = new PoisonBallSpell(caller);
                break;

            case SpellKind.IceBall:
                spell = new IceBallSpell(caller);
                break;

            case SpellKind.Skeleton:
                spell = new SkeletonSpell(caller, Roguelike.Generators.GenerationInfo.Difficulty);
                break;

            case SpellKind.Transform:
                spell = new TransformSpell(caller);
                break;

            case SpellKind.ManaShield:
                spell = new ManaShieldSpell(caller);
                break;

            case SpellKind.Rage:
                spell = new RageSpell(caller);
                break;

            case SpellKind.Weaken:
                spell = new WeakenSpell(caller);
                break;

            case SpellKind.Inaccuracy:
                spell = new InaccuracySpell(caller);
                break;

            case SpellKind.IronSkin:
                spell = new IronSkinSpell(caller);
                break;

            case SpellKind.Teleport:
                spell = new TeleportSpell(caller);
                break;

            case SpellKind.Portal:
                spell = new Portal(caller);
                break;

            case SpellKind.ResistAll:
                spell = new ResistAllSpell(caller);
                break;

            default:
                break;
                throw new Exception("CreateSpell ???" + Kind);
            }
            if (spell is IProjectileSpell proj)
            {
                proj.Range += spell.CurrentLevel - 1;
            }
            return(spell);
        }
 protected override void Awake()
 {
     base.Awake();
     netTab   = GetComponent <HasNetworkTabItem>();
     teleport = GetComponent <TeleportSpell>();
 }